我正在使用 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