1

This is a follow-up question from here. One of the examples in the top solution work well with the plainnat style, but when I used the aea style, it threw an error.

Here is the aea style with a MWE that does not involve acronyms.

\begin{filecontents*}{\jobname.bib}
    @article{oasis,
        author={{Organization for the Advancement of Structured Information Standards}},
        title={Some title},
        journal={J. Something},
        year={2012},
    }
\end{filecontents*}
\documentclass{article}
\usepackage[authoryear]{natbib}

\begin{document}

Here it is \citep{oasis}

A second time \citep{oasis}

\bibliographystyle{aea} \bibliography{\jobname}

\end{document}

The output is very good:

regular author name

However, with the acronym, TexStudio won't compile:

\begin{filecontents*}{\jobname.bib}
    @article{oasis,
        author={{\acroauthor{Organization for the Advancement of Structured Information Standards}{OASIS}}},
        title={Some title},
        journal={J. Something},
        year={2012},
    }
\end{filecontents*}
\documentclass{article}
\usepackage[authoryear]{natbib}

\usepackage{etoolbox}

\newif\ifabbreviation \pretocmd{\thebibliography}{\abbreviationfalse}{}{} \AtBeginDocument{\abbreviationtrue} \DeclareRobustCommand\acroauthor[2]{% \ifabbreviation \ifcsname acroused@#2\endcsname #2% \else #1% %~(\mbox{#2})% <---- \expandafter\gdef\csname acroused@#2\endcsname{}% \fi \else #1 (\mbox{#2})% \fi }

\begin{document}

Here it is \citep{oasis}

A second time \citep{oasis}

\bibliographystyle{aea} \bibliography{\jobname}

\end{document}

Instead, it throws three errors along with two warnings:

Something's wrong--perhaps a missing \item. ...nformation Standards}{OASIS}}}{2012}{oasis}
Something's wrong--perhaps a missing \item. ...nformation Standards}{OASIS}}}{2012}{oasis}
Something's wrong--perhaps a missing \item. ...nformation Standards}{OASIS}}}{2012}{oasis}
File `document.bib' already exists on the system.
Empty `thebibliography' environment

For reference, aea.bst can be obtained here, in the zip file called LaTeX templates.

1 Answers1

1

Since you're using the natbib citation management package, you could use its citation aliasing machinery to create the desired citation call-outs.

enter image description here

\documentclass{article}

\begin{filecontents}[overwrite]{mybib.bib} @article{oasis, author={{Organization for the Advancement of Structured Information Standards {(OASIS)}}}, title={Some title}, journal={J. Something}, year={2012}, } \end{filecontents}

\usepackage[authoryear]{natbib} \bibliographystyle{aea} \defcitealias{oasis}{OASIS} \newcommand\mycitep[1]{\citepalias[\citeyear{#1}]{#1}} \newcommand\mycitet[1]{\citetalias{#1} (\citeyear{#1})}

\begin{document} \mycitep{oasis}, \mycitet{oasis} \bibliography{mybib} \end{document}

Mico
  • 506,678
  • 1
    Thanks for the quick answer. I was aware of the existence of \defcitealias, but I had not thought to use a combination of \defcitealias, \newcommand, and \citeyear. This answer works well for me for my current needs. – Life is Good Apr 23 '21 at 19:24