# How to make section in Nomenclature?

I try to make sections in Nomenclature and sort them as I desire in my paper like the one I added in the picture. I have not had any success. I am close to get mad! I searched a lot but I couldn't find any appropriate answer! Any help?

• Welcome to TeX.SX! Instead of getting mad, add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cfr Jan 16 '15 at 3:56

Here is an attempt with nomencl package.

\documentclass{article}
\usepackage{nomencl}
\usepackage{ifthen}
\renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{C}}{\item[\textbf{Constants}]}{%
\ifthenelse{\equal{#1}{V}}{\item[\textbf{Variables}]}{%
\ifthenelse{\equal{#1}{S}}{\item[\textbf{sets}]}{}}}
}
\makenomenclature
\begin{document}
\nomenclature[Cp]{$p_{Di}$}{Active power demand at bus $i$}
\nomenclature[Vp]{$p_{Gi}$}{Active power generation at bus $i$}
\nomenclature[SO]{$\Omega_{G}$}{Set of generator buses}
Some text
\printnomenclature
\end{document}


Here C in Cp (\nomenclature[Cp]{$p_{Di}$}{Active power demand at bus $i$}) puts the entry in Constants where Vp would put it in Variables.

You have to compile with

pdflatex yourfilename
makeindex.exe -s nomencl.ist -t "yourfilename.nlg" -o "yourfilename.nls" "yourfilename.nlo"
pdflatex yourfilename


to get things done.

• The package glossaries is more versatile for such jobs. – user11232 Jan 16 '15 at 4:37
• Thank You so much for your kind concern. That works for me! I appreciate your help. – Omid ziaee Jan 16 '15 at 18:36
• Hi, Thank you so much for your help. I used this code: – Omid ziaee Jan 16 '15 at 21:35

Here's an attempt with the glossaries package:

\documentclass{article}

\usepackage[acronym,nonumberlist]{glossaries}

\renewcommand{\acronymname}{Nomenclature}

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

\newcommand*{\Agroupname}{Constants}
\newcommand*{\Bgroupname}{Variables}
\newcommand*{\Cgroupname}{Sets}

\newacronym[sort=a1]{APD}{$p_{D_{i}}$}{Active power demand at bus $i$}
\newacronym[sort=b1]{APG}{$p_{G_{i}}$}{Active power generation at bus $i$}
\newacronym[sort=b2]{RPG}{$q_{G_{i}}$}{Reactive power generation at bus $i$}
\newacronym[sort=c1]{SGB}{$\Omega_{G}$}{Set of generator buses}

\makeglossaries

\begin{document}

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

\end{document}


Output

How it works.

First of all, I've defined a new glossary style mystyle to simulate the output of nomencl

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


Then I defined three groups (a, b and c) which correspond to your "sections"

\newcommand*{\Agroupname}{Constants}
\newcommand*{\Bgroupname}{Variables}
\newcommand*{\Cgroupname}{Sets}


When you want to define an entry, use something like

\newacronym[sort=b1]{APG}{$p_{G_{i}}$}{Active power generation at bus $i$}


where sort=b1 means: insert the entry in the group b ("Variables") and put it in the list as the first element.