LaTeX forum ⇒ 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.
pisoir
Posts: 8
Joined: Thu Aug 06, 2009 4:10 pm

Nomencl + hyperref / remove duplicates from the list

Postby pisoir » Mon Nov 30, 2009 7:53 pm

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.

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

Postby pisoir » Sat Dec 05, 2009 3:51 pm

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

Postby pisoir » Sat Dec 05, 2009 4:54 pm

I found the solution using phantomsection:
  1. \newcommand{\abbr}[2]{\phantomsection\label{abbr:#1}\nomenclature{#1}{#2, \pageref{abbr:#1}\phantomsection\label{abbr:#1bbbb}}\hyperref[abbr:#1bbbb]{#1}}
  2. \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.

tommes42
Posts: 1
Joined: Wed Jan 13, 2010 1:29 pm

Postby tommes42 » Wed Jan 13, 2010 1:32 pm

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


Return to “MakeIndex, Nomenclature, Glossaries and Acronyms”

Who is online

Users browsing this forum: No registered users and 1 guest