![Natbib 參考文獻中的重複縮寫](https://rvso.com/image/472711/Natbib%20%E5%8F%83%E8%80%83%E6%96%87%E7%8D%BB%E4%B8%AD%E7%9A%84%E9%87%8D%E8%A4%87%E7%B8%AE%E5%AF%AB.png)
我有一篇研究論文的一部分引用了一堆技術和政府報告。這些名字很麻煩,所以如下natbib 中縮寫的這個很好的解決方案我清理了我的參考書目。
不幸的是,我使用的 .bst 檔案不能很好地播放,並且將組織名稱和縮寫放在參考書目中的兩個不同條目中。我在用著Shiro Takeda 很棒的 econ.bst。所以我的問題是如何得到正確的引用?理想情況下,不必創建我自己的 .bst 檔案分支,但如果有一個優雅的解決方案可以保留格式,我願意使用 biblatex。先致謝!
這是產生我的問題的 MWE:
\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1.5in]{geometry}
\usepackage{natbib}
% Abbreviations in natbib
\usepackage{etoolbox}
\newif\ifabbreviation
\pretocmd{\thebibliography}{\abbreviationfalse}{}{}
\AtBeginDocument{\abbreviationtrue}
\DeclareRobustCommand\acroauthor[2]{%
\ifabbreviation #2\else #1 (\mbox{#2})\fi}
% econ.bst style of choice
\bibliographystyle{aer}
\begin{document}
In Germany, feed-in-tariffs for renewable energy last for 20 years \citep{OECDFIT} while similar Chinese tax cuts last for 6\citep{kpmgwind}.
\bibliography{citations}
\end{document}
我的 itations.bib 檔案包含:
@techreport{OECDFIT,
author={{\acroauthor{Organization for Economic Co-Operation and Development}{OECD}}},
institution = {{Organization for Economic Co-Operation and Development}},
year ={2022},
title = {Renewable Energy Feed-in-tariffs}
}
@techreport{kpmgwind2020,
title = {The Power of Nature: Taxation of Wind Power - 2022 A Country Overview},
pages = {27--29},
author = {Nyberg, Per and Thorvaldsen, Trond and Greni, Jan},
institution = {{KPMG Law Advokatfirma}},
year = {2020}
}
這就是它產生的結果,請注意「經濟合作暨發展組織(OECD)」奇怪的雙重外觀。
答案1
這個問題是由 natbib 中的實作細節引起的。正如您在文件中看到的.bbl
,產生了以下項目:
\harvarditem[Nyberg et al.]{Nyberg, Thorvaldsen and Greni}{2020}{kpmgwind2020}
{\bf Nyberg, Per, Trond Thorvaldsen, and Jan Greni}, ``The Power of Nature:
Taxation of Wind Power - 2022 A Country Overview,'' Technical Report, {KPMG
Law Advokatfirma} 2020.
\harvarditem[{\acroauthor{Organization for Economic Co-Operation and
Development}{OECD}}]{{\acroauthor{Organization for Economic Co-Operation and
Development}{OECD}}}{2022}{OECDFIT}
{\bf {\acroauthor{Organization for Economic Co-Operation and
Development}{OECD}}}, ``Renewable Energy Feed-in-tariffs,'' Technical Report,
{Organization for Economic Co-Operation and Development} 2022.
從開始的部分{\bf
是文件中的實際輸出,在此之前有一個命令對與文件和各種命令\harvarditem
相對應的 citekey、短作者、完整作者、年份進行簿記。.aux
\cite
Natbib 定義\harvarditem
為預設\bibitem
指令的包裝器。它檢查第一個(可選)參數是否為空\if\relax#1\relax
:
% definition from natbib.sty
\newcommand\harvarditem[4][]{%
\if\relax#1\relax
\bibitem[#2(#3)]{#4}%
\else
\bibitem[#1(#3)#2]{#4}%
\fi
}%
但是,當包含類似 的命令時,此檢查\if\relax#1\relax
無法正常工作,因為該命令已擴展,並且在此時已列印。#1
\acroauthor
#1 (\mbox{#2})
正如示例中所解釋的\detokenize 的確切語意是什麼?,檢查參數的去標記化表示更安全:
\documentclass[12pt,letterpaper]{article}
\usepackage[margin=1.5in]{geometry}
\usepackage{natbib}
\renewcommand\harvarditem[4][]{%
\if\relax\detokenize{#1}\relax
\bibitem[#2(#3)]{#4}%
\else
\bibitem[#1(#3)#2]{#4}%
\fi
}%
% Abbreviations in natbib
\usepackage{etoolbox}
\newif\ifabbreviation
\pretocmd{\thebibliography}{\abbreviationfalse}{}{}
\AtBeginDocument{\abbreviationtrue}
\DeclareRobustCommand\acroauthor[2]{%
\ifabbreviation#2\else#1 (\mbox{#2})\fi}
% econ.bst style of choice
\bibliographystyle{aer}
\begin{document}
In Germany, feed-in-tariffs for renewable energy last for 20 years \citep{OECDFIT} while similar Chinese tax cuts last for 6 \citep{kpmgwind2020}.
\bibliography{techrepauth}
\end{document}
結果: