10

I have a webpage I need to cite, whose author is a company (no real person specified). Its full name is Organization for the Advancement of Structured Information Standards, abbreviated OASIS. I want to have the OASIS in citations (OASIS, 2006), for example, but include the full company name in the list of references.

I tried

author = "{OASIS}, {Organization for the Advancement of Structured Information Standards}"

that prints OASIS in the citations, but prints "OASIS, O.", in the list of references. If I do

author = "{OASIS, Organization for the Advancement of Structured Information Standards}"

then I have the full name in the list of references, but also in citations, which looks ugly.

How can I have OASIS in citations and Organization for the Advancement of Structured Information Standards in the list of references?

Another example I need is the World Wide Web Consortium. I would like to have it cited like W3C, for example: "(W3C, 2009)", but have the full name in the list of references: "The World Wide Web Consortium".

1 Answers1

10

Here's a way, that requires special formatting of the author field in the .bib file.

\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 #2\else #1 (\mbox{#2})\fi}

\begin{document}

Here it is \citep{oasis}

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}

Notes: the filecontents* is just to keep the example selfcontained; if you want only the expanded name in the references section, change

#1 (\mbox{#2})\fi

into

#1\fi

Important: don't forget the additional braces around \acroauthor{...}{...}, which are essential for the correct sorting by author.

enter image description here

This can be modified to expand the acronym the first time it is used in a citation. Remove the first % in the line marked <----- if you want to show the acronym also the first time, together with the expanded text, which is what's done usually to help readers.

\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
    (\mbox{#2})%
  \fi
}

\begin{document}

Here it is \citep{oasis}

A second time \citep{oasis}

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}

enter image description here

egreg
  • 1,121,712
  • This almost works. The problem is that I am using a bibliography style that capitalizes surnames of authors and it is currently broken (capitalizes only characters without any punctuation. E.a. "Müller" becomes "MüLLER" instead of "MÜLLER"). I cannot change my bibliography style. So far I avoided this capitalization by enclosing the surname in brackets {}, but this no longer works with \acroauthor. – Jakub Zaverka Dec 16 '12 at 18:47
  • OK I managed to get the capitalization fixed by including the whole command into yet another set of brackets: {{{\acroauthor{Organization for the Advancement of Structured Information Standards}{OASIS}}}}. But now the alphabetic ordering of bibliography is broken, \acroauthor going first. – Jakub Zaverka Dec 16 '12 at 18:52
  • 1
    @JakubZaverka Did you try with M{\"u}ller? – egreg Dec 16 '12 at 19:01
  • Yep, no difference. – Jakub Zaverka Dec 16 '12 at 19:06
  • @JakubZaverka Can you point to the bib style you're using? – egreg Dec 16 '12 at 19:07
  • http://repo.or.cz/w/csplainnat.git/blob/HEAD:/csplainnat.bst – Jakub Zaverka Dec 16 '12 at 19:09
  • By digging further down the bst file and with Google's help I was able to find the captializing function and turn it off. Now it works as expected. Thank you for your help. – Jakub Zaverka Dec 16 '12 at 20:03
  • 1
    @JakubZaverka With a syntax like M{\"u}ller it works (with no additional braces, of course); also author={{\acroauthor{Organization...}{OASIS}}} works correctly, in my test, and the sorting is good. – egreg Dec 16 '12 at 20:07
  • 1
    Insanely complex! This capability should be built into the standard. I imagine this is a very common need/desire. – robguinness May 02 '13 at 12:46
  • Apparently biblatex provides this capability. See http://tex.stackexchange.com/questions/11658/displaying-short-version-of-author-name-in-citations. Unfortunately, switching from natbib to biblatex requires quite a few other changes... – robguinness May 02 '13 at 13:01
  • Is there any way for this command to 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 Apr 29 '20 at 14:20
  • @VictorHugo Added according to the request – egreg Apr 29 '20 at 14:56
  • Thank you very much @egreg! Just one last question. Is there any way to remove the acronym (OASIS) after Organization for the Advancement of Structured Information Standards when we use the command for the first time? – Math Apr 29 '20 at 15:08
  • Removing the command (\mbox{#2}) works, but it removes the abbreviation from the bibliography. – Math Apr 29 '20 at 15:17
  • 1
    @VictorHugo I've reworked the implementation – egreg Apr 29 '20 at 16:18
  • @egreg Now it's perfect! Thank you very much! :) – Math Apr 29 '20 at 16:52
  • Did anyone implement this solution and find that the author name in the reference list is printed twice, once at the beginning of the reference, and once above the reference? – Life is Good Apr 22 '21 at 19:27
  • @LifeisGood I just tried the same code with TeX Live 2021 and I get the expected output. The first code is supposed to print twice the name, once in full form and once in abbreviated form. – egreg Apr 22 '21 at 20:14
  • @egreg This is the output I get link. The citations work great. – Life is Good Apr 22 '21 at 20:18
  • @LifeisGood Sorry, but I cannot reproduce it. Please, make a followup question with the details and a minimal example of code that shows the problem. – egreg Apr 22 '21 at 20:20
  • @egreg While producing the MWE, I have realized that the problem may be associated with the aea.bst file. Please find the follow-up question here – Life is Good Apr 22 '21 at 22:46