Ignoring an acronym that is only used once
If you want to get the long form of an acronym—independently of the selected acronym style and the context where the acronym is used—I think it's best to simply use \acrlong
or \acl.
Note that the latter command is only defined if the shortcuts
option of the glossaries
package is set.
Edit: Werner has pointed out in a comment to his answer that it is probably possible to extend the glossaries
package such that acronyms are printed in a distinct way if they are used only once in the document. The following patch shows that this can indeed be done:
\documentclass{article}
\usepackage{etoolbox}
\usepackage{glossaries}[2011/04/12]
\makeatletter
\appto\newacronymhook{%
\newbool{glo@\the\glslabeltok @usedonlyonce}% define an additional switch per acronym
}
\patchcmd{\@gls@}{%
\glsunset{#2}%
}{% write appropriate information to the main auxiliary file
\ifglsused{#2}{%
\write\@auxout{\global\setbool{glo@#2@usedonlyonce}{false}}%
}{%
\write\@auxout{\global\setbool{glo@#2@usedonlyonce}{true}}%
}%
\glsunset{#2}%
}{}{}
\patchcmd{\@gls@}{%
\glsentryfirst{#2}%
}{% print the long form of the acronym if the acronym is used only once
\ifbool{glo@#2@usedonlyonce}{\glsentrylong{#2}}{\glsentryfirst{#2}}%
}{}{}
\makeatother
\newacronym{ANO}{ANO}{Acronym Number One}
\newacronym{ANT}{ANT}{Acronym Number Two}
\makeglossaries
\begin{document}
\printglossary
\noindent
\gls{ANO}, \gls{ANO}\\
\gls{ANT}
\end{document}
Obviously, you need two LaTeX runs to get everything right. Moreover, if you use not only \gls
(\ac
), but also \Gls
(\Ac
), \GLS,
\glspl
(\acp
), \Glspl
(\Acp
) and \GLSpl
you have to patch \@Gls@,
\@GLS@,
\@glspl@,
\@Glspl@
and \@GLSpl@
in the same way as \@gls@.
The resulting output is:
You need to set the first
key for these entries when you declare them via
\newacronym[<key-val list>]{<label>}{<abbrv>}{<long>}
Even though the first
key is described under the definition of \newglossaryentry
, \newacronym
uses \newglossaryentry
to define acronyms. Consequently, the following is taken from the glossaries
package documentation:
first
How the entry will appear in the document text on first use with
\gls
(or one of its uppercase variants). If this field is omitted, the value of thetext
key is used. Note that if you use\glspl
,\Glspl
,\GLSpl
,\glsdisp
before using\gls
, thefirstplural
value won’t be used with\gls
.
So, specifically for your case, you would probably define it this way:
\newacronym%
[first={density functional theory},...]% <key-val list>
{dft}% <label>
{DFT}% <abbrv>
{density functional theory}% <long>
The following minimal example illustrates this:
\documentclass{book}
\usepackage{glossaries}% http://ctan.org/pkg/glossaries
\begin{document}
\newacronym%
[first={density functional theory}]% <key-val list>
{dft}% <label>
{DFT}% <abbrv>
{density functional theory}% <long>
Blah blah blah \gls{dft}. Blah blah blah blah
\end{document}