[Tex/LaTex] Nomenclature section

lyxnomenclature

I used the following code to make sections in nomenclature. This totally works. While I wanted to add the fourth section "Matrices" which is now commented out I faced with an error. I attached the photo of the error. Any help appreciated.

    \renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{A}}{\item[{Sets and Indicis:}]}{%
\ifthenelse{\equal{#1}{B}}{\item[{Variables:}]}{%
%\ifthenelse{\equal{#1}{B}}{\item[{Parameters:}]}{%     
\ifthenelse{\equal{#1}{D}}{\item[{Cons}]}{}}}
}
\makenomenclature
  \nomenclature[A1]{$\Omega_N$}{Set of all buses (nodes).}
  \nomenclature[A2]{$n,m$}{Index of all buses (nodes). $m$ is alias of $n$.}
  \nomenclature[A3]{$\Omega_L$}{Set of all Transmission lines.}
  \nomenclature[A4]{$l$}{Index of transmission lines.}
  \nomenclature[A5]{$\Omega_{K}$}{Set of all genetors.}
  \nomenclature[A6]{$k$}{Index of generator $k\in\Omega_{k}.$}
  \nomenclature[A7]{$\Omega_{D}$}{Set of all demand buses.}
  \nomenclature[A8]{$d$}{Index of demand, $d\in\Omega_{D}.$\\}
  \nomenclature[B1]{$\theta_{n}$}{Voltage angle at bus $n.$}
  \nomenclature[B2]{$v_n$}{Voltage magnitude at bus $n.$}
  \nomenclature[B3]{$p_{nk}$}{Real power supply from generator $k$ at bus $n.$}
  \nomenclature[B4]{$q_{nk}$}{Reactive power supply from generator $k$ at bus$n.$}
  \nomenclature[B5]{$p_{nml}$}{Active power flows from bus $m$ to bus $n$ through transmission line $l.$}
  \nomenclature[B6]{$\lambda_{nml}$}{compansation level of transmission line $l$ between bus $n$ and $m$.}
  \nomenclature[B7]{$u_{nml}$}{Binary variable denoting the placement of TCSC on line $l$  between bus $m$  and $n.$\\}
  \nomenclature[D1]{$c_k$}{Cost coefficient of generator $k.$}
  \nomenclature[D2]{$p_{nd}$}{Real power demand at bus $n.$}
  \nomenclature[D3]{$q_{nd}$}{Reactivel power demand at bus $n.$}
  \nomenclature[D4]{$r_{nml}$}{Resistance of transmission line $l$  between bus $m$  and $n.$}
  \nomenclature[D5]{$x_{nml}$}{Reactance of transmission line $l$  between bus $m$  and $n$ .}
  \nomenclature[D6]{$g_{nml}$}{Conductance of transmission line $l$  between bus $m$  and $n$ .}
  \nomenclature[D7]{$b_{nml}$}{Susceptance of transmission line $l$  between bus $m$  and $n$ .}
  \nomenclature[D8]{$x_{nml}^{'}$}{Reactance of transmission line $l$ after compansation.}
  \nomenclature[D9]{$g_{nml}^{'}$}{Conductance of transmission line $l$ after compansation.}
  \nomenclature[D10]{$b_{nml}^{'}$}{Sueceptance of transmission line $l$ after compansation.}
  \nomenclature[D11]{$p_{k}^{min}$ ,$p_{k}^{max}$}{Lower and upper bound of active power supplied by generator$ k.$}
  \nomenclature[D12]{$p_{k}^{min}$ ,$p_{k}^{max}$}{Lower and upper bound of reactive power supplied by generator$ k.$}
  \nomenclature[D13]{$\theta_{n}^{min}$, $\theta_{n}^{max}$}{Lower and upper bound of voltage angle at bus $n.$}
  \nomenclature[D14]{$v_{n}^{min}$, $v_{n}^{max}$}{Lower and upper bound of voltage magnitude at bus $n.$}
  \nomenclature[D15]{$\lambda^{max}$}{Maximum available compansation level.}
  \nomenclature[D16]{$\eta_{TCSC}$}{Number of available TCSCs.}
  \nomenclature[D17]{$M$}{Big integer number.}
  \nomenclature[D18]{$N_{b}$}{ Number of buses ($\mid\Omega_{N}\mid=N_{b}$).}
  \nomenclature[D19]{$N_{l}$}{Number of transmission lines ($\mid\Omega_{L}\mid=N_{l}$).}
  \nomenclature[D20]{$\mu_l$}{Dual variable regarding to change in active power generation of unit $k$  in subproblem.}
  \nomenclature[D21]{$\alpha_k$}{Dual variable regarding to change in active power generation of unit $k$  in              subproblem.}
  \nomenclature[D22]{$\beta_l$}{Dual variable in adjusting compansation level of TCSC in trasmission line $l$.}
  \nomenclature[D23]{$N_{k}$}{ Number of generators ($\mid\Omega_{K}\mid=N_{k}$).}
  %\nomenclature[G1]{}{}
 \printnomenclature

enter image description here

Best Answer

You are simply missing a closing brace.

\ifthenelse{\equal{#1}{D}}{\item[{Cons}]}{}}}

should be

\ifthenelse{\equal{#1}{D}}{\item[{Cons}]}{}}}}

MWE:

\documentclass{article}
\usepackage{nomencl}
\usepackage{ifthen}
    \renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{A}}{\item[{Sets and Indicis:}]}{%
\ifthenelse{\equal{#1}{B}}{\item[{Variables:}]}{%
\ifthenelse{\equal{#1}{G}}{\item[{Parameters:}]}{%
\ifthenelse{\equal{#1}{D}}{\item[{Cons}]}{}}}}
}
\makenomenclature
  \nomenclature[A1]{$\Omega_N$}{Set of all buses (nodes).}
  \nomenclature[A2]{$n,m$}{Index of all buses (nodes). $m$ is alias of $n$.}
  \nomenclature[A3]{$\Omega_L$}{Set of all Transmission lines.}
  \nomenclature[A4]{$l$}{Index of transmission lines.}
  \nomenclature[A5]{$\Omega_{K}$}{Set of all genetors.}
  \nomenclature[A6]{$k$}{Index of generator $k\in\Omega_{k}.$}
  \nomenclature[A7]{$\Omega_{D}$}{Set of all demand buses.}
  \nomenclature[A8]{$d$}{Index of demand, $d\in\Omega_{D}.$\\}
  \nomenclature[B1]{$\theta_{n}$}{Voltage angle at bus $n.$}
  \nomenclature[B2]{$v_n$}{Voltage magnitude at bus $n.$}
  \nomenclature[B3]{$p_{nk}$}{Real power supply from generator $k$ at bus $n.$}
  \nomenclature[B4]{$q_{nk}$}{Reactive power supply from generator $k$ at bus$n.$}
  \nomenclature[B5]{$p_{nml}$}{Active power flows from bus $m$ to bus $n$ through transmission line $l.$}
  \nomenclature[B6]{$\lambda_{nml}$}{compansation level of transmission line $l$ between bus $n$ and $m$.}
  \nomenclature[B7]{$u_{nml}$}{Binary variable denoting the placement of TCSC on line $l$  between bus $m$  and $n.$\\}
  \nomenclature[D1]{$c_k$}{Cost coefficient of generator $k.$}
  \nomenclature[D2]{$p_{nd}$}{Real power demand at bus $n.$}
  \nomenclature[D3]{$q_{nd}$}{Reactivel power demand at bus $n.$}
  \nomenclature[D4]{$r_{nml}$}{Resistance of transmission line $l$  between bus $m$  and $n.$}
  \nomenclature[D5]{$x_{nml}$}{Reactance of transmission line $l$  between bus $m$  and $n$ .}
  \nomenclature[D6]{$g_{nml}$}{Conductance of transmission line $l$  between bus $m$  and $n$ .}
  \nomenclature[D7]{$b_{nml}$}{Susceptance of transmission line $l$  between bus $m$  and $n$ .}
  \nomenclature[D8]{$x_{nml}^{'}$}{Reactance of transmission line $l$ after compansation.}
  \nomenclature[D9]{$g_{nml}^{'}$}{Conductance of transmission line $l$ after compansation.}
  \nomenclature[D10]{$b_{nml}^{'}$}{Sueceptance of transmission line $l$ after compansation.}
  \nomenclature[D11]{$p_{k}^{min}$ ,$p_{k}^{max}$}{Lower and upper bound of active power supplied by generator$ k.$}
  \nomenclature[D12]{$p_{k}^{min}$ ,$p_{k}^{max}$}{Lower and upper bound of reactive power supplied by generator$ k.$}
  \nomenclature[D13]{$\theta_{n}^{min}$, $\theta_{n}^{max}$}{Lower and upper bound of voltage angle at bus $n.$}
  \nomenclature[D14]{$v_{n}^{min}$, $v_{n}^{max}$}{Lower and upper bound of voltage magnitude at bus $n.$}
  \nomenclature[D15]{$\lambda^{max}$}{Maximum available compansation level.}
  \nomenclature[D16]{$\eta_{TCSC}$}{Number of available TCSCs.}
  \nomenclature[D17]{$M$}{Big integer number.}
  \nomenclature[D18]{$N_{b}$}{ Number of buses ($\mid\Omega_{N}\mid=N_{b}$).}
  \nomenclature[D19]{$N_{l}$}{Number of transmission lines ($\mid\Omega_{L}\mid=N_{l}$).}
  \nomenclature[D20]{$\mu_l$}{Dual variable regarding to change in active power generation of unit $k$  in subproblem.}
  \nomenclature[D21]{$\alpha_k$}{Dual variable regarding to change in active power generation of unit $k$  in              subproblem.}
  \nomenclature[D22]{$\beta_l$}{Dual variable in adjusting compansation level of TCSC in trasmission line $l$.}
  \nomenclature[D23]{$N_{k}$}{ Number of generators ($\mid\Omega_{K}\mid=N_{k}$).}
  \nomenclature[G1]{text}{some explanation}
\begin{document}
  Some text
  \printnomenclature
\end{document} 

Output:

enter image description here