[Tex/LaTex] Natbib cite with abbreviation

bibtexcitingnatbib

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

Best Answer

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