From 033271bfdf58e2563bd3fbdbeb0f1facfb0c02e5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 14 Nov 2013 22:52:09 +0000 Subject: glossaries (14nov13) git-svn-id: svn://tug.org/texlive/trunk@32147 c570f23f-e606-0410-a88d-b1316a301751 --- .../glossaries/samples/sample-nomathhyper.tex | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex (limited to 'Master/texmf-dist/doc/latex/glossaries/samples/sample-nomathhyper.tex') 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} -- cgit v1.2.3