[Tex/LaTex] Natbib: Multiple citations with page numbers in one bracket

apa-stylebibtexnatbib

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}

Best Answer

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