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.

Following the solution given in New line in a Nomenclature

I am using

\renewcommand{\nomlabel}[1]{\smash{\parbox[t]{1.5cm}{#1}}\hfil}

However, it conflicts with the \nomgroup (see below).

Code example:

\documentclass{article}

\usepackage{ifthen}
\usepackage{calc}

\usepackage[noprefix]{nomencl}

% Configure title of groups
\newcommand{\bfdz}[1]{\bf\fontsize{12}{14}\selectfont #1}
\newcommand{\meru}[1]{\rule[2pt]{\textwidth-(\widthof{#1})}{.5pt}}

% Enable two line label
\renewcommand{\nomlabel}[1]{\smash{\parbox[t]{1.5cm}{#1}}\hfil}

% Create Groups
\renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{A}}{\vspace{5mm} \item[\bfdz General Symbols] \meru{\bfdz General Symbols~~}}{%
\ifthenelse{\equal{#1}{G}}{\vspace{5mm} \item[\bfdz Greek Symbols] \meru{\bfdz Greek Symbols~~}}{}}}

\makenomenclature 

\begin{document}

\printnomenclature[1.5cm]

\nomenclature[A]{$p(r_m,t)$, $p_m(t)$}{Received signal at the $m^{th}$ microphone\nomrefpage}%{}{}

\nomenclature[G]{$\Delta t_{\vec{x}}$}{Emission time delay at focus point $\vec{x}$, $\Delta t_{\vec{x}}=r_{\vec{x}} / c$\nomrefpage}%{}{}

\end{document}

If you comment the line

\renewcommand{\nomlabel}[1]{{\parbox[t]{1.5cm}{#1}}\hfil}

you will get correct title, but wrong label size.

Incorrect title screenshot

Does anyone know a way to fix it ?

share|improve this question
1  
Hi Will Welcome to TeX.SE! I added your image, and thanks for providing a MWE :) Welcome! –  cmhughes Dec 19 '12 at 19:49
add comment

1 Answer

up vote 4 down vote accepted

On www.latex-community.org I made the following suggestion to the very same question:

% arara: pdflatex
% arara: nomencl
% arara: pdflatex
\documentclass{article}

\usepackage{ragged2e}
\usepackage[noprefix]{nomencl}

% define a command for the group heading:
% \rlap overlaps to the right => ``break out'' of the labels box
% and set a box over the whole textwidth;
% create the rule with \hrulefill rather than measuring the
% remaining space.
% let's also not use \bf but rather \bfseries (see http://tex.stackexchange.com/q/516/5049)
% and use \large instead of explicitly chhoose the font size:
\newcommand\grouphead[1]{%
  \rlap{%
    \parbox{\textwidth}{\textbf{\large#1 \hrulefill}}%
  }\hfill
}

% Enable two line label
% I added \RaggedRight from the `ragged2e' package here to avoid
% over- and underfull boxes
\renewcommand{\nomlabel}[1]{%
  \smash{\parbox[t]{.15\linewidth}{\RaggedRight#1}}}

% Create Groups
% the tests can be done without any additional package
% (they will fail, though, for a group like `aa')
\renewcommand{\nomgroup}[1]{%
  \ifx#1A\relax
    \item[\grouphead{General Symbols}]
  \fi
  \ifx#1G\relax
    \item[\grouphead{Greek Symbols}]
  \fi
  \bigskip}

\makenomenclature 

\begin{document}

Text bla bla

\printnomenclature[1.5cm]

\nomenclature[A]{$p(r_m,t)$, $p_m(t)$}{Received signal at the $m^{th}$
  microphone\nomrefpage}

\nomenclature[G]{$\Delta t_{\vec{x}}$}{Emission time delay at focus point
  $\vec{x}$, $\Delta t_{\vec{x}}=r_{\vec{x}} / c$\nomrefpage}

\end{document}

enter image description here

Please note that I chose \bfseries over \bf (see Does it matter if I use \textit or \it, \bfseries or \bf, etc for reasons) and \large over \fontsize{}{}\selectfont.

For a thicker line one could follow David's answer on What is the thickness of \hrulefill and maybe define a corresponding \nomgrouprulefill.

share|improve this answer
    
Cgnieder, thanks a lot ! Since before I got no answer there I tried here ! –  Will Fonseca Dec 19 '12 at 20:33
    
@WillFonseca you're welcome! –  cgnieder Dec 19 '12 at 20:45
    
note: I was getting an error until I changed \smash{\parbox[t]{.15\linewidth}{\RaggedRight#1}}} to \smash{\parbox[t]{.15\linewidth}{\raggedright#1}}} this might be an error with my setup, but might be of interest to others... SpB. –  spb Nov 26 '13 at 19:39
    
You forgot to load the ragged2e package as in cgneider's answer. The \RaggedRight command much better than \raggedright. –  Andrew Swann Nov 26 '13 at 20:29
add comment

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.