Suppose I make two citations at the same place
\cite{ref1}, \cite{ref2}
It would appear as
[1], [2]
Sometimes I see a reference like
[1, 2]
How is that done in TeX? Also, when should I use one over the other?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityMultiple citations at the same place can be achieved with
\cite{ref1,ref2,...}
Some bibliographic styles (ieee
for example) turn multiple citations, i.e., [1,2] into [1], [2]. So, for the second part, it is a matter of the style used and customs.
If you want to include page numbers, you can use BibLaTex's \cites
command (as described here) or you can use BibTex with the xparse
package and define your own command.
\usepackage{xparse}
% Takes up to 4 pairs of citations with optional page reference
\NewDocumentCommand{\multicite}{ogogogog}{%
\citetext{%
\IfValueT{#2}{%
\IfValueT{#1}{\citealp[p.~#1]{#2}}%
\IfNoValueT{#1}{\citealp{#2}}%
}%
\IfValueT{#4}{%
;
\IfValueT{#3}{\citealp[p.~#3]{#4}}%
\IfNoValueT{#3}{\citealp{#4}}%
}%
\IfValueT{#6}{%
;
\IfValueT{#5}{\citealp[p.~#5]{#6}}%
\IfNoValueT{#5}{\citealp{#6}}%
}%
\IfValueT{#8}{%
;
\IfValueT{#7}{\citealp[p.~#7]{#8}}%
\IfNoValueT{#7}{\citealp{#8}}%
}%
}
}
Example usage:
\multicite[1]{Sjostrom2018}{Kerly2007}[3]{Winkler2019}
leads to:
(Sjöström et al., 2018, p. 1; Kerly et al., 2007; Winkler und Roos, 2019, p. 3)
\cite{key1,key2}
?