[Tex/LaTex] glossaries acronyms description in brackets


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)



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:


\usepackage{textcomp} % special chars
\usepackage{lmodern} % better fonts
\usepackage{relsize} % font size relative


    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
    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


\newacronym{DIN}{DIN}{Deutsches Institut für Normung}


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.



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:



\newacronym{DIN}{DIN}{Deutsches Institut für Normung}

\newcommand*\myacr[2][]{\glslink[#1]{#2}{\glsentryshort{#2} (\glsentrylong{#2})}}


Standard form: \gls{DIN}.

Other way round: \myacr{DIN}.



This produces:

Image of resulting document

Note that \glslink doesn't change the first use flag, so if I change the ordering in the above to:

Other way round: \myacr{DIN}.

Standard form: \gls{DIN}.

Then \gls{DIN} still gets fully expanded. If you want to change the first use flag then use \glsdisp instead of \glslink.