Natbib 引用、缩写和 aea.bst

Natbib 引用、缩写和 aea.bst

这是来自这里。顶部解决方案中的一个示例与该plainnat样式配合得很好,但是当我使用该aea样式时,它抛出了错误。

这是aea不涉及首字母缩略词的 MWE 样式。

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

输出效果非常好:

常规作者姓名

但是,使用首字母缩略词时,TexStudio 无法编译:

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

相反,它会抛出三个错误和两个警告:

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

作为参考,aea.bst可以得到这里,在名为 的 zip 文件中LaTeX templates

答案1

由于您正在使用natbib引文管理包,因此您可以使用其引文别名机制来创建所需的引文调用。

在此处输入图片描述

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

相关内容