Debian Codegraph @

texmf-dist/doc/latex/glossaries-extra/glossaries-extra-manual-examples/glossaries-extra-manual-example118.tex

raw
1 % This file is embedded in glossaries-extra-manual.pdf
2 % Example 118 Alternatives to buffering
3 % Label: "ex:protectinnertextformat"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 \usepackage[T1]{fontenc}
9 \usepackage{soul}
10 \usepackage{glossaries-extra}
11
12
13 \newabbreviation{html}{HTML}{hypertext markup language}
14 % custom command to expand content before using \ul:
15 \newrobustcmd{\xpul}[1]{\GlsXtrExpandedFmt{\ul}{#1}}
16
17
18 \begin{document}
19 First approach (inner formatting):
20 {% scope
21 \renewcommand{\glsxtrdefaultentrytextfmt}[1]{\ul{#1}}%
22 \ul{Some text about \protect\gls{html}.
23 Next use: \protect\gls{html}}
24 }
25
26
27 Next use: \gls{html}.
28
29
30 Second approach (middle formatting with expanded link text):
31 \glsresetall
32 {% scope
33 \renewcommand{\glsxtrabbreviationfont}[1]{\xpul{#1}}%
34 \renewcommand{\glsxtrregularfont}[1]{\xpul{#1}}%
35 \ul{Some text about \protect\gls{html}. Next use: \gls{html}.}
36 }
37
38 Next use: \gls{html}.
39 \end{document}