51

I have searched for the whole day online, but all the threads indicate only realizing one of the lists by using nomencl package. I want to create both list of abbreviations AND list of nomenclature using nomencl package. How do I differ two \printnomenclature so that LaTeX could separate them clearly?

  • Perhaps you can use the gloss package for the abbreviations? – guillem Dec 12 '12 at 7:21
  • 3
    Have a look at glossaries, a package which is capable of dealing with multiple - well - glossaries. – cgnieder Dec 12 '12 at 9:06
  • 1
    +1 for glossaries, Iused that myself, and it works great. I guess it is up to @cgnieder to make that an answer. – mafp Dec 12 '12 at 16:36
  • You can visit: texblog.org/2012/05/14/… This is the simplest method I found.. – Ahmed Apr 15 '19 at 15:27
59

I'm not aware of a way to do this with nomencl. However, there are other packages which can be used. I'll give two examples, one for my package acro and one for glossaries.

  1. acro

    The acro package allows to assign acronyms to a class and print lists for each class (also for combined classes...). This fact can be used for the task. Entries are defined with the following syntax:

    \DeclareAcronym{<ID>}{
      short = <short> ,
      long  = <long> ,
      class = <class>
    }
    

    Here is a full example:

    \documentclass{article}
    \usepackage{acro}
    
    % probably a good idea for the nomenclature entries:
    \acsetup{first-style=short}
    
    % class `abbrev': abbreviations:
    \DeclareAcronym{ny}{
      short = NY ,
      long  = New York ,
      class = abbrev
    }
    \DeclareAcronym{la}{
      short = LA ,
      long  = Los Angeles ,
      class = abbrev
    }
    \DeclareAcronym{un}{
      short = UN ,
      long  = United Nations ,
      class = abbrev
    }
    
    % class `nomencl': nomenclature
    \DeclareAcronym{angelsperarea}{
      short = \ensuremath{a} ,
      long  = The number of angels per unit area ,
      sort  = a ,
      class = nomencl
    }
    \DeclareAcronym{numofangels}{
      short = \ensuremath{N} ,
      long  = The number of angels per needle point ,
      sort  = N ,
      class = nomencl
    }
    \DeclareAcronym{areaofneedle}{
      short = \ensuremath{A} ,
      long  = The area of the needle point ,
      sort  = A ,
      class = nomencl
    }
    
    \begin{document}
    
    \ac{ny}, \ac{la} and \ac{un} are abbreviations whereas
    \ac{angelsperarea}, \ac{numofangels} and \ac{areaofneedle} are part of the
    nomenclature
    
    \printacronyms[include-classes=abbrev,name=Abbreviations]
    
    \printacronyms[include-classes=nomencl,name=Nomenclature]
    
    \end{document}
    

    enter image description here

  2. glossaries

    The glossaries package is much more powerfull. You can define as many glossaries as you like. Here we can use the fact that a glossary for acronyms is already defined. Similar to nomencl it requires you to run a script to sort the entries. If your file is called file.tex this is usually done by calling

    makeglossaries file
    

    from the command line. Details can be found in the user manual (page 26, section 1.3.3).

    The full example:

    \documentclass{article}
    \usepackage{longtable}
    \usepackage[acronym]{glossaries}
    
    % abbreviations:
    \newacronym{ny}{NY}{New York}
    \newacronym{la}{LA}{Los Angeles}
    \newacronym{un}{UN}{United Nations}
    
    % nomenclature:
    \newglossaryentry{angelsperarea}{
      name = $a$ ,
      description = The number of angels per unit area,
    }
    \newglossaryentry{numofangels}{
      name = $N$ ,
      description = The number of angels per needle point
    }
    \newglossaryentry{areaofneedle}{
      name = $A$ ,
      description = The area of the needle point
    }
    
    \makeglossaries
    \begin{document}
    
    \gls{ny}, \gls{la} and \gls{un} are abbreviations whereas
    \gls{angelsperarea}, \gls{numofangels} and \gls{areaofneedle} are part of the
    nomenclature
    
    \printglossary[type=\acronymtype,title=Abbreviations]
    
    \printglossary[title=Nomenclature]
    
    \end{document}
    

    enter image description here

| improve this answer | |
  • 2
    Forgive my ignorance, but what are those numbers in the end of each abbreviation / nomenclature entry ? – jmacedo Feb 3 '14 at 9:14
  • 3
    @joxnas the page the respective acronym appeared – cgnieder Feb 3 '14 at 9:17
  • @clemens Is it possible to generate hyperlinks with the acro package like glossaries does? Thanks. – codeaviator Mar 23 '17 at 13:31
  • @cgnieder, excellent answer! Thanks! But by the way, how to not expand the acronym at its first reference in the text? For example, when I use "\gls{IEEE} 802.15.4", it is expanded to "Institute of Electrical and Electronics Engineers (IEEE) 802.15.4" – Alex8752 Sep 12 at 3:19
10

It is indeed possible to have two separate lists using nomencl.

You can define them as groups with corresponding titles.

When doing so, you need to remove the main title by placing \renewcommand{\nomname}{} in the preamble.

Here is an example with two groups:

\documentclass{article}
\usepackage{nomencl}
\makenomenclature

%% This removes the main title:
\renewcommand{\nomname}{}
%% this modifies item separation:
\setlength{\nomitemsep}{8pt}
%% this part defines the groups:
%----------------------------------------------
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\Large\bfseries
  \ifstrequal{#1}{N}{Nomenclature}{%
  \ifstrequal{#1}{A}{List of Abbreviations}{}}%
]\vspace{10pt}} % this is to add vertical space between the groups.
%----------------------------------------------

\begin{document}

\nomenclature[A]{\textbf{IMO}}{in my opinion}
\nomenclature[A]{\textbf{OP}}{original poster}
\nomenclature[N]{$c$}{speed of light in vacuum}
\nomenclature[N]{$h$}{Plank constant}

\printnomenclature[2cm]

\end{document}

giving:

enter image description here

| improve this answer | |
  • may I add some suggested detail here... say you wanted this to appear in the table of contents, you could use the [intoc] option for the package, use List of Symbols rather than Nomenclature for the name of the second group, and then in the first \nomname renew, use Nomenclature there – jonnybolton16 Jul 28 at 22:15
9

This also works (I couldn't get the above script working for a symbol list with units AND glossary..). Important is the order of lines here!

BasicFile.tex:

%Load the package
\usepackage[
nonumberlist, %do not show page numbers
acronym,      %generate acronym listing   -> Not used in this example (see line with %%% )
toc,          %show listings as entries in table of contents
section]      %use section level for toc entries
{glossaries}

%Generate a list of symbols
\newglossary[slg]{symbols}{syi}{syg}{List of symbols}

%Remove the dot at the end of glossary descriptions
\renewcommand*{\glspostdescription}{}

%Activate glossary commands
\makeglossaries

%Load nomenclature and glossary files
\loadglsentries{nomenclature}
\loadglsentries{glossary}

%These commands sort the lists
%%%makeindex -s filename.ist -t filename.alg -o filename.acr filename.acn
%makeindex -s filename.ist -t filename.glg -o filename.gls filename.glo
%makeindex -s filename.ist -t filename.slg -o filename.syi filename.syg


\begin{document}

%Print the glossary
\printglossary[style=altlist,title=Glossary]

%%%%Print list of acronyms
%%%\printglossary[type=\acronymtype,style=long]

%Print list of symbols
\printglossary[type=symbols,style=long4col]
\clearpage

bla-bla \gls{h} \gls{nslats} \gls{illuminance}

\end{document}

nomenclature.tex:

%Some entries for the list of symbols
\newglossaryentry{nslats}{
name=$nslats$,
description={The number of slats},
sort=S, type=symbols, symbol=[$-$]}

\newglossaryentry{h}{
name=$h$,
description={Height},
sort=h, type=symbols, symbol=[$m$]}

glossary.tex

%Some glossary terms
\newglossaryentry{illuminance}{
name=Illuminance,
description={Light flux striking a surface, measured in Lux (lx).}
}



%%% In case you also want a list acronyms
%%%\newacronym{MS}{MS}{Microsoft}
%%%\newacronym{CD}{CD}{Compact Disc}

I don't use Perl so I type these lines directly in the command prompt after changes in any file (notice: if you didn't change anything concerning the glossary or the symbol list it is be okay to just pdflatex only once!):

pdflatex BasicFile.tex 
pdflatex BasicFile.tex 
makeindex -s BasicFile.ist -t BasicFile.slg -o BasicFile.syi BasicFile.syg
makeindex -s BasicFile.ist -t BasicFile.glg -o BasicFile.gls Report_Base_v6.glo 
pdflatex BasicFile.tex
BasicFile.pdf
| improve this answer | |

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