# More than one index of notation in a single document using nomencl

My thesis consists of two rather independent parts, and I'd like to include an index of notation for each part separately at the end of the whole document. Is this possible with the nomencl package?

Thank you!

• Welcome to TeX.SX! Do you just want to how if it's possible or how it can be done? ;-) – user31729 Jan 8 '15 at 23:21

Currently nomencl writes the index into the file \jobname.nlo, so if your file is thesis.tex, you will have thesis.nlo. Thus if you want two indices, you need to rewrite this part of nomencl. Namely:

1. Define the commands \makenomenclatureA and \makenomenclatureB that write two indices, say, PartA.nlo and PartB.nlo.

2. Define the similar commands \printnomenclatureA and \printnomenclatureB.

3. Put in the document

\makenomenclatureA
TEXT
\renewcommand{\nomname}{Nomenclature A}
\printnomenclatureA

\makenomenclatureB
TEXT
\renewcommand{\nomname}{Nomenclature B}
\printnomenclatureB

4. Run pdflatex and then

makeindex -o PartA.nls -s nomencl.ist PartA.nlo
makeindex -o PartB.nls -s nomencl.ist PartB.nlo

5. Run pdflatex again.

Now let us do (1) and (2). We can take the definitions of \makenomenclature and \printnomenclature and modify them. Here is the quick hack (copy the part between \makeatletter and \makeatother):

\documentclass{article}
\usepackage{nomencl}
\makeatletter
\newwrite\@nomenclaturefile
\def\makenomenclatureA{%
\closeout\@nomenclaturefile
\openout\@nomenclaturefile=PartA\@outputfileextension
\def\@nomenclature{%
\@bsphack
\begingroup
\@sanitize
\@ifnextchar[%
{\@@@nomenclature}{\@@@nomenclature[\nomprefix]}}%
\typeout{Writing nomenclature file PartA\@outputfileextension}%
\let\makenomenclature\@empty}
\def\makenomenclatureB{%
\closeout\@nomenclaturefile
\openout\@nomenclaturefile=PartB\@outputfileextension
\def\@nomlature{%push.relevant.stage.int
\@bsphack
\begingroup
\@sanitize
\@ifnextchar[%
{\@@@nomenclature}{\@@@nomenclature[\nomprefix]}}%
\typeout{Writing nomenclature file PartB\@outputfileextension}%
\let\makenomenclature\@empty}
\def\printnomenclatureA{%
\@ifnextchar[%
{\@printnomenclatureA}{\@printnomenclatureA[\nomlabelwidth]}}
\def\@printnomenclatureA[#1]{%
\nom@tempdim#1\relax
\@input@{PartA\@inputfileextension}}
\def\printnomenclatureB{%
\@ifnextchar[%
{\@printnomenclatureB}{\@printnomenclatureB[\nomlabelwidth]}}
\def\@printnomenclatureB[#1]{%
\nom@tempdim#1\relax
\@input@{PartB\@inputfileextension}}
\makeatother
\begin{document}

\section{First}

\makenomenclatureA
\nomenclature{a}{Definition of a}
\nomenclature{b}{Definition of b}
\nomenclature{c}{Definition of c}

\renewcommand\nomname{Nomenclature A}
\printnomenclatureA

\section{Second}

\makenomenclatureB
\nomenclature{a'}{Definition of a'}
\nomenclature{b'}{Definition of b'}
\nomenclature{c'}{Definition of c'}

\renewcommand\nomname{Nomenclature B}
\printnomenclatureB

\end{document}


And here is the result:

• Dear Boris, thank you very much for your effort and your fast reponse, your suggestion works fine and does precisely what I wanted! – Hanno Jan 9 '15 at 8:40