1

This question is related to the following question.

I would like to know if there exists a way to configure the command \acroauthor so that it's generate (Organization for the Advancement of Structured Information Standards, 2012) when it is used once and (OASIS, 2012) from the second time it is used?

Math
  • 459

1 Answers1

1

You have to slightly amend the macro \acroauthor to get that right:

    \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}{\global\abbreviationfalse}{}{}
    \AtBeginDocument{\global\abbreviationfalse}
    \DeclareRobustCommand\acroauthor[2]{%
      \ifabbreviation #2\else #1\global\abbreviationtrue\fi}

    \begin{document}

    Here it is \citep{oasis}

    A second time \citep{oasis}

    \bibliographystyle{plainnat}
    \bibliography{\jobname}

    \end{document}

This will get the desired output.

enter image description here

Jagath
  • 4,287
  • How can I add the acronym (OASIS) after Organization for the Advancement of Structured Information Standards in the references? Without changing how the first quote is appearing, that is, [Organization for the Advancement of Structured Information Standards, 2012]. – Math Apr 29 '20 at 15:40
  • @VictorHugo you can use the acro package or the acronym package, define a suitable abbreviation with the package and use author = {\ac{OASIS}} (or similar) in the bib file – cgnieder May 01 '20 at 14:20