6

I am using the nomencl package to make a list of abbreviations.

I would like the name of the nomenclature, "Abbreviations", to be formatted and numbered in the same way as a \section{}.

For example:

\documentclass{article}

\usepackage{nomencl}
\makenomenclature

\begin{document}

\section{Introduction}

\nomenclature{A}{First one}
\nomenclature{B}{Second one}
\renewcommand{\nomname}{Abbreviations}
\printnomenclature

\section{Methods}
\end{document}

I would like this to produce:


1 Introduction

2 Abbreviations

A First one

B Second one

3 Methods


How can I do that ?

Joe King
  • 193

1 Answers1

5

The package uses \section* (if \chapter is not available in the current document class) to format the title as an unnumbered section; you can patch (using, for example, the etoolbox package) the \thenomenclature command to use \section instead:

\documentclass{article}
\usepackage{nomencl}
\usepackage{etoolbox}
\makenomenclature

\makeatletter
\patchcmd{\thenomenclature}{\section*}{\section}{}{}
\makeatother

\begin{document}

\section{Introduction}
\nomenclature{A}{First one}
\nomenclature{B}{Second one}
\renewcommand{\nomname}{Abbreviations}
\printnomenclature
\section{Methods}

\end{document}

enter image description here

If you don't want to use additional packages, you'll need to make the change in the definition of \thenomenclature:

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

\makeatletter
\def\thenomenclature{%
  \@ifundefined{chapter}%
  {
    \section{\nomname}
    \if@intoc\addcontentsline{toc}{section}{\nomname}\fi%
  }%
  {
    \chapter{\nomname}
    \if@intoc\addcontentsline{toc}{chapter}{\nomname}\fi%
  }%

  \nompreamble
  \list{}{%
    \labelwidth\nom@tempdim
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \itemsep\nomitemsep
    \let\makelabel\nomlabel}}
\makeatother

\begin{document}

\section{Introduction}

\nomenclature{A}{First one}
\nomenclature{B}{Second one}
\renewcommand{\nomname}{Abbreviations}
\printnomenclature

\section{Methods}
\end{document}
Gonzalo Medina
  • 505,128