summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-18 21:31:32 +0000
committerKarl Berry <karl@freefriends.org>2017-04-18 21:31:32 +0000
commit8e743c86b6872f30b7a35c72aa944455157d4b3f (patch)
tree1d712f3824ef514604b4f626c4a5f53f290b7aa3 /Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty
parent684bd5dd12c9a1f9dfdb2093e5250b7e5d8967c2 (diff)
glossaries-extra (18apr17)
git-svn-id: svn://tug.org/texlive/trunk@43913 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty')
-rw-r--r--Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty259
1 files changed, 230 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty b/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty
index 888488ab869..df30651a874 100644
--- a/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty
+++ b/Master/texmf-dist/tex/latex/glossaries-extra/glossaries-extra.sty
@@ -11,7 +11,7 @@
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
-%% of this license of (at your option) any later version.
+%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{glossaries-extra}[2017/02/07 v1.13 (NLCT)]
+\ProvidesPackage{glossaries-extra}[2017/04/18 v1.14 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{etoolbox}
\@ifpackageloaded{glossaries}
@@ -114,10 +114,13 @@
\let\@glsxtr@redef@forglsentries\relax
\fi
}
-\newcommand*{\@glsxtr@record}[2]{}
-\newcommand*{\@@glsxtr@record}[2]{%
+\newcommand*{\@glsxtr@record}[3]{}
+\newcommand*{\glsxtr@recordsee}[2]{}
+\newcommand*{\@@glsxtr@record}[3]{%
\begingroup
\def\@glsnumberformat{glsnumberformat}%
+ \def\@glsxtr@thevalue{}%
+ \def\@glsxtr@theHvalue{\@glsxtr@thevalue}%
\ifcsdef{glo@#2@counter}%
{%
\edef\@gls@counter{\csname glo@#2@counter\endcsname}%
@@ -125,12 +128,19 @@
{%
\def\@gls@counter{page}%
}%
- \setkeys{glslink}{#1}%
+ \setkeys{#3}{#1}%
\ifKV@glslink@noindex
\else
\glswriteentry{#2}%
{%
- \glsxtr@saveentrycounter
+ \ifdefempty{\@glsxtr@thevalue}%
+ {%
+ \glsxtr@saveentrycounter
+ }%
+ {%
+ \let\theglsentrycounter\@glsxtr@thevalue
+ \def\theHglsentrycounter{\@glsxtr@theHvalue}%
+ }%
\let\@@do@@wrglossary\@glsxtr@dorecord
\glsxtr@@do@wrglossary{#2}%
}%
@@ -153,6 +163,11 @@
\newcommand*{\@glsxtr@op@recordcounter}[1]{%
\eappto\@glsxtr@counterrecordhook{\noexpand\@glsxtr@docounterrecord{#1}}%
}
+\newcommand*{\@glsxtr@recordsee}[2]{%
+ \def\@gls@xref{#2}%
+ \@onelevel@sanitize\@gls@xref
+ \protected@write\@auxout{}{\string\glsxtr@recordsee{#1}{\@gls@xref}}%
+}
\newcommand{\printunsrtglossaryunit}{%
\print@noop@unsrtglossaryunit
}
@@ -204,7 +219,9 @@
{%
\ifcase\nr\relax
\def\glsxtr@setup@record{%
- \renewcommand*{\@glsxtr@record}[2]{}%
+ \let\@glo@autosee\@glsxtr@org@gloautosee
+ \renewcommand*{\@do@seeglossary}{\@glsxtr@org@doseeglossary}%
+ \renewcommand*{\@glsxtr@record}[3]{}%
\let\@@do@wrglossary\glsxtr@@do@wrglossary
\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter
\let\glsxtrundefaction\@glsxtr@err@undefaction
@@ -215,6 +232,8 @@
}%
\or
\def\glsxtr@setup@record{%
+ \ifdef\@glo@autosee{\let\@glo@autosee\relax}{}%
+ \let\@do@seeglossary\@glsxtr@recordsee
\let\@glsxtr@record\@@glsxtr@record
\let\@@do@wrglossary\@gobble
\let\@gls@saveentrycounter\relax
@@ -228,6 +247,8 @@
}%
\or
\def\glsxtr@setup@record{%
+ \let\@glo@autosee\@glsxtr@org@gloautosee
+ \renewcommand*{\@do@seeglossary}{\@glsxtr@org@doseeglossary}%
\let\@glsxtr@record\@@glsxtr@record
\let\@@do@wrglossary\glsxtr@@do@wrglossary
\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter
@@ -436,6 +457,8 @@
\ProcessOptionsX
\RequirePackage{glossaries}
\@glsxtr@doaccsupp
+\let\@glsxtr@org@doseeglossary\@do@seeglossary
+\let\@glsxtr@org@gloautosee\@glo@autosee
\@glsxtr@abbreviationsdef
\let\@glsxtr@abbreviationsdef\relax
\@glsxtr@setupshortcuts
@@ -1257,7 +1280,7 @@
}
\newcommand*{\glsxtrregularfont}[1]{#1}
\renewcommand{\@gls@field@link}[4][]{%
- \@glsxtr@record{#2}{#3}%
+ \@glsxtr@record{#2}{#3}{glslink}%
\glsdoifexists{#3}%
{%
\let\glsxtrorg@ifKV@glslink@hyper\ifKV@glslink@hyper
@@ -1272,36 +1295,36 @@
}
\let\@glsxtr@org@gls@\@gls@
\def\@gls@#1#2{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\@glsxtr@org@gls@{#1}{#2}%
}%
\let\@glsxtr@org@glspl@\@glspl@
\def\@glspl@#1#2{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\@glsxtr@org@glspl@{#1}{#2}%
}%
\let\@glsxtr@org@Gls@\@Gls@
\def\@Gls@#1#2{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\@glsxtr@org@Gls@{#1}{#2}%
}%
\let\@glsxtr@org@Glspl@\@Glspl@
\def\@Glspl@#1#2{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\@glsxtr@org@Glspl@{#1}{#2}%
}%
\let\@glsxtr@org@GLS@\@GLS@
\def\@GLS@#1#2{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\@glsxtr@org@GLS@{#1}{#2}%
}%
\let\@glsxtr@org@GLSpl@\@GLSpl@
\def\@GLSpl@#1#2{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\@glsxtr@org@GLSpl@{#1}{#2}%
}%
\renewcommand*{\@glsdisp}[3][]{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\glsdoifexists{#2}{%
\let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper
\let\glsifplural\@secondoftwo
@@ -1319,7 +1342,7 @@
\glspostlinkhook
}
\renewcommand*{\@gls@@link}[3][]{%
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glslink}%
\glsdoifexistsordo{#2}%
{%
\let\do@gls@link@checkfirsthyper\relax
@@ -1330,15 +1353,76 @@
}%
\glspostlinkhook
}
+\newcommand*{\glsxtrinitwrgloss}{%
+ \glsifattribute{\glslabel}{wrgloss}{after}%
+ {%
+ \glsxtrinitwrglossbeforefalse
+ }%
+ {%
+ \glsxtrinitwrglossbeforetrue
+ }%
+}
+\newif\ifglsxtrinitwrglossbefore
+\glsxtrinitwrglossbeforetrue
+\define@choicekey{glslink}{wrgloss}[\val\nr]{before,after}%
+{%
+ \ifcase\nr\relax
+ \glsxtrinitwrglossbeforetrue
+ \or
+ \glsxtrinitwrglossbeforefalse
+ \fi
+}
+\def\@gls@link[#1]#2#3{%
+ \leavevmode
+ \edef\glslabel{\glsdetoklabel{#2}}%
+ \def\@gls@link@opts{#1}%
+ \let\@gls@link@label\glslabel
+ \def\@glsnumberformat{glsnumberformat}%
+ \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}%
+ \edef\glstype{\csname glo@\glslabel @type\endcsname}%
+ \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper
+ \glsxtrinitwrgloss
+ \@gls@setdefault@glslink@opts
+ \do@glsdisablehyperinlist
+ \do@gls@link@checkfirsthyper
+ \setkeys{glslink}{#1}%
+ \glslinkpostsetkeys
+ \@gls@saveentrycounter
+ \@gls@setsort{\glslabel}%
+ \ifglsxtrinitwrglossbefore
+ \@do@wrglossary{#2}%
+ \fi
+ \ifKV@glslink@hyper
+ \@glslink{\glolinkprefix\glslabel}{\glstextformat{#3}}%
+ \else
+ \glsdonohyperlink{\glolinkprefix\glslabel}{\glstextformat{#3}}%
+ \fi
+ \ifglsxtrinitwrglossbefore
+ \else
+ \@do@wrglossary{#2}%
+ \fi
+ \let\ifKV@glslink@hyper\org@ifKV@glslink@hyper
+}
+\define@key{glossadd}{thevalue}{\def\@glsxtr@thevalue{#1}}
+\define@key{glossadd}{theHvalue}{\def\@glsxtr@theHvalue{#1}}
\renewrobustcmd*{\glsadd}[2][]{%
\@gls@adjustmode
- \@glsxtr@record{#1}{#2}%
+ \@glsxtr@record{#1}{#2}{glossadd}%
\glsdoifexists{#2}%
{%
\def\@glsnumberformat{glsnumberformat}%
\edef\@gls@counter{\csname glo@\glsdetoklabel{#2}@counter\endcsname}%
+ \def\@glsxtr@thevalue{}%
+ \def\@glsxtr@theHvalue{\@glsxtr@thevalue}%
\setkeys{glossadd}{#1}%
- \@gls@saveentrycounter
+ \ifdefempty{\@glsxtr@thevalue}%
+ {%
+ \@gls@saveentrycounter
+ }%
+ {%
+ \let\theglsentrycounter\@glsxtr@thevalue
+ \def\theHglsentrycounter{\@glsxtr@theHvalue}%
+ }%
\@@do@wrglossary{#2}%
}%
}
@@ -2048,6 +2132,11 @@
}%
}%
}
+\renewrobustcmd*{\glshyperlink}[2][\glsentrytext{\@glo@label}]{%
+ \def\@glo@label{#2}%
+ {\edef\glslabel{#2}%
+ \@glslink{\glolinkprefix\glslabel}{#1}}%
+}
\ifundef\glsdonohyperlink
{%
\renewcommand{\glsdisablehyper}{%
@@ -2469,7 +2558,7 @@
}%
\let\@cgls@\@@cgls@
\let\@cglspl@\@@cglspl@
- \let\@cGLS@\@@cGLS@
+ \let\@cGls@\@@cGls@
\let\@cGlspl@\@@cGlspl@
\let\@cGLS@\@@cGLS@
\let\@cGLSpl@\@@cGLSpl@
@@ -2772,7 +2861,7 @@
}%
\let\@cgls@\@@cgls@
\let\@cglspl@\@@cglspl@
- \let\@cGLS@\@@cGLS@
+ \let\@cGls@\@@cGls@
\let\@cGlspl@\@@cGlspl@
\let\@cGLS@\@@cGLS@
\let\@cGLSpl@\@@cGLSpl@
@@ -2985,7 +3074,6 @@
\renewcommand\makeglossaries[1][]{}%
\@disable@onlypremakeg
\let\gls@checkseeallowed\relax
- \let\@glsxtr@org@doseeglossary\@do@seeglossary
\renewcommand*{\@do@seeglossary}[2]{%
\edef\@gls@label{\glsdetoklabel{##1}}%
\edef\@gls@type{\csname glo@\@gls@label @type\endcsname}%
@@ -3219,6 +3307,60 @@
}%
}%
\newcommand*{\@glsxtr@idx@entrynumberlist}[1]{\glsentrynumberlist{#1}}
+\renewcommand*{\@gls@noidx@getgrouptitle}[2]{%
+ \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
+ \@onelevel@sanitize\@glsxtr@titlelabel
+ \ifcsundef{\@glsxtr@titlelabel}%
+ {%
+ \DTLifint{#1}%
+ {%
+ \ifnum#1<256\relax
+ \edef#2{\char#1\relax}%
+ \else
+ \edef#2{#1}%
+ \fi
+ }%
+ {%
+ \ifcsundef{#1groupname}%
+ {\def#2{#1}}%
+ {\letcs#2{#1groupname}}%
+ }%
+ }%
+ {%
+ \letcs#2{\@glsxtr@titlelabel}%
+ }%
+}
+\let\glsxtr@org@getgrouptitle\@gls@getgrouptitle
+\newrobustcmd{\glsxtrgetgrouptitle}[2]{%
+ \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
+ \@onelevel@sanitize\@glsxtr@titlelabel
+ \ifcsdef{\@glsxtr@titlelabel}
+ {\letcs{#2}{\@glsxtr@titlelabel}}%
+ {\glsxtr@org@getgrouptitle{#1}{#2}}%
+}
+\let\@gls@getgrouptitle\glsxtrgetgrouptitle
+\newcommand{\glsxtrsetgrouptitle}[2]{%
+ \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
+ \@onelevel@sanitize\@glsxtr@titlelabel
+ \csxdef{\@glsxtr@titlelabel}{#2}%
+}
+\renewcommand*{\glsnavigation}{%
+ \def\@gls@between{}%
+ \ifcsundef{@gls@hypergrouplist@\@glo@type}%
+ {%
+ \def\@gls@list{}%
+ }%
+ {%
+ \expandafter\let\expandafter\@gls@list
+ \csname @gls@hypergrouplist@\@glo@type\endcsname
+ }%
+ \@for\@gls@tmp:=\@gls@list\do{%
+ \@gls@between
+ \glsxtrgetgrouptitle{\@gls@tmp}{\@gls@grptitle}%
+ \glsnavhyperlink{\@gls@tmp}{\@gls@grptitle}%
+ \let\@gls@between\glshypernavsep
+ }%
+}
\renewcommand*{\@print@noidx@glossary}{%
\ifcsdef{@glsref@\@glo@type}%
{%
@@ -3273,17 +3415,56 @@
\expandafter{\glsxtrlocrangefmt}{#2}%
}
\newcommand*{\glsxtrdisplayendloc}[2]{%
- \ifdefstring{\glsxtrlocrangefmt}{#1}{}%
- {\GlossariesExtraWarning{Mismatched end location range
- (start=\glsxtrlocrangefmt, end=#1)}%
- }%
- \glsxtrdisplayendlochook{#1}{#2}%
+ \edef\@glsxtr@tmp{#1}%
+ \ifdefempty{\@glsxtr@tmp}{\def\@glsxtr@tmp{glsnumberformat}}{}%
+ \ifx\glsxtrlocrangefmt\@glsxtr@tmp
+ \else
+ \GlossariesExtraWarning{Mismatched end location range
+ (start=\glsxtrlocrangefmt, end=\@glsxtr@tmp)}%
+ \fi
+ \expandafter\glsxtrdisplayendlochook\expandafter{\@glsxtr@tmp}{#2}%
\expandafter\glsxtrdisplaysingleloc
\expandafter{\glsxtrlocrangefmt}{#2}%
\def\glsxtrlocrangefmt{}%
}
\newcommand*{\glsxtrdisplayendlochook}[2]{}
\newcommand*{\glsxtrlocrangefmt}{}
+\def\@gls@removespaces#1 #2\@nil{%
+ \toks@=\expandafter{\the\toks@#1}%
+ \ifx\\#2\\%
+ \edef\x{\the\toks@}%
+ \ifx\x\empty
+ \else
+ \glsxtrlocationhyperlink{\glsentrycounter}{\@glo@counterprefix}{\the\toks@}%
+ \fi
+ \else
+ \@gls@ReturnAfterFi{%
+ \@gls@removespaces#2\@nil
+ }%
+ \fi
+}
+\newcommand*{\glsxtrlocationhyperlink}[3]{%
+ \ifdefvoid\glsxtrsupplocationurl
+ {%
+ \hyperlink{#1#2#3}{#3}%
+ }%
+ {%
+ \hyperref{\glsxtrsupplocationurl}{}{#1#2#3}{#3}%
+ }%
+}
+\newcommand*{\glsxtrsupphypernumber}[1]{%
+ {%
+ \glshasattribute{\glscurrententrylabel}{externallocation}%
+ {%
+ \def\glsxtrsupplocationurl{%
+ \glsgetattribute{\glscurrententrylabel}{externallocation}}%
+ }%
+ {%
+ \def\glsxtrsupplocationurl{}%
+ }%
+ \glshypernumber{#1}%
+ }%
+}
\renewcommand{\@print@glossary}{%
\makeatletter
\@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}%
@@ -3531,6 +3712,21 @@
\AtBeginDocument
{\protected@write\@auxout{}{\string\glsxtr@linkprefix{\glolinkprefix}}}%
\let\glsxtr@writefields\relax
+ \ifglsautomake
+ \IfFileExists{\jobname.aux}%
+ {\immediate\write18{bib2gls "\jobname"}}{}%
+ \ifx\@gls@doautomake\@gls@doautomake@err
+ \let\@gls@doautomake\relax
+ \fi
+ \fi
+}
+\newcommand*{\@gls@doautomake@err}{%
+ \PackageError{glossaries}{You must use
+ \string\makeglossaries\space with automake=true}
+ {%
+ Either remove the automake=true setting or
+ add \string\makeglossaries\space to your document preamble.%
+ }%
}
\newcommand*{\glsxtr@record}[5]{}
\newcommand*{\glsxtr@counterrecord}[3]{%
@@ -3614,8 +3810,12 @@
\PackageError{glossaries-extra}{\string\printunsrtglossaryunit\space
requires the record=only or record=alsoindex package option}{}%
}
-\newcommand*{\@glsxtr@unsrt@getgrouptitle}[2]{%
- \def#2{#1}%
+\newrobustcmd*{\@glsxtr@unsrt@getgrouptitle}[2]{%
+ \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}%
+ \@onelevel@sanitize\@glsxtr@titlelabel
+ \ifcsdef{\@glsxtr@titlelabel}
+ {\letcs{#2}{\@glsxtr@titlelabel}}%
+ {\def#2{#1}}%
}
\newcommand{\glsxtrunsrtdo}{\@glsxtr@noidx@do}
\newcommand{\@glsxtr@noidx@do}[1]{%
@@ -3655,7 +3855,8 @@
{}%
{%
\ifdefempty{\@gls@currentlettergroup}{}{\glsgroupskip}%
- \glsgroupheading{\@glo@thislettergrp}%
+ \expandafter\glsgroupheading\expandafter
+ {\csname glo@\glsdetoklabel{#1}@group\endcsname}%
}%
\let\@gls@currentlettergroup\@glo@thislettergrp
\ifdefvoid{\@gls@location}%