Skip to content

Instantly share code, notes, and snippets.

@JeanOlivier
Last active May 8, 2020 16:28
Show Gist options
  • Save JeanOlivier/2ac78c07bef461da0bcb1baf4f31c383 to your computer and use it in GitHub Desktop.
Save JeanOlivier/2ac78c07bef461da0bcb1baf4f31c383 to your computer and use it in GitHub Desktop.
% Multiples citations avec commentaires séparées par des ;
% Utilisation: Mettres les réfs à la suite entre {<refkey>} et mettre un [<commentaire>] avant celles dont on veut un commentaire
% Exemple, la commande
% \cites[p.1]{ref1}{ref2}[chap.3]{ref3}
% donnera quelquechose du style:
% [<label1>, p.1 ; <label2> ; <label3>, chap.3]
\usepackage{xspace}
\makeatletter
\newcommand{\citecomment}[2][]{\citen{#2}#1\citevar}
\newcommand{\citeone}[1]{\citecomment{#1}}
\newcommand{\citetwo}[2][]{\citecomment[,~#1]{#2}}
\newcommand{\citevar}{\@ifnextchar\bgroup{~;~\citeone}{\@ifnextchar[{~;~\citetwo}{]\xspace}}}
\newcommand{\citefirst}{\@ifnextchar\bgroup{\citeone}{\@ifnextchar[{\citetwo}{]\xspace}}}
\newcommand{\cites}{[\citefirst}
\makeatother
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment