1

I have a part of a research paper that cites a bunch of technical and government reports. The names are unwieldy, so following this nice solution for abbreviations in natbib I cleaned up my bibliography.

Unfortunately the .bst file I'm using isn't playing nicely and is putting the name of the organization and the abbreviation in two different entries in the bibliography. I'm using Shiro Takeda's awesome econ.bst. So my question is how can I get the citations right? Ideally without having to make my own branch of the .bst file, but I'm open to using biblatex if there is an elegant solution that will preserve formatting. Thanks in advance!

Here is a MWE that generates my problem:

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

where my citations.bib file contains:

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

This is what it generates, note the weird double appearance of "Organization for Economic Co-Operation and Development (OECD)."

messed up references

1 Answer 1

1

The issue is caused by an implementation detail in natbib. As you can see in the .bbl file, the following items are generated:

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

The part starting from {\bf is the actual output in the document, and before that there is a command \harvarditem that does the bookkeeping for the citekey, short author, full author, year, that corresponds to the .aux file and the various \cite commands.

Natbib defines \harvarditem as a wrapper around the default \bibitem command. It checks if the first (optional) argument is empty with \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
}%

However, this check \if\relax#1\relax does not work properly when #1 contains a command like \acroauthor, because this command is expanded and in doing so #1 (\mbox{#2}) is printed at that point.

As explained for example in What are the exact semantics of \detokenize?, it is safer to check for the detokenized representation of the argument:

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

Result:

enter image description here

1
  • Works like a charm. I would have never thought to get into the tokenization. Commented Jan 15 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .