summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries/samples/sample-entryfmt.tex
blob: 3018244964b63d7a77b16d646a050e0c6cdb13bd (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
% This file is public domain
% If you want to use arara, you need the following directives:
% arara: pdflatex: { synctex: on }
% arara: makeglossaries
% arara: pdflatex: { synctex: on }
%
%http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sample-entryfmt
\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[style=tree]{glossaries}

\makeglossaries

\renewcommand*{\glsentryfmt}{%
  \glsgenentryfmt
  \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}%
}

\newglossaryentry{distance}{name=distance,
description={The length between two points},
symbol={km}}

\begin{document}

First use: \gls{distance}. Next use: \gls{distance}.

\printglossaries

\end{document}