[Tex/LaTex] List of abbreviation

horizontal alignmentnomenclature

I want to display a list of abbreviation in two columns and list each abbreviation preceded by the corresponding letter. for example :

A

AAR ….

AG ….

i use the package nomencl :

below the latex code :

\documentclass[12pt,a4paper]{report}
   .
   .
   .
\usepackage[intoc]{nomencl}
\makenomenclature
\begin{document}
\printnomenclature
\nomenclature{abrev}{text}
\end{document}

Also i met an other problem that the abbreviation are not aligned!!
enter image description here

Best Answer

The nomencl package typesets the labels in a fixed width box; if the label (together with a padding space) exceeds this width, the description is moved right.

\documentclass[12pt,a4paper]{report}
\usepackage[intoc]{nomencl}
\makenomenclature
\setlength\nomlabelwidth{1.5cm}

\nomenclature{AA}{text}
\nomenclature{AAA}{text}
\nomenclature{AAB}{text}
\nomenclature{AACD}{text}

\begin{document}
x
\printnomenclature
\end{document}

will do. An automatic setting is possible, by measuring the labels and writing the maximum width in the .aux file. A couple of compilations are necessary if the labels change.

\documentclass[12pt,a4paper]{report}
\usepackage[intoc]{nomencl}
\makenomenclature

\usepackage{xpatch}
\makeatletter
\xapptocmd\thenomenclature{\let\@item\nomencl@item\def\nomencl@width{0pt}}{}{}
\let\nomencl@item\@item
\xpretocmd\nomencl@item{\nomencl@measure{#1}}{}{}
\def\nomencl@measure#1{%
  \sbox0{#1}%
  \ifdim\wd0>\nomencl@width\relax
    \edef\nomencl@width{\the\wd0}%
  \fi
}
\xapptocmd\endthenomenclature{%
  \immediate\write\@mainaux{\global\nomlabelwidth\nomencl@width\relax}%
}{}{}
\makeatother

\nomenclature{AA}{text}
\nomenclature{AAA}{text}
\nomenclature{AAB}{text}
\nomenclature{AACD}{text}

\begin{document}
x
\printnomenclature
\end{document}

Version with commented code and two column nomenclature

\documentclass[12pt,a4paper]{report}
\usepackage[intoc]{nomencl}
\usepackage{multicol}
\makenomenclature

\usepackage{xpatch}
\makeatletter

%%% we want that \item[...] measures its argument
\xapptocmd\thenomenclature{\let\@item\nomencl@item\def\nomencl@width{0pt}}{}{}
% copy \@item
\let\nomencl@item\@item
% patch the copy
\xpretocmd\nomencl@item{\nomencl@measure{#1}}{}{}
% define the measuring command
\def\nomencl@measure#1{%
  \sbox0{#1}%
  \ifdim\wd0>\nomencl@width\relax
    \edef\nomencl@width{\the\wd0}%
  \fi
}

%%% we want a two column nomenclature, so we patch
%%% \thenomenclature to start multicols
\xpatchcmd\thenomenclature
  {\section*{\nomname}}
  {\begin{multicols}{2}[\section*{\nomname}]}
  {}{}
\xpatchcmd\thenomenclature
  {\chapter*{\nomname}}
  {\begin{multicols}{2}[\chapter*{\nomname}]}
  {}{}

%%% finally we patch \endthenomenclature to 
%%% annotate in the aux file the required width
\xapptocmd\endthenomenclature{%
  \immediate\write\@mainaux{\global\nomlabelwidth\nomencl@width\relax}%
  \end{multicols}
}{}{}
\makeatother

\nomenclature{AA}{text}
\nomenclature{AAA}{text}
\nomenclature{AAB}{text}
\nomenclature{AACD}{text}

\begin{document}
x
\printnomenclature
\end{document}