[Tex/LaTex] How to make section in Nomenclature

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?

enter image description here

Best Answer

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}

enter image description here

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.