Search:   Help



LyX documentation


Shared groups



Categories: Tip, Languages
<< | Page list | >>

Create a list of symbols with LyX and the nomencl package

Create Nomenclature with LyX

In LyX 1.5.x+, you can generate a nomenclature with Insert→List/ToC→Nomenclature.
Nomenclature entries can be added using Insert→Nomenclature Entry or using the appropriate button on the toolbar. This will bring up a dialogue box which wants the symbol as it is to appear, a description and a sort as key.
Often you will want the symbol to appear as it does in an equation in which case you should surround it by dollar signs ($Symbol$). You should be able to copy and paste the symbol directly from a LyX equation, which could be useful if you are unsure of the LaTeX codes for Greek letters or subscripts.
For further documentation see Help→Additional Features (in 2.0.0, Help→User's Guide) and the documentation of the nomencl package.

Adding Nomenclature to TOC without ERT

Use the following code in your LaTeX preamble (Documents>Settings>Latex Preamble).


Changing the name of the nomenclature section

You may prefer using Notation or Symbols used, or anything you like. Use the following code in your LaTeX preamble (Documents>Settings>Latex Preamble) - change the name to your choice.

\AtBeginDocument{\def\nomname{New Name for Nomenclature}}

Creating Nomenclature with Sections

This assumes that you prefix all your sort as keys with appropriate letters (e.g. A for alphabetical i.e Roman; G for Greek etc). Personally I use an underscore too (a_ or G_)because this makes the key clearer to me. If you do this be consistent and use underscores throughout otherwise your sort order may not be as expected. (See documentation on nomencl for sort orders).
Use the following code in your LaTeX preamble (Documents>Settings>Latex Preamble). Comment out lines as appropriate if those sections are not required along with line containing corresponding terminating '}'. Similarly add a new line in the same format if required not forgetting to add the terminating bracket.

\ifthenelse{\equal{#1}{A}}{\item[\textbf{Roman Symbols}]}{%
\ifthenelse{\equal{#1}{G}}{\item[\textbf{Greek Symbols}]}{%
\ifthenelse{\equal{#1}{Z}}{\item[\textbf{Mathematical Symbols}]}
}% matches mathematical symbols
}% matches Subscripts
}% matches Abbreviations
}% matches Greek Symbols
}% matches Roman Symbols

The groupings will appear in the order Roman Symbols, Abbreviations, Greek, Subscripts, Mathematical Symbols because that is the alphabetical sort order. Other people use the prefix B for Greek to change the order - I prefer to use G so as not to confuse myself. Change the letters to taste and preferred sort order for grouping.
This section uses the package ifthen so if it is not loaded for any other reason you may need to preface the code with

I have used this code without explicitly labelling the Roman symbols section (so that code omitted), but I still preface all my sort keys with an a to list them in front of the Greek and subscript sections.

Adding Units and lining them up on the right

The code shown here defines a new command (\nomunit) which can be used in the description box following the description. Usage is as \nomunit{unit}, or my preferred \nomunit{[unit]} to encapsulate the units in square brackets.


To separate the description and units with dots one could replace the second line with


Although if units are not defined for a particular entry there will be a line with nothing after the description.
To improve this further one could use the package SIunits and use those commands.

Nomenclature and ngerman (German new spelling)

The problem and hints below apply to other German variants as austrian or naustrian (Austrian new spelling), too.

Including a Nomenclature in a document that shall use ngerman as document language is tricky, because:

  1. The nomencl package (version 4.2) supports a set of language options, including german but not ngerman.
  2. LyX calls the package without options, so that the nomencl options must be added to the global options.
  3. Options added with Document>Settings>Document Class Options are appended to the language settings in Document>Settings>Language, but
  4. babel considers the last recognized option to be the document language.

Simple workaround: In the LaTeX preamble add \renewcommand{\nomname}{Glossar}. You can change "Glossar" to everything you like. [But this does not change the name for page references etc.]

To get the complete German version of nocmencl add \PassOptionsToPackage{german}{nomencl} to the preamble. So you still can use you preferred German spelling (ngerman, naustrian) in the document settings.

Alternative workarounds:

  • Set german with Document>Settings>Language German and append ngerman via Document>Settings>Document Class Options.
  • Mark at least one word (e.g. in a comment) with Edit>Text Style>Customized>Language German, so LyX adds german to the global options (before ngerman).
  • Patch nomencl.sty so it recognizes ngerman as an alias to the option german:
    @@ -71,6 +71,8 @@
       \def\eqdeclaration#1{, siehe Gleichung\nobreakspace(#1)}%
       \def\pagedeclaration#1{, Seite\nobreakspace#1}%
    +\DeclareOption{ngerman}{% German (new spelling)
    +  \ExecuteOptions{german}}
     \def\eqdeclaration#1{, vedi equazione\nobreakspace(#1)}%
     \def\pagedeclaration#1{, pagina\nobreakspace#1}%


Category: Tip Languages

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2020-07-03 13:23 UTC