3

My problem with the nomencl package is that I have to call \nomenclature manually every time I use a new symbol. For example the following code

\documentclass{article}
\usepackage{xspace,ifthen}

\usepackage[intoc]{nomencl}
\renewcommand{\nomname}{List of Notations}
\renewcommand*{\pagedeclaration}[1]{\dotfill\hyperpage{#1}}
\renewcommand{\nomgroup}[1]{%
  \ifthenelse{\equal{#1}{R}}{\item[\textbf{Roman Symbols}]}{%
    \ifthenelse{\equal{#1}{G}}{\item[\textbf{Greek Symbols}]}{%
      \ifthenelse{\equal{#1}{P}}{\item[\textbf{Superscripts}]}{%
        \ifthenelse{\equal{#1}{B}}{\item[\textbf{Subscripts}]}{%
          \ifthenelse{\equal{#1}{S}}{\item[\textbf{Symbols}]}{%
      }}}}}}

\makenomenclature

\newcommand{\symbI}{\ensuremath{F}\xspace}
\newcommand{\symbII}{\ensuremath{M}\xspace}
\newcommand{\symbIII}{\ensuremath{\alpha}\xspace}
\newcommand{\symbIV}{\ensuremath{U}\xspace}

\begin{document}

\printnomenclature[1.5cm]

\section*{Math section}

\begin{equation}
   \symbI = \symbII \symbIII
\end{equation}
\nomenclature[rsymbI ]{\symbI}{some explanation for F}
\nomenclature[rsymbII ]{\symbII}{some explanation for M}
\nomenclature[gsymbIII ]{\symbIII}{some explanation for \alpha}

\end{document}

would produce

enter image description here

Is there any way, let say, that one defines all the symbols once and only those that used in the text appear in the list of nomenclature? Something similar to citation maybe.

For example to have the following way in order to produce the above nomenclature list?

\documentclass{article}

\usepackage{xspace}

\anicecommand{\symbI}{Roman sympbol}{\ensuremath{F}\xspace}{some explanation for $F$}
\anicecommand{\symbII}{Roman sympbol}{\ensuremath{M}\xspace}{some explanation for $M$}
\anicecommand{\symbIII}{Greek sympbol}{\ensuremath{\alpha}\xspace}{some explanation for $\alpha$}
\anicecommand{\symbIV}{Roman sympbol}{\ensuremath{U}\xspace}{some explanation for $U$}

\begin{document}

\printnomenclature[1.5cm]

\section*{Math section}

\begin{equation}
   \symbI = \symbII \symbIII
\end{equation}

\end{document}
4

I don't know a way to do that with the nomencl package, but it is easily feasible with glossaries:

enter image description here

Code:

\documentclass{article}

\usepackage{xspace}
\usepackage[acronym,nonumberlist]{glossaries}

\renewcommand{\acronymname}{List of Notations}

\newglossarystyle{mystyle}{%
  \setglossarystyle{long}%
  \renewenvironment{theglossary}%
     {\begin{longtable}[l]{@{}p{0.1\hsize}p{0.8\hsize}}}%
     {\end{longtable}}%
  \renewcommand*{\glsgroupheading}[1]{%
     \multicolumn{2}{@{}l}{\bfseries\glsgetgrouptitle{##1}}\\[5pt]}%
}

\newcommand*{\Rgroupname}{Roman Symbols}
\newcommand*{\Ggroupname}{Greek Symbols}

\newcommand*{\myacro}[4][sort=s]{%
  \newacronym[#1]{#2}{#3}{#4}%
  \global\expandafter\def\csname #2\endcsname{\acrshort{#2}}%
}

\myacro[sort=ra]{symbI}{\ensuremath{F}\xspace}{some explanation for $F$}
\myacro[sort=rb]{symbII}{\ensuremath{M}\xspace}{some explanation for $M$}
\myacro[sort=ga]{symbIII}{\ensuremath{\alpha}\xspace}{some explanation for $\alpha$}
\myacro[sort=rc]{symbIV}{\ensuremath{U}\xspace}{some explanation for $u$}

\makeglossaries

\begin{document}

\printglossary[style=mystyle,type=\acronymtype]

\section*{Math section}

\begin{equation}
   \symbI = \symbII \symbIII
\end{equation}

\end{document} 

I've defined a new glossary style mystyle which simulates the output of nomencl and used it in \printglossary.

Notice the new commands

\newcommand*{\Rgroupname}{Roman Symbols}
\newcommand*{\Ggroupname}{Greek Symbols}

used to define the subheadings. Probably you will have to define

\newcommand*{\Pgroupname}{Superscripts}
\newcommand*{\Bgroupname}{Subscripts} 
\newcommand*{\Sgroupname}{Symbols}

Also note the definition of symbols, for example:

\myacro[sort=ra]{symbI}{\ensuremath{F}\xspace}{some explanation for $F$}

sort=ra is needed to insert the symbol in the "Roman Symbols" list (the r) and to sort it as the first one in the list (the a).

When

  • Thanks! This works fine. For those who use Texlipse like me need to do some extra stuff as well explained here – A.GH Mar 12 '14 at 12:01
  • @A.GH You're welcome. Happy it helped. – karlkoeller Mar 12 '14 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.