My advice is to get rid of nomencl
package and use glossaries
at its full power. I assume that the sense of this question is to have both a list of equations and a glossary in the document, whatever tool is used.
In fact, with glossaries, one can define as many glossaries as he wants: a simple glossary, a list of acronyms, a list of symbols and so on.
Instead of using the nomencl
package, you can define a new glossary (I know the name is misleading, but that's how lists of terms are referred to in the package documentation; you can name your list as you prefer) with the following command:
\newglossary{equations}{equ}{eqn}{List of Equations}
where: equations
is the type of the glossary entry, in order to distinguish it from an ordinary glossary entry; equ
and eqn
are file extensions for auxiliary files; List of Equations
is the title of your list, as it will be printed in the table of contents and in the text.
To define an entry to be added to this list, use the glossaries command:
\newglossaryentry{sml}{type=equations,name={$\nabla B = 0$},description={Second Maxwell's Law}}
Note the value assigned to the key: type=equations
; if you don't specify it, it will be added to the main glossary.
To have the glossaries printed, you have to put \printglossaries
in your document backmatter/frontmatter, and run makeglossaries
from command line on your root .tex
file.
Patch \thenomenclature
to do also \itemindent 1em
:
\documentclass{article}
\usepackage{nomencl}
\usepackage{xpatch}
\patchcmd{\thenomenclature}
{\leftmargin\labelwidth}
{\leftmargin\labelwidth\itemindent 1em }
{}{}
\makenomenclature
\begin{document}
a\nomenclature{ALE}{Arbitrary Lagrangian-Eulerian Method}
b\nomenclature{AOR}{Angle of repose}
\printnomenclature
\end{document}
Since your group labels are typeset with \item
, then you have also to change them so they skip back by the current \itemindent
:
\newcommand{\nomenclheader}[1]{\item[\hspace*{-\itemindent}#1]}
\renewcommand\nomgroup[1]{%
\ifthenelse{\equal{#1}{A}}{%
\nomenclheader{\textbf{Acronyms}}}{% A - Acronyms
\ifthenelse{\equal{#1}{R}}{%
\nomenclheader{\textbf{Roman Symbols}}}{% R - Roman
\ifthenelse{\equal{#1}{G}}{%
\nomenclheader{\textbf{Greek Symbols}}}{% G - Greek
\ifthenelse{\equal{#1}{S}}{%
\nomenclheader{\textbf{Superscripts}}}{{% S - Superscripts
\ifthenelse{\equal{#1}{U}}{%
\nomenclheader{\textbf{Subscripts}}}{{% U - Subscripts
\ifthenelse{\equal{#1}{X}}{%
\nomenclheader{\textbf{Other Symbols}}}% X - Other Symbols
{{}}}}}}}}}}
You'll probably have less problem in maintaining the code above if you say
\usepackage{xstring}
and then
\newcommand{\nomenclheader}[1]{%
\item[\hspace*{-\itemindent}\normalfont\bfseries #1]}
\renewcommand\nomgroup[1]{%
\IfStrEqCase{#1}{%
{A}{\nomenclheader{Acronyms}}% A - Acronyms
{R}{\nomenclheader{Roman Symbols}}% R - Roman
{G}{\nomenclheader{Greek Symbols}}% G - Greek
{S}{\nomenclheader{Superscripts}}% S - Superscripts
{U}{\nomenclheader{Subscripts}}% U - Subscripts
{X}{\nomenclheader{Other Symbols}}% X - Other Symbols
}%
}
Complete example
\documentclass{article}
\usepackage[intoc]{nomencl}
\usepackage{bm}
\usepackage{xstring}
\usepackage{xpatch}
\patchcmd{\thenomenclature}
{\leftmargin\labelwidth}
{\leftmargin\labelwidth\itemindent 1em }
{}{}
\newcommand{\nomenclheader}[1]{%
\item[\hspace*{-\itemindent}\normalfont\bfseries#1]}
\renewcommand\nomgroup[1]{%
\IfStrEqCase{#1}{%
{A}{\nomenclheader{Acronyms}}% A - Acronyms
{R}{\nomenclheader{Roman Symbols}}% R - Roman
{G}{\nomenclheader{Greek Symbols}}% G - Greek
{S}{\nomenclheader{Superscripts}}% S - Superscripts
{U}{\nomenclheader{Subscripts}}% U - Subscripts
{X}{\nomenclheader{Other Symbols}}% X - Other Symbols
}%
}
\begin{document}
Some text for getting output.
\nomenclature[rV]{$V$}{Fluid control volume}
\nomenclature[ruf]{$\bm{u}_f$}{Fluid velocity}
\nomenclature[gepsilonf]{$\epsilon_f$}{Fluid porosity}
\nomenclature[rfb]{$\bm{f}_b$}{Body force per unit volume}
\nomenclature[gepsilonf]{$\epsilon_f$}{Fluid porosity}
\nomenclature[gsigma]{$\bm{\sigma}$}{Cauchy stress tensor}
\printnomenclature
\end{document}
Best Answer
The documentation of the nomenclature package includes code to put everything in a longtable environment, but this involves some hacking of the
.ist
file. A simpler approach that may be sufficient is just to define some helper macros that work within in an ordinary list:The optional argument to
\printnomenclature
sets the space available for the symbols. We then set each line as an\item
whose label is the symbol, followed by a paragraph of fixed width containing the description, followed by a box for dimensions and finally a box for units.etoolbox
has been loaded to avoid the deprecatedifthen
package.sunitx
has been loaded for printing the units.Of course, to compile this you need to run the file through (pdf)latex, then run
with "
file
" replaced (both times) by your jobname, i.e. where the main file isfile.tex
. You then need to run (pdf)latex again.ADDED in response to comment Here is a version with different styling for different categories. UPDATED again Now with optional arguments to pass to the sorting keys.