[Tex/LaTex] Grouped multi-column nomenclature

multicolnomenclature

I'd like to print a multicolumn nomenclature list that consists of several groups. At the moment, using the grouping approach described in the manual and with a code snippet from http://www.latex-community.org/forum/viewtopic.php?f=51&t=7892, it works in principle.

However, the list runs down the entire first column of the page and then continues on the second, regardless of the groups. What I'd prefer is for each group to be in its own multicols environment:

What I have:

What I'd like:

Is there a way to achieve this with the nomencl package?


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


\renewcommand{\nomgroup}[1]{%
  \ifthenelse{\equal{#1}{A}}{%
   \medskip\item[\large\textbf{\textsf{Latin}}]\medskip%
    }{%
    \ifthenelse{\equal{#1}{B}}{%    
     \medskip\item[\large\textbf{\textsf{Greek}}]\medskip}{%
            \medskip}
    }
}

\renewcommand*\nompreamble{\begin{multicols}{2}}
\renewcommand*\nompostamble{\end{multicols}}


\begin{document}  

\nomenclature[A]{a}{1}%
\nomenclature[A]{b}{2}%
\nomenclature[A]{c}{3}%
\nomenclature[A]{d}{4}%
\nomenclature[A]{e}{5}%
\nomenclature[A]{f}{6}%
\nomenclature[A]{g}{7}%
\nomenclature[A]{h}{8}%
\nomenclature[A]{i}{9}%
\nomenclature[A]{j}{10}%
\nomenclature[A]{k}{11}%
\nomenclature[A]{l}{12}%


\nomenclature[B]{$\alpha$}{1}%
\nomenclature[B]{$\beta$}{2}%
\nomenclature[B]{$\gamma$}{3}%


\printnomenclature
\end{document}

Best Answer

Not sure this is the best solution, but still...

% arara: pdflatex
% arara: nomencl
% arara: pdflatex
\documentclass{article}
\usepackage{nomencl}
\usepackage{multicol}
\makenomenclature

\makeatletter
\newif\if@nomlist

\newcommand*\nomlist{%
  \@nomlisttrue
  \list{}{%
    \labelwidth\nom@tempdim
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \itemsep\nomitemsep
    \let\makelabel\nomlabel}}

\renewcommand*\thenomenclature{%
  \@ifundefined{chapter}%
    {\section*{\nomname}\if@intoc\addcontentsline{toc}{section}{\nomname}\fi}%
    {\chapter*{\nomname}\if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi}%
  \nompreamble
  \@nomlistfalse
}

\renewcommand\nomgroup[1]{%
  \if@nomlist\endlist\end{multicols}\fi
  \ifx#1A\relax
    \def\nomgroupname{Latin}%
  \else
    \ifx#1B\relax
      \def\nomgroupname{Greek}%
    \else
      \def\nomgroupname{Other}%
    \fi
  \fi
  \begin{multicols}{2}[\noindent\large\textbf{\textsf{\nomgroupname}}]
  \nomlist
}

\renewcommand*\nompreamble{}
\renewcommand*\nompostamble{\end{multicols}}
\makeatother

\usepackage{lipsum}
\begin{document}
\lipsum[1-2]

\nomenclature[A]{a}{1}%
\nomenclature[A]{b}{2}%
\nomenclature[A]{c}{3}%
\nomenclature[A]{d}{4}%
\nomenclature[A]{e}{5}%
\nomenclature[A]{f}{6}%
\nomenclature[A]{g}{7}%
\nomenclature[A]{h}{8}%
\nomenclature[A]{i}{9}%
\nomenclature[A]{j}{10}%
\nomenclature[A]{k}{11}%
\nomenclature[A]{l}{12}%

\nomenclature[B]{$\alpha$}{1}%
\nomenclature[B]{$\beta$}{2}%
\nomenclature[B]{$\gamma$}{3}%

\printnomenclature
\end{document}

enter image description here