I need to switch a project to Overleaf. I'm using biblatex and Biber, and I use \DeclareSortingTemplate to create a separate bibliography environment that's sorted by shorthand instead of author.
Is there a special package I need or....?
Minimal example that works in my regular setup but not on Overleaf:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{filecontents}
\begin{filecontents}{example.bib}
@book{test,
title = {A Title},
year = {2420},
author = {Famous, Person},
location = {Big City},
publisher = {Fancy Academic Press},
shorthand = {b2420},
}
\end{filecontents}
\usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{example.bib}
% special sort style
\DeclareSortingTemplate{byShorthand}{
\sort{\field{shorthand}}
\sort{\field{name}}
\sort{\field{year}}
\sort{\field{title}}
}
\begin{document}
I want to cite \cite{test}
\newrefcontext[sorting=byShorthand]
\printbibliography[title={Bibliography sorted by shorthand}]
\newrefcontext[sorting=nyt]
\printbibliography[title={Bibliography sorted by author}]
\end{document}
biblatexthan you're likely using. On TL2017, you should use\DeclareSortingSchemeinstead of\DeclareSortingTemplate. The syntax is the same, this macro was simply renamed in more recent versions ofbiblatex. – Paul Gessler Apr 18 '19 at 20:03shorthandthat sorts only byshorthandand not by name, title and year. So you could just use\newrefcontext[sorting=shorthand]and no\DeclareSortingTemplateat all. The difference should be negligible unless you use the sameshorthandtwice (which you probably shouldn't). Note that\field{name}is not a valid sorting rule anyway, since there is no field calledname. – moewe Apr 19 '19 at 05:16\field{name}is sort of valid in the current version of Biber (see https://github.com/plk/biber/issues/262), it just does not do something extremely useful. Unless there is a field callednameit will behave like\literal{name}. But since it is in a\sort{...}of its own that means it could be omitted since all entries will have the "name" string in their sort specification. – moewe Apr 29 '19 at 15:31