Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.

glossaries package FAQ

FAQ Search Tips

How can I make just the short form a hyperlink? 🔗

If you switch off the hyperlink on first use (using the "hyperfirst=false" package option), you can create a custom acronym style that inserts the link around just the short form:

\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[hyperfirst=false]{glossaries}

\makeglossaries

\newacronymstyle{linkshort}
{%
  % use the "long-short" display style:
  \GlsUseAcrEntryDispStyle{long-short}%
}
{%
  % use the "long-short" style definitions:
  \GlsUseAcrStyleDefs{long-short}%
  % adjust the full form so that it has a hyperlink for the short part:
  \renewcommand*{\genacrfullformat}[2]{%
    \glsentrylong{##1}##2\space
    (\glshyperlink[\protect\firstacronymfont{\glsentryshort{##1}}]{##1})%
  }%
  % same for the plural form:
  \renewcommand*{\genplacrfullformat}[2]{%
    \glsentrylongpl{##1}##2\space
    (\glshyperlink[\protect\firstacronymfont{\glsentryshortpl{##1}}]{##1})%
  }%
}

% apply this new style
\setacronymstyle{linkshort}

% now define the acronyms
\newacronym{gnu}{GNU}{Gnu is Not Unix}

\begin{document}

First use: \gls{gnu}. Next use: \gls{gnu}.

Full form: \acrfull*{gnu}.

\printglossaries
\end{document}

Last modified: 2014-07-26 17:29:49.


Category: glossaries package
Topic: Referencing Terms

© 2019 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs