Natbib 参照における重複した略語

Natbib 参照における重複した略語

たくさんの技術報告書や政府報告書を引用した研究論文があります。名前が扱いにくいので、natbibの略語に対するこの素晴らしい解決策参考文献を整理しました。

残念ながら、私が使用している.bstファイルはうまく動作せず、組織名と略称が参考文献の2つの異なるエントリに入っています。私は武田史郎の素晴らしい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}

私の citations.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.

から始まる部分はドキュメント内の実際の出力であり、その前には、ファイルとさまざまなコマンドに対応する citekey、短い著者名、完全な著者名、年の記録を行う{\bfコマンドがあります。\harvarditem.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}

結果:

ここに画像の説明を入力してください

関連情報