From 9bb046ed6f507a2cfcfe59984674922afe5d2ed9 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 10 Jun 2016 21:45:31 +0000
Subject: glossaries-extra (10jun16)

git-svn-id: svn://tug.org/texlive/trunk@41342 c570f23f-e606-0410-a88d-b1316a301751
---
 .../glossaries-extra-stylemods.sty                 | 422 ++++++++++++++++++++-
 1 file changed, 421 insertions(+), 1 deletion(-)

(limited to 'Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra-stylemods.sty')

diff --git a/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra-stylemods.sty b/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra-stylemods.sty
index 044bc566442..ef638614c51 100644
--- a/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra-stylemods.sty
+++ b/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra-stylemods.sty
@@ -39,7 +39,7 @@
 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %%   Right brace   \}     Tilde         \~}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossaries-extra-stylemods}[2016/05/02 v1.04 (NLCT)]
+\ProvidesPackage{glossaries-extra-stylemods}[2016/06/10 v1.05 (NLCT)]
 \newcommand*{\@glsxtr@loadstyles}{}
 \DeclareOption*{%
   \IfFileExists{glossary-\CurrentOption.sty}
@@ -284,6 +284,426 @@
      #1\glsxtrpostdescription}
 }
 {}
+\ifdef{\@glsstyle@alttree}
+{%
+  \newcommand{\glsxtralttreeSymbolDescLocation}[2]{%
+    {%
+      \let\par\glsxtrAltTreePar
+      \ifglshassymbol{#1}{(\glossentrysymbol{#1})\space}{}%
+      \glossentrydesc{#1}\glspostdescription \space #2\par
+    }%
+  }
+\newlength\glsxtrAltTreeIndent
+  \newcommand{\glsxtrAltTreePar}{%
+    \@@par
+    \glsxtrAltTreeSetHangIndent
+    \setlength{\parindent}{\dimexpr\hangindent+\glsxtrAltTreeIndent}%
+  }
+  \newcommand{\glsxtralttreeSubSymbolDescLocation}[3]{%
+    \glsxtralttreeSymbolDescLocation{#2}{#3}%
+  }
+  \newlength\glsxtrtreetopindent
+  \newcommand*{\glsxtralttreeInit}{%
+    \settowidth{\glsxtrtreetopindent}{\glstreenamefmt{\glsgetwidestname\space}}%
+    \glsxtrAltTreeIndent=\parindent
+  }
+  \newcommand*{\eglssetwidest}[2][0]{%
+    \protected@csedef{@glswidestname\romannumeral#1}{#2}%
+  }
+  \newcommand*{\xglssetwidest}[2][0]{%
+    \protected@csxdef{@glswidestname\romannumeral#1}{#2}%
+  }
+  \newcommand*{\glsgetwidestname}{\@glswidestname}
+  \newcommand*{\glsgetwidestsubname}[1]{%
+    \ifcsundef{@glswidestname\romannumeral#1}%
+    {\@glswidestname}%
+    {\csuse{@glswidestname\romannumeral#1}}%
+  }
+  \let\glsFindWidestTopLevelName\glsfindwidesttoplevelname
+  \newrobustcmd*{\glsFindWidestUsedTopLevelName}[1][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \ifglsused{\@glo@label}%
+        {%
+          \ifglshasparent{\@glo@label}%
+          {}%
+          {%
+            \settowidth{\dimen@}%
+             {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+            \ifdim\dimen@>\gls@tmplen
+              \gls@tmplen=\dimen@
+              \eglssetwidest{\glsentryname{\@glo@label}}%
+            \fi
+          }%
+        }%
+        {}%
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestUsedAnyName}[1][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \ifglsused{\@glo@label}%
+        {%
+          \settowidth{\dimen@}%
+           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+          \ifdim\dimen@>\gls@tmplen
+            \gls@tmplen=\dimen@
+            \eglssetwidest{\glsentryname{\@glo@label}}%
+          \fi
+        }%
+        {}%
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestAnyName}[1][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \settowidth{\dimen@}%
+         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+        \ifdim\dimen@>\gls@tmplen
+          \gls@tmplen=\dimen@
+          \eglssetwidest{\glsentryname{\@glo@label}}%
+        \fi
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestUsedLevelTwo}[1][\@glo@types]{%
+    \dimen@=0pt\relax
+    \dimen@i=0pt\relax
+    \dimen@ii=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \ifglsused{\@glo@label}%
+        {%
+          \ifglshasparent{\@glo@label}%
+          {%
+            \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@label}@parent}}%
+            \ifglshasparent{\@glo@parent}%
+            {%
+              \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@parent}@parent}}%
+              \ifglshasparent{\@glo@parent}%
+              {}%
+              {%
+                \settowidth{\gls@tmplen}%
+                   {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+                \ifdim\gls@tmplen>\dimen@ii
+                  \dimen@ii=\gls@tmplen
+                  \eglssetwidest[2]{\glsentryname{\@glo@label}}%
+                \fi
+              }%
+            }%
+            {%
+              \settowidth{\gls@tmplen}%
+                 {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+              \ifdim\gls@tmplen>\dimen@i
+                \dimen@i=\gls@tmplen
+                \eglssetwidest[1]{\glsentryname{\@glo@label}}%
+              \fi
+            }%
+          }%
+          {%
+            \settowidth{\gls@tmplen}%
+               {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+            \ifdim\gls@tmplen>\dimen@
+              \dimen@=\gls@tmplen
+              \eglssetwidest{\glsentryname{\@glo@label}}%
+            \fi
+          }%
+        }%
+        {}%
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestLevelTwo}[1][\@glo@types]{%
+    \dimen@=0pt\relax
+    \dimen@i=0pt\relax
+    \dimen@ii=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \ifglshasparent{\@glo@label}%
+        {%
+          \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@label}@parent}}%
+          \ifglshasparent{\@glo@parent}%
+          {%
+            \edef\@glo@parent{\csuse{glo@\glsdetoklabel{\@glo@parent}@parent}}%
+            \ifglshasparent{\@glo@parent}%
+            {}%
+            {%
+              \settowidth{\gls@tmplen}%
+                 {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+              \ifdim\gls@tmplen>\dimen@ii
+                \dimen@ii=\gls@tmplen
+                \eglssetwidest[2]{\glsentryname{\@glo@label}}%
+              \fi
+            }%
+          }%
+          {%
+            \settowidth{\gls@tmplen}%
+               {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+            \ifdim\gls@tmplen>\dimen@i
+              \dimen@i=\gls@tmplen
+              \eglssetwidest[1]{\glsentryname{\@glo@label}}%
+            \fi
+          }%
+        }%
+        {%
+          \settowidth{\gls@tmplen}%
+             {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+          \ifdim\gls@tmplen>\dimen@
+            \dimen@=\gls@tmplen
+            \eglssetwidest{\glsentryname{\@glo@label}}%
+          \fi
+        }%
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestUsedAnyNameSymbol}[2][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    #2=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \ifglsused{\@glo@label}%
+        {%
+          \settowidth{\dimen@}%
+           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+          \ifdim\dimen@>\gls@tmplen
+            \gls@tmplen=\dimen@
+            \eglssetwidest{\glsentryname{\@glo@label}}%
+          \fi
+          \settowidth{\dimen@}%
+           {\glsentrysymbol{\@glo@label}}%
+          \ifdim\dimen@>#2\relax
+            #2=\dimen@
+          \fi
+        }%
+        {}%
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestAnyNameSymbol}[2][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    #2=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \settowidth{\dimen@}%
+         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+        \ifdim\dimen@>\gls@tmplen
+          \gls@tmplen=\dimen@
+          \eglssetwidest{\glsentryname{\@glo@label}}%
+        \fi
+        \settowidth{\dimen@}%
+         {\glsentrysymbol{\@glo@label}}%
+        \ifdim\dimen@>#2\relax
+          #2=\dimen@
+        \fi
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestUsedAnyNameSymbolLocation}[3][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    #2=0pt\relax
+    #3=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \ifglsused{\@glo@label}%
+        {%
+          \settowidth{\dimen@}%
+           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+          \ifdim\dimen@>\gls@tmplen
+            \gls@tmplen=\dimen@
+            \eglssetwidest{\glsentryname{\@glo@label}}%
+          \fi
+          \settowidth{\dimen@}%
+           {\glsentrysymbol{\@glo@label}}%
+          \ifdim\dimen@>#2\relax
+            #2=\dimen@
+          \fi
+          \settowidth{\dimen@}%
+           {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
+          \ifdim\dimen@>#3\relax
+            #3=\dimen@
+          \fi
+        }%
+        {}%
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestAnyNameSymbolLocation}[3][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    #2=0pt\relax
+    #3=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \settowidth{\dimen@}%
+         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+        \ifdim\dimen@>\gls@tmplen
+          \gls@tmplen=\dimen@
+          \eglssetwidest{\glsentryname{\@glo@label}}%
+        \fi
+        \settowidth{\dimen@}%
+         {\glsentrysymbol{\@glo@label}}%
+        \ifdim\dimen@>#2\relax
+          #2=\dimen@
+        \fi
+        \settowidth{\dimen@}%
+          {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
+        \ifdim\dimen@>#3\relax
+          #3=\dimen@
+        \fi
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestUsedAnyNameLocation}[2][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    #2=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \ifglsused{\@glo@label}%
+        {%
+          \settowidth{\dimen@}%
+           {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+          \ifdim\dimen@>\gls@tmplen
+            \gls@tmplen=\dimen@
+            \eglssetwidest{\glsentryname{\@glo@label}}%
+          \fi
+          \settowidth{\dimen@}%
+           {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
+          \ifdim\dimen@>#2\relax
+            #2=\dimen@
+          \fi
+        }%
+        {}%
+      }%
+    }%
+  }
+  \newrobustcmd*{\glsFindWidestAnyNameLocation}[2][\@glo@types]{%
+    \dimen@=0pt\relax
+    \gls@tmplen=0pt\relax
+    #2=0pt\relax
+    \forallglossaries[#1]{\@gls@type}%
+    {%
+      \forglsentries[\@gls@type]{\@glo@label}%
+      {%
+        \settowidth{\dimen@}%
+         {\glstreenamefmt{\glsentryname{\@glo@label}}}%
+        \ifdim\dimen@>\gls@tmplen
+          \gls@tmplen=\dimen@
+          \eglssetwidest{\glsentryname{\@glo@label}}%
+        \fi
+        \settowidth{\dimen@}%
+         {\GlsXtrFormatLocationList{\glsentrynumberlist{\@glo@label}}}%
+        \ifdim\dimen@>#2\relax
+          #2=\dimen@
+        \fi
+      }%
+    }%
+  }
+  \newcommand*{\glsxtrComputeTreeIndent}[1]{%
+    \glstreeindent=\glsxtrtreetopindent\relax
+  }
+  \newcommand*{\glsxtrComputeTreeSubIndent}[3]{%
+    \ifcsundef{@glswidestname\romannumeral#1}%
+    {%
+      \settowidth{#3}{\glstreenamefmt{\@glswidestname\space}}%
+    }%
+    {%
+      \settowidth{#3}{\glstreenamefmt{%
+             \csname @glswidestname\romannumeral#1\endcsname\space}}%
+    }%
+  }
+\newcommand*{\glsxtrAltTreeSetHangIndent}{\hangindent\glstreeindent}
+\newcommand*{\glsxtrAltTreeSetSubHangIndent}[1]{\hangindent\glstreeindent}
+  \renewglossarystyle{alttree}{%
+    \renewenvironment{theglossary}%
+      {%
+       \glsxtralttreeInit
+       \def\@gls@prevlevel{-1}%
+       \mbox{}\par}%
+      {\par}%
+    \renewcommand*{\glossaryheader}{}%
+    \renewcommand*{\glsgroupheading}[1]{}%
+    \renewcommand{\glossentry}[2]{%
+      \ifnum\@gls@prevlevel=0\relax
+      \else
+        \glsxtrComputeTreeIndent{##1}%
+      \fi
+      \parindent\glstreeindent
+      \glsxtrAltTreeSetHangIndent
+      \makebox[0pt][r]%
+      {%
+        \glstreenamebox{\glstreeindent}%
+        {%
+           \glsentryitem{##1}%
+           \glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}%
+        }%
+      }%
+      \glsxtralttreeSymbolDescLocation{##1}{##2}%
+      \def\@gls@prevlevel{0}%
+    }
+    \renewcommand{\subglossentry}[3]{%
+      \ifnum##1=1\relax
+        \glssubentryitem{##2}%
+      \fi
+      \ifnum\@gls@prevlevel=##1\relax
+      \else
+        \glsxtrComputeTreeSubIndent{##1}{##2}{\gls@tmplen}%
+        \ifnum\@gls@prevlevel<##1\relax
+          \setlength\glstreeindent\gls@tmplen
+          \addtolength\glstreeindent\parindent
+          \parindent\glstreeindent
+        \else
+          \ifnum\@gls@prevlevel=0\relax
+            \glsxtrComputeTreeIndent{##2}%
+          \else
+            \glsxtrComputeTreeSubIndent{\@gls@prevlevel}{##2}{\glstreeindent}%
+          \fi
+          \addtolength\parindent{-\glstreeindent}%
+          \setlength\glstreeindent\parindent
+        \fi
+      \fi
+      \glsxtrAltTreeSetSubHangIndent{##1}%
+      \makebox[0pt][r]{\glstreenamebox{\gls@tmplen}{%
+        \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}}}%
+      \glsxtralttreeSubSymbolDescLocation{##1}{##2}{##3}%
+      \def\@gls@prevlevel{##1}%
+    }%
+    \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}%
+  }
+}%
+{%
+}
 \ifx\@glossary@default@style\relax
 \else
   \setglossarystyle{\@glsxtr@current@style}
-- 
cgit v1.2.3

