1

I am using Report class for my thesis and want to remove white space before nomenclature heading. I am successful in generating a PDF preview from LyX but when I import the file as LaTeX plain however the .tex file does not print out the nomenclature section. I do not know why this happens. I use tocloft package to control the spacing for Table of Contents, List of Figures and titles but I am not familiar with the command for the nomenclature section. I have changed the name of the nomenclature to List of Abbreviations. I have attached the output from the LyX file below.

% Preview source code

%% LyX 2.1.4 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english]{report}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=30mm,bmargin=22mm,lmargin=20mm,rmargin=30mm,headheight=3mm,headsep=12mm,footskip=10mm}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{nomencl}
% the following is useful when we have the old nomencl.sty package
\providecommand{\printnomenclature}{\printglossary}
\providecommand{\makenomenclature}{\makeglossary}
\makenomenclature

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\AtBeginDocument{\newgeometry{hmargin=4cm}}
\raggedbottom
\pagenumbering{roman}
\geometry{textheight=245mm, textwidth=160mm, footskip=10mm}
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\hspace*{\fill}\Huge\bfseries}
\renewcommand{\cftaftertoctitle}{\hspace*{\fill}}
\renewcommand{\cftlottitlefont}{\hspace*{\fill}\Huge\bfseries}
\renewcommand{\cftafterlottitle}{\hspace*{\fill}}
\renewcommand{\cftloftitlefont}{\hspace*{\fill}\Huge\bfseries}
\renewcommand{\cftafterloftitle}{\hspace*{\fill}}

\setlength\cftbeforetoctitleskip{-7mm}
\setlength\cftbeforeloftitleskip{-25mm}
\setlength\cftbeforelottitleskip{-4mm}

\setlength\cftaftertoctitleskip{0mm}
\setlength\cftafterloftitleskip{0mm}
\setlength\cftafterlottitleskip{0mm}

\renewcommand\nomname{List of Abbreviations}
\renewcommand{\nomname}{\makebox[\linewidth]{List of Abbreviations}}

\renewcommand\cftchapfont{\fontsize{16}{18}\selectfont}
\setlength{\cftbeforechapskip}{-8pt}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsecfont{\fontsize{14}{16}\selectfont}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsecskip}{-12pt}
\renewcommand\cftsubsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsubsecskip}{-12pt}

\renewcommand{\cftsecfont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecfont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecfont}{\fontseries{md}\fontsize{10}{12}\selectfont}

\renewcommand{\cftsecpagefont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecpagefont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecpagefont}{\fontseries{md}\fontsize{10}{12}\selectfont}

\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\LARGE\bfseries}{\chaptertitlename\ \thechapter}{15mm}{\LARGE}

\titlespacing*{\chapter}{0mm}{50mm}{15mm}
\titlespacing*{\section}{0pt}{15mm}{15mm}
\titlespacing*{\subsection}{0pt}{15mm}{15mm}
\titlespacing*{\subsubsection}{0pt}{10mm}{10mm}


\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{Chapter\space{\thechapter,\space\space}Section\space{\thesection}}
\fancyhead[RO]{\thepage}
\fancyhead[LO]{\nouppercase\rightmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}

\makeatother

\usepackage{babel}
\begin{document}
\tableofcontents{}\settowidth{\nomlabelwidth}{X-Y}
\printnomenclature{}\nomenclature{X-Y}{XY}
\end{document}
  • Are you ultimately using (and compiling with) LyX, or are you going to export the LyX document and compile the .tex in a different editor? – Werner Dec 25 '16 at 16:52
  • I will export the final version as a .tex file and then make the pdf. – Curious Dec 26 '16 at 6:37
1

Printing a nomenclature is not just as simple as adding a \printnomenclature command to your .tex file. Indeed, LyX does all the background legwork to process your nomenclature for printing in the PDF output. Specifically, since its nomenclatures uses nomencl, processing is achieved using makeindex.

If your intent is to use LyX for the draft construction of your document, then subsequently extracting it to a .tex for final processing, then you need to include the makeindex processing steps. Here are the steps listed in the nomencl documentation (section 2.1 The Basics):

The creation of the nomenclature list is very similar to the creation of an index. You need to:

  • Put \usepackage[<options>]{nomencl} in the preamble of your document.

  • Put \makenomenclature in the preamble of your document.

  • Issue the \nomenclature command for each symbol you want to have included in the nomenclature list. The best place for this command is immediately after you introduce the symbol for the first time.

  • Put \printnomenclature at the place you want to have your nomenclature list.

Now put your file through LaTeX. The command \makenomenclature will instruct LaTeX to open the nomenclature file <filename>.nlo corresponding to your LaTeX file <filename>.tex and to write the information from your \nomenclature commands to this file.

All of the above content should work as-is from your exported .tex file. The next steps were done internally by LyX, but you'll have to add them to your regular process:

The next step is to invoke makeindex. You should instruct makeindex to use <filename>.nlo as your input file, use nomencl.ist as your style file, and write output to the file <filename>.nls. How to do this depends on your implementation of makeindex. For most Unix implementations you should write something like

makeindex <filename>.nlo -s nomencl.ist -o <filename>.nls

Now you have the file <filename>.nls that contains your nomenclature list properly ordered. The last step is to invoke LaTeX on your master file <filename>.tex once more. It will input your .nls file and process it accordingly to the current options. That's all!


Using the example from the nomencl documentation, together with some ideas from How to decrease spacing before chapter title?, we can remove the spacing above the (chapter) Nomenclature:

enter image description here

\documentclass{report}

\usepackage{nomencl}
\makenomenclature

\begin{document}

\section*{Main equations}
\begin{equation}
a=\frac{N}{A}
\end{equation}%
\nomenclature{$a$}{The number of angels per unit area}%
\nomenclature{$N$}{The number of angels per needle point}%
\nomenclature{$A$}{The area of the needle point}%
The equation $\sigma = m a$%
\nomenclature{$\sigma$}{The total mass of angels per unit area}%
\nomenclature{$m$}{The mass of one angel}
follows easily.

\printnomenclature

\begingroup
\let\oldvspace\vspace
\renewcommand{\vspace}[2]{\let\vspace\oldvspace}
\printnomenclature
\endgroup

\end{document}

In the above example, I print the Nomenclature twice. The first time shows the default spacing above the chapter, while the second time the space (\vspace*{50\p@}) is removed.

  • Unfortunately, I am not able to solve this issue. When I copy paste the example given by you in the tex editor, it does not complie. There must be a way to control the nomenclature spacing in the pdf preview because if it does that, then it will do in the tex version too. – Curious Dec 26 '16 at 14:10

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.