17

I'm using natbib with bibliography style "apalike". I can cite two different papers in one bracket; for instance

\citep{adams03,collier09}

gives me

(Adams and Fournier, 2003; Collier et al., 1990).

I can also give page numbers for one source at a time; for instance

\citep[p.3]{adams03}

gives me

(Adams and Fournier, 2003, p.3).

My Question: What if I have page numbers for both sources? Is there a standard way to produce an output like

(Adams and Fournier, 2003, p.3; Collier et al., 1990, p.5)?

I'm not very keen on editing the bibstyle files myself if there is an easier way.

Any help is much appreciated!


A minimal example:

\documentclass{article}

\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{natbib}

\begin{document}

\citep{adams03,collier09}

\citep[p.3]{adams03}

I would like to have something like (Adams and Fournier, 2003, p.3; Collier et al., 1990, p.5).

\bibliography{bibliography}{}
\bibliographystyle{apalike}

\end{document}
16

It can be automatized, but the basic is like this:

\begin{filecontents*}{\jobname.bib}
@article{adams03,
 author={A. Adams and F. Fournier},
 title={?},
 journal={?},
 year=2003,
}
\@article{collier09,
 author={C. Collier and S. Someone and T. Tomeone and V. Vomeone},
 title={?},
 journal={?},
 year=2009,
}
\end{filecontents*}
\documentclass{article}

\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{natbib}

\begin{document}

\citep{adams03,collier09}

\citep[p.~3]{adams03}

(\citeauthor{adams03}, \citeyear{adams03}, p.~3; \citeauthor{collier09}, \citeyear{collier09}, p.~5).


\bibliography{\jobname}
\bibliographystyle{apalike}

\end{document}

enter image description here

A better version, with a syntax slightly different from \citep, but easier to manage for multiple citations:

\begin{filecontents*}{\jobname.bib}
@article{adams03,
 author={A. Adams and F. Fournier},
 title={?},
 journal={?},
 year=2003,
}
\@article{collier09,
 author={C. Collier and S. Someone and T. Tomeone and V. Vomeone},
 title={?},
 journal={?},
 year=2009,
}
\end{filecontents*}
\documentclass{article}

\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage{natbib}

\usepackage{xparse}
\ExplSyntaxOn

\makeatletter
\NewDocumentCommand{\multicitep}{m}
 {
  \NAT@open
  \mjb_multicitep:n { #1 }
  \NAT@close
 }
\makeatother

\seq_new:N \l_mjb_multicite_in_seq
\seq_new:N \l_mjb_multicite_out_seq
\seq_new:N \l_mjb_cite_seq

\cs_new_protected:Npn \mjb_multicitep:n #1
 {
  \seq_set_split:Nnn \l_mjb_multicite_in_seq { ; } { #1 }
  \seq_clear:N \l_mjb_multicite_out_seq
  \seq_map_inline:Nn \l_mjb_multicite_in_seq
   {
    \mjb_cite_process:n { ##1 }
   }
  \seq_use:Nn \l_mjb_multicite_out_seq { ;~ }
 }

\cs_new_protected:Npn \mjb_cite_process:n #1
 {
  \seq_set_split:Nnn \l_mjb_cite_seq { , } { #1 }
  \int_compare:nTF { \seq_count:N \l_mjb_cite_seq == 1 }
   {
    \seq_put_right:Nn \l_mjb_multicite_out_seq
     { \citeauthor{#1},~\citeyear{#1} }
   }
   {
    \seq_put_right:Nx \l_mjb_multicite_out_seq
     {
      \exp_not:N \citeauthor{\seq_item:Nn \l_mjb_cite_seq { 1 }},~
      \exp_not:N \citeyear{\seq_item:Nn \l_mjb_cite_seq { 1 }},~
      \seq_item:Nn \l_mjb_cite_seq { 2 }
     }
   }
 }
\ExplSyntaxOff

\begin{document}

\citep{adams03,collier09}

\citep[p.~3]{adams03}

\multicitep{adams03, p.~3; collier09, p.~5}.

\multicitep{adams03, p.~3; collier09, p.~5}.

\multicitep{adams03; collier09, p.~5}.

\multicitep{adams03; collier09, p.~5}.


\bibliography{\jobname}
\bibliographystyle{apalike}

\end{document}

Different keys are separated by a semicolon, a postnote is separated from the key by a comma (if a comma is in the postnote, place it between braces). You can actually use it for a single citation, like

\multicitep{adams03, p.~3}

enter image description here

  • Thanks a lot! I'm now using (the unflexible but working) new command "\newcommand{\citetwo}[4]{(\citeauthor{#1}, \citeyear{#1}, p.#2; \citeauthor{#3}, \citeyear{#3}, p.#4)}" – mjb Mar 17 '14 at 18:02
5

Also consider the \citealp syntax described at http://merkel.texture.rocks/Latex/natbib.php

You still need to bring your own parentheses and semicolons, but the syntax is slightly more compact than above (modified code below):

\begin{filecontents*}{\jobname.bib}
@article{adams03,
 author={A. Adams and F. Fournier},
 title={?},
 journal={?},
 year=2003,
}
\@article{collier09,
 author={C. Collier and S. Someone and T. Tomeone and V. Vomeone},
 title={?},
 journal={?},
 year=2009,
}
\end{filecontents*}
\documentclass{article}

\usepackage{natbib}
\begin{document}

\citep{adams03,collier09}

\citep[p.~3]{adams03}

(\citeauthor{adams03}, \citeyear{adams03}, p.~3; \citeauthor{collier09}, \citeyear{collier09}, p.~5).

(\citealp[p.~3]{adams03}; \citealp[p.~5]{collier09}).

\bibliography{\jobname}
\bibliographystyle{apalike}

\end{document}
-2

More suggestions for a workaround can be found here: http://www.latex-community.org/forum/viewtopic.php?f=31&t=2840

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Would like to say something more about what is important in the link you parted? – Symbol 1 Apr 18 '15 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.