Skip to content

Instantly share code, notes, and snippets.

@moewew
Created April 5, 2019 19:21
Show Gist options
  • Save moewew/df9eb6e4f730350084b9a3fb371621a9 to your computer and use it in GitHub Desktop.
Save moewew/df9eb6e4f730350084b9a3fb371621a9 to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear-comp]{biblatex}
\addbibresource{biblatex-examples.bib}
\renewbibmacro*{cite}{%
<\the\value{overallcitecount}/\the\value{overallcitetotal}>
[\the\value{citecount}/\the\value{citetotal}]}
\begin{document}
% leaking counts with \cite (probably the smuggling?)
A \cite{sigfridsson,worman,nussbaum}
B \cite{sigfridsson}
C \cites{sigfridsson,sigfridsson}
D \cites{sigfridsson}{worman}
E \cites{sigfridsson,sigfridsson}
RESET \setcounter{overallcitecount}{0}\setcounter{overallcitetotal}{0}
% comparison with \cites
A \cites{sigfridsson}{worman}{geer}
B \cite{sigfridsson}
C \cite{sigfridsson,worman}
D \cite{sigfridsson}
RESET \setcounter{overallcitecount}{0}\setcounter{overallcitetotal}{0}
% \forcsvlist over the list of keys does not drop duplicates, hence
% may give inflated values
A \cites{sigfridsson,worman,sigfridsson}
\end{document}
@PhelypeOleinik
Copy link

Okay, I'll make the counter global with initialisation at the beginning of the citation command.

The test suite is something to start with, I'll use it. Random thought: testing typesetting is tricky, but I think that the output of \loggingoutput might be something to start with. Given the same settings the boxes TeX make should remain the same. Plus, with pdfTeX and LuaTeX it is possible to have reproducible PDFs (https://tex.stackexchange.com/q/440270/134574), so it might be used as well. I'll learn how to use l3build to do something about that.

I think that sorting the multicites will be awkward, but it can be done. However I believe that it should not be activated by sortcites. I think that a new option (a good name would be IKnowThatThisIsn'tThePurposeOfMulticitesButI'llDoThisAnyway ;-) should be added to make that work. Certainly possible, given an enough amount of code :)

I'm working on it. Right now I'm trying to understand how the sorting algorithm works to start messing around with it. As soon as I have something new I send you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment