This is a solution.
Use a fixed width when issuing \printnomenclature
(e.g. 2cm
):
\printnomenclature[2cm] % <-- change the value here
and define a new glossary style mylong
where you use the same width (2cm
)
\newglossarystyle{mylong}{%
\setglossarystyle{long}%
\renewenvironment{theglossary}%
{\begin{longtable}[l]{@{}p{\dimexpr 2cm-\tabcolsep}p{0.8\hsize}}}% <-- change the value here
{\end{longtable}}%
}
When you print your glossary use the above style:
\printglossary[style=mylong,type=\acronymtype]
MWE:
\documentclass{article}
\usepackage{nomencl}
\usepackage[nonumberlist,acronym]{glossaries}
\newglossarystyle{mylong}{%
\setglossarystyle{long}%
\renewenvironment{theglossary}%
{\begin{longtable}[l]{@{}p{\dimexpr 2cm-\tabcolsep}p{0.8\hsize}}}% <-- change the value here
{\end{longtable}}%
}
\makenomenclature
\makeglossaries
\newacronym{BWB}{BWB}{Blended Wing Body}
\newacronym{DOE}{DOE}{Design of Experiments}
\newacronym{FEA}{FEA}{Finite Element Analysis}
\begin{document}
$t_{wb}$ and $w_{fg}$
\newpage
\nomenclature{$t_{wb}$}{Thickness of Stiffener Web (in)}
\nomenclature{$w_{fg}$}{Width of Stiffener Flange (in)}
\printnomenclature[2cm] % <-- change the value here
\glsaddall
\printglossary[style=mylong,type=\acronymtype]
\end{document}
Output:

The problem is that makeindex
doesn't understand (La)TeX commands. The .idx
file created by your MWE contains:
\indexentry{first}{1}
\indexentry{compact disk (CD)}{1}
\indexentry{subsequent}{1}
\indexentry{compact disk (CD)}{1}
\indexentry{United Nations (UN)}{1}
\indexentry{\emph {italic text} acronym (ITA)}{1}
\indexentry{4-methyl-compound (MC)}{1}
\indexentry{human growth hormone (HGH)}{1}
\indexentry{human growth hormone (HGH)}{1}
\indexentry{isoelectric point (pI)}{1}
makeindex
interprets \emph {italic text} acronym (ITA)
as a string of characters \
, e
, m
, p
, h
, etc. The first character is a backslash so makeindex
puts it in the "Symbols" group. There are two options: provide makeindex
with a different sort key that doesn't contain any formatting commands or use xindy
instead (which simply ignores any LaTeX commands found in the sort key).
If you want to stick with makeindex
, it's possible to modify your definition of \CustomAcronymFields
so that it uses the same sort key that the glossary entry uses. The modified definition is:
\renewcommand*{\CustomAcronymFields}{%
name={\the\glsshorttok},%
symbol={\the\glsshorttok},%
text={\the\glsshorttok\protect\index{\noexpand\glsentrysort{\the\glslabeltok}@\the\glslongtok\space(\the\glsshorttok)}},%
plural={\the\glsshorttok\noexpand\acrpluralsuffix\protect\index{\noexpand\glsentrysort{\the\glslabeltok}@\the\glslongtok\space(\the\glsshorttok)}},%
first={\the\glslongtok\space(\the\glsshorttok)\protect\index{\noexpand\glsentrysort{\the\glslabeltok}@\the\glslongtok\space(\the\glsshorttok)}},%
firstplural={\the\glslongtok\noexpand\acrpluralsuffix\space(\the\glsshorttok)\protect\index{\noexpand\glsentrysort{\the\glslabeltok}@\the\glslongtok\space(\the\glsshorttok)}},%
description={\the\glslongtok}%
}
This now creates the following .idx
file:
\indexentry{first}{1}
\indexentry{CD@compact disk (CD)}{1}
\indexentry{subsequent}{1}
\indexentry{CD@compact disk (CD)}{1}
\indexentry{UN@United Nations (UN)}{1}
\indexentry{ITA@\emph {italic text} acronym (ITA)}{1}
\indexentry{MC@4-methyl-compound (MC)}{1}
\indexentry{HGH@human growth hormone (HGH)}{1}
\indexentry{HGH@human growth hormone (HGH)}{1}
\indexentry{pI@isoelectric point (pI)}{1}
(The sort key is the bit before the @
character in each entry.) This now sorts according to the acronym rather than the full form. You can neaten things up a bit and reduce the chances of error by doing:
\newcommand*{\gindex}{%
\protect\index{\noexpand\glsentrysort{\the\glslabeltok}@\the\glslongtok\space
(\the\glsshorttok)}%
}
\renewcommand*{\CustomAcronymFields}{%
name={\the\glsshorttok},%
symbol={\the\glsshorttok},%
text={\the\glsshorttok\gindex},%
plural={\the\glsshorttok\noexpand\acrpluralsuffix\gindex},%
first={\the\glslongtok\space(\the\glsshorttok)\gindex},%
firstplural={\the\glslongtok\noexpand\acrpluralsuffix\space(\the\glsshorttok)\gindex},%
description={\the\glslongtok}%
}
However, it would be better to sort on the long form, so if you still want to stick with makeindex
, the following modification will strip \emph
from the entry:
\makeatletter
\renewcommand{\newacronymhook}{%
{%
\let\emph\@firstofone
\expandafter\protected@xdef\expandafter\gindexsort
\expandafter{\the\glslongtok}%
}%
}
\makeatother
\newcommand*{\gindex}{%
\protect\index{\gindexsort @\the\glslongtok\space (\the\glsshorttok)}%
}
If you have other formatting commands, for example \textbf
, they can be stripped in the same way:
\makeatletter
\renewcommand{\newacronymhook}{%
{%
\let\emph\@firstofone
\let\textbf\@firstofone
\expandafter\protected@xdef\expandafter\gindexsort
\expandafter{\the\glslongtok}%
}%
}
\makeatother
The .idx
file now contains:
\indexentry{first}{1}
\indexentry{compact disk@compact disk (CD)}{1}
\indexentry{subsequent}{1}
\indexentry{compact disk@compact disk (CD)}{1}
\indexentry{United Nations@United Nations (UN)}{1}
\indexentry{italic text acronym@\emph {italic text} acronym (ITA)}{1}
\indexentry{4-methyl-compound@4-methyl-compound (MC)}{1}
\indexentry{human growth hormone@human growth hormone (HGH)}{1}
\indexentry{human growth hormone@human growth hormone (HGH)}{1}
\indexentry{isoelectric point@isoelectric point (pI)}{1}
The resulting index now looks like:

Best Answer
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 theshortcuts
option of theglossaries
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: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: