• No results found

Index of /CTAN/macros/latex/contrib/glossaries-extra

N/A
N/A
Protected

Academic year: 2022

Share "Index of /CTAN/macros/latex/contrib/glossaries-extra"

Copied!
1198
0
0

Full text

(1)

glossaries-extra.sty v1.49: documented code

Nicola L.C. Talbot Dickimaw Books

http://www.dickimaw-books.com/

2022-10-14

This is the documented code for theglossaries-extrapackage. Seeglossaries-extra-manual.pdf for the user manual.

Contents

1 Main Package Code (glossaries-extra.sty) 2

1.1 Package Initialisation and Options . . . 2

1.2 Extra Utilities. . . 38

1.3 Modifications to Commands Provided byglossaries . . . 55

1.3.1 Existence Checks . . . 62

1.3.2 Document Definitions . . . 76

1.3.3 Existing Glossary Style Modifications . . . 83

1.3.4 Entry Formatting, Hyperlinks and Indexing . . . 87

1.3.5 Entry Counting . . . 153

1.3.6 Acronym Modifications . . . 170

1.3.7 Indexing and Displaying Glossaries . . . 174

1.4 Link Counting . . . 225

1.5 Integration with glossaries-accsupp . . . 227

1.6 Categories . . . 282

1.7 Abbreviations . . . 311

1.7.1 Abbreviation Styles Setup . . . 339

1.7.2 Predefined Styles . . . 345

1.8 Using Entries in Headings . . . 345

1.9 Prefixes . . . 368

1.10 Multi (Combined/Compound) Entries . . . 374

1.11 Multi-Lingual Support . . . 422

2 Predefined Abbreviation Styles (glossaries-extra-abbrstyles.def )423 2.1 Predefined Styles (Default Font) . . . 442

2.2 Predefined Styles (Small Capitals) . . . 463

2.3 Predefined Styles (Fake Small Capitals) . . . 481

(2)

2.4 Predefined Styles (Emphasized) . . . 498

2.5 Predefined Styles (User Parentheses Hook). . . 525

2.6 Predefined Styles (Hyphen) . . . 538

2.7 Predefined Styles (No Short on First Use) . . . 577

3 Commands Specific to bib2gls (glossaries-extra-bib2gls.sty) 582 4 Style Adjustments (glossaries-extra-stylemods.sty) 642 4.1 Package Initialisation. . . 642

4.2 List-Like Styles . . . 643

4.3 Longtable Styles . . . 647

4.4 Long Ragged Styles. . . 649

4.5 Supertabular Styles. . . 651

4.6 Super Ragged Styles . . . 654

4.7 Inline Style . . . 656

4.8 Tree Styles . . . 656

4.9 Multicolumn Styles . . . 680

5 bookindex style (glossary-bookindex.sty) 689 6 longextra styles (glossary-longextra.sty) 697 7 topic styles (glossary-topic.sty) 729 8 table styles (glossary-table.sty) 735 9 Rollback Files 762 9.1 Rollback v1.48 (glossaries-extra-2021-11-22.sty) . . . 762

9.2 Rollback v1.48 (glossaries-extra-bib2gls-2021-11-22.sty). . . 1064

9.3 Rollback v1.48 (glossaries-extra-stylemods-2021-11-22.sty) . . . . 1099

9.4 Rollback v1.48 (glossary-bookindex-2021-11-22.sty) . . . 1129

9.5 Rollback v1.48 (glossary-longextra-2021-11-22.sty) . . . 1133

9.6 Rollback v1.48 (glossary-topic-2021-11-22.sty) . . . 1151

1 Main Package Code (glossaries-extra.sty)

1.1 Package Initialisation and Options

\NeedsTeXFormat{LaTeX2e}

Rollback releases:

\DeclareRelease{v1.48}{2021-11-22}{glossaries-extra-2021-11-22.sty}

\DeclareCurrentRelease{v1.49}{2022-10-14}

Declare package:

\ProvidesPackage{glossaries-extra}[2022/10/14 v1.49 (NLCT)]

Requiresxkeyvalto define package options.

\RequirePackage{xkeyval}

(3)

Requiresetoolboxpackage.

\RequirePackage{etoolbox}

Hasglossariesalready been loaded?

\@ifpackageloaded{glossaries}

{%

Already loaded so pass any options to\setupglossaries. This means that the options that can only be set whenglossariesis loaded can’t be used.

\newcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}%

\let\@glsxtr@declareoption\@gls@declareoption }

{%

Not already loaded, so pass options toglossaries.

\newcommand{\glsxtr@dooption}[1]{%

\PassOptionsToPackage{#1}{glossaries}%

}%

Set the defaults.

\PassOptionsToPackage{toc}{glossaries}

\PassOptionsToPackage{nopostdot}{glossaries}

\PassOptionsToPackage{noredefwarn}{glossaries}

\@ifpackageloaded{polyglossia}%

{}%

{%

\@ifpackageloaded{babel}%

{\PassOptionsToPackage{translate=babel}{glossaries}}%

{}%

}%

\newcommand*{\@glsxtr@declareoption}[2]{%

\DeclareOptionX{#1}{#2}%

\DeclareOption{#1}{#2}%

} }

Declare package options.

\glsxtrundefaction Determines what to do if an entry hasn’t been defined. The two arguments are the error or warning message and the help message if an error should be produced.

\newcommand*{\glsxtrundefaction}[2]{%

\@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}%

}

\glsxtr@warnonexistsordo If user wantsundefaction=warn, thenglossariesv4.19 is required.

\newcommand*{\glsxtr@warnonexistsordo}[1]{}

\glsxtrundeftag Text to display when an entry doesn’t exist.

\newcommand*{\glsxtrundeftag}{??}

\newcommand*{\@glsxtrundeftag}{}

This text is switched on at the start of the document to prevent unwanted text inserted into the preamble if any tests are made before the start of the document.

(4)

\@glsxtr@warn@undefaction This is how\glsxtrundefactionshould behave if undefaction=warn is set.

\newcommand*{\@glsxtr@warn@undefaction}[2]{%

\@glsxtrundeftag\GlossariesExtraWarning{#1}%

}

\@glsxtr@err@undefaction This is how\glsxtrundefactionshould behave if undefaction=erroris set.

\newcommand*{\@glsxtr@err@undefaction}[2]{%

\@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}%

}

\@glsxtr@warn@onexistsordo This is how\glsxtr@warnonexistsordoshould behave if undefaction=warnis set.

\newcommand*{\@glsxtr@warn@onexistsordo}[1]{%

\GlossariesExtraWarning{\string#1\space hasn’t been defined, so some errors won’t be converted to warnings.

(This most likely means your version of glossaries.sty is below version 4.19.)}%

}

\@glsxtr@redef@forglsentries

\newcommand*{\@glsxtr@redef@forglsentries}{}

\@glsxtr@do@redef@forglsentries

\newcommand*{\@glsxtr@do@redef@forglsentries}{%

\renewcommand*{\forglsentries}[3][\glsdefaulttype]{%

\protected@edef\@@glo@list{\csname glolist@##1\endcsname}%

\ifdefstring{\@@glo@list}{,}%

{%

\GlossariesExtraWarning{No entries defined in glossary ‘##1’}%

}%

{%

\@for##2:=\@@glo@list\do {%

\ifdefempty{##2}{}{##3}%

}%

}%

}%

}%

undefaction

\define@choicekey{glossaries-extra.sty}{undefaction}%

[\glsxtr@undefaction@val\glsxtr@undefaction@nr]%

{warn,error}%

{%

\ifcase\glsxtr@undefaction@nr\relax

\let\glsxtrundefaction\@glsxtr@warn@undefaction

\let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo

\let\@glsxtr@redef@forglsentries\@glsxtr@do@redef@forglsentries

\or

(5)

\let\glsxtrundefaction\@glsxtr@err@undefaction

\let\glsxtr@warnonexistsordo\@gobble

\let\@glsxtr@redef@forglsentries\relax

\fi }

To assist bib2gls, v1.08 introduces therecordoption, which will write infor- mation to the aux file whenever an entry needs to be indexed.

\@glsxtr@record Does nothing by default.

\newcommand*{\@glsxtr@record}[3]{}

\glsxtr@recordsee Does nothing by default.

\newcommand*{\glsxtr@recordsee}[2]{}

\@glsxtr@defaultnumberformat

\newcommand*{\@glsxtr@defaultnumberformat}{glsnumberformat}%

\GlsXtrSetDefaultNumberFormat

\newcommand*{\GlsXtrSetDefaultNumberFormat}[1]{%

\renewcommand*{\@glsxtr@defaultnumberformat}{#1}%

}%

The record option is somewhat problematic. On the first LATEX run the entries aren’t defined. This isn’t as straight-forward as commands like \cite since attributes associated with the entry’s category may switch off the indexing or the entry’s glossary type might require a particular counter. This kind of information can’t be determined until the entry has been defined. So there are two different commands here. One that’s used if the entry hasn’t been defined, which tries to use sensible defaults, and one which is used when the entry has been defined.

\@glsxtr@do@record@wrglossary Therecord=onlyoption sets\@@do@wrglossaryto this command, which means it’s done within\glsaddand\@gls@link, and so is only done if the entry exists.

\newcommand*{\@glsxtr@do@record@wrglossary}[1]{%

\begingroup

\ifKV@glslink@noindex

\else

\protected@edef\@gls@label{\glsdetoklabel{#1}}%

\let\glslabel\@gls@label

\glswriteentry{#1}%

{%

\ifdefempty{\@glsxtr@thevalue}%

{%

\ifx\@glsxtr@org@theHvalue\@glsxtr@theHvalue

\else

\let\theHglsentrycounter\@glsxtr@theHvalue

\fi

(6)

\glsxtr@saveentrycounter

\let\@@do@@wrglossary\@glsxtr@dorecord }%

{%

\let\theglsentrycounter\@glsxtr@thevalue

\let\theHglsentrycounter\@glsxtr@theHvalue

\let\@@do@@wrglossary\@glsxtr@dorecordnodefer }%

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex

\glsxtr@@do@wrglossary{#1}%

\else

\@@glsxtrwrglossmark Increment associated counter.

\glsxtr@inc@wrglossaryctr{#1}%

\@@do@@wrglossary

\fi }%

\fi

\endgroup }

\glsxtr@do@alsoindex@wrglossary Therecord=alsoindex option needs to both record and index.

\newcommand*{\glsxtr@do@alsoindex@wrglossary}[1]{%

\glsxtr@@do@wrglossary{#1}%

\@glsxtr@do@record@wrglossary{#1}%

}

\@@glsxtr@record Therecord=onlyoption sets\@glsxtr@recordto this. This performs the record- ing if the entrydoesn’t exist and is done at the start of \@gls@field@linkand commands like\@gls@(before the existence test). This means that it disregards thewrgloss key.

The first argument is the option list (as passed in the first optional argument to commands like\gls). This allows the noindexsetting to be picked up. The second argument is the entry’s label. The third argument is the key family (glslinkin most cases,glossaddfor\glsadd).

\newcommand*{\@@glsxtr@record}[3]{%

Save the label in case it’s needed. This needs to be outside the existence check to allow the post-link hook to reference it.

\protected@edef\@gls@label{\glsdetoklabel{#2}}%

\let\glslabel\@gls@label

\ifglsentryexists{#2}{}%

{%

\@@glsxtrwrglossmark

\begingroup

\let\@glsnumberformat\@glsxtr@defaultnumberformat

\def\@glsxtr@thevalue{}%

\def\@glsxtr@theHvalue{\@glsxtr@thevalue}%

\let\@glsxtr@org@theHvalue\@glsxtr@theHvalue

(7)

Entry hasn’t been defined, so we’ll have to assume it’s\glscounterby default.

\let\@gls@counter\glscounter

Unless theequationsoption is on and this is inside a numbered maths environ- ment.

\if@glsxtr@equations

\@glsxtr@use@equation@counter

\fi

Check for default options (which may switch off indexing).

\@gls@setdefault@glslink@opts Implement any pre-key settings.

\csuse{@glsxtr@#3@prekeys}%

Assign keys.

\setkeys{#3}{#1}%

Implement any post-key settings. Is the auto-add on?

\glsxtr@do@autoadd{#3}%

Check post-key hook.

\csuse{@glsxtr@#3@postkeys}%

Increment associated counter.

\glsxtr@inc@wrglossaryctr{#2}%

Check ifnoindexoption has been used.

\ifKV@glslink@noindex

\else

\glswriteentry{#2}%

{%

Check ifthevaluehas been set.

\ifdefempty{\@glsxtr@thevalue}%

{%

Keythevaluehasn’t been set, but check if theHvaluehas been set. (Not partic- ularly likely, but allow for it.)

\ifx\@glsxtr@org@theHvalue\@glsxtr@theHvalue

\else

\let\theHglsentrycounter\@glsxtr@theHvalue

\fi Save the entry counter.

\glsxtr@saveentrycounter

Temporarily redefine\@@do@@wrglossaryfor use with\glsxtr@@do@wrglossary.

\let\@@do@@wrglossary\@glsxtr@dorecord }%

{%

(8)

thevaluehas been set, so there’s no need to defer writing the location value. (If it’s dependent on the page counter, thecounterkey should be set instead.)

\let\theglsentrycounter\@glsxtr@thevalue

\let\theHglsentrycounter\@glsxtr@theHvalue

\let\@@do@@wrglossary\@glsxtr@dorecordnodefer }%

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex

\glsxtr@@do@wrglossary{#2}%

\else

No need to escape special characters.

\@@do@@wrglossary

\fi }%

\fi

\endgroup }%

}

\@glsxtr@glslink@prekeys

\newcommand{\@glsxtr@glslink@prekeys}{\glslinkpresetkeys}

\@glsxtr@glslink@postkeys

\newcommand{\@glsxtr@glslink@postkeys}{\glslinkpostsetkeys}

\@glsxtr@glossadd@prekeys

\newcommand{\@glsxtr@glossadd@prekeys}{\glsaddpresetkeys}

\@glsxtr@glossadd@postkeys

\newcommand{\@glsxtr@glossadd@postkeys}{\glsaddpostsetkeys}

\@glsxtr@dorecord If record=alsoindexor record=hybridis used, then\@glslocrefmay have been escaped, but this isn’t appropriate here.

\newcommand*\@glsxtr@dorecord{%

\@@glsxtr@dorecord\@gls@label\glsxtr@record\@glsxtr@do@nameref@record }

\@@glsxtr@dorecord

\newcommand*\@@glsxtr@dorecord[3]{%

\global\let\@glsrecordlocref\theglsentrycounter

\let\@glsxtr@orgprefix\@glo@counterprefix

\ifx\theglsentrycounter\theHglsentrycounter

\def\@glo@counterprefix{}%

\else

Protect against non-expandable commands occurring in the location.

\protected@edef\@glsxtr@theentrycounter{\theglsentrycounter}%

\protected@edef\@glsxtr@theHentrycounter{\theHglsentrycounter}%

\@onelevel@sanitize\@glsxtr@theentrycounter

(9)

\@onelevel@sanitize\@glsxtr@theHentrycounter

\@xp@gls@getcounterprefix

{\@glsxtr@theentrycounter}{\@glsxtr@theHentrycounter}%

\fi

Don’t protect the \@glsrecordlocref from premature expansion. If the counter isn’tpage then it needs expanding. If the location includes\thepage then\protected@writewill automatically deal with it.

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref

#3%

{#1}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}%

{\@glsrecordlocref}%

\else

\@bibgls@write@aux{}{\string#2%

{#1}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}%

{\@glsrecordlocref}}%

\fi

\@glsxtr@counterrecordhook

\let\@glo@counterprefix\@glsxtr@orgprefix }

\@glsxtr@dorecordnodefer As above, but don’t defer expansion of location. This uses\theglsentrycounter directly for the location rather than\@glslocrefsince there’s no need to guard against premature expansion of the page counter.

\newcommand*\@glsxtr@dorecordnodefer{%

\ifx\theglsentrycounter\theHglsentrycounter

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref

\@glsxtr@do@nameref@record

{\@gls@label}{}{\@gls@counter}{\@glsnumberformat}%

{\theglsentrycounter}%

\else

\@bibgls@write@aux{}{\string\glsxtr@record

{\@gls@label}{}{\@gls@counter}{\@glsnumberformat}%

{\theglsentrycounter}}%

\fi

\else

\@xp@gls@getcounterprefix{\theglsentrycounter}{\theHglsentrycounter}%

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref

\@glsxtr@do@nameref@record

{\@gls@label}{\@glo@counterprefix}{\@gls@counter}%

{\@glsnumberformat}{\theglsentrycounter}%

\else

\@bibgls@write@aux{}{\string\glsxtr@record

{\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}%

{\theglsentrycounter}}%

\fi

\fi

\@glsxtr@counterrecordhook }

(10)

\@glsxtr@ifnum@mmode Check if in a numbered maths environment. Theamsmathpackage is automat- ically loaded by datatool-base, which is required by glossaries, so \ifst@rred and\if@displayshould both be defined.

\newcommand{\@glsxtr@ifnum@mmode}[2]{%

\ifmmode

\ifst@rred

#2%

\else

Non-amsmath environments and regular inline math mode isn’t flagged as starred by amsmath, but we can’t use \mathchoice in this case as it’s not the current style that’s relevant. Instead we can useamsmath’s \if@display.

This may not work for environments that aren’t provided byamsmath.

\if@display #1\else #2\fi

\fi

\else

#2%

\fi }

\@glsxtr@do@nameref@record Withrecord=nameref, the current label information is included in the record, but this may not have been defined, so \csuse will prevent an undefined control sequence error and just leave the last two arguments blank if there’s no information. In the event that a record is in amsmath’s align environ- ment \@currentHref will be out. There may be other instances where

\@currentHrefis out, so this also saves\theHglsentrycounter, which is useful if it can’t be obtained by prefixing\theglsentrycounter.

\newcommand*{\@glsxtr@do@nameref@record}[5]{%

\gls@ifnotmeasuring {%

\@bibgls@write@aux{}{\string\glsxtr@record@nameref {#1}{#2}{#3}{#4}{#5}%

{\csuse{@currentlabelname}}{\csuse{@currentHref}}%

{\theHglsentrycounter}}%

}%

}

\@@glsxtr@recordcounter

\newcommand*{\@@glsxtr@recordcounter}{%

\@glsxtr@noop@recordcounter }

\@glsxtr@noop@recordcounter

\newcommand*{\@glsxtr@noop@recordcounter}[1]{%

\PackageError{glossaries-extra}{\string\GlsXtrRecordCounter\space requires record=only or record=hybrid package option}{}%

}

(11)

\@glsxtr@op@recordcounter

\newcommand*{\@glsxtr@op@recordcounter}[1]{%

\protected@eappto\@glsxtr@counterrecordhook{\noexpand\@glsxtr@docounterrecord{#1}}%

}

\@glsxtr@recordsee Deal with \glssee in record mode. (This doesn’t increment the associated counter.)

\newcommand*{\@glsxtr@recordsee}[2]{%

\@@glsxtrwrglossmark

\def\@gls@xref{#2}%

\@onelevel@sanitize\@gls@xref

\@bibgls@write@aux{}{\string\glsxtr@recordsee{#1}{\@gls@xref}}%

}

\printunsrtglossaryunit

\newcommand{\printunsrtglossaryunit}{%

\print@noop@unsrtglossaryunit }

\glsxtr@setup@record Initialise.

\newcommand*{\glsxtr@setup@record}{\let\@@do@wrglossary\glsxtr@@do@wrglossary}

\glsxtr@indexonly@saveentrycounter Only store the entry counter information if the indexing is on.

\newcommand*{\glsxtr@indexonly@saveentrycounter}{%

\ifKV@glslink@noindex

\else

\glsxtr@saveentrycounter

\fi }

\glsxtr@addloclistfield

\newcommand*{\glsxtr@addloclistfield}{%

\key@ifundefined{glossentry}{loclist}%

{%

\define@key{glossentry}{loclist}{\def\@glo@loclist{##1}}%

\appto\@gls@keymap{,{loclist}{loclist}}%

\appto\@newglossaryentryprehook{\def\@glo@loclist{}}%

\appto\@newglossaryentryposthook{%

\gls@assign@field{}{\@glo@label}{loclist}{\@glo@loclist}%

}%

\glssetnoexpandfield{loclist}%

}%

{}%

The loclist field is just a comma-separated list. The location field is the format- ted list.

\key@ifundefined{glossentry}{location}%

{%

\define@key{glossentry}{location}{\def\@glo@location{##1}}%

(12)

\appto\@gls@keymap{,{location}{location}}%

\appto\@newglossaryentryprehook{\def\@glo@location{}}%

\appto\@newglossaryentryposthook{%

\gls@assign@field{}{\@glo@label}{location}{\@glo@location}%

}%

\glssetnoexpandfield{location}%

}%

{}%

Add a key to store the group heading.

\key@ifundefined{glossentry}{group}%

{%

\define@key{glossentry}{group}{\def\@glo@group{##1}}%

\appto\@gls@keymap{,{group}{group}}%

\appto\@newglossaryentryprehook{\def\@glo@group{}}%

\appto\@newglossaryentryposthook{%

\gls@assign@field{}{\@glo@label}{group}{\@glo@group}%

}%

\glssetnoexpandfield{group}%

}%

{}%

}

\@glsxtr@record@setting Keep track of therecordpackage option.

\newcommand*{\@glsxtr@record@setting}{off}

\@glsxtr@record@setting@alsoindex As from v1.46, therecord=alsoindexis renamed torecord=hybridwithrecord=alsoindex as a deprecated synonym to avoid confusion. The internal commands that in- cludealsoindexin the name will remain unchanged to avoid breaking things, but this command will need to be redefined byrecord=hybrid.

\newcommand*{\@glsxtr@record@setting@alsoindex}{alsoindex}

\@glsxtr@record@setting@only

\newcommand*{\@glsxtr@record@setting@only}{only}

\@glsxtr@record@setting@nameref

\newcommand*{\@glsxtr@record@setting@nameref}{nameref}

\@glsxtr@if@record@only

\newcommand*{\@glsxtr@if@record@only}[2]{%

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@only

#1%

\else

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref

#1%

\else

#2%

\fi

\fi }

(13)

\@glsxtr@record@setting@off

\newcommand*{\@glsxtr@record@setting@off}{off}

\@glsxtr@warn@hybrid@noprintgloss Used by hybrid method if \printglossaryisn’t used.

\newcommand\@glsxtr@warn@hybrid@noprintgloss{%

\ifdefstring{\@glo@types}{,}%

{%

\GlossariesExtraWarningNoLine{No glossaries have been defined}%

}%

{%

\GlossariesExtraWarningNoLine{No \string\printglossary\space or \string\printglossaries\space

found. ^^JYou have requested the hybrid setting record=\@glsxtr@record@setting\space which requires a

combination of bib2gls (to fetch entries) and makeindex/xindy (to sort and collate the entries). If you only want to use bib2gls then change the option to record=only or record=nameref}%

}%

}

\@glsxtr@record@only@setup Initialisation code for record=only and record=nameref

\newcommand*{\@glsxtr@record@only@setup}{%

\def\glsxtr@setup@record{%

\@glsxtr@autoseeindexfalse

\let\@do@seeglossary\@glsxtr@recordsee

\let\@glsxtr@record\@@glsxtr@record

\let\@@do@wrglossary\@glsxtr@do@record@wrglossary

\let\@gls@saveentrycounter\relax

\let\glsxtrundefaction\@glsxtr@warn@undefaction

\let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo

\glsxtr@addloclistfield

\renewcommand*{\@glsxtr@autoindexcrossrefs}{}%

\let\@@glsxtr@recordcounter\@glsxtr@op@recordcounter

\def\printunsrtglossaryunit{\print@op@unsrtglossaryunit}%

Switch off the index suppression for aliased entries. (bib2gls will deal with them.)

\def\glsxtrsetaliasnoindex{}%

\@gls@setupsort@nonewas only introduced toglossariesv4.30, so it may not be available. If it’s defined, use it to remove the unnecessary overhead of escaping and sanitizing the sort value.

\ifdef\@gls@setupsort@none{\@gls@setupsort@none}{}%

Warn about using\printglossary:

\def\glsxtrNoGlossaryWarning{\@glsxtr@record@noglossarywarning}%

Loadglossaries-extra-bib2gls:

\RequirePackage{glossaries-extra-bib2gls}%

}%

}

(14)

record Now define the record package option. As from v1.46, record=alsoindex is a deprecated synonym of record=hybridto avoid confusion.

\define@choicekey{glossaries-extra.sty}{record}

[\@glsxtr@record@setting\glsxtr@record@nr]%

{off,only,alsoindex,nameref,hybrid}%

[only]%

{%

\ifcase\glsxtr@record@nr\relax Don’t record.

\def\glsxtr@setup@record{%

\renewcommand*{\@do@seeglossary}{\@glsxtr@doseeglossary}%

\renewcommand*{\@glsxtr@record}[3]{}%

\let\@@do@wrglossary\glsxtr@@do@wrglossary

\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter

\let\glsxtrundefaction\@glsxtr@err@undefaction

\let\glsxtr@warnonexistsordo\@gobble

\let\@@glsxtr@recordcounter\@glsxtr@noop@recordcounter

\def\printunsrtglossaryunit{\print@noop@unsrtglossaryunit}%

\undef\glsxtrsetaliasnoindex }%

\or

Only record (don’t index).

\@glsxtr@record@only@setup

\or

Record and index. This option doesn’t loadglossaries-extra-bib2glsas the sorting is performed byxindyormakeindex. Index in this sense refers to the indexing mechanism used with indexing applications such as makeindex and xindy, but this could be confused with recording locations so “alsoindex” is now deprecated in favour of “hybrid”, which is more obvious.

\def\glsxtr@setup@record{%

\renewcommand*{\@glsxtr@record@setting@alsoindex}{alsoindex}%

\renewcommand*{\@do@seeglossary}{\@glsxtr@dosee@alsoindex@glossary}%

\let\@glsxtr@record\@@glsxtr@record

\let\@@do@wrglossary\glsxtr@do@alsoindex@wrglossary

\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter

\let\glsxtrundefaction\@glsxtr@warn@undefaction

\let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo

\glsxtr@addloclistfield

\let\@@glsxtr@recordcounter\@glsxtr@op@recordcounter

\def\printunsrtglossaryunit{\print@op@unsrtglossaryunit}%

\undef\glsxtrsetaliasnoindex }%

\or

Only record (don’t index) but also include nameref information.

\@glsxtr@record@only@setup

\ifundef\hyperlink

{\GlossariesExtraWarning{You have requested record=nameref but

(15)

the document doesn’t support hyperlinks}}%

{}%

\or

Hybrid record (use bib2gls to fetch definitions) and index (use makeindex/xindy to sort and collate).

\def\glsxtr@setup@record{%

\renewcommand*{\@glsxtr@record@setting@alsoindex}{hybrid}%

\renewcommand*{\@do@seeglossary}{\@glsxtr@dosee@alsoindex@glossary}%

\let\@glsxtr@record\@@glsxtr@record

\let\@@do@wrglossary\glsxtr@do@alsoindex@wrglossary

\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter

\let\glsxtrundefaction\@glsxtr@warn@undefaction

\let\glsxtr@warnonexistsordo\@glsxtr@warn@onexistsordo

\glsxtr@addloclistfield

\let\@@glsxtr@recordcounter\@glsxtr@op@recordcounter

\def\printunsrtglossaryunit{\print@op@unsrtglossaryunit}%

\undef\glsxtrsetaliasnoindex }%

\fi }

bibglsaux Provide an option to put the records in a different aux file that will only be read by bib2gls and not by LATEX. A large number of records in the aux file can slow down the document build as LATEX has to parse it all. This will require an extra write register, so may not be so desirable for documents with small glossaries but a large number of temporary files.

\define@key{glossaries-extra.sty}{bibglsaux}{%

\glsxtrsetbibglsaux{#1}%

}

\glsxtrsetbibglsaux

\newcommand{\glsxtrsetbibglsaux}[1]{%

\renewcommand{\@glsxtr@setup@bibglsaux}{\@@glsxtr@setup@bibglsaux{#1}}%

}

\@glsxtr@setup@bibglsaux

\newcommand{\@glsxtr@setup@bibglsaux}{%

\renewcommand{\glsxtrsetbibglsaux}[1]{%

\@@glsxtr@setup@bibglsaux{##1}%

}%

}

\AtBeginDocument{\@glsxtr@setup@bibglsaux}

\@@glsxtr@setup@bibglsaux

\newcommand{\@@glsxtr@setup@bibglsaux}[1]{%

\ifstrempty{#1}%

{\renewcommand{\@bibgls@write@aux}{\protected@write\@auxout}}%

{\@set@bibgls@write@aux{#1.aux}}%

}

(16)

\@bibgls@write@aux Just used for writing records.

\newcommand{\@bibgls@write@aux}{\protected@write\@auxout}

\@set@bibgls@write@aux

\newcommand{\@set@bibgls@write@aux}[1]{%

\protected@write\@auxout{}%

{\string\providecommand{\string\@bibgls@input}[1]{}}%

\protected@write\@auxout{}{\string\@bibgls@input{#1}}%

\global\newwrite\@bibgls@auxout

\openout\@bibgls@auxout=#1

\AtEndDocument{\closeout\@bibgls@auxout}%

\gdef\@bibgls@write@aux{\protected@write\@bibgls@auxout}%

\gdef\@set@bibgls@write@aux##1{\GlossariesExtraWarning{repeated invocation of bibglsaux option ignored}}%

}

Version 1.06 changes thedocdef option to a choice rather than boolean set- ting. The available values are: false, true or restricted. The restricted option permits document definitions as long as they occur before the first glossary is displayed.

\@glsxtr@docdefval Thedocdef value is stored as an integer: 0 (false), 1 (true) and 2 (restricted).

\newcommand*{\@glsxtr@docdefval}{0}

Need to provide conditional commands that are backward compatible:

\if@glsxtrdocdef

\newcommand*{\if@glsxtrdocdef}{\ifnum\@glsxtr@docdefval>0 }

\@glsxtrdocdeftrue

\newcommand*{\@glsxtrdocdeftrue}{\def\@glsxtr@docdefval{1}}

\@glsxtrdocdeffalse

\newcommand*{\@glsxtrdocdeffalse}{\def\@glsxtr@docdefval{0}}

docdef By default don’t allow entries to be defined in the document to encourage the user to define them in the preamble, but if the user is really determined to define them in the document allow them to request this.

\define@choicekey{glossaries-extra.sty}{docdef}

[\@glsxtr@docdefsetting\@glsxtr@docdefval]%

{false,true,restricted,atom}[true]%

{%

\ifnum\@glsxtr@docdefval>1\relax

\renewcommand*{\@glsdoifexistsorwarn}{\glsdoifexists}%

\else

\renewcommand*{\@glsdoifexistsorwarn}{\glsdoifexistsorwarn}%

\fi }

(17)

\if@glsxtrdocdefrestricted

\newcommand*{\if@glsxtrdocdefrestricted}{\ifnum\@glsxtr@docdefval>1 }

\@glsdoifexistsorwarn Need an error to notify user if an undefined entry is being referenced in the glossary for the docdef=restricted option. This is used by \glossentryname (but not by\glossentrydescetc as one error per entry is sufficient).

\newcommand*{\@glsdoifexistsorwarn}{\glsdoifexistsorwarn}

indexcrossrefs Automatically index cross references at the end of the document

\define@boolkey{glossaries-extra.sty}[@glsxtr]{indexcrossrefs}[true]{%

\if@glsxtrindexcrossrefs

\else

\renewcommand*{\@glsxtr@autoindexcrossrefs}{}%

\fi }

Switch off since this can increase the build time.

\@glsxtrindexcrossrefsfalse

But allowseeandseealsokeys to switch it on automatically.

\@glsxtr@autoindexcrossrefs

\newcommand*{\@glsxtr@autoindexcrossrefs}{\@glsxtrindexcrossrefstrue}

autoseeindex Provide a boolean option to allow the user to prevent the automatic indexing of the cross-referencing keyssee,seealsoandalias.

\define@boolkey{glossaries-extra.sty}[@glsxtr@]{autoseeindex}[true]{%

}

\@glsxtr@autoseeindextrue

equations Provide a boolean option to automatically switch to theequationcounter when in a numbered maths environment.

\define@boolkey{glossaries-extra.sty}[@glsxtr@]{equations}[true]{%

}

\@glsxtr@equationsfalse

\glsxtr@float

\let\glsxtr@float\@float

\glsxtr@dblfloat

\let\glsxtr@dblfloat\@dblfloat

floats Provide a boolean option to automatically switch to the the corresponding counter when in a float.

\define@boolkey{glossaries-extra.sty}[@glsxtr@]{floats}[true]{%

\if@glsxtr@floats

\renewcommand*{\@float}[1]{\renewcommand{\glscounter}{##1}\glsxtr@float{##1}}%

\renewcommand*{\@dblfloat}[1]{\renewcommand{\glscounter}{##1}\glsxtr@dblfloat{##1}}%

\else

(18)

\let\@float\glsxtr@float

\let\@dblfloat\glsxtr@dblfloat

\fi }

\@glsxtr@floatsfalse

\GlossariesExtraWarning Allow users to suppress warnings.

\newcommand*{\GlossariesExtraWarning}[1]{\PackageWarning{glossaries-extra}{#1}}

\GlossariesExtraWarningNoLine Allow users to suppress warnings.

\newcommand*{\GlossariesExtraWarningNoLine}[1]{%

\PackageWarningNoLine{glossaries-extra}{#1}}

\@glsxtr@declareoption{nowarn}{%

\let\GlossariesExtraWarning\@gobble

\let\GlossariesExtraWarningNoLine\@gobble

\glsxtr@dooption{nowarn}%

}

\@glsxtr@defpostpunc Redefines\glspostdescription. The postdotandnopostdotoptions will have to redefine this.

\newcommand*{\@glsxtr@defpostpunc}{}

postdot Shortcut fornopostdot=false

\@glsxtr@declareoption{postdot}{%

\glsxtr@dooption{nopostdot=false}%

\renewcommand*{\@glsxtr@defpostpunc}{%

\renewcommand*{\glspostdescription}{%

\ifglsnopostdot\else.\spacefactor\sfcode‘\. \fi}%

}%

}

nopostdot Needs to redefine\@glsxtr@defpostpunc

\define@choicekey{glossaries-extra.sty}{nopostdot}{true,false}[true]{%

\glsxtr@dooption{nopostdot=#1}%

\renewcommand*{\@glsxtr@defpostpunc}{%

\renewcommand*{\glspostdescription}{%

\ifglsnopostdot\else.\spacefactor\sfcode‘\. \fi}%

}%

}

postpunc Set the post-description punctuation. This also sets the\ifglsnopostdotcon- ditional, which now indicates if the post-description punctuation has been sup- pressed.

\define@key{glossaries-extra.sty}{postpunc}{%

\glsxtr@dooption{nopostdot=false}%

\ifstrequal{#1}{dot}%

{%

\renewcommand*{\@glsxtr@defpostpunc}{%

(19)

\renewcommand*{\glspostdescription}{.\spacefactor\sfcode‘\. }%

}%

}%

{%

\ifstrequal{#1}{comma}%

{%

\renewcommand*{\@glsxtr@defpostpunc}{%

\renewcommand*{\glspostdescription}{,}%

}%

}%

{%

\ifstrequal{#1}{none}%

{%

\glsxtr@dooption{nopostdot=true}%

\renewcommand*{\@glsxtr@defpostpunc}{%

\renewcommand*{\glspostdescription}{}%

}%

}%

{%

\renewcommand*{\@glsxtr@defpostpunc}{%

\renewcommand*{\glspostdescription}{#1}%

}%

}%

}%

}%

}

\glsxtrabbrvtype Glossary type for abbreviations.

\newcommand*{\glsxtrabbrvtype}{\glsdefaulttype}

\@glsxtr@abbreviationsdef Set byabbreviations option.

\newcommand*{\@glsxtr@abbreviationsdef}{}

\@glsxtr@doabbreviationsdef

\newcommand*{\@glsxtr@doabbreviationsdef}{%

\@ifpackageloaded{babel}%

{\providecommand{\abbreviationsname}{\acronymname}}%

{\providecommand{\abbreviationsname}{Abbreviations}}%

\newglossary[glg-abr]{abbreviations}{gls-abr}{glo-abr}{\abbreviationsname}%

\renewcommand*{\glsxtrabbrvtype}{abbreviations}%

\newcommand*{\printabbreviations}[1][]{%

\printglossary[type=\glsxtrabbrvtype,##1]%

}%

\disable@keys{glossaries-extra.sty}{abbreviations}%

If theacronymoption hasn’t been used, change\acronymtypeto\glsxtrabbrvtype.

\ifglsacronym

\else

\renewcommand*{\acronymtype}{\glsxtrabbrvtype}%

(20)

\fi }%

abbreviations If abbreviations, create a new glossary type for abbreviations.

\@glsxtr@declareoption{abbreviations}{%

\let\@glsxtr@abbreviationsdef\@glsxtr@doabbreviationsdef }

\shortcut@gls

\newcommand{\shortcut@gls}{\cgls}

\shortcut@glspl

\newcommand{\shortcut@glspl}{\cglspl}

\shortcut@Gls

\newcommand{\shortcut@Gls}{\cGls}

\shortcut@Glspl

\newcommand{\shortcut@Glspl}{\cGlspl}

\shortcut@GLS

\newcommand{\shortcut@GLS}{\cGLS}

\shortcut@GLSpl

\newcommand{\shortcut@GLSpl}{\cGLSpl}

\GlsXtrDefineAbbreviationShortcuts Enable shortcut commands for the abbreviations. Unlike the analogous com- mand provided byglossaries, this uses\newcommandinstead of \letas a safety feature (except for\newabbrwhich is also provided with\GlsXtrDefineAcShortcuts).

\newcommand*{\GlsXtrDefineAbbreviationShortcuts}{%

\newcommand*{\ab}{\shortcut@gls}%

\newcommand*{\abp}{\shortcut@glspl}%

\newcommand*{\as}{\glsxtrshort}%

\newcommand*{\asp}{\glsxtrshortpl}%

\newcommand*{\al}{\glsxtrlong}%

\newcommand*{\alp}{\glsxtrlongpl}%

\newcommand*{\af}{\glsxtrfull}%

\newcommand*{\afp}{\glsxtrfullpl}%

\newcommand*{\Ab}{\shortcut@Gls}%

\newcommand*{\Abp}{\shortcut@Glspl}%

\newcommand*{\As}{\Glsxtrshort}%

\newcommand*{\Asp}{\Glsxtrshortpl}%

\newcommand*{\Al}{\Glsxtrlong}%

\newcommand*{\Alp}{\Glsxtrlongpl}%

\newcommand*{\Af}{\Glsxtrfull}%

\newcommand*{\Afp}{\Glsxtrfullpl}%

\newcommand*{\AB}{\shortcut@GLS}%

\newcommand*{\ABP}{\shortcut@GLSpl}%

(21)

\newcommand*{\AS}{\GLSxtrshort}%

\newcommand*{\ASP}{\GLSxtrshortpl}%

\newcommand*{\AL}{\GLSxtrlong}%

\newcommand*{\ALP}{\GLSxtrlongpl}%

\newcommand*{\AF}{\GLSxtrfull}%

\newcommand*{\AFP}{\GLSxtrfullpl}%

\glsmfuaddmap{\ab}{\Ab}%

\glsmfublocker{\AB}%

\glsmfuaddmap{\abp}{\Abp}%

\glsmfublocker{\ABP}%

\glsmfuaddmap{\as}{\As}%

\glsmfublocker{\AS}%

\glsmfuaddmap{\asp}{\Asp}%

\glsmfublocker{\ASP}%

\glsmfuaddmap{\al}{\Al}%

\glsmfublocker{\AL}%

\glsmfuaddmap{\alp}{\Alp}%

\glsmfublocker{\ALP}%

\glsmfuaddmap{\af}{\Af}%

\glsmfublocker{\AF}%

\glsmfuaddmap{\afp}{\Afp}%

\glsmfublocker{\AFP}%

\providecommand*{\newabbr}{\newabbreviation}%

Disable this command after it’s been used.

\let\GlsXtrDefineAbbreviationShortcuts\relax }

\GlsXtrDefineAcShortcuts Enable shortcut commands for the abbreviations, but uses the analogous com- mands provided byglossaries.

\newcommand*{\GlsXtrDefineAcShortcuts}{%

\newcommand*{\ac}{\shortcut@gls}%

\newcommand*{\acp}{\shortcut@glspl}%

\newcommand*{\acs}{\glsxtrshort}%

\newcommand*{\acsp}{\glsxtrshortpl}%

\newcommand*{\acl}{\glsxtrlong}%

\newcommand*{\aclp}{\glsxtrlongpl}%

\newcommand*{\acf}{\glsxtrfull}%

\newcommand*{\acfp}{\glsxtrfullpl}%

\newcommand*{\Ac}{\shortcut@Gls}%

\newcommand*{\Acp}{\shortcut@Glspl}%

\newcommand*{\Acs}{\Glsxtrshort}%

\newcommand*{\Acsp}{\Glsxtrshortpl}%

\newcommand*{\Acl}{\Glsxtrlong}%

\newcommand*{\Aclp}{\Glsxtrlongpl}%

\newcommand*{\Acf}{\Glsxtrfull}%

\newcommand*{\Acfp}{\Glsxtrfullpl}%

\newcommand*{\AC}{\shortcut@GLS}%

\newcommand*{\ACP}{\shortcut@GLSpl}%

(22)

\newcommand*{\ACS}{\GLSxtrshort}%

\newcommand*{\ACSP}{\GLSxtrshortpl}%

\newcommand*{\ACL}{\GLSxtrlong}%

\newcommand*{\ACLP}{\GLSxtrlongpl}%

\newcommand*{\ACF}{\GLSxtrfull}%

\newcommand*{\ACFP}{\GLSxtrfullpl}%

\glsmfuaddmap{\ac}{\Ac}%

\glsmfublocker{\AC}%

\glsmfuaddmap{\acp}{\Acp}%

\glsmfublocker{\ACP}%

\glsmfuaddmap{\acs}{\Acs}%

\glsmfublocker{\ACS}%

\glsmfuaddmap{\acsp}{\Acsp}%

\glsmfublocker{\ACSP}%

\glsmfuaddmap{\acl}{\Acl}%

\glsmfublocker{\ACL}%

\glsmfuaddmap{\aclp}{\Aclp}%

\glsmfublocker{\ACLP}%

\glsmfuaddmap{\acf}{\Acf}%

\glsmfublocker{\ACF}%

\glsmfuaddmap{\acfp}{\Acfp}%

\glsmfublocker{\ACFP}%

\providecommand*{\newabbr}{\newabbreviation}%

Disable this command after it’s been used.

\let\GlsXtrDefineAcShortcuts\relax }

\GlsXtrDefineOtherShortcuts Similarly provide shortcut versions for the commands provided by thesymbols andnumbersoptions.

\newcommand*{\GlsXtrDefineOtherShortcuts}{%

\newcommand*{\newentry}{\newglossaryentry}%

\ifdef\printsymbols {%

\newcommand*{\newsym}{\glsxtrnewsymbol}%

}{}%

\ifdef\printnumbers {%

\newcommand*{\newnum}{\glsxtrnewnumber}%

}{}%

\let\GlsXtrDefineOtherShortcuts\relax }

Always use the long forms, not the shortcuts, where portability is an issue.

(For example, when defining entries in a file that may be input by multiple documents.)

\@glsxtr@setupshortcuts Command used to set the shortcuts option.

\newcommand*{\@glsxtr@setupshortcuts}{}

(23)

\@glsxtr@shortcutsval Store the value of the shortcuts option. (Needed by bib2gls.)

\newcommand*{\@glsxtr@shortcutsval}{\ifglsacrshortcuts acro\else none\fi}%

shortcuts Provide shortcuts option. Unlike the glossaries version, this is a choice rather than a boolean key but it also providesshortcuts=trueandshortcuts=false, which are equivalent toshortcuts=allandshortcuts=none. Multiple use of this option in the same option list will override each other. New to v1.17: shortcuts=ac which implements \GlsXtrDefineAcShortcuts (not included in shortcuts=all as it conflicts with other shortcuts).

\define@choicekey{glossaries-extra.sty}{shortcuts}%

[\@glsxtr@shortcutsval\@glsxtr@shortcutsnr]%

{acronyms,acro,abbreviations,abbr,other,all,true,ac,acother,abother,none,false}[true]{%

\ifcase\@glsxtr@shortcutsnr\relax % acronyms

\renewcommand*{\@glsxtr@setupshortcuts}{%

\glsacrshortcutstrue

\DefineAcronymSynonyms }%

\or % acro

\renewcommand*{\@glsxtr@setupshortcuts}{%

\glsacrshortcutstrue

\DefineAcronymSynonyms }%

\or % abbreviations

\renewcommand*{\@glsxtr@setupshortcuts}{%

\GlsXtrDefineAbbreviationShortcuts }%

\or % abbr

\renewcommand*{\@glsxtr@setupshortcuts}{%

\GlsXtrDefineAbbreviationShortcuts }%

\or % other

\renewcommand*{\@glsxtr@setupshortcuts}{%

\GlsXtrDefineOtherShortcuts }%

\or % all

\renewcommand*{\@glsxtr@setupshortcuts}{%

\glsacrshortcutstrue

\GlsXtrDefineAcShortcuts

\GlsXtrDefineAbbreviationShortcuts

\GlsXtrDefineOtherShortcuts }%

\or % true

\renewcommand*{\@glsxtr@setupshortcuts}{%

\glsacrshortcutstrue

\GlsXtrDefineAcShortcuts

\GlsXtrDefineAbbreviationShortcuts

\GlsXtrDefineOtherShortcuts }%

(24)

\or % ac

\renewcommand*{\@glsxtr@setupshortcuts}{%

\glsacrshortcutstrue

\GlsXtrDefineAcShortcuts }%

\or % acother

\renewcommand*{\@glsxtr@setupshortcuts}{%

\glsacrshortcutstrue

\GlsXtrDefineAcShortcuts

\GlsXtrDefineOtherShortcuts }%

\or % abother

\renewcommand*{\@glsxtr@setupshortcuts}{%

\glsacrshortcutstrue

\GlsXtrDefineAbbreviationShortcuts

\GlsXtrDefineOtherShortcuts }%

Leave none and false as last option.

\else % none, false

\renewcommand*{\@glsxtr@setupshortcuts}{}%

\fi }

\@glsxtr@doaccsupp

\newcommand*{\@glsxtr@doaccsupp}{}

glossaries-accsupp can’t be loaded after glossaries-extra. glossaries-accsupp v4.29+ checks\@glsxtr@doaccsuppto determine if it’s been loaded too late.

accsupp If accsupp, loadglossaries-accsupppackage.

\@glsxtr@declareoption{accsupp}{%

\renewcommand*{\@glsxtr@doaccsupp}{\RequirePackage{glossaries-accsupp}}}

\@glsxtr@doloadprefix

\newcommand*{\@glsxtr@doloadprefix}{}

prefix If prefix, loadglossaries-prefixpackage.

\@glsxtr@declareoption{prefix}{%

\renewcommand*{\@glsxtr@doloadprefix}{\RequirePackage{glossaries-prefix}}}

\glsxtrNoGlossaryWarning Warning text displayed in document if the external glossary file given by the argument is missing.

\newcommand{\glsxtrNoGlossaryWarning}[1]{%

\GlossariesExtraWarning{Glossary ‘#1’ is missing}%

\@glsxtr@defaultnoglossarywarning{#1}%

}

(25)

nomissingglstext If true, suppress the text and warning produced if the external glossary file is missing.

\define@choicekey{glossaries-extra.sty}{nomissingglstext}

[\@glsxtr@nomissingglstextval\@glsxtr@nomissingglstextnr]%

{true,false}[true]{%

\ifcase\@glsxtr@nomissingglstextnr\relax % true

\renewcommand{\glsxtrNoGlossaryWarning}[1]{\null}%

\else % false

\renewcommand{\glsxtrNoGlossaryWarning}[1]{%

\@glsxtr@defaultnoglossarywarning{#1}%

}%

\fi }

Provide option to loadglossaries-extra-stylemods(Deferred to the end.)

\@glsxtr@redefstyles

\newcommand*{\@glsxtr@redefstyles}{}

stylemods

\define@key{glossaries-extra.sty}{stylemods}[default]{%

\ifstrequal{#1}{default}%

{%

\renewcommand*{\@glsxtr@redefstyles}{%

\RequirePackage{glossaries-extra-stylemods}}%

}%

{%

\ifstrequal{#1}{all}%

{%

\renewcommand*{\@glsxtr@redefstyles}{%

\PassOptionsToPackage{all}{glossaries-extra-stylemods}%

\RequirePackage{glossaries-extra-stylemods}%

}%

}%

{%

\renewcommand*{\@glsxtr@redefstyles}{}%

\@for\@glsxtr@tmp:=#1\do{%

\IfFileExists{glossary-\@[email protected]}%

{%

\eappto\@glsxtr@redefstyles{%

\noexpand\RequirePackage{glossary-\@glsxtr@tmp}}%

}%

{%

\PackageError{glossaries-extra}%

{Glossaries style package ‘glossary-\@[email protected]

doesn’t exist (did you mean to use the ‘style’ key?)}%

{The list of values (#1) in the ‘stylemods’ key should match the glossary-xxx.sty files provided with glossaries.sty}%

}%

(26)

}%

\appto\@glsxtr@redefstyles{\RequirePackage{glossaries-extra-stylemods}}%

} }%

}

\@glsxtr@do@style

\newcommand*{\@glsxtr@do@style}{}

style Since the stylemods option can automatically load extra style packages, deal with thestyleoption after those packages have been loaded.

\define@key{glossaries-extra.sty}{style}{%

Defer actual style change:

\renewcommand*{\@glsxtr@do@style}{%

Set this as the default style:

\setkeys{glossaries.sty}{style={#1}}%

Set this style:

\setglossarystyle{#1}%

}%

}

\glsxtr@inc@wrglossaryctr Increments the associated counter if enabled. Does nothing by default. The optional argument is the entry label in case it’s required, but the wrglossary counter is globally used by all entries.

\newcommand*{\glsxtr@inc@wrglossaryctr}[1]{}

\GlsXtrInternalLocationHyperlink

\GlsXtrInternalLocationHyperlink{⟨counter⟩}{⟨prefix⟩}

{⟨location⟩}

The first two arguments are always control sequences.

\newcommand*{\GlsXtrInternalLocationHyperlink}[3]{%

\glsxtrhyperlink{#1#2#3}{#3}%

}

\@glsxtr@wrglossary@locationhyperlink

\newcommand*{\@glsxtr@wrglossary@locationhyperlink}[3]{%

\pageref{wrglossary.#3}%

}

indexcounter Define thewrglossarycounter that’s incremented every time an entry is indexed, except for cross-references. This is designed for use withbib2glsv1.4+. It can work with the other indexing methods but it will interfere with the number list collation. This option automatically implementscounter=wrglossary.

Sinceglossariesautomatically loadsamsmath, there may be a problem if the indexing occurs in theequationenvironment, because only one\labelis allowed

(27)

in each instance of that environment. It’s best to change the counter when in maths mode.

\@glsxtr@declareoption{indexcounter}{%

\glsxtr@dooption{counter=wrglossary}%

\ifundef\c@wrglossary {%

\newcounter{wrglossary}%

\renewcommand{\thewrglossary}{\arabic{wrglossary}}%

}%

{}%

\renewcommand*{\glsxtr@inc@wrglossaryctr}[1]{%

Only increment if the current counter iswrglossary.

\ifdefstring\@gls@counter{wrglossary}%

{%

\refstepcounter{wrglossary}%

\label{wrglossary.\thewrglossary}%

\@@glsxtrwrglosscountermark{\thewrglossary}%

}%

{}%

}%

\renewcommand*{\GlsXtrInternalLocationHyperlink}[3]{%

\ifdefstring\glsentrycounter{wrglossary}%

{%

\@glsxtr@wrglossary@locationhyperlink{##1}{##2}{##3}%

}%

{\glsxtrhyperlink{##1##2##3}{##3}}%

}%

}

\@glsxtrwrglossmark Marks the place where indexing occurs. Does nothing by default.

\newcommand*{\@glsxtrwrglossmark}{}

\@@glsxtrwrglossmark Since \glsadd can be used in the preamble, this action needs to be disabled until the start of the document.

\newcommand*{\@@glsxtrwrglossmark}{}

\AtBeginDocument{\renewcommand*{\@@glsxtrwrglossmark}{\@glsxtrwrglossmark}}

\glsxtrwrglossmark

\newcommand*{\glsxtrwrglossmark}{\ensuremath{\cdot}}

\@glsxtrwrglosscountermark Marks the place where wrglossary counter is incremented. Does nothing by default.

\newcommand*{\@glsxtrwrglosscountermark}[1]{}

\@@glsxtrwrglosscountermark

\newcommand*{\@@glsxtrwrglosscountermark}[1]{}

\AtBeginDocument{\renewcommand*{\@@glsxtrwrglosscountermark}{\@glsxtrwrglosscountermark}}

(28)

\glsxtrwrglosscountermark

\newcommand*{\glsxtrwrglosscountermark}[1]{\glsshowtargetfonttext{[#1]}}

\@glsxtr@doshowtarget

\newcommand\@glsxtr@doshowtarget[2]{#2}

\glsxtrundefdebug Don’t do anything until after the document environment has begun.

\newcommand*{\glsxtrundefdebug}[1]{}

\@glsxtrundefdebug Use the same font as the targets.

\newcommand*{\@glsxtrundefdebug}[1]{%

\if@gls@debug \glsshowtargetfonttext{[#1]}\fi }

debug Provide extra debug options.

\define@choicekey{glossaries-extra.sty}{debug}

[\@glsxtr@debugval\@glsxtr@debugnr]%

{true,false,showtargets,showwrgloss,all,showaccsupp}[true]{%

\ifcase\@glsxtr@debugnr\relax % true

\glsxtr@dooption{debug=true}%

\renewcommand*{\@glsxtrwrglossmark}{}%

\renewcommand*{\@glsxtrwrglosscountermark}[1]{}%

\or % false

\glsxtr@dooption{debug=false}%

\renewcommand*{\@glsxtrwrglossmark}{}%

\renewcommand*{\@glsxtrwrglosscountermark}[1]{}%

\let\@glsxtr@doshowtarget\@secondoftwo

\or % showtargets

\glsxtr@dooption{debug=showtargets}%

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetleft}%

\or % showwrgloss

\glsxtr@dooption{debug=true}%

\renewcommand*{\@glsxtrwrglossmark}{\glsxtrwrglossmark}%

\renewcommand*{\@glsxtrwrglosscountermark}{\glsxtrwrglosscountermark}%

\or % all

\glsxtr@dooption{debug=true,debug=showaccsupp}%

% debug=showwrgloss:

\renewcommand*{\@glsxtrwrglossmark}{\glsxtrwrglossmark}%

\renewcommand*{\@glsxtrwrglosscountermark}{\glsxtrwrglosscountermark}%

% debug=showtargets:

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetleft}%

\or % showaccsupp

\glsxtr@dooption{debug=showaccsupp}%

\fi }

\glsxtrshowtargetouter

\newcommand*{\glsxtrshowtargetouter}{\glsshowtargetouter}

(29)

\glsxtrshowtargetinner

\newcommand*{\glsxtrshowtargetinner}[1]{\glsshowtargetinner{#1}}

Debugging show targets.

\@glsxtrshowtargetleft

\newcommand{\@glsxtrshowtargetleft}[2]{\@glsshowtarget{#1}#2\@glsxtrshowtargetmark}%

\@glsxtrshowtargetright

\newcommand{\@glsxtrshowtargetright}[2]{\@glsxtrshowtargetmark#2\@glsshowtarget{#1}}%

\@glsxtrshowtargetmark

\newcommand{\@glsxtrshowtargetmark}{}%

showtargets Implementsdebug=showtargetsand provides extra adjustments.

\define@choicekey{glossaries-extra.sty}{showtargets}

[\@glsxtr@showtargetsval\@glsxtr@showtargetsnr]%

{left,right,innerleft,innerright,annoteleft,annoteright}%

{%

\glsxtr@dooption{debug=showtargets}%

\ifcase\@glsxtr@showtargetsnr\relax

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetleft}%

\def\glsxtrshowtargetouter{\glsshowtargetouter}%

\def\glsxtrshowtargetinner{\glsshowtargetinner}%

\let\@glsxtrshowtargetmark\empty

\or

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetright}%

\def\glsxtrshowtargetouter{\glsshowtargetouter}%

\def\glsxtrshowtargetinner{\glsshowtargetinner}%

\let\@glsxtrshowtargetmark\empty

\or

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetleft}%

\def\glsxtrshowtargetouter{\glsxtrshowtargetinner}%

\def\glsxtrshowtargetinner{\glsshowtargetinnersymleft}%

\let\@glsxtrshowtargetmark\empty

\or

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetright}%

\def\glsxtrshowtargetouter{\glsxtrshowtargetinner}%

\def\glsxtrshowtargetinner{\glsshowtargetinnersymright}%

\let\@glsxtrshowtargetmark\empty

\or

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetleft}%

\def\glsxtrshowtargetouter{\glsxtrshowtargetinner}%

\def\glsxtrshowtargetinner{\glsshowtargetinnersymleft}%

\def\@glsxtrshowtargetmark{\@glsshowtargetmarkfmt\glsxtrshowtargetsymbolright}%

\or

\def\@glsxtr@doshowtarget{\@glsxtrshowtargetright}%

\def\glsxtrshowtargetouter{\glsxtrshowtargetinner}%

\def\glsxtrshowtargetinner{\glsshowtargetinnersymright}%

(30)

\def\@glsxtrshowtargetmark{\@glsshowtargetmarkfmt\glsxtrshowtargetsymbolleft}%

\fi }

Pass all other options toglossaries.

\glsxtr@processunknownoptions Need to compensate for the problem identified inhttps://www.dickimaw-books.

com/bugtracker.php?key=171

\newcommand*{\glsxtr@processunknownoptions}{}

\@ifpackageloaded{glossaries}

{%

\DeclareOptionX*{%

\edef\glsxtr@processunknownoptions{%

\noexpand\setupglossaries{\expandonce\CurrentOption}}}

} {%

\DeclareOptionX*{%

\expandafter\glsxtr@dooption\expandafter{\CurrentOption}}

}

Process options.

\ProcessOptionsX

Loadglossariesif not already loaded.

\RequirePackage{glossaries}

\glsxtr@processunknownoptions

Load theglossaries-accsupppackage if required.

\@glsxtr@doaccsupp

Load theglossaries-prefixpackage if required.

\@glsxtr@doloadprefix

Redefine\glspostdescriptionif required.

\@glsxtr@defpostpunc

\glsindexsetting This command was new to glossariesv4.50 so may not be defined. Note that record=only and record=nameref implement sort=none, which will change the default definition of\glsindexingsetting.

\let\@glsxtr@org@indexingsetting\glsindexingsetting

\providecommand{\glsindexingsetting}{\ifglsxindy xindy\else makeindex\fi}

\ifx\@glsxtr@org@indexingsetting\glsindexingsetting

\renewcommand{\glsindexingsetting}{%

\@glsxtr@if@record@only{bib2gls}{\ifglsxindy xindy\else makeindex\fi}%

}

\else

\@glsxtr@if@record@only{\renewcommand{\glsindexingsetting}{bib2gls}}{}%

\fi

The following commands are new to glossariesv4.50, so provide them if an older version is present.

(31)

\glssentencecase

\providecommand{\glssentencecase}[1]{\makefirstuc{#1}}

\glslowercase This uses \MakeTextLowercase because if \glslowercase isn’t defined then textcasehas been loaded and we might have an older kernel.

\providecommand{\glslowercase}[1]{\MakeTextLowercase{#1}}

\glsuppercase Not using\unexpanded because ditto the above.

\providecommand{\glsuppercase}[1]{\mfirstucMakeUppercase{#1}}

\@Glsentryfield

\providecommand{\@Glsentryfield}[2]{%

\glstexorpdfstring{\@Gls@entry@field{#1}{#2}}%

{\MFUsentencecase{\@gls@entry@field{#1}{#2}}}%

}

\glstexorpdfstring

\ifdef\glstexorpdfstring {}

{

\ifdef\texorpdfstring

{\newcommand{\glstexorpdfstring}{\texorpdfstring}}

{\newcommand{\glstexorpdfstring}[2]{#1}}

}

\@glsxtr@org@MakeUppercase Save the original definition of\MakeUppercasein case it needs to be restored.

\let\@glsxtr@org@MakeUppercase\MakeUppercase

If mfirstuc v2.08+ is installed, provide interface commands. The simplest method is to test the existence of \MFUsentencecase, which is provided by mfirstuc v2.08+ but also by glossaries v4.50+. So it may be defined because glossariesv4.50+ is installed, in which case \glsmfuexcl etc are also defined, but it may be defined becausemfirstucv2.08+ is installed but an older version of glossariesmay be present, in which case\glsmfuexcletc won’t be defined.

\ExplSyntaxOn

\ifdef\MFUsentencecase {%

Automatically identify exclusions, blockers and mappings.

\glsmfuexcl

\providecommand{\glsmfuexcl}[1]{\MFUexcl{#1}}

\glsmfublocker

\providecommand{\glsmfublocker}[1]{\MFUblocker{#1}}

\glsmfuaddmap

\providecommand{\glsmfuaddmap}[2]{\MFUaddmap{#1}{#2}}

(32)

Don’t alter\MakeUppercase

\@glsxtr@saveMakeUppercase

\newcommand{\@glsxtr@saveMakeUppercase}{}

\@glsxtr@restoreMakeUppercase

\newcommand{\@glsxtr@restoreMakeUppercase}{}

\@glsxtr@assignMakeUppercase

\newcommand{\@glsxtr@assignMakeUppercase}{}

} {

Provide\MFUsentencecasefor use where expandable contexts are required.

\MFUsentencecase

\providecommand{\MFUsentencecase}[1]{\text_titlecase_first:n{#1}}

Provide support for exclusions with\MFUsentencecase.

\glsmfuexcl

\providecommand{\glsmfuexcl}[1]{

\tl_if_in:NnF \l_text_case_exclude_arg_tl {#1}

{

\tl_put_right:Nn \l_text_case_exclude_arg_tl {#1}

} }

Just treat blockers and mappings as exclusions.

\glsmfublocker

\providecommand{\glsmfublocker}[1]{\glsmfuexcl{#1}}

\glsmfuaddmap

\providecommand{\glsmfuaddmap}[2]{\glsmfuexcl{#1}\glsmfublocker{#2}}

With old versions of mfirstuc, save and restore\MakeUppercasein the heading hooks.

\newcommand{\@glsxtr@saveMakeUppercase}{%

\let\@glsxtr@org@MakeUppercase\MakeUppercase }

\newcommand{\@glsxtr@restoreMakeUppercase}{%

\let\MakeUppercase\@glsxtr@org@MakeUppercase }

\newcommand{\@glsxtr@assignMakeUppercase}{%

\let\MakeUppercase\MakeTextUppercase }

}

(33)

Finished LATEX3 code.

\ExplSyntaxOff

\glsdoshowtarget Added to glossaries v4.50 so many not be defined. Need to redefine it so use

\def.

\def\glsdoshowtarget{\@glsxtr@doshowtarget}

\glsxtrshowtargetsymbolright

\newcommand{\glsxtrshowtargetsymbolright}{%

\ifmmode \mbox{\tiny$\triangleleft$}\else {\tiny$\triangleleft$}\fi }

\glsxtrshowtargetsymbolleft

\newcommand{\glsxtrshowtargetsymbolleft}{%

\ifmmode \mbox{\tiny$\triangleright$}\else {\tiny$\triangleright$}\fi }

\glsshowtargetinner Only added toglossariesin v4.50 so may not be defined.

\providecommand*{\glsshowtargetinner}[1]{\glsshowtargetfonttext{[#1]}}

\glsshowtargetfont Only added toglossariesin v4.45 so may not be defined.

\providecommand*{\glsshowtargetfont}{\ttfamily\footnotesize}

\glsshowtargetfonttext Text-block command that checks for math-mode. Only added to glossaries in v4.50 so may not be defined.

\providecommand*{\glsshowtargetfonttext}[1]{%

\ifmmode \nfss@text{\glsshowtargetfont #1}\else {\glsshowtargetfont #1}\fi }

\glsshowtargetinnersymleft

\newcommand*{\glsshowtargetinnersymleft}[1]{%

\glsshowtargetinner{#1}\allowbreak\glsxtrshowtargetsymbolleft}

\glsshowtargetinnersymright

\newcommand*{\glsshowtargetinnersymright}[1]{%

\glsxtrshowtargetsymbolright\allowbreak\glsshowtargetinner{#1}}

\glsshowtargetouter Only added toglossariesin v4.45 so may not be defined.

\providecommand*{\glsshowtargetouter}[1]{%

\glsshowtargetsymbol\marginpar{\glsshowtargetsymbol\glsshowtargetfont #1}}

\@glsshowtarget Only added toglossariesin v4.32 so may not be defined.

\providecommand*{\@glsshowtarget}[1]{}

\glsshowtarget This command was introduced to glossaries v4.32 so it may not be defined.

Therefore it’s defined here using\def. \glsshowtargetouterwas introduced inglossariesv4.45, so that also may not be defined.

\def\glsshowtarget#1{%

(34)

\glsxtrtitleorpdforheading {%

\ifmmode

\nfss@text{\glsxtrshowtargetinner{#1}}%

\else

\ifinner

\glsxtrshowtargetinner{#1}%

\else

\glsxtrshowtargetouter{#1}%

\fi

\fi }%

{[#1]}%

{{\protect\glsshowtargetinner{#1}}}%

}

\@glsshowtargetmarkfmt

\newcommand*{\@glsshowtargetmarkfmt}[1]{%

\glsxtrtitleorpdforheading {%

\ifmmode \nfss@text{#1}\else #1\fi }%

{}%

{\ifmmode \nfss@text{#1}\else #1\fi}%

}

\@glsxtr@org@doseeglossary Save original definition of \@do@seeglossary

\let\@glsxtr@org@doseeglossary\@do@seeglossary

\@glsxtr@doseeglossary This doesn’t increment the associated counter.

\newcommand*{\@glsxtr@doseeglossary}[2]{%

\glsdoifexists{#1}%

{%

\@@glsxtrwrglossmark

\@glsxtr@org@doseeglossary{#1}{#2}%

}%

}

\@glsxtr@dosee@alsoindex@glossary

\newcommand*{\@glsxtr@dosee@alsoindex@glossary}[2]{%

\@glsxtr@recordsee{#1}{#2}%

\@glsxtr@doseeglossary{#1}{#2}%

}

\@glsxtr@org@gloautosee Save and restore original definition of \@glo@autosee. (That command may not be defined as it was only introduced toglossaries v4.30, in which case the synonym won’t be defined either.)

\let\@glsxtr@org@gloautosee\@glo@autosee

(35)

Check if user triedautoseeindex=falsewhen it can’t be supported.

\if@glsxtr@autoseeindex

\else

\ifdef\@glsxtr@org@gloautosee {}%

{\PackageError{glossaries-extra}{‘autoseeindex=false’ package option requires at least v4.30 of glossaries.sty}%

{You need to update the glossaries.sty package}%

}

\fi

\@glo@autosee If\@glo@autoseehas been defined (glossariesv4.30 onwards), redefine it to test theautoseeindex option.

\ifdef\@glo@autosee {%

\renewcommand*{\@glo@autosee}{%

\if@glsxtr@autoseeindex\@glsxtr@org@gloautosee\fi}%

}%

{}

\gls@checkseeallowed Don’t prohibit the use of theseekey before the indexing files have been opened if the automatic see indexing has been disabled, since it’s no longer an issue.

\renewcommand*{\gls@checkseeallowed}{%

\if@glsxtr@autoseeindex\@gls@see@noindex\fi }

Define abbreviations glossaries if required.

\@glsxtr@abbreviationsdef

\let\@glsxtr@abbreviationsdef\relax Setup shortcuts if required.

\@glsxtr@setupshortcuts

Redefine\@glsxtr@redef@forglsentriesif required.

\@glsxtr@redef@forglsentries

\glossariesextrasetup Allow user to set options after the package has been loaded. First modify

\glsxtr@dooptionso that it now uses \setupglossaries:

\renewcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}%

Disable options that can only be used when the package is loaded:

\disable@keys{glossaries-extra.sty}{accsupp}

Now define the user command:

\newcommand*{\glossariesextrasetup}[1]{%

\let\glsxtr@setup@record\relax

\let\@glsxtr@setupshortcuts\relax

\let\@glsxtr@redef@forglsentries\relax

\let\@glsxtr@doloadprefix\relax

\setkeys{glossaries-extra.sty}{#1}%

(36)

\@glsxtr@abbreviationsdef

\let\@glsxtr@abbreviationsdef\relax

\@glsxtr@setupshortcuts

\glsxtr@setup@record

\@glsxtr@redef@forglsentries

\@glsxtr@doloadprefix }

\glsxtr@org@@do@wrglossary Save original definition of \@@do@wrglossary.

\let\glsxtr@org@@do@wrglossary\@@do@wrglossary

\glsxtr@@do@wrglossary The new version adds code that can show a marker for debugging and increments the associated counter if enabled.

\newcommand*{\glsxtr@@do@wrglossary}[1]{%

\@@glsxtrwrglossmark

\glsxtr@inc@wrglossaryctr{#1}%

\glsxtr@org@@do@wrglossary{#1}%

}

\glsxtr@saveentrycounter Save original definition of \@gls@saveentrycounter.

\let\glsxtr@saveentrycounter\@gls@saveentrycounter

\@gls@saveentrycounter Change\@gls@saveentrycounter so that it only stores the entry counter in- formation if the indexing is on.

\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter

\@xp@gls@getcounterprefix This command is provided byglossariesv4.50 so may not be defined. Provide a similar command in case the new version hasn’t been installed.

\providecommand*\@xp@gls@getcounterprefix[2]{%

\bgroup

\glswrglossdisableanchorcmds

\protected@edef\@do@gls@getcounterprefix{%

\noexpand\egroup

\noexpand\@gls@getcounterprefix{#1}{#2}%

}%

\@do@gls@getcounterprefix }

\glswrglossdisableanchorcmds

\providecommand{\glswrglossdisableanchorcmds}{\let\glstexorpdfstring\@secondoftwo}

\@gls@getcounterprefix This command is provided by the baseglossariespackage, but is redefined here.

The standard indexing methods don’t directly store the hypertarget but instead need to split it into the counter, prefix and location parts, which can be recon- stituted in the location list. Unfortunately, not all targets are in this form, so the links fail. Withrecord=nameref, the complete target name can be saved, so this modification adjusts the warning.

(37)

The expansion should now be performed in \@xp@gls@getcounterprefix.

Any commands that were using\@gls@getcounterprefixdirectly need to be use\@xp@gls@getcounterprefix instead.

\renewcommand*\@gls@getcounterprefix[2]{%

\def\@gls@thisloc{#1}\def\@gls@thisHloc{#2}%

\ifx\@gls@thisloc\@gls@thisHloc

\def\@glo@counterprefix{}%

\else

\def\@gls@get@counterprefix##1.#1##2\end@getprefix{%

\def\@glo@tmp{##2}%

\ifx\@glo@tmp\@empty

\def\@glo@counterprefix{}%

\else

\def\@glo@counterprefix{##1}%

\fi }%

\@gls@get@counterprefix#2.#1\end@getprefix Warn if no prefix can be formed, unlessrecord=nameref.

\ifx\@glo@counterprefix\@empty

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref

\else

\GlossariesExtraWarning{Hyper target ‘#2’ can’t be formed by prefixing^^Jlocation ‘#1’. You need to modify the

definition of \string\theH\@gls@counter^^Jotherwise you will get the warning: "‘name{\@gls@counter.#1}’ has been^^J referenced but does not exist"%

\ifx\@glsxtr@record@setting\@glsxtr@record@setting@only . You may want to consider using record=nameref instead%

\fi}%

\fi

\fi

\fi }

Provide script dialect hook (does nothing unless redefined byglossaries-extra- bib2gls).

\@glsxtrdialecthook

\newcommand*{\@glsxtrdialecthook}{}

Set up record option if required.

\glsxtr@setup@record

Disable preamble-only options and switch on the undefined tag at the start of the document.

\AtBeginDocument{%

\disable@keys{glossaries-extra.sty}{abbreviations,docdef,record}%

\def\glsxtrundefdebug{\@glsxtrundefdebug}%

\def\@glsxtrundeftag{\glsxtrundeftag}%

}

(38)

1.2 Extra Utilities

\GlsXtrIfUnusedOrUndefined

\GlsXtrIfUnusedOrUndefined{⟨label⟩}{⟨true⟩}{⟨false⟩}

Does⟨true⟩if the entry given by⟨label⟩is either undefined or hasn’t been used (or has had the first use flag reset).

\newcommand*{\GlsXtrIfUnusedOrUndefined}[3]{%

\ifglsentryexists{#1}%

{\ifbool{glo@\glsdetoklabel{#1}@flag}{#3}{#2}}%

{#2}%

}

Starred form of \ifglossaryexistswas only introduced toglossariesv4.46 so provide it if it hasn’t been defined.

\ifdef\s@ifglossaryexists {}

{

\ifglossaryexists

\renewcommand{\ifglossaryexists}{%

\@ifstar\s@ifglossaryexists\@ifglossaryexists }

\@ifglossaryexists

\newcommand{\@ifglossaryexists}[3]{%

\ifcsundef{@glotype@#1@out}{#3}{#2}%

}

\s@ifglossaryexists

\newcommand{\s@ifglossaryexists}[3]{%

\ifcsundef{glolist@#1}{#3}{#2}%

} }

\glsxtrifemptyglossary

\glsxtrifemptyglossary{⟨type⟩}{⟨true⟩}{⟨false⟩}

Provide command to determine if any entries have been added to the glossary (where the glossary label is provided in the first argument). The entries are stored in the comma-separated list \glolist@⟨type⟩. If this hasn’t been de- fined, the glossary doesn’t exist. If it has been defined and is simply a comma, the glossary exists and is empty. (It’s initialised to a comma.)

\newcommand{\glsxtrifemptyglossary}[3]{%

\ifcsdef{glolist@#1}%

{%

\ifcsstring{glolist@#1}{,}{#2}{#3}%

(39)

}%

{%

\glsxtrundefaction{Glossary type ‘#1’ doesn’t exist}{}%

#2%

}%

}

\GlsXtrIfInGlossary

\GlsXtrIfInGlossary{⟨label⟩}{⟨type⟩}{⟨true⟩}{⟨false⟩}

Test if the given entry is in the given glossary list. This may not correspond to thetypekey as the entry may have been copied to the list. Does⟨false⟩and issues warning if the glossary doesn’t exist.

\newcommand*{\GlsXtrIfInGlossary}[4]{%

\ifcsdef{glolist@#2}%

{%

\protected@edef\@glsxtr@tmp{#1}%

\letcs\@glsxtr@tmplist{glolist@#2}%

\expandafter\DTLifinlist\expandafter{\@glsxtr@tmp}{\@glsxtr@tmplist}%

{#3}{#4}%

}%

{%

\glsxtrundefaction{Glossary type ‘#1’ doesn’t exist}{}%

#4%

}%

}

\glsxtrifkeydefined Tests if the key given in the first argument has been defined.

\newcommand*{\glsxtrifkeydefined}[3]{%

\key@ifundefined{glossentry}{#1}{#3}{#2}%

}

\glsxtrprovidestoragekey Like\glsaddstoragekeybut does nothing if the key has already been defined.

\newcommand*{\glsxtrprovidestoragekey}{%

\@ifstar\@sglsxtr@provide@storagekey\@glsxtr@provide@storagekey }

\@glsxtr@provide@storagekey Unstarred version.

\newcommand*{\@glsxtr@provide@storagekey}[3]{%

\key@ifundefined{glossentry}{#1}%

{%

\define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}%

\appto\@gls@keymap{,{#1}{#1}}%

\appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}%

\appto\@newglossaryentryposthook{%

\letcs{\@glo@tmp}{@glo@#1}%

\gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}%

}%

(40)

Allow the user to omit the user level command if they only intended fetching the value with\glsxtrusefield

\ifblank{#3}

{}%

{%

\newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%

}%

}%

{%

Provide the no-link command if not already defined.

\ifblank{#3}

{}%

{%

\providecommand*{#3}[1]{\@gls@entry@field{##1}{#1}}%

}%

}%

}

\s@glsxtr@provide@storagekey Starred version.

\newcommand*{\s@glsxtr@provide@storagekey}[1]{%

\key@ifundefined{glossentry}{#1}%

{%

\expandafter\newcommand\expandafter*\expandafter {\csname gls@assign@#1@field\endcsname}[2]{%

\@@gls@expand@field{##1}{#1}{##2}%

}%

}%

{}%

\@glsxtr@provide@addstoragekey{#1}%

}

The name of a text-block control sequence can be stored in a field (given by \GlsXtrFmtField). This command can then be used with \glsxtrfmt [⟨options⟩]{⟨label⟩}{⟨text⟩}which effectively does\glslink[⟨options⟩]{⟨label⟩}{⟨cs⟩

{⟨text⟩}} If the field hasn’t been set for that entry just⟨text⟩is done.

\GlsXtrFmtField

\newcommand{\GlsXtrFmtField}{useri}

\GlsXtrFmtDefaultOptions

\newcommand{\GlsXtrFmtDefaultOptions}{noindex}

\glsxtrfmt

\glsxtrfmt[⟨options⟩]{⟨entry-label⟩}{⟨text⟩}[⟨insert⟩]

The post-link hook isn’t done. This now has a starred form that checks for a final optional argument.

\newrobustcmd*{\glsxtrfmt}{\@ifstar\s@glsxtrfmt\@glsxtrfmt}

(41)

\@glsxtrfmt Unstarred form.

\newcommand*{\@glsxtrfmt}[3][]{\@@glsxtrfmt{#1}{#2}{#3}{}}

\s@glsxtrfmt Starred form.

\newcommand*{\s@glsxtrfmt}[3][]{%

\new@ifnextchar[{\s@@glsxtrfmt{#1}{#2}{#3}}%

{\@@glsxtrfmt{#1}{#2}{#3}{}}%

}

\s@@glsxtrfmt Pick up final optional argument.

\def\s@@glsxtrfmt#1#2#3[#4]{\@@glsxtrfmt{#1}{#2}{#3}{#4}}

\@@glsxtrfmt Actual inner working.

\newcommand*{\@@glsxtrfmt}[4]{%

Since there’s no post-link hook to worry about, grouping can be added to pro- vide some protection against nesting (but in general nested link text should be avoided).

\begingroup

\def\glslabel{#2}%

\glsdoifexistsordo{#2}%

{%

\ifglshasfield{\GlsXtrFmtField}{#2}%

{%

\let\do@gls@link@checkfirsthyper\relax

\expandafter\@gls@link\expandafter[\GlsXtrFmtDefaultOptions,#1]{#2}%

{\glsxtrfmtdisplay{\glscurrentfieldvalue}{#3}{#4}}%

}%

{\glsxtrfmtdisplay{@firstofone}{#3}{#4}}%

}%

{%

Has the default noindexbeen counteracted? If so, this needs\glsadd in case bib2glsneeds to pick up the record.

\begingroup

\@gls@setdefault@glslink@opts

\setkeys{glslink}{\GlsXtrFmtDefaultOptions,#1}%

\ifKV@glslink@noindex\else\glsadd{#2}\fi

\endgroup

\glsxtrfmtdisplay{@firstofone}{#3}{#4}%

}%

\endgroup }

\Glsxtrfmt

\Glsxtrfmt[⟨options⟩]{⟨entry-label⟩}{⟨text⟩}[⟨insert⟩]

As\glsxtrfmt but applies a sentence-case change to ⟨text⟩. This is provided to allow a mapping withmfirstuc v2.08+ in the event that an automated case- change is required.

References

Related documents

Where councils apply more stringent rules, the overall status of the activity may change so that even if a forestry activity complies with NESPF permitted activity conditions

disadvantage have special resonance for the Australian Aboriginal community, where the construct, the best interests of the child, has been applied and has resulted in an

production down whilst finding more innovative ways to add value to keep profits up. This will mean that at least the same, and probably more, will need to be spent on R&D in the

The Swedish school authorities have drawn attention to this work and designated the school ‘the best school in Sweden working for equal value 2008’. Student empowerment, child’s

Socialisation processes proposed in this model which is expected to effect adolescents’ knowledge, attitudes and behaviour towards OTC are communication with family,

This optional argument can be used to enable the setting of the driver counter value as well as the associated counter values at once.... Description of arguments of

Again there is an optional argument to indicate a label and each equa- tion is separated by a “\\” or “\\*” command, as for the

For \ddotsDeduce, move lower box right; for \dotsdDeduce, move upper box right; then set \curCenter to align with horizontal center of dots.

The package modifies the L A TEX kernel command \pagenumbering so that it has an optional argument; all the kernel-defined numbering styles ignore the optional argument, but if

The findings of this present study provide empirical evidence of; adolescents’ OTCs usage, the process by which they learn to become consumers of OTCs, the effect of their

and connections with number theory.. theorem ( Thurston )

However, a complex classics citation command created by \newclassic can be used within the optional argument to \cite only if it is enclosed in braces. \cite [{\Homer{hbook

Sessional Com m ittee on the Environm ent 79.. A strong research and development effort, particularly into the integration of control methods, is essential to the

The \rollaway macro works exactly like most macros here: It takes a single optional argument, and the star version rewords things a bit (it takes no count argument since that’s always

The process for the Board hearing applications for review of decisions by the Economic Regulation Authority and the Minister under the Electricity Industry Act 2004 refl ects

The preexisting macro from the doc package is redefined to create hyperlinked index entries, include an optional class, and also to place an ‘Env’ tag in front of the name in

This command is used in the definition of \glsxtrshort and in some of the predefined abbreviation styles to format the short value of the entry identified by hentry-labeli with

subentrycounter Define a counter that can be used in the standard glossary styles to number each level 1 entry.. If true, this will define a counter

Note that glossaries-extra provides an extra indexing option ( bib2gls ) which isn’t available with just the base glossaries package.. If you require multilingual support you must

(You don’t need the symbols package option in this case, unless you want a separate symbols list.) The corresponding document (where the definition is in the file entries.bib) is

When converting a document that currently uses the obsolete glossary package to the re- placement glossaries package, it should be fairly obvious that the first thing you need to do

format htexti according to specifications, add formatted index sub-entry to the main index entry hmain entryi , sorted according to hsort idxi or, if the optional argument is left

Finally, the \printindex command is used in your L A TEX document to indicate where the file foo.idx should be inserted, i.e., where the index should appear in your document.. The