summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-14 22:52:09 +0000
committerKarl Berry <karl@freefriends.org>2013-11-14 22:52:09 +0000
commit033271bfdf58e2563bd3fbdbeb0f1facfb0c02e5 (patch)
tree1ca0cddf673e09a878c83db761e4dc52c65ba48b /Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex
parente537bba01fd3f3a532b7fc1f6186c24065208638 (diff)
glossaries (14nov13)
git-svn-id: svn://tug.org/texlive/trunk@32147 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex')
-rw-r--r--Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex47
1 files changed, 47 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex b/Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex
new file mode 100644
index 00000000000..c1efc549d07
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex
@@ -0,0 +1,47 @@
+ % 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 }
+\documentclass{report}
+
+\usepackage[colorlinks]{hyperref}
+\usepackage{glossaries}
+
+\makeglossaries
+
+ % switch off hyperlinks:
+\glsdisablehyper
+
+ % redefine \glsentryfmt so that it adds a hyperlink
+ % if not in math mode
+\renewcommand*{\glsentryfmt}{%
+ \ifmmode
+ \glsgenentryfmt
+ \else
+ % Temporarily enable hyperlinks:
+ \glsenablehyper
+ \glshyperlink[\glsgenentryfmt]{\glslabel}%
+ % Disable hyperlinks again
+ \glsdisablehyper
+ \fi
+}
+
+\renewcommand{\glossarypreamble}{\glsenablehyper}
+\renewcommand{\glossarypostamble}{\glsdisablehyper}
+
+ % define a sample entry:
+\newglossaryentry{x}{name={x},description={sample entry}}
+
+\begin{document}
+\chapter{Sample}
+In text mode: \gls{x}. Inline maths: $\gls{x}$. Displayed
+maths:
+\[
+ \gls{x}
+\]
+
+Back to text mode again: \gls{x}.
+
+\printglossaries
+\end{document}