
私は 2 つの論文を引用しており、参考文献のスタイルを変更したいと考えています。つまり、1 つのスタイルを変更し、もう 1 つのスタイルは変更しません。
\documentclass[12pt,a4paper]{article}
\usepackage[round]{natbib}
\begin{document}
My citation \citep{desmet2015geography}
another citation \citep{roberts2012evaluating}
\medskip
\bibliographystyle{plainnat}
\bibliography{citation}
\end{document}
参考文献ファイル (citation.bib)
@article{roberts2012evaluating,
Author = {Roberts, Mark and Deichmann, Uwe and Fingleton, Bernard and Shi, Tuo},
Journal = {Regional Science and Urban Economics},
Number = {4},
Pages = {580--594},
Publisher = {Elsevier},
Title = {Evaluating China's road to prosperity: A new economic geography approach},
Volume = {42},
Year = {2012}}
@techreport{desmet2015geography,
Author = {Desmet, Klaus and Nagy, D{\'a}vid Kriszti{\'a}n and Rossi-Hansberg, Esteban},
Date-Added = {2016-09-03 13:29:14 +0000},
Date-Modified = {2016-09-03 13:29:14 +0000},
Institution = {National Bureau of Economic Research},
Title = {The geography of development: Evaluating migration restrictions and coastal flooding},
Year = {2015}}
IDE:Texpad 1.731
エンジン: Xelatex、BibTex
答え1
LaTeX と BibTeX の間でやり取りされる唯一の情報は、cite キーです。したがって、「and」を使用するエントリと「&」を使用するエントリを区別したい場合は、この情報を cite キーで渡す必要があるようです。そのための私の解決策を以下に示します。
「&」を使用する必要があるエントリには、「&」で終わる引用キーが付与されます。上記の例では、これは参考文献ファイル内にあります。
@article{roberts2012evaluating&, Author = {Roberts, Mark and Deichmann, Uwe and Fingleton, Bernard and Shi, Tuo}, Journal = {Regional Science and Urban Economics}, Number = 4, Pages = {580--594}, Publisher = {Elsevier}, Title = {Evaluating {China}'s road to prosperity: A new economic geography approach}, Volume = 42, Year = 2012}
そして引用コマンドは
\citep{roberts2012evaluating&}
(興味深いことに、裸も&
許可されています。)
- ここで、参考文献のスタイルを変更して、「and」の代わりにマクロを生成する必要があります
\AND
。 そのため、 のコピーを作成しplainnat.bst
、 と呼びますmyplainnat.bst
。 違いは次のとおりです (最初の行を 2 番目の行に置き換えます)。
232 と 325
{ " and " * t * }
{ " \AND{} " * t * }
1111年
{ " and " * s #2 "{vv~}{ll}" format.name$ * }
{ " \AND{} " * s #2 "{vv~}{ll}" format.name$ * }
- ここで、の
\bibliographystyle{myplainnat}
代わりにを使用します。そして、 cite キーが で終わるかどうかをチェックし、 で終わる場合はとして定義し、 でない場合は として定義するようにplainnat
書き直す必要があります。\bibitem
&
\AND
&
and
それで、適応された MWE は次のようになります。
\documentclass[12pt,a4paper]{article}
\usepackage[round]{natbib}
\usepackage{ifthen}
\newcommand\AND{and}
\let\origbibitem\bibitem
\renewcommand\bibitem[2][]{%
\bibitemcheckkey{#2}\origbibitem[#1]{#2}}
\newcommand\bibitemcheckkey[1]{%
\bibitemampcheck#1&\relax}
\def\bibitemampcheck#1\relax{%
\ifthenelse{\equal{#2}{&}}{\def\AND{\&}}{\def\AND{and}}}
\begin{document}
My citation \citep{desmet2015geography}
another citation \citep{roberts2012evaluating&}
\medskip
\bibliographystyle{myplainnat}
\bibliography{citation}
\end{document}