% This file is public domain % If you want to use arara, you need the following directives: % arara: pdflatex % arara: makeglossaries % arara: pdflatex % %http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sample-storage-abbr \documentclass{article} \usepackage{glossaries} \makeglossaries \glsaddstoragekey {abbrtype}% key/field name {word}% default value if not explicitly set {\abbrtype}% custom command to access the value if required \newacronymstyle {mystyle}% style name {% Use the generic display \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% } {% Put the long form in the description \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% % For the full format, test the value of the "abbrtype" key. % If it's set to "word" put the short form first with % the long form in brackets. \renewcommand*{\genacrfullformat}[2]{% \ifglsfieldeq{##1}{abbrtype}{word} {% is a proper acronym \protect\firstacronymfont{\glsentryshort{##1}}##2\space (\glsentrylong{##1})% } {% is another form of abbreviation \glsentrylong{##1}##2\space (\protect\firstacronymfont{\glsentryshort{##1}})% }% }% % first letter upper case version: \renewcommand*{\Genacrfullformat}[2]{% \ifglsfieldeq{##1}{abbrtype}{word} {% is a proper acronym \protect\firstacronymfont{\Glsentryshort{##1}}##2\space (\glsentrylong{##1})% } {% is another form of abbreviation \Glsentrylong{##1}##2\space (\protect\firstacronymfont{\glsentryshort{##1}})% }% }% % plural \renewcommand*{\genplacrfullformat}[2]{% \ifglsfieldeq{##1}{abbrtype}{word} {% is a proper acronym \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space (\glsentrylong{##1})% } {% is another form of abbreviation \glsentrylongpl{##1}##2\space (\protect\firstacronymfont{\glsentryshortpl{##1}})% }% }% % plural and first letter upper case \renewcommand*{\Genplacrfullformat}[2]{% \ifglsfieldeq{##1}{abbrtype}{word} {% is a proper acronym \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space (\glsentrylong{##1})% } {% is another form of abbreviation \Glsentrylongpl{##1}##2\space (\protect\firstacronymfont{\glsentryshortpl{##1}})% }% }% % Just use the short form as the name part in the glossary: \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% % Sort by the short form: \renewcommand*{\acronymsort}[2]{##1}% % Just use the surrounding font for the short form: \renewcommand*{\acronymfont}[1]{##1}% % Same for first use: \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% % Default plural suffix if the plural isn't explicitly set \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% } \setacronymstyle{mystyle} % The default for "abbrtype" is "acronym" so we don't need % this new key for acronyms: \newacronym{radar}{radar}{radio detecting and ranging} \newacronym{laser}{laser}{light amplification by stimulated emission of radiation} \newacronym{scuba}{scuba}{self-contained underwater breathing apparatus} \newcommand*{\newinitialism}[4][]{% \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% } \newinitialism{dsp}{DSP}{digital signal processing} \newinitialism{atm}{ATM}{automated teller machine} \begin{document} First use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, \gls{atm}. Next use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, \gls{atm}. \printglossaries \end{document}