2

I am writing an article and I need to use a predefined class. The nomenclature is coded as an environment like this:

\documentclass[12pt]{article}

\newbox\tempbox
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
   \setbox\tempbox\hbox{##1.\quad}
   \hangindent\wd\tempbox\noindent{##1}\quad\ignorespaces##2\par}
   \section*{NOMENCLATURE}}{\par\addvspace{12pt}}

\begin{document}

\begin{nomenclature}
    \entry{$A$}{Duct cross section {[$m^2$]}}
    \entry{$A^\pm$}{Acoustic waves}
    \entry{$c_p$}{Specific heat capacity at constant pressure {[$J.kg^{-1}.K^{-1}$]}}
    \entry{$E_0$}{Energy deposited by the energy deposition model {[$J$]}}
    \entry{$He$}{Helmholtz number}
\end{nomenclature}

\end{document}

It is very simple but I would like to have the definitions for the different variables with an indentation.

Thank you very much for your help.

linksse
  • 23

1 Answers1

0

Here is one way to modify your code to this. You want a fixed sized space for the indent and to put the label text in to a box of the same width.

Sample output

\documentclass[12pt]{article}

\newlength{\nomenlabelindent}
\setlength{\nomenlabelindent}{4em}
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
   \hangindent\nomenlabelindent\noindent\makebox[\nomenlabelindent][l]{##1\quad}\ignorespaces##2\par}%
   \section*{NOMENCLATURE}}{\par\addvspace{12pt}}

\begin{document}

\begin{nomenclature}
    \entry{$A$}{Duct cross section {[$m^2$]}}
    \entry{$A^\pm$}{Acoustic waves}
    \entry{$c_p$}{Specific heat capacity at constant pressure {[$J.kg^{-1}.K^{-1}$]}}
    \entry{$E_0$}{Energy deposited by the energy deposition model {[$J$]}}
    \entry{$He$}{Helmholtz number}
    \entry{$T$}{Some long text description to show how a second line
    is handled when absolutely necessary}
\end{nomenclature}

\end{document}

The code sets up a length variable to store the space needed for the label and following space. This should be the same amount for all labels otherwise you will not get a uniform indentation. Then each entry builds a par shape with the given indentation, and then prints out a box containing the label flushleft. If you want the label aligned to the right of the box, change the argument of \makebox from [l] to [r].

Andrew Swann
  • 95,762