# List of Abbreviations/Acronyms in Latex. Several issues

I want a list of abbreviations in my thesis. My thesis consist of multiple parts, which are included into the final document with the "include" command. The distinct parts of the thesis introduce sometimes the same abbreviations. However, i do not want to maintain abbreviations on the level of the whole thesis, but on the level of the included parts.

Two packages are commonly used for abbreviations: nomencl and glossaries. Both have issues.

Nomencl: I cannot have duplicate abbreviations, thus i have to maintain them at the thesis' level, which is complicated and distracting. I want the distinct parts to be as independent as possible.

Glossaries: Glossaries does not work good with natbib, e.g. \gls{SOM}\citep{Kohonen2001} results in (SOM) (Kohonen, 2001), what is considered bad style. It would be nicer, if it would produce (SOM; Kohonen, 2001). So, my idea is to use the glossaries-package in a similar manner to nomencl. Only defining acronyms for the list of abbreviations, but not using \gls, glspl, etc. in the text. However, to print the acronyms in the list, they must explicitly added with /glsaddall, but this command does not work for acronyms defined in included documents. I consider this a bug.

So, the best i think would be to stick with nomencl and somehow force it to ignore redefinitions of acronyms in the included documents. Is this possible?

Alternatively, what approach would you suggest for my usecase (need abbrev list, multiple included documents)?

-
\glsaddall doesn't work in the included file for the simple reason that managing abbreviations on a per-file basis is awkward and error prone. Having the same acronym defined (perhaps in sligtly different ways) in two parts of the document can be a source for headaches. Don't do like that. – egreg Jul 18 '12 at 9:41

It's not clear if you want the citation every time you use the acronym, or just specific instances. It's also not clear what you want to happen if you try to redefine an existing acronym. Assuming specific instances of a citation and a reset when you attempt to define an existing acronym, you could achieve this as follows. First the main tex file:

\documentclass{book}

\usepackage{natbib}
\usepackage{etoolbox}
\usepackage[acronym,smallcaps]{glossaries}

\makeglossaries

\newcommand*{\provideacronym}[4][]{%
\ifglsentryexists{#2}%
{%
\glsreset{#2}%
}%
{%
\newacronym[#1]{#2}{#3}{#4}%
}%
}

\newcommand*{\provideglossaryentry}[2]{%
\ifglsentryexists{#1}%
{}%
{%
\newglossaryentry{#1}{#2}%
}%
}

\renewcommand*{\acronymfont}[1]{#1}

\defglsdisplayfirst[acronym]{%
#1 \ifstrempty{#4}{(#3)}{\citep[#3;][]{#4}}%
}

\defglsdisplay[acronym]{%
#1\ifstrempty{#4}{}{ \citep{#4}}%
}

\title{Sample Thesis}
\author{A.N. Other}

\begin{document}
\maketitle

\include{sample1}

\include{sample2}

\printglossaries

\bibliographystyle{plainnat}
\bibliography{xampl}
\end{document}


Now the first chapter (sample1.tex):

\chapter{First Sample Chapter}

\provideacronym{abc}{ABC}{Sample Acronym 1}%
\provideacronym{xyz}{XYZ}{Sample Acronym 2}%
\provideglossaryentry{sample}{name=sample,description=An example}%

An acronym: \gls{abc}. A \gls{sample}.
Sample acronym with a citation
\gls{xyz}[article-minimal].
Another instance with a citation
\gls{xyz}[article-minimal].


And the second chapter (sample2.tex):

\chapter{Second Sample Chapter}

\provideacronym{abc}{ABC}{Sample Acronym 1}%
\provideglossaryentry{sample2}{name=another sample,description=Another example}%

An acronym: \gls{abc}. \Gls{sample2}.
Sample acronym with a citation
\gls{abc}[article-minimal].
Another instance with a citation
\gls{abc}[article-minimal].

-