diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-08 22:32:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-08 22:32:47 +0000 |
commit | e1218e4d5ddcb68ac921c718bbe7a537af862583 (patch) | |
tree | b77730b9572c833245ca5b3a0f4389e16dd72fa3 /Master/texmf-dist/doc/latex/glossaries/samples/sample-storage-abbr.tex | |
parent | 4cc63125c198c95120c614619f6adca51ed8b7e3 (diff) |
glossaries (8jul15)
git-svn-id: svn://tug.org/texlive/trunk@37808 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/glossaries/samples/sample-storage-abbr.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/glossaries/samples/sample-storage-abbr.tex | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries/samples/sample-storage-abbr.tex b/Master/texmf-dist/doc/latex/glossaries/samples/sample-storage-abbr.tex new file mode 100644 index 00000000000..36949a2a6cc --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries/samples/sample-storage-abbr.tex @@ -0,0 +1,112 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\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} |