5

I am creating a nomenclature and would like to reduce line spacing. If I use the approach found online inserting the \setlength{\nomitemstep}{-parsep} command, all line skips are removed including the ones before and after the sub-section headings of the nomenclature. Is there a way of reducing the line space only for the individual items, however not for the headers?

Attached is an example code and a snapshot of the output:

\documentclass[authoryear, preprint]{elsarticle} 

\usepackage{nomencl}
\makenomenclature
\renewcommand{\nomgroup}[1]{%
    \ifthenelse{\equal{#1}{A}}{\item[\textbf{Greek Symbols}]}{%
    \ifthenelse{\equal{#1}{B}}{\item[\textbf{Other Variables}]}{}}} 
\setlength{\nomitemsep}{-\parsep}
\RequirePackage{ifthen}

\begin{document}
This is my text document.
\nomenclature[a]{$\sigma$}{Variable explanation}
\nomenclature[a]{$\alpha$}{Variable explanation}
\nomenclature[a]{$\beta$}{Variable explanation}
\nomenclature[b]{$A$}{Variable explanation}
\nomenclature[b]{$B$}{Variable explanation}
\nomenclature[b]{$C$}{Variable explanation}
\nomenclature[b]{$D$}{Variable explanation}
\printnomenclature[0.9in]
\end{document}

Thanks a lot for any hints!

Christian enter image description here

4
  • I think, the spacings is actually controlled in the nomencl.ist file
    – user31729
    Dec 14 '15 at 13:59
  • @ChristianHupfer Thanks for the reply. As I am fairly new to LaTeX, could you let me know how I can access and edit that file in a way that solves my question above?
    – Christian
    Dec 14 '15 at 16:50
  • I'll try to do later on
    – user31729
    Dec 14 '15 at 19:13
  • @ChristianHupfer Hi Christian, I would appreciate if you could give me a hint on how to edit the .ist file to achieve the desired effect. Thanks so much
    – Christian
    Dec 16 '15 at 8:26
2

Here's a small bypass solution: Restore the \noitemsep value temporarily in a \nomgroup and use the newer value afterwards.

\documentclass[authoryear, preprint]{elsarticle} 
\usepackage{ifthen}

\usepackage{nomencl}
\usepackage{xpatch}



\newlength{\nomitemorigsep}
\setlength{\nomitemorigsep}{\nomitemsep}
\setlength{\nomitemsep}{-\parsep}


\makenomenclature
\renewcommand{\nomgroup}[1]{%
  \itemsep\nomitemorigsep%
  \ifthenelse{%
    \equal{#1}{A}%
  }{%
  \item[\textbf{Greek Symbols}]%

  }{%
    \ifthenelse{\equal{#1}{B}}{%
    \item[\textbf{Other Variables}]%

    }{}%
  }%
  \itemsep\nomitemsep% Restore spacing
} 


\begin{document}
This is my text document.
\nomenclature[a]{$\sigma$}{Variable explanation}
\nomenclature[a]{$\alpha$}{Variable explanation}
\nomenclature[a]{$\beta$}{Variable explanation}
\nomenclature[b]{$A$}{Variable explanation}
\nomenclature[b]{$B$}{Variable explanation}
\nomenclature[b]{$C$}{Variable explanation}
\nomenclature[b]{$D$}{Variable explanation}
\printnomenclature[0.9in]
\end{document}
1
  • how to add some spacing say 0.5\ \nomitemorigsep bewteen Other Variables and A? Thanks.
    – Nick
    Nov 20 '18 at 7:17
0

If you do not need to set a precise spacing, and would just like to set single spacing, you can wrap \printnomenclature in a single space environment:

\documentclass{report}

\usepackage[utf8]{inputenc}
\usepackage{nomencl}
\makenomenclature
\usepackage[doublespacing]{setspace}

\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\bfseries
  \ifstrequal{#1}{a}{Symbols}{%
  \ifstrequal{#1}{b}{Acronyms}{}}%
]}

\begin{document}

\nomenclature[a]{$x$}{Symbol explanation}
\nomenclature[a]{$y$}{Symbol explanation}
\nomenclature[a]{$z$}{Symbol explanation}
\nomenclature[b]{A}{Acronym explanation}
\nomenclature[b]{B}{Acronym explanation}
\nomenclature[b]{C}{Acronym explanation}

\renewcommand{\nomname}{Nomenclature}
\begin{singlespace}
\printnomenclature
\end{singlespace}

\end{document}

In this case the document will be double spaced (because of the doublespacing argument passed to the setspace package, and the nomenclature will be single spaced.

To compile this example, make sure to run makeindex <filename>.nlo -s nomencl.ist -o <filename>.nls for the nomenclature to print, where is the name of the .tex file.

3
  • It doesn't work.
    – Apprentice
    Sep 4 at 8:35
  • Works for me. Are you using report class?
    – Mike
    Sep 4 at 17:59
  • 1
    I realized my example code wasn't running, so I fixed it, and for me the single line spacing in the nomenclature still runs as expeced.
    – Mike
    Sep 4 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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