summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries-extra/samples/sample-trans.tex
blob: 041dc24e48c895e93a714e17ad8a16ace431b33c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\usepackage[nogroupskip]{glossaries-extra}

\makeglossaries

\setabbreviationstyle[acronym]{long-short-user}

% Translations are stored in the user1 key in the sample file
% (loaded below).
% This is the default for the long-short-user style so
% \glsxtruserfield doesn't need changing, but let's illustrate
% changing the font style for the short form:

\renewcommand{\glsabbrvuserfont}[1]{\textsc{\MakeLowercase{#1}}}
\renewcommand*{\glsxtrusersuffix}{\glsxtrscsuffix}

\loadglsentries{example-glossaries-acronyms-lang}

% The entries in the above file are all defined using
% \newacronym, which automatically sets the category
% to "acronym" (which is why the abbreviation style needs
% to use "acronym" in the optional argument). The glossary
% can be adapted by using the post-description hook for this
% category.

% \glscurrentfieldvalue only works with glossaries v4.23 (and above)
\renewcommand{\glsxtrpostdescacronym}{%
 \ifglshasfield{\glsxtruserfield}{\glscurrententrylabel}%
 { (English: \glscurrentfieldvalue)}%
 {}%
}

\begin{document}

\section{Sample}

First use:

\forglsentries{\thislabel}{\gls{\thislabel}. }

Next use:

\forglsentries{\thislabel}{\gls{\thislabel}. }

\printglossaries

\end{document}