MakeIndex, Nomenclature, Glossaries and AcronymsNomencl + hyperref / remove duplicates from the list

Information and discussion about MakeIndex - the tool to generate subject indices for LaTeX documents.
Post Reply
pisoir
Posts: 8
Joined: Thu Aug 06, 2009 4:10 pm

Nomencl + hyperref / remove duplicates from the list

Post by pisoir »

Hello, I have one question.
Is there a way how to make the list of abbreviations clickable? I mean, if I use \usepackage[refpage]{nomencl} \usepackage{hyperref} I would like to have the list of nomenclatures to contain the clickable references to the pages. Everything else is clickable, but list produced by nomencl package is not. (list of indexes is also; i.e. hyperref works).

Also, if I use some abbreviation/nomenclature (\nomenclature{Abbr}{Something}) twice, or several times in the document, nomencl produces a list (\printnomenclature} that contains duplicate entries. Is there a way how to make it the same way as index is produced (one entry - several pages; or only the first page of occuring).

Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

pisoir
Posts: 8
Joined: Thu Aug 06, 2009 4:10 pm

Re: Nomencl + hyperref / remove duplicates from the list

Post by pisoir »

I made a macro that works almost as I wanted:

\newcommand{\abbr}[2]{\label{abbr:#1}\nomenclature{#1}{\label{abbr:#1b}#2, \pageref{abbr:#1}}\hyperref[abbr:#1b]{#1}}

Now when you write \abbr{Abbr}{Abbreviation}, it will put Abbr in the text and in the list of abbreviations. You can also click back and forth. The problem is, that the link is only to the first page of abbreviations and not actually to the abbreviation. So in case when you have long list of abbreviations, on several pages, and you click on the abbreviation it will just link you on the first page. Which is not completely ok.

If someone has a better solution, please post it.
pisoir
Posts: 8
Joined: Thu Aug 06, 2009 4:10 pm

Nomencl + hyperref / remove duplicates from the list

Post by pisoir »

I found the solution using phantomsection:

Code: Select all

\newcommand{\abbr}[2]{\phantomsection\label{abbr:#1}\nomenclature{#1}{#2, \pageref{abbr:#1}\phantomsection\label{abbr:#1bbbb}}\hyperref[abbr:#1bbbb]{#1}}
\newcommand{\abref}[1]{\hyperref[abbr:#1bbbb]{#1}}
Since there is a big chance, that some abbreviation ends on "b", I had to change the label to abbr:Abbrbbbb.
Last edited by pisoir on Sat Dec 05, 2009 4:54 pm, edited 1 time in total.
tommes42
Posts: 1
Joined: Wed Jan 13, 2010 1:29 pm

Re: Nomencl + hyperref / remove duplicates from the list

Post by tommes42 »

Nice macro! Unfortunately, this doesn't seem to work with math symbols like $\vec{x}$. Could you provide a solution to this?

Best regards,
tommes42
Post Reply