summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries-extra/sample-alttree-sym.tex
blob: c328aee923389941485a06d1c6776118e0351c29 (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
55
56
57
58
59
60
% arara: pdflatex
% arara: makeglossaries if found("aux", "@istfilename")
% arara: pdflatex
\documentclass{book}

\usepackage[stylemods=tree,style=alttree,savenumberlist]{glossaries-extra}

\makeglossaries

\loadglsentries{example-glossaries-symbols}

\newlength\maxsymbolwidth
\newlength\maxlocwidth
\newlength\fieldsep
\setlength{\fieldsep}{10pt}
\newlength\midfield
\newlength\rightfield

\renewcommand*{\glsxtralttreeInit}{%
% setup lengths
  \glsFindWidestAnyNameSymbolLocation[\currentglossary]%
    {\maxsymbolwidth}{\maxlocwidth}%
  \settowidth
    {\glsxtrtreetopindent}%
    {\glstreenamefmt{\glsgetwidestname}}%
  \addtolength{\glsxtrtreetopindent}{\fieldsep}%
  \ifdim\maxsymbolwidth>\maxlocwidth
    \setlength{\rightfield}{\maxsymbolwidth}%
  \else
    \setlength{\rightfield}{\maxlocwidth}%
  \fi
  \addtolength{\rightfield}{\fieldsep}%
  \setlength
    {\midfield}%
    {\dimexpr\linewidth-\glsxtrtreetopindent-\rightfield}%
}

\renewcommand{\glsxtralttreeSymbolDescLocation}[2]{%
 \parbox[t]{\midfield}{\raggedright
   \glossentrydesc{#1}\glspostdescription\strut\par}%
 \parbox[t]{\rightfield}{\raggedleft
   \glossentrysymbol{#1}\par
   \sffamily#2\strut\par
 }%
 \par
}

\begin{document}

\frontmatter
\setcounter{page}{37}% test wide page number
Test document.
\newpage
Indexing all entries here.
\glsaddall

\mainmatter
\printglossaries

\end{document}