Go to page:

Search:   Help

Edit

LyX /

# ProducingGlossary

Categories: Glossary
<< | Page list | >>

# Producing a glossary

## Overview

This is one way to produce a glossary of terms using the nomencl package. (This is the method I use on LyXWin)

Since 2005 the nomencl package does not support the term "glossary" by default anymore. Please use the package with option compatible or exchange \makeglossary by \makenomenclature and \printglossary by \printnomenclature in the examples below.

Add this to the preamble of your masterfile.lyx


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

\renewcommand{\nomgroup}[1]{%
\ifthenelse{\equal{#1}{A}}{\item[\textbf{Roman Symbols}]}{%
\ifthenelse{\equal{#1}{B}}{\item[\textbf{Greek Symbols}]}{%
\ifthenelse{\equal{#1}{C}}{\item[\textbf{Abbreviations}]}{%
\ifthenelse{\equal{#1}{Z}}{\item[\textbf{Mathematical Symbols}]}{}}}}}

\def\pagedeclaration#1{\dotfill\nobreakspace#1}

\makeglossary



The Ifthen package is handy to split up the notation into separate headed lists should you need it. It is optional.

the \def\pagedeclaration#1{\dotfill\nobreakspace#1} produces dots between abbreviation and page number, again optional.

I now have a separate notation.lyx file in which I only place an ERT box:


\printglossary



In my master document I have an ERT with:


\renewcommand\nomname{Notation}



(This can go into the preamble if you wish). This is where you change the title of the glossary to whatever you want - I choose "Notation". Omit this if you are happy with the default "Glossary"

I then Include my notation.lyx into my masterfile.lyx at the point I want the notation.

(At this stage I would suggest looking at the documentation of the nomencl package)

In general though each time a new symbol, abbreviation etc occurs then immediately after (without a space) add an ERT with the following:


\nomenclature[ALa]{L}{Length\refpage}



where from left to right in this example:

A refers to a Roman character (as defined in the ifthenelse statement of the preamble, it would be B for Greek etc)

L is the first letter to sort the notation order

a is simply there to sort the first letter in order (in the case of more than one L; one may be subscripted etc)

NOTE: the terms in the [...] are purely there for sorting purposes to give you control over the final output. You can have a fourth term if needed but I have found three user entered terms suffice for me (hydraulic engineering)

{L} is the letter, abbrv. etc as it appears in your text

{Length is any definition you give it (Length for L in this case)

\refpage} tells latex to reference the page.

Ok; once you have gone through the document and added all the ERT boxes at each new term then:

File→Export→Pdf (PdfLatex)

on the masterfile.lyx

This process creates the masterfile.glo file.

Dependent on your OS now open a command prompt (e.g. cmd in windows XP)

change directory to the lyx/tmp/lyx_tmpdir****/lyx_tmpbuf* folder which now should hold masterfile.pdf and masterfile.glo

at the command prompt enter


makeindex masterfile.glo -s nomencl.ist -o masterfile.gls



then


pdflatex masterfile.tex



To ensure all the page numbers are updated you need to run this last command once more.

That should do it! Have a look at the pdf ...any good?

For those on Windows versions of LyX use Notepad to create a .bat file with those last two commands in (remember to call the pdflatex command twice to update page numbers), place a copy directly into /Lyx/tmp/lyx_tmpdir***/lyx_tmpbuf* where the masterfile.pdf resides. You can then simply double click the .bat file to run the code.