diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-10 21:45:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-10 21:45:31 +0000 |
commit | 9bb046ed6f507a2cfcfe59984674922afe5d2ed9 (patch) | |
tree | c1ed0d3ba58acdf5fc6a9e3356645aa51528a157 /Master/texmf-dist/doc/latex/glossaries-extra/sample-alttree-marginpar.tex | |
parent | 0ac6fd79d838a5f0181ad5378bc0721ea37cd58a (diff) |
glossaries-extra (10jun16)
git-svn-id: svn://tug.org/texlive/trunk@41342 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/glossaries-extra/sample-alttree-marginpar.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/glossaries-extra/sample-alttree-marginpar.tex | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/glossaries-extra/sample-alttree-marginpar.tex b/Master/texmf-dist/doc/latex/glossaries-extra/sample-alttree-marginpar.tex new file mode 100644 index 00000000000..261e878f733 --- /dev/null +++ b/Master/texmf-dist/doc/latex/glossaries-extra/sample-alttree-marginpar.tex @@ -0,0 +1,100 @@ +% arara: pdflatex +% arara: makeglossaries if found("aux", "@istfilename") +% arara: pdflatex +\documentclass[12pt]{book} + +\usepackage[T1]{fontenc} +\usepackage{tgtermes} +\usepackage[dvipsnames]{xcolor} +\usepackage{pifont} +\usepackage{tikz} + +\usepackage[colorlinks]{hyperref} +\usepackage[stylemods=tree,style=alttree,savenumberlist]{glossaries-extra} + +\makeglossaries + +\loadglsentries{example-glossaries-multipar} + +\glssetcategoryattribute{general}{glossname}{firstuc} + +\renewcommand*{\GlsXtrFormatLocationList}[1]{% + {% + \hypersetup{hidelinks}% + \textcolor{Plum}{\ding{230}}~\textbf{#1}% + }% +} + +% Suppress hanging paragraphs: +%\renewcommand*{\glsxtrAltTreeSetHangIndent}{} + +\newlength\maxlocwidth + +\renewcommand*{\glsxtralttreeInit}{% +% setup lengths + \glsFindWidestAnyNameLocation[\currentglossary]% + {\maxlocwidth}% + \settowidth + {\glsxtrtreetopindent}% + {\glstreenamefmt{\glsgetwidestname}}% + \addtolength{\glsxtrtreetopindent}% + {\dimexpr1em+2\nameinnersep+2\nameoutersep}% + \addtolength{\maxlocwidth}{1em}% + \glsxtrAltTreeIndent=\parindent +} + +\newlength\nameinnersep +\nameinnersep=4pt +\newlength\nameoutersep +\nameoutersep=2pt + +\renewcommand*{\glstreenamebox}[2]{% + \makebox[#1][l]% + {% + \begin{tikzpicture}[baseline=(X.base)] + \node[fill=Orchid, + align=center, + text width=\dimexpr#1-2\nameinnersep-2\nameoutersep, + inner sep=\nameinnersep, + outer sep=\nameoutersep + ] (X) {#2}; + \end{tikzpicture}% + }% +} + +\newcommand*{\locbox}[1]{% + \begin{tikzpicture}[baseline=(X.base)] + \node[text width=\maxlocwidth, + draw=CadetBlue, + fill=CornflowerBlue, + double, + thick, + align=center, + rounded corners] + (X) {#1}; + \end{tikzpicture}% +} + +\renewcommand{\glsxtralttreeSymbolDescLocation}[2]{% + \marginpar[\hfill\locbox{#2}]{\locbox{#2}}% + % scope \par change + {% + \let\par\glsxtrAltTreePar + \glossentrydesc{#1}\glspostdescription\par + }% +} + +\begin{document} + +\frontmatter +\chapter{Front Matter Test} +\forallglsentries{\thislabel}{\gls{\thislabel}.\newpage} + +\mainmatter + +\chapter{Main Matter Test} +\forallglsentries{\thislabel}{\gls{\thislabel}.\newpage} + +\printglossaries + +\end{document} |