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?
3 Answers
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
.
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=abbrev,name=Abbreviations]
\printacronyms[include=nomencl,name=Nomenclature]
\end{document}
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}
-
2Forgive my ignorance, but what are those numbers in the end of each abbreviation / nomenclature entry ?– jmacedoFeb 3, 2014 at 9:14
-
3
-
@clemens Is it possible to generate hyperlinks with the
acro
package likeglossaries
does? Thanks. Mar 23, 2017 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"– Alex8752Sep 12, 2020 at 3:19
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
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:
-
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 Jul 28, 2020 at 22:15
gloss
package for the abbreviations?glossaries
, a package which is capable of dealing with multiple - well - glossaries.glossaries
, Iused that myself, and it works great. I guess it is up to @cgnieder to make that an answer.