I have a layout with a fairly large margin which I want to use to add citation information. For this, I defined a sidecite command, to put this info in the margin. A MWE is the following
\documentclass{memoir}
\setstocksize{297mm}{210mm}
\settrimmedsize{\stockheight}{\stockwidth}{*}
\setulmarginsandblock{27.4mm}{*}{1}
\setlrmarginsandblock{24mm}{79mm}{*}
\setmarginnotes{9mm}{50mm}{1em}
\setheadfoot{1.25\baselineskip}{10mm}
\setheaderspaces{*}{8mm}{*}
\checkandfixthelayout[fixed]
\usepackage[style=alphabetic]{biblatex}
\providecommand\sidecite[2]{\mbox{#1}\marginpar{\footnotesize[\mbox{#1}] #2}}
\DeclareCiteCommand{\cite}[\mkbibbrackets]
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexfield{indextitle}}
{}%
\sidecite{\printfield{labelalpha}}{%
\usebibmacro{author}
\setunit{\addcomma\space}
\printfield[citetitle]{labeltitle}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\usepackage{filecontents}
\begin{filecontents*}{test.bib}
@book{test,
author="John Smith",
title="The title",
year=1099,
publisher="nobody",
}
\end{filecontents*}
\bibliography{test}
\begin{document}
\cite{test}
\cite{test}
\end{document}
This obviously prints the cite informations multiple times, if more then one sidecite command appears per page.
Can someone help me with automatically detecting such a double cite and only printing the information once in the margin per page?
And how would I modify the textcite macro accordingly?
![The body reads "Lorem [SR98; Wor02; Gee85] ipsum [SR98] dolor Sigfridsson and Ryde [SR98] and Knuth [Knu84]" and has a margin note for each of the references exactly once.](../../images/edf36fa4ccb84db9da8db8884f2cb0ac.webp)
DeclareCiteCommandfor thetextcitemacro? – asante Aug 06 '18 at 14:48\textciteis quite a bit more complicated because the margin note has to be invisible for the punctuation tracker. – moewe Aug 06 '18 at 15:16\citeand once with\textcite– asante Aug 06 '18 at 16:06cbx@isbiblatex's usual prefix for internal macros in the citations. I guessscbx@was invented in analogy tocbx@for this answer. – moewe Mar 04 '22 at 16:38