Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a nomenclature section in my paper where I defined my symbols. For example:

\documentclass[twocolumn,10pt]{asme2e}
\addtolength{\textwidth}{-1pt}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\special{papersize=8.5in,11in}
\begin{document}
\begin{nomenclature}
\entry{$\hat{q}$}{Continuum scale conserved quantity}
\entry{$\hat{f}^0$}{Continuum scale source density function}
\end{nomenclature}
\end{document}

My code compiles properly, but the space between the symbol and its corresponding definition seems to be constant such that the definitions are not all aligned in one column. How can I modify it to ensure that the descriptions begin at the same point?

share|improve this question
2  
please edit the code to be a complete document showing the problem and packages used: I guessed nomencl.sty) but that doesn't define \entry –  David Carlisle Mar 8 '13 at 22:34
    
@DavidCarlisle: Done. I don't think i used nomencl.sty unless the asme2e package implicitly uses it. I'm not really sure. –  Paul Mar 8 '13 at 23:00
    
The class file (asme2e.cls) isn't on CTAN as far as I can tell, could you post a link? (Is it this one for example?) –  Torbjørn T. Mar 8 '13 at 23:04
    
@TorbjørnT.: Here's the link: iel.ucdavis.edu/code/ASME/conf-1.7/asme2e.cls –  Paul Mar 8 '13 at 23:18
    
@Paul The \entry command is defined by \newbox\tempbox \newcommand\entry[2]{% \setbox\tempbox\hbox{##1.\quad} \hangindent\wd\tempbox\noindent{##1}\quad\ignorespaces##2\par}. Not the best, IMO. However, if you want to submit a paper to ASME, you probably have to adhere to the style file. –  Jubobs Mar 8 '13 at 23:21

2 Answers 2

up vote 5 down vote accepted

If the asme2.cls is the one found here it's the normal behavior. You can change it by adding the code between \makeatletter and \makeatother (included) to your document:

\documentclass[twocolumn,10pt]{asme2e}

%%% Start of code to add
\makeatletter
\newif\if@checkentries
\renewenvironment{nomenclature}[1][]
 {\if\relax\detokenize{#1}\relax
    \@checkentriesfalse
  \else
    \settowidth{\@tempdima}{#1\quad}%
    \@checkentriestrue
  \fi
  \def\entry##1##2{%
    \sbox\@tempboxa{##1\quad}%
    \if@checkentries
      \ifdim\wd\@tempboxa>\@tempdima
        \@latex@warning{Entry `\unexpanded{##1}' is wider}%
        \@tempdima=\wd\@tempboxa
      \fi
    \else
      \@tempdima=\wd\@tempboxa
    \fi
    \hangindent\@tempdima
    \noindent\makebox[\@tempdima][l]{##1}\ignorespaces##2\par}%
    \section*{NOMENCLATURE}}
 {\par\addvspace{12pt}}
\makeatother
%% End of code to add

\begin{document}
\begin{nomenclature}[$\hat{f}^0$]
\entry{$\hat{q}$}{Continuum scale conserved quantity}
\entry{$\hat{f}^0$}{Continuum scale source density function}
\end{nomenclature}
\end{document}

You can specify the widest entry as an optional argument to \begin{nomenclature}; if you don't guess correctly, there will be a warning in the log file. For example, if you write

\begin{nomenclature}[$\hat{q}$]

you'll get the warning

LaTeX Warning: Entry `$\hat {f}^0$' is wider on input line 31.

If you don't specify an optional argument, you obtain the same behavior as defined by the class.

enter image description here

share|improve this answer

As already pointed out the non-aligned setting is the expected behaviour of asme2e. Here is my take of a redefinition using a \list. It also indents long descriptions so that the description forms an aligned block, just like the original environment. As an optional argument my nomenclature environment takes the width of the symbol column, which defaults to 1cm.

\documentclass[twocolumn,10pt]{asme2e}
% \addtolength{\textwidth}{-1pt}
% \usepackage{graphicx}
% \usepackage{amsmath}
% \usepackage{amssymb}
% \special{papersize=8.5in,11in}

\renewenvironment{nomenclature}[1][1cm]{%
    \newcommand\entry[2]{\item[##1]##2\par}
    \section*{NOMENCLATURE}
    \list{}{\leftmargin #1}%
  }%
  {\endlist\par\addvspace{12pt}}


\begin{document}
\begin{nomenclature}
% or use \begin{nomenclature}[1.5cm] to have a wider symbol column
\entry{$\hat{q}$}{Continuum scale conserved quantity}
\entry{$\hat{f}^{0}$}{Continuum scale source density function}
\entry{$A$}{Long description long description long description long description long description long description long description long description long description}
\end{nomenclature}
\end{document}

sample output

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.