Closed mapfiable closed 1 year ago
I don't think this is possible in the current framework. Currently citation sorting works by looking at a sorted list of all keys (this list is generated by Biber according to the selected sorting scheme). This means that context-dependent sorting is not available. But this needs context-dependent sorting. Specifically, you want
Author 2010, Buther 2012, Cuther 2016
and
Author 2010, 2015, Buther 2012, Cuther 2016
but
Buther 2012, Author 2015, Cuther 2016
Here "Author 2015"'s sorting position changes depending on the presence of Author 2010.
This would require sorting on a per-cite-call basis.
This isn't really a coherent sorting scheme and it's more easily dealt with by using separate \cite{}
for each author I think.
Hi thanks! That seems very complicated in deed. What a shame. It would be still nice to have though....
I tried to solve this by just locally switching so sorting=none
, and manually ordering the references in the citation according to my preferences. So I tried doing this, but it doesn't work:
\newcommand{\manualciteorder}[1]{%
\begingroup%
\newrefcontext[sorting=none]#1%
\endgroup%
}%
Then I noticed in the manual that there is also this \localrefcontext
, but I don't understand how I am supposed to use it. It would be great if \localrefcontext
is actually used in given the examples. They also some to have some errors.
For your intents and purposes it should be enough to locally disable sortcites
.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear-comp]{biblatex}
\makeatletter
\newcommand*{\DisableSortcites}{%
\let\blx@thecitesort\blx@citenosort
\let\blx@thenotecheck\relax
\boolfalse{sortcites}}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem \autocite{knuth:ct:a,sigfridsson,knuth:ct:b}
\begingroup
\DisableSortcites
Ipsum \autocite{knuth:ct:a,sigfridsson,knuth:ct:b}
\endgroup
Dolor \autocite{knuth:ct:a,sigfridsson,knuth:ct:b}
\printbibliography
\end{document}
If that does not help, you really ought to show us a minimal example document of what you are trying. Debugging code snippets without context is always pretty tricky.
Thanks a lot! But for some reason, this doesn't work in my case (I'm using the kaobook template). Without even using the command I get the following error: You can't use \spacefactor in vertical mode.
If you are having trouble implementing this suggestion (which works in principle) I suggest you ask a question on TeX.SX or your favourite TeX forum. Be sure to include an example document showing what you tried.
Often the spacefactor error is a sign that something went wrong with \makeatletter...\makeatother
. The code I posted really needs these commands around the definition of \newcommand*{\DisableSortcites}
. But if you paste it into an existing preamble you need to check if the category code regime works out. If you add a \makeatother
in the wrong place, you might get errors.
In any case my experience has been that it's better to stay away from complex templates on GitHub that are scarcely maintained.
Thank you for the advice! This allowed me to fix it.
When citing multiple referenes at once, I would like to have the option to sort the citations by year-name-title, but not how it is curretly implemented. In the current implementation,
ynt
is a strict rule, which means that if some author A e.g. published two works some years apart, and a second author B published at some point in between, the the citations of author A will be split, e.g. like so:I would like a sorting style where the citations are sorted by year first, unless the work is published by the same author, so something like this:
Especially if you have several works by the same authors that are "interrupted" by other citations, the list will become needlessly long.