4

This is a problem google was unable to aid me with. I am writing an aiaa journal paper and need to generate a nomenclature. All templates and examples I have come accross do this manually, using a tabular. My question is, is there any way to make the \printnomenclature use a separator as in this example here?

enter image description here

egreg
  • 1,121,712
Elad Den
  • 3,941

3 Answers3

4

With the standard setting of nomencl you have to decide yourself for the label width; here's a simple change for getting an equals sign.

\documentclass{article}
\usepackage{nomencl}

\makenomenclature
\renewcommand{\nomlabel}[1]{#1\hfil\hspace{\labelsep}$=$}

\begin{document}

xyz

\nomenclature{P}{Plume length}
\nomenclature{Loooooong}{Whatever}

\printnomenclature

\end{document}

enter image description here

With the optional argument to \printnomenclature you can set the width to the widest label.

\documentclass{article}
\usepackage{nomencl}

\makenomenclature
\renewcommand{\nomlabel}[1]{#1\hfil\hspace{\labelsep}$=$}
\newlength{\nomwidest}

\begin{document}

xyz

\nomenclature{P}{Plume length}
\nomenclature{Loooooong}{Whatever}

\settowidth{\nomwidest}{\nomlabel{Loooooong}}
\printnomenclature[\nomwidest]

\end{document}

enter image description here

With a bit more of effort, we can also make the setting of the widest label automatic:

\documentclass{article}
\usepackage{nomencl}

\makenomenclature

\makeatletter
\newdimen\nomwidest
\renewcommand{\nomlabel}[1]{%
  \sbox\z@{#1\hspace{\labelsep}$=$}%
  \ifdim\nomwidest<\wd\z@\global\nomwidest\wd\z@\fi
  #1\hfil\hspace{\labelsep}$=$%
}
\renewcommand{\nompostamble}{%
  \protected@write\@auxout{}{\global\nomwidest=\the\nomwidest}%
}
\makeatother

\begin{document}

xyz

\nomenclature{P}{Plume length}
\nomenclature{Loooooong}{Whatever}

\printnomenclature[\nomwidest]

\end{document}

The output is as in the second picture. Since we use the aux file, two runs of LaTeX may be necessary for synchronization.

egreg
  • 1,121,712
0

Edit using the package nomencl (note: replace all occurrences of \nomenclature with \nommod):

\documentclass{article}
\usepackage{nomencl}
\newcommand\nommod[2]{\nomenclature{#1}{=\quad #2}}
\begin{document}
\makenomenclature
Nomenclature separator example
\nommod{G}{number of global configurations available for end states} 
\nommod{M}{large number for logical constraints}
\nommod{N}{number of dimensions}
\printnomenclature
\end{document}

Original answer: You can define a custom \item command to include a separator. Using the enumitem package you can customize alignment etc. MWE:

\documentclass{article}
\usepackage{enumitem}
\newcommand\litem[2]{\item[\textnormal{\textit{#1}}] = \quad #2}
\begin{document}
\begin{center}\textbf{Nomenclature}\end{center}
\begin{description}[leftmargin=3em,itemsep=-1mm,style=nextline]
  \litem{G}{number of global configurations available for end states} 
  \litem{M}{large number for logical constraints}
  \litem{N}{number of dimensions}
\end{description}
\par\noindent\textit{Subscripts}
\begin{description}[leftmargin=3em,itemsep=-1mm,style=nextline]
  \litem{g}{global configuration for final states} 
  \litem{i}{time step}
  \litem{l}{obstacle}
  \litem{n,m}{axes in some orthogonal coordinate frame}
\end{description}
\end{document}

Sources: https://tex.stackexchange.com/a/56251 and https://tex.stackexchange.com/a/33818.

Marijn
  • 37,699
  • what is the difference between this and using a tabular ? if I understand corectly, this does not generate the nomenclature automatically, I'd have to list all items manually ? this also does not make use of the \nomenclature definitions I've used all through the document... – Elad Den Oct 20 '15 at 09:43
  • @EladDen this is indeed manual, but with a bit easier syntax as compared to a tabular. I'll try to find a solution using \printnomenclature. – Marijn Oct 20 '15 at 09:48
0

and here's how to do it with glossaries

\documentclass{article}

\usepackage[nonumberlist,acronym]{glossaries} 
%this takes the acronyms out of the gossaries, unless otherwise specified

\makenoidxglossaries
\include{misc/Glossaries}

\newglossarystyle{mystyle}{%
    \renewenvironment{theglossary}%
    {\begin{longtable}[L]{l>{\raggedright}l}}%
        {\end{longtable}}%
    \renewcommand*{\glossaryheader}{}%
    \renewcommand*{\glsgroupheading}[1]{}%
    \renewcommand*{\glossaryentryfield}[5]{%
        \glsentryitem{##1}\glstarget{##1}{##2}& = ##3\glspostdescription\space ##5%
        \tabularnewline}%
    \renewcommand*{\glossarysubentryfield}[6]{%
        &
        \glssubentryitem{##2}%
        \glstarget{##2}{\strut}##4\glspostdescription\space ##6%
        \tabularnewline}%
    \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else & \tabularnewline\fi}%
}

\begin{document}

\glsaddall
\begin{spacing}{1.5}
    \printnoidxglossary[nopostdot,title=Nomenclature,style=mystyle]
\end{spacing}

\end{document}
Elad Den
  • 3,941