[Tex/LaTex] LyX and Nomenclatures

acronymslyxnomenclature

I'm using LyX and trying to use the nomenclature package to insert a bunch of acronyms into my document.

I've inserted a Nomenclature table (Insert -> List/TOC -> Nomenclature).

I've then created a Nomenclature entry (Insert -> Nomenclature entry), and I can insert one fine.

And I've also just figured out how to insert another one – you just delete the old text and enter in new details. It's not the most intuitive, and I would have thought LyX could supply you with a list of previously used acronyms to reinsert, but ah well.

However, how do I get the actual acronyms to print the text? As it is, I have to type in both the text I want displayed, and the acronym entry. I'm fairly certain there's an easier way, but I'm not sure if I can do it within LyX or I have to use LaTeX directly?

Best Answer

This has nothing to do with LyX in the first place, it is just nomencl’s standard behaviour. The \nomenclature command just stores the entry for the list, but it does not print any text. However, you can redefine the \nomenclature command in order to print the text as well. You could, for instance, put the following in the preamble of your document:

\let\nomenclOrig\nomenclature
\renewcommand*{\nomenclature}[3][]{#2\nomenclOrig[#1]{#2}{#3}}

The first line stores the \nomenclature command in \nomenclOrig. This is necessary, since we have to redefince the \nomenclature command. This is done in the second line. Since the \nomenclature command has two mandatory arguments and one optional argument, we have to specify 3 arguments (the [3] bit). The optional argument has no standard value (the [] bit). Then we print the second argument (which is the first mandatory argument, since the optional argument is always #1) as normal text and use the original command that we have stored in \nomenclOrig.

I tried this with LyX, without problems. Note, though, that the two lines will give an error in a document without a nomenclature entry or list, because then LyX will not load the nomencl package and thus the \renewcommand will throw an error.