Natbib:多个引用,页码放在一个括号中

Natbib:多个引用,页码放在一个括号中

我使用 natbib 和参考书目样式“apalike”。我可以在一个括号中引用两篇不同的论文;例如

\citep{adams03,collier09}

给我

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

我还可以一次给出一个来源的页码;例如

\citep[p.3]{adams03}

给我

(Adams and Fournier, 2003, p.3)

我的问题:如果我有两个来源的页码怎么办?有没有标准方法可以生成类似

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

如果有更简单的方法,我不太热衷于自己编辑 bibstyle 文件。

任何帮助深表感谢!


一个简单的例子:

\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}

答案1

它可以自动化,但基本是这样的:

\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}

在此处输入图片描述

一个更好的版本,其语法与 略有不同\citep,但更易于管理多个引用:

\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}

不同的关键词用分号分隔,后记与关键词用逗号分隔(如果后记中有逗号,请将其放在括号内)。实际上,您可以将其用于单个引用,例如

\multicitep{adams03, p.~3}

在此处输入图片描述

答案2

另请考虑 \citealp 语法描述 http://merkel.texture.rocks/Latex/natbib.php

您仍然需要带上自己的括号和分号,但语法比上面的稍微紧凑一些(下面的修改代码):

\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}

答案3

以下是一个替代解决方案:

\citetext{\citealp[p.~1]{ref1}; \citealp[p.~2]{ref2}}

给出

(参考文献 1,第 1 页;参考文献 2,第 2 页)

就你的情况而言:

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

给出你想要的。

答案4

您可以在此处找到更多解决方法的建议:http://www.latex-community.org/forum/viewtopic.php?f=31&t=2840

相关内容