3

Is there a way to automatically remove duplicates from the generated Nomenclature?

E.g. adding multiple times:

\nomenclature{HTML}{HyperText Markup Language}

in your TeX file should generate only one entry in the Nomenclature.

This minimal example shows what happens:

% This is test.tex
\documentclass{book}
\usepackage{nomencl}
\makenomenclature
\begin{document}

Some text \nomenclature{HTML}{HyperText Markup Language}

\newpage
\chapter{Chapter}

Some text \nomenclature{HTML}{HyperText Markup Language}

\printnomenclature
\end{document}

The nomenclature was generated with makeindex test.nlo -s nomencl.ist -o test.nls and here is the test.nls:

\begin{thenomenclature}

\nomgroup{A}

  \item [{HTML}]\begingroup HyperText Markup Language\nomeqref {0}
        \nompageref{1}
  \item [{HTML}]\begingroup HyperText Markup Language\nomeqref {1.0}
        \nompageref{3}

\end{thenomenclature}

Problem comes with lines at test.nlo are not identical:

\nomenclatureentry{aHTML@[{HTML}]\begingroup HyperText Markup Language\nomeqref {0}|nompageref}{1}
\nomenclatureentry{aHTML@[{HTML}]\begingroup HyperText Markup Language\nomeqref {1.0}|nompageref}{3}

In my real tex \nomeqref's content is \relax x.x for duplicate entries.

3
  • I tried to use uniq command to .nls file but each entry is not a single line but 2 lines.
    – juanmah
    Commented Oct 27, 2011 at 14:28
  • 2
    You are misusing the nomencl package, which is made for unique entries. You probably should be using either acronym or the more general glossaries package.
    – egreg
    Commented Dec 22, 2011 at 13:33
  • You're perfectly right @egreg, acronym package fits exactly what I need. Thanks!
    – juanmah
    Commented Dec 23, 2011 at 10:15

4 Answers 4

6

The nomencl package has a different purpose than what you're using it for.

The package's purpose is to write a list of symbols or abbreviation used, with a reference to the place where they're defined or first used (at the user's choice). So it's not meant to place multiple reference to a nomenclature.

For acronyms the best package around is glossaries, but the simpler acronym is often used.

2

I may have missed something but with the following code I get only one entry in the nomenclature.

% This is test.tex
\documentclass{article}
\usepackage{nomencl}
\makenomenclature
\begin{document}
Some text \nomenclature{HTML}{HyperText Markup Language}

\newpage

Some text \nomenclature{HTML}{HyperText Markup Language}

\printnomenclature

\end{document}

The nomenclature was generated with makeindex test.nlo -s nomencl.ist -o test.nls and here is the test.nls.

\begin{thenomenclature} 

 \nomgroup{A}

  \item [{HTML}]\begingroup HyperText Markup Language\nomeqref {0}
        \nompageref{1, 2}

\end{thenomenclature}
1
  • I edited the question because I couldn't show here commented the minimal example that generate multiple entries.
    – juanmah
    Commented Dec 22, 2011 at 12:06
1

This is a manual and not elegant post-editing workaround to test.nlo

In command line do:

cat test.nlo | sort | uniq -w 49 > test.nlo

and then:

makeindex test.nlo -s nomencl.ist -o test.nls

uniq -w parameter is 49 because is the width of the shortest nomenclature before differences in nomeqref \nomenclatureentry{a@[{}]\begingroup \nomeqref { and can handle up to 30 characters in nomenclatures.

1
  • It could be shorter: cat test.nlo | sort | uniq -w 49 | makeindex -i -s nomencl.ist -o test.nls
    – juanmah
    Commented Dec 22, 2011 at 12:37
1

This is a manual and not elegant post-editing workaround to test.nls

In kile/kate editor do replace whole text with the following regular expression:

Find:    (.*\[\{)(.*)\}\].*\n.*\n.*\[\{\2\}\]
Replace: \1\2\}\]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .