I use the package \usepackage[acronym,toc]{glossaries}
In the text I write my acronyms usually via \gls{Acr}
, \acrshort{Acr}
or \acrlong{Acr}
This displays my acronyms like:
Acronymdescription (Acr)
Acr
Acronymdescription
Now my question:
How can I get the description in brackets?
Acr (Acronymdescription)
I used in a makeshift manner \acrshort{Acr} (\acrlong{Acr})
Is there a better solution?
Minimal example:
\documentclass{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp} % special chars
\usepackage{lmodern} % better fonts
\usepackage{relsize} % font size relative
\usepackage{xcolor}
\definecolor{navy}{RGB}{0,0,128}
\usepackage[
bookmarks,
bookmarksopen=true,
bookmarksnumbered,
colorlinks=true,
linkcolor=navy, % link colors
anchorcolor=black,% anchor link color
citecolor=navy, % referral to bibliography items in the text
filecolor=navy, % links to local files
menucolor=black, % Acrobat-menuecolor
urlcolor=navy,
backref,
plainpages=false, % needed for correct creation of bookmarks
pdfpagelabels=true, % needed for correct creation of bookmarks
hypertexnames=true, % needed for correct creation of bookmarks
linktocpage % page number linked to text in toc
]{hyperref}
\usepackage[acronym]{glossaries}
\makeglossaries
\newacronym{DIN}{DIN}{Deutsches Institut für Normung}
\begin{document}
Often I need the standard form: \gls{DIN}.
But sometimes I need it like this: \acrshort{DIN} (\acrlong{DIN}).
Better would be an single command that includes the bracket in the link.
\newpage
\printglossary
\end{document}
Best Answer
(Transferring my comment to an answer.)
You can use
\glslink
to provide a link to a glossary entry with your own custom text. The commands\glsentrylong
and\glsentryshort
just display the long or short form without doing anything else (such as creating a link) so you can combine them to define your custom command:This produces:
Note that
\glslink
doesn't change the first use flag, so if I change the ordering in the above to:Then
\gls{DIN}
still gets fully expanded. If you want to change the first use flag then use\glsdisp
instead of\glslink
.