From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/glossaries-extra/CHANGES | 1044 + macros/latex/contrib/glossaries-extra/README | 28 + .../glossaries-extra/glossaries-extra-code.pdf | Bin 0 -> 898453 bytes .../glossaries-extra/glossaries-extra-manual.html | 29815 +++++++++++++++++ .../glossaries-extra/glossaries-extra-manual.pdf | Bin 0 -> 787643 bytes .../glossaries-extra/glossaries-extra-manual.tex | 12125 +++++++ .../contrib/glossaries-extra/glossaries-extra.dtx | 33306 +++++++++++++++++++ .../contrib/glossaries-extra/glossaries-extra.ins | 57 + .../samples/sample-abbr-styles.pdf | Bin 0 -> 512876 bytes .../samples/sample-abbr-styles.tex | 430 + .../glossaries-extra/samples/sample-abbrv.pdf | Bin 0 -> 44761 bytes .../glossaries-extra/samples/sample-abbrv.tex | 36 + .../glossaries-extra/samples/sample-accsupp.pdf | Bin 0 -> 82623 bytes .../glossaries-extra/samples/sample-accsupp.tex | 124 + .../samples/sample-acronym-desc.pdf | Bin 0 -> 50368 bytes .../samples/sample-acronym-desc.tex | 43 + .../glossaries-extra/samples/sample-acronym.pdf | Bin 0 -> 36745 bytes .../glossaries-extra/samples/sample-acronym.tex | 30 + .../glossaries-extra/samples/sample-alias.pdf | Bin 0 -> 43875 bytes .../glossaries-extra/samples/sample-alias.tex | 48 + .../samples/sample-altmodifier.pdf | Bin 0 -> 35308 bytes .../samples/sample-altmodifier.tex | 32 + .../samples/sample-alttree-marginpar.pdf | Bin 0 -> 91061 bytes .../samples/sample-alttree-marginpar.tex | 100 + .../samples/sample-alttree-sym.pdf | Bin 0 -> 69498 bytes .../samples/sample-alttree-sym.tex | 60 + .../glossaries-extra/samples/sample-alttree.pdf | Bin 0 -> 54848 bytes .../glossaries-extra/samples/sample-alttree.tex | 23 + .../samples/sample-autoindex-hyp.pdf | Bin 0 -> 141700 bytes .../samples/sample-autoindex-hyp.tex | 129 + .../glossaries-extra/samples/sample-autoindex.pdf | Bin 0 -> 161138 bytes .../glossaries-extra/samples/sample-autoindex.tex | 127 + .../glossaries-extra/samples/sample-crossref.pdf | Bin 0 -> 41294 bytes .../glossaries-extra/samples/sample-crossref.tex | 22 + .../glossaries-extra/samples/sample-crossref2.pdf | Bin 0 -> 41613 bytes .../glossaries-extra/samples/sample-crossref2.tex | 32 + .../glossaries-extra/samples/sample-docdef.pdf | Bin 0 -> 45257 bytes .../glossaries-extra/samples/sample-docdef.tex | 28 + .../glossaries-extra/samples/sample-entrycount.pdf | Bin 0 -> 54623 bytes .../glossaries-extra/samples/sample-entrycount.tex | 44 + .../glossaries-extra/samples/sample-external.pdf | Bin 0 -> 34187 bytes .../glossaries-extra/samples/sample-external.tex | 38 + .../glossaries-extra/samples/sample-fmt.pdf | Bin 0 -> 75268 bytes .../glossaries-extra/samples/sample-fmt.tex | 58 + .../glossaries-extra/samples/sample-footnote.pdf | Bin 0 -> 63232 bytes .../glossaries-extra/samples/sample-footnote.tex | 30 + .../glossaries-extra/samples/sample-header.pdf | Bin 0 -> 125912 bytes .../glossaries-extra/samples/sample-header.tex | 73 + .../glossaries-extra/samples/sample-indexhook.pdf | Bin 0 -> 42722 bytes .../glossaries-extra/samples/sample-indexhook.tex | 42 + .../samples/sample-initialisms.pdf | Bin 0 -> 81618 bytes .../samples/sample-initialisms.tex | 70 + .../glossaries-extra/samples/sample-linkcount.pdf | Bin 0 -> 38234 bytes .../glossaries-extra/samples/sample-linkcount.tex | 44 + .../samples/sample-mixed-abbrv-styles.pdf | Bin 0 -> 57823 bytes .../samples/sample-mixed-abbrv-styles.tex | 25 + .../glossaries-extra/samples/sample-mixedsort.pdf | Bin 0 -> 45154 bytes .../glossaries-extra/samples/sample-mixedsort.tex | 35 + .../glossaries-extra/samples/sample-mixture.pdf | Bin 0 -> 159578 bytes .../glossaries-extra/samples/sample-mixture.tex | 344 + .../glossaries-extra/samples/sample-name-font.pdf | Bin 0 -> 202110 bytes .../glossaries-extra/samples/sample-name-font.tex | 355 + .../glossaries-extra/samples/sample-nested.pdf | Bin 0 -> 67736 bytes .../glossaries-extra/samples/sample-nested.tex | 46 + .../samples/sample-noidx-restricteddocdefs.pdf | Bin 0 -> 47582 bytes .../samples/sample-noidx-restricteddocdefs.tex | 33 + .../glossaries-extra/samples/sample-onelink.pdf | Bin 0 -> 44455 bytes .../glossaries-extra/samples/sample-onelink.tex | 49 + .../samples/sample-onthefly-utf8.pdf | Bin 0 -> 106071 bytes .../samples/sample-onthefly-utf8.tex | 60 + .../samples/sample-onthefly-xetex.pdf | Bin 0 -> 19859 bytes .../samples/sample-onthefly-xetex.tex | 55 + .../glossaries-extra/samples/sample-onthefly.pdf | Bin 0 -> 43481 bytes .../glossaries-extra/samples/sample-onthefly.tex | 50 + .../glossaries-extra/samples/sample-pages.pdf | Bin 0 -> 38801 bytes .../glossaries-extra/samples/sample-pages.tex | 34 + .../glossaries-extra/samples/sample-postdot.pdf | Bin 0 -> 37059 bytes .../glossaries-extra/samples/sample-postdot.tex | 47 + .../glossaries-extra/samples/sample-postlink.pdf | Bin 0 -> 67890 bytes .../glossaries-extra/samples/sample-postlink.tex | 76 + .../glossaries-extra/samples/sample-prefix.pdf | Bin 0 -> 33119 bytes .../glossaries-extra/samples/sample-prefix.tex | 24 + .../samples/sample-record-nameref.pdf | Bin 0 -> 71315 bytes .../samples/sample-record-nameref.tex | 74 + .../glossaries-extra/samples/sample-record.pdf | Bin 0 -> 50230 bytes .../glossaries-extra/samples/sample-record.tex | 51 + .../samples/sample-restricteddocdefs.pdf | Bin 0 -> 47895 bytes .../samples/sample-restricteddocdefs.tex | 33 + .../glossaries-extra/samples/sample-suppl-hyp.pdf | Bin 0 -> 34944 bytes .../glossaries-extra/samples/sample-suppl-hyp.tex | 29 + .../samples/sample-suppl-main-hyp.pdf | Bin 0 -> 46402 bytes .../samples/sample-suppl-main-hyp.tex | 30 + .../glossaries-extra/samples/sample-suppl-main.pdf | Bin 0 -> 31607 bytes .../glossaries-extra/samples/sample-suppl-main.tex | 18 + .../glossaries-extra/samples/sample-suppl.pdf | Bin 0 -> 13423 bytes .../glossaries-extra/samples/sample-suppl.tex | 14 + .../glossaries-extra/samples/sample-trans.pdf | Bin 0 -> 49455 bytes .../glossaries-extra/samples/sample-trans.tex | 54 + .../glossaries-extra/samples/sample-undef.pdf | Bin 0 -> 33231 bytes .../glossaries-extra/samples/sample-undef.tex | 21 + .../samples/sample-unitentrycount.pdf | Bin 0 -> 61051 bytes .../samples/sample-unitentrycount.tex | 90 + .../contrib/glossaries-extra/samples/sample.pdf | Bin 0 -> 45747 bytes .../contrib/glossaries-extra/samples/sample.tex | 26 + 104 files changed, 79711 insertions(+) create mode 100644 macros/latex/contrib/glossaries-extra/CHANGES create mode 100644 macros/latex/contrib/glossaries-extra/README create mode 100644 macros/latex/contrib/glossaries-extra/glossaries-extra-code.pdf create mode 100644 macros/latex/contrib/glossaries-extra/glossaries-extra-manual.html create mode 100644 macros/latex/contrib/glossaries-extra/glossaries-extra-manual.pdf create mode 100644 macros/latex/contrib/glossaries-extra/glossaries-extra-manual.tex create mode 100644 macros/latex/contrib/glossaries-extra/glossaries-extra.dtx create mode 100644 macros/latex/contrib/glossaries-extra/glossaries-extra.ins create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-abbrv.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-abbrv.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-accsupp.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-accsupp.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-acronym.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-acronym.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alias.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alias.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alttree.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-alttree.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-autoindex.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-autoindex.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-crossref.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-crossref.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-crossref2.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-crossref2.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-docdef.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-docdef.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-entrycount.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-entrycount.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-external.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-external.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-fmt.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-fmt.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-footnote.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-footnote.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-header.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-header.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-indexhook.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-indexhook.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-initialisms.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-initialisms.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-linkcount.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-linkcount.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-mixture.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-mixture.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-name-font.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-name-font.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-nested.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-nested.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onelink.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onelink.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onthefly.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-onthefly.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-pages.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-pages.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-postdot.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-postdot.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-postlink.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-postlink.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-prefix.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-prefix.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-record.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-record.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-suppl.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-trans.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-trans.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-undef.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-undef.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.tex create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample.pdf create mode 100644 macros/latex/contrib/glossaries-extra/samples/sample.tex (limited to 'macros/latex/contrib/glossaries-extra') diff --git a/macros/latex/contrib/glossaries-extra/CHANGES b/macros/latex/contrib/glossaries-extra/CHANGES new file mode 100644 index 0000000000..922ea958be --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/CHANGES @@ -0,0 +1,1044 @@ +1.41 (2019-04-09): + + * glossary-topic.sty: + + - added command \glstopicSubPreLocSep and moved \space + from \glstopicSubLoc to \glstopicSubPreLocSep + + - added check for description in \glstopicSubItem + + - moved \par from \glstopicSubItem to \glstopicAssignSubIndent + + * glossaries-extra-stylemods.sty: + + - added \glstreePreHeader + + - added check for description in \glsxtralttreeSymbolDescLocation + + - added \glstreeDescLoc and \glstreeChildDescLoc + + - \glsxtralttreeSymbolDescLocation now checks if the description + field is set + + - added \glslistgroupskip + +1.40 (2019-03-31): + + * glossaries-extra.sty: + + - corrected formatting for abbreviation + style 'long-hyphen-noshort-noreg' + + - changed definition of \glsfirstabbrvdefaultfont to use + \glsabbrvdefaultfont instead of \glsabbrvfont for + consistency + + - new: \GlsXtrDefaultResourceOptions + + * glossaries-extra-bib2gls.sty: + + - new commands provided if associated glossary has been defined: + \printunsrtabbreviations + \printunsrtsymbols + \printunsrtnumbers + \printunsrtacronyms + \printunsrtindex + + * glossary-topic.sty: + + - new package providing glossary styles 'topic' and 'topicmcols' + +1.39 (2018-03-22) + + * glossaries-extra.sty: + + - Added example-glossaries-symbolnames.bib + (corresponds to sample example-glossaries-symbolnames.tex + file provided by glossaries.sty) + + - Added starred versions of: + + \GlsXtrIfFieldEqStr + \GlsXtrIfFieldEqXpStr + \GlsXtrIfXpFieldEqXpStr + \GlsXtrIfFieldCmpNum + \GlsXtrIfFieldEqNum + \GlsXtrIfFieldNonZero + + - New command: \glsxtrentryparentname + + - New command: \glsxtrsetglossarylabel and 'label' key + for 'printgloss' family. + + - bug fix: added protection against fragile/non-expandable + commands in location within \@glsxtr@dorecord + + - bug fix: corrected short-nolong-desc, short-sc-nolong-desc, + short-sm-nolong-desc, short-em-desc (and their synonyms) + to behave as advertised in the manual. (That is, + name={short (long)} and description key must be supplied.) + + * glossary-bookindex.sty: + + - added: \glsxtrbookindexlocation, \glsxtrbookindexsublocation + +1.38 (2018-12-01) + + * glossary-longextra.sty + + - bug fix: \glslongextraNameFmt + +1.37 (2018-11-30) + + * glossaries-extra.sty + + - added record=nameref option + + - added equations and floats options + + - added \glsxtrhiername, \Glsxtrhiername, \GlsXtrhiername, + \GLSxtrhiername, \GLSXTRhiername and \glsxtrhiernamesep + + - added \GlsXtrStandaloneEntryName and \GlsXtrStandaloneEntryOther + + - added \GlsXtrLocationField + + - added \GlsXtrAutoAddOnFormat + + - added \glsxtridentifyglslike + + - added \GLSxtrusefield + + - bug fix: corrected \Glsxtrusefield + + * glossaries-extra-bib2gls.sty + + - added \glsxtrdisplaylocnameref, \glsxtrfmtinternalnameref + and \glsxtrfmtexternalnameref + + - added \glsxtrSetWidest and \glsxtrSetWidestFallback + + - added \glsxtraddlabelprefix, \glsxtrprependlabelprefix, + \glsxtrclearlabelprefixes, \glsxtrifinlabelprefixlist, + \dgls, \dglspl, \dGls, \dGlspl, \dGLS, \dGLSpl, + \dglslink, \dglsdisp + + - added \glsrenewcommand + + * glossary-longextra.sty + + - new package providing additional longtable glossary styles + +1.36 (2018-08-18) + + * glossaries-extra-bib2gls.sty + + - added \glsxtrdisplaysupploc and \glsxtrmultisupplocation for use + with bib2gls version 1.7+. + + * glossaries-extra.sty + + - added \glsxtrautoindexesc + +1.35 (2018-08-13) + + * fixed bug in \glslink + +1.34 (2018-07-29): + + * glossaries-extra.sty + + - added package option docdef=atom (behaves like docdef=restricted + but creates the .glsdefs file for atom's autocomplete support). + + - added \GlsXtrIfUnusedOrUndefined + +1.33 (2018-07-26): + + * glossaries-extra.sty: + + - bug fix: added check for existence in \ifglsused + +1.32 (2018-05-24): + + * glossaries-extra.sty: + + - added \GlsXtrForeignText, \GlsXtrForeignTextField + and \GlsXtrUnknownDialectWarning + +1.31 (2018-05-09): + + * glossaries-extra.sty: + + - added \glsdefpostlink, \glsdefpostname, \glsdefpostdesc + + - added \glsxtrpostlinkAddSymbolDescOnFirstUse + + - added \glslocalreseteach and \glslocalunseteach + + - added \glsaddeach + + - added \GlsXtrIfFieldEqXpStr, \GlsXtrIfXpFieldEqXpStr + \GlsXtrIfFieldNonZero, \GlsXtrIfFieldEqNum and + \GlsXtrIfFieldCmpNum + + - added \GlsXtrForUnsetBufferedList + + - added starred version \GlsXtrStartUnsetBuffering* + + - added prefix key to the glslink and printgloss families + + - added support for accessibility attributes: + accessinsertdots, accessaposplural, accessnoshortplural, + nameshortaccess, firstshortaccess, textshortaccess + + - added \GlsXtrStandaloneGlossaryType and + \GlsXtrStandaloneSubEntryItem + + - added \glsxtrRevertTocMarks + + - added warning if \printglossary is used with record=only + + - bug fix: corrected targetnameprefix + + * glossaries-extra-bib2gls.sty: + + - added \glscapturedgroup + + - added \GlsXtrIfHasNonZeroChildCount + + * glossaries-extra-stylemods.sty: + + - added: + + \glstreedefaultnamefmt + \glstreenonamedesc + \glstreenonamesymbol + \glstreenonamechilddesc + \glstreedesc + \glstreesymbol + \glstreechilddesc + \glstreechildsymbol + \glslistdesc + +1.30 (2018-04-25): + + * glossaries-extra.sty: + + - added \glsuserdescription (now used by long-short-user + and short-long-user abbreviation styles) + + - added \glsaddpresetkeys and \glsaddpostsetkeys + + - added \GlsXtrStartUnsetBuffering and + \GlsXtrStopUnsetBuffering + + - added \GlsXtrExpandedFmt + + - added \glsxtrabbreviationfont + + - added textformat key for commands like \glslink, \gls etc + + - bug fix: added \@glsxtr@record to \glsxtrfull, + \glsxtrshort, \glsxtrlong and variants + + - bug fix: added check for counter=wrglossary + in \glsxtr@inc@wrglossaryctr + + * glossaries-extra-bib2gls.sty: + + - new commands: + + \GlsXtrDualField + \GlsXtrDualBackLink + +1.29 (2018-04-09): + + * glossaries-extra-bib2gls.sty: + + - new commands: + + \GlsXtrBibTeXEntryAliases + \GlsXtrProvideBibTeXFields + \glsxtr@wrglossarylocation + \GlsXtrIndexCounterLink + + * glossaries-extra.sty: + + - added package option 'indexcounter' + + - bug fix: \glsxtrfieldforlistloop (corrected argument order) + + - added check for \gls@begindocdefs + + - added expansion in \@gls@removespaces + +1.28 (2018-03-06): + + * glossaries-extra.sty: + + - bug fix: \glsxtrsetgrouptitle and \glsxtrlocalsetgrouptitle + changed \csxdef/\csedef to \protected@csxdef and + \protected@csedef, respectively + + - \glsxtredeffield now uses \protected@csedef instead + of \csedef + +1.27 (2018-02-26): + + * added supplementary package glossaries-extra-bib2gls.sty + (automatically loaded by the record=only package option) + +1.26 (2018-01-05): + + * glossaries-extra.sty: + + - added \GlsXtrEnableLinkCounting and associated commands. + + - added \glslinkpresetkeys + +1.25 (2017-11-24) + + * glossaries-extra.sty: + + - added: \glsxtronlyname, \glsxtrlongshortname, + \glsxtrshortlongname, \glsxtrfootnotename, + \glsxtrshortnolongname, \glsxtrlongnoshortdescname, + \glsxtrlongnoshortname, \glsxtrlongshortuserdescname, + \glsxtrshortlonguserdescname + + - added \glsextrapostnamehook + + - \glsxtrpostlinkAddDescOnFirstUse and + \glsxtrpostlinkAddSymbolOnFirstUse now use \glsxtrparen instead + of hard-coded parentheses. + + * glossary-bookindex.sty: + + - added \glsxtrbookindexmulticolsenv + +1.24 (2017-11-14): + + * glossaries-extra-manual.tex: + + - corrected syntax of \glsxtrifhasfield and \GlsXtrIfFieldEqStr + (first argument is field, second is entry label) + + * glossaries-extra.sty: + + - added \glsxtrforcsvfield + + - added \glsxtrlocalsetgrouptitle + + - bug fix (\glsadd breaks with sort=use) + +1.23 (2017-11-12): + + * glossaries-extra.sty: + + - added \glsxtrrestorepostpunc + + - added \GlsXtrIfFieldUndef + + - added \glsxtrifcustomdiscardperiod + + - added starred form of \glsxtrfmt + + - bug fix: added missing label in \@glsxtrentryfmt + + - fixed shortcuts=all / true option + (\newabbr now defined with \providecommand) + + * glossaries-extra-stylemods.sty: + + - added \glsupdatewidest, \gglsupdatewidest, \eglsupdatewidest + and \xglsupdatewidest + +1.22 (2017-11-08): + + * glossaries-extra.sty: + + - \glsseeitemformat: added check for short field + + - added \glossentrynameother and \glsxtrglossentryother + + - added \glsxtrnopostpunc and \glsxtractivatenopost + + * glossary-bookindex.sty: + + - removed \ifglsnopostdot check from \glsxtrbookindexprelocation + (inappropriate as bookindex style doesn't display the + description) + +1.21 (2017-11-03): + + * glossaries-extra.sty: + + - fixed shortcuts=ac and shortcuts=none settings + + - new package option postpunc + + - added extra debug settings (debug=showwrgloss and debug=all) + + - modified \glsseeitemformat + + - new commands: \glsuseabbrvfont and \glsuselongfont + + - new command \glsxtrglossentry + + - new commands: \ifglsxtr@hyperoutside and + \glsxtrinithyperoutside and associated key hyperoutside + and category attribute hyperoutside. + + - new attribute textformat + + - patched \glsnavhyperlink + + - \glsenablehyper and \glsdisablehyper now use \def rather + than \let to allow for redefinitions of \glsdohyperlink etc + + - added \@glsxtr@checkgroup (letter group check is now + in \@print@unsrt@glossary during the construction of + \@glsxtr@doglossary to avoid complications caused + by the tabular-like styles) + + - added \glshex, \glsxtrresourceinit + + - added \GlsXtrTotalRecordCount, \GlsXtrRecordCount, + \GlsXtrLocationRecordCount, \glsxtrdetoklocation, + \glsxtrenablerecordcount, \glsxtrrecordtriggervalue, + \GlsXtrSetRecordCountAttribute, \glsxtrifrecordtrigger + + - added \rgls, \rglspl, \rGls, \rGlspl, \rGLS, \rGLSpl, + \rglsformat, \rglsplformat, \rGlsformat, \rGlsplformat, + \rGLSformat, \rGLSplformat + + - added \glsxtrnewgls, \glsxtrnewglslike, \glsxtrnewrgls, + \glsxtrnewrglslike + + - added \printunsrtglossaryentryprocesshook, + \printunsrtglossaryskipentry, + \printunsrtglossarypredoglossary, + \glsxtriflabelinlist + + - added \GlsXtrIfFieldEqStr + + - new abbreviation styles: nolong-short, nolong-short-noreg, + nolong-short-sm, nolong-short-sc + + * glossary-bookindex.sty: new + + * glossaries-extra-stylemods.sty: + + - added package option "all" + + - added \glsxtrprelocation + + - added \glstreeprelocation and \glstreechildprelocation + + - added \glslistprelocation, \glslistchildprelocation, + and \glslistchildpostlocation + + - patched indexgroup, indexhypergroup, treegroup, + treehypergroup, treenonamegroup, treenonamehypergroup, + alttreegroup, alttreehypergroup, mcolindexgroup, + mcolindexhypergroup, mcolindexspannav, mcoltreegroup, + mcoltreehypergroup, mcoltreespannav, mcoltreenonamegroup, + mcoltreenonamehypergroup, mcoltreenonamespannav, + mcolalttreegroup, mcolalttreehypergroup, mcolalttreespannav, + listgroup, listhypergroup, altlistgroup, altlisthypergroup + styles to discourage page breaks after + letter group headings. + + - added \gglssetwidest + + - ensured that all tabular-like styles have the + \ifglsnogroupskip moved outside of the definition + of \glsgroupskip + +1.20 (2017-09-11): + + * New 'printgloss' key targetnameprefix + + * Corrected .ins to remove default preamble and postamble + from .bib files + +1.19 (2017-09-08): + + * New command: \GlsXtrSetDefaultNumberFormat + + * New command: \glsxtrhyperlink + + * New command: \glsxtrifhasfield + + * Added thevalue and theHvalue keys to \glslink etc + + * Bug fixes for record=only and record=alsoindex options + + * Added example .bib files for use with bib2gls + +1.18 (2017-08-10): + + * Fixed bug caused by missing argument of 'stylemods'. + +1.17 (2017-08-09): + + * Added \glsxtrword, \glsxtrwordsep and check for 'markwords' + and 'markshortwords' category attributes. + + * New abbreviation styles: + + - short-nolong-noreg + - short-nolong-desc-noreg + - long-noshort-desc-noreg + - long-noshort-noreg + - long-em-noshort-em-noreg + - long-em-noshort-em-desc-noreg + - long-only-short-only + - long-only-short-only-desc + + designed to work with 'markwords' attribute: + - long-hyphen-short-hyphen + - long-hyphen-short-hyphen-desc + - long-hyphen-noshort-desc-noreg + - long-hyphen-postshort-hyphen + - long-hyphen-postshort-hyphen-desc + - short-hyphen-long-hyphen + - short-hyphen-long-hyphen-desc + - short-hyphen-postlong-hyphen + - short-hyphen-postlong-hyphen-desc + + * New sample document sample-abbr-styles.tex that illustrates all + available abbreviation styles. + + * Fixed some inconsistencies in the predefined abbreviation styles. + + * Added extra value 'ac' to package option 'shortcuts' + + * Added \ifglsxtrinsertinside check for subsequent use. + + * Added \glsxtrparen, \glsxtrsubsequentfmt and sundry other helper + commands related to abbreviation styles. + +1.16 (2017-06-15): + + * New key: seealso + + * New commands: \glsxtrseealsolabels, \glsxtrseelist, + \glsxtrindexseealso, \glsxtruseseealso, + \glsxtrautoindexentry, \glsxtrautoindexassignsort, + \glsxtrautoindex + + * New package option: autoseeindex + (autoseeindex=false requires at least glossaries v4.30) + + * Added xindy "seealso" cross-reference class to work with + \glsxtrindexseealso (requires at least glossaries v4.30, + otherwise behaves like \glssee). + + * Added example-glossaries-xr.tex which contains dummy entries + with cross-references for use in test documents. + + * Fixed bug in \@gls@noidx@getgrouptitle + + * Fixed bug in \@print@unsrt@glossary + +1.15 (2017-05-10): + + * Fixed typo in command name (\glsabbvfont -> \glsabbrvfont) + + * Deferred location expansion in \@glsxtr@dorecord + +1.14 (2017-04-18): + + * New keys for \glsadd: thevalue and theHvalue + + * New key 'wrgloss' for \gls, \glstext etc and associated + commands: + \glsxtrinitwrgloss + \ifglsxtrinitwrglossbefore + \glsxtrinitwrglossbeforetrue + \glsxtrinitwrglossbeforefalse + + * New command: \glsxtrlocationhyperlink + + * New attribute checks: externallocation, wrgloss + + * Bug fix: "incorrect alias target name when using \glshyperlink + (and therefore also \glsseeformat)" + http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=120 + + * Bug fix: corrected assignment of \cGls in \glsenableentrycount + and \glsenableentryunitcount + +1.13 (2017-02-07): + + * Fixed bug in \glsdisp that caused an infinite loop. + + * Switched to \providecommand for \glsxtrsetaliasnoindex + +1.12 (2017-02-03): + + * \longnewglossaryentry now has a starred version that + doesn't suppress the post-description hook. The unstarred + version now inserts \glsxtrpostlongdescription at the end + of the description instead of the hard-coded + \leavevmode\unskip\nopostdesc + + * Added option 'postdot' (shortcut for 'nopostdot=false') + + * Added 'alias' key to \newglossaryentry and associated command + \glsxtralias + + * \printunsrtglossary now has a starred version. + + * New commands: + + \apptoglossarypreamble + \pretoglossarypreamble + \glsxtrprovidestoragekey + \glsxtrfielduse + \glsxtrifkeydefined + \glsxtrfieldlistadd + \glsxtrfieldlistgadd + \glsxtrfieldlisteadd + \glsxtrfieldlistxadd + \glsxtrfielddolistloop + \glsxtrfieldforlistloop + \glsxtrfieldifinlist + \glsxtrfieldxifinlist + \glsxtrdisplaysingleloc + \glsxtrdisplaystartloc + \glsxtrdisplayendloc + \glsxtrdisplayendlochook + \glsxtrlocrangefmt + \GlsXtrSetField + \gGlsXtrSetField + \eGlsXtrSetField + \xGlsXtrSetField + \GlsXtrLetField + \csGlsXtrLetField + \GlsXtrLetFieldToField + \glsxtrdeffield + \glsxtredeffield + \glsxtrsetfieldifexists + \GlsXtrRecordCounter + \printunsrtglossaryunit + \printunsrtglossaryunitsetup + \glsxtrcopytoglossary + \provideignoredglossary + \glsxtrabbrvpluralsuffix + \glsxtrfmt + \glsxtrentryfmt + \GlsXtrFmtField + \GlsXtrFmtDefaultOptions + + * Added existence checks to \newignoredglossary + + * Modified \glsnoidxdisplayloc to check for range formations. + + * The record=only package option automatically implements + indexcrossref=false + + * \glsxtrresourcefile sets the category code of @ to letter + to allow internal commands within the location field. + + * \GlsXtrLoadResources can now be used multiple times. After + the first instance "\jobname-" is used as the argument + to \glsxtrresourcefile. + + * New abbreviation styles: + + long-postshort-user + long-postshort-user-desc + short-postlong-user + short-postlong-user-desc + +1.11 (2017-01-19): + + * \glsxtrresourcefile now enforces the file extension .glstex + (This change is a security feature so there's no backward + compatibility. If you have used this command from v1.08 + you'll have to change the file name extension to continue + using it. Alternatively use \input or \loadglsentries instead.) + + * Extra information written to aux file by \glsxtrresourcefile + + * Added \GlsXtrLoadResources + + * New command: \glsxtrpageref (like glossary.sty's \glsrefentry + but uses \pageref instead of \ref). + + * Added starred version of \newignoredglossary + + * Added support for attributes: targeturl, targetcategory + and targetname. + +1.10 (2016-12-17): + + * Fixed bug causing \GLS to behave like \GLSpl + http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view;key=117 + +1.09 (2016-12-16): + + * Fixed bug when using the optional argument of \makeglossaries + +1.08 (2016-12-13): + + * Added record option + + * New commands: + + - \glsxtrresourcefile + - \printunsrtglossary + - \printunsrtglossaries + + * Fixed bug that occurs with undefaction=warn and an + undefined \glslabel in the post-link hook + +1.07 (2016-08-15): + + * New commands \glsxtrp etc. + + * New command \glsxtrabbrvfootnote used by the footnote + abbreviation styles (instead of hard-coding \footnote + into the style). + + * Fixed bug in footnote styles that used \glsfirstlongfont + instead of \glsfirstlongfootnotefont. + + * Fixed "first" and "firstplural" keys in the postfootnote + style (was causing repeated footnotes). + + * Fixed "text" key in the long-short-desc and short-long-desc + abbreviation styles, and fixed misspelling of \glsabbrvfont + in the "plural" key. + + * Fixed \glsfirst, \Glsfirst and \GLSfirst to ensure they + honour the nohyperfirst attribute. + + * Fixed bug in \RestoreAcronyms + www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=113 + +1.06 (2016-06-18): + + * Added docdefs=restricted (don't use .glsdefs file, document + definitions allowed provided they come before the glossary + in which they belong is displayed) + + * New command \glsxtrusesee + +1.05 (2016-06-10): + + * Added \glsfirstlongfootnotefont and \glslongfootnotefont + (Bug fix http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=110) + + * Bug fix in short-em-long style (corrected long form font command) + + * glossaries-extra-stylemods.sty: provided supplementary + alttree commands. + +1.04 (2016-05-02): + + * Added \GlsXtrEnablePreLocationTag + + * Added check for category \glsxtrpostname... in + \glxstrpostnamehook + + * Added new abbreviation styles: + - long-short-user + - long-short-user-desc + - short-long-user + - short-long-user-desc + and their accompanying commands \glsxtruserfield, + \glsxtruserparen, \glsabbrvuserfont and \glsxtrusersuffix. + + * Added new abbreviation styles: + - long-em-short-em + - long-em-short-em-desc + - short-em-long-em + - short-em-long-em-desc + and their accompanying commands \glsabbrvemfont and + \glsfirstlongemfont + + * Fixed sort in long-short-desc abbreviation style. + + * Reorganised naming scheme of abbreviation styles. + (Backward-compatible synonyms provided.) + + * Added \glsxtrregularfont + + * Added \glslongfont and \glslongdefaultfont + + * Added glossdescfont and glossnamefont attribute checks in + \glossentryname, \Glossentryname and \glossentrydesc + + * Tidied up accessibility support + + * Modified \glstext, \glsfirst, \glsplural, \glsfirstplural + (and case-changing variants) to set the abbreviation style + if required. + +1.03 (2016-04-27): + + * Fixed bug in \glsxtrtitleshortpl + (www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=107) + + * Fixed bugs in \glsplural, \Glsplural, \GLSplural, + \Glsfirstplural, \GLSfirstplural, \glsxtrtitlelongpl + +1.02 (2016-04-25): + + * Added \ifglsxtrinsertinside + + * Added \glsfmtlong, \glsfmtlongpl, \Glsfmtlong, \Glsfmtlongpl, + \glsfmtfull, \glsfmtfullpl, \Glsfmtfull, \Glsfmtfullpl + + * Added package glossaries-extra-stylemods.sty + +1.01 (2016-02-02): + + * Added retainfirstuseperiod attribute + + * bug fix for "short-desc" style: + fixed typo in \glsxtrinlinefullformat + and added missing second argument + +1.0 (2016-01-24 First stable release): + + * indexcrossrefs is now initially set to false but will + be automatically switched on if the "see" key is used. + +0.5.4 (2015-12-15): + + * Modified \glsdohyperlink and \glsdonohyperlink to ameliorate + the problems resulted from nested link-text. + + * Added per unit entry counting. + + * Modified \cglsformat etc to check for the regular attribute. + + * Added \GlsXtrEnableOnTheFly + + * Added \GlsXtrSetAltModifier and \GlsXtrSetDefaultGlsOpts + + * Added \glsxtrprotectlinks to deal with nested \gls etc. + + * Added \glsxtrpostunset, \glsxtrpostlocalunset, + \glsxtrpostreset and \gslxtrpostlocalreset + + * Added checks for entry's existence in shortcut tests + \glshasattribute and \glsifattribute and in + \glspostlinkhook + + * Added \glsxtrdowrglossaryhook + + * Added package option indexcrossrefs + + * Fixed \@newglossaryentryposthook so that it will add an empty + see value if not set. Added "see" element to field map + \@gls@keymap. + + * Added redefinition of \@gls@setdefault@glslink@opts to + set the default index value. + + * \MakeAcronymsAbbreviations now disables \setacronymstyle + +0.5.3 (2015-12-08): + + * Fixed bug in "abbreviations" package option. + + * Added support for "indexname" and "dualindex" attributes + with associated new commands. + + * Added provision for language modules (but none provided). + + * Removed \GlsXtrNoGlsWarningNoAutoMakeMain + (identical to \GlsXtrNoGlsWarningEmptyMain) + + * Added check for \glsdescwidth and \glspagelistwidth and + fixed adjustment for \glslistdottedwidth. + +0.5.2 (2015-12-08): + + * Modified the "nonumberlist" key (\printglossary) so that + it saves the number list. + + * Added \GlsXtrFormatLocationList + + * New command \GlsXtrEnableInitialTagging + + * Added \glsxtrfieldtitlecase + + * Modified \glossentrydesc to check for "glossdesc" attribute. + + * Modified \glossentryname to check for "glossname" attribute. + + * Fixed misspelt glossaries-accsupp (final letter was missing) + in \@ifpackageloaded + + * Modified commands like \@glstext@ to use \glsaccess... + instead of \glsentry... if glossaries-accsupp loaded. + + * Added: + + \GLSaccessname + \GLSaccesstext + \GLSaccessplural + \GLSaccessfirst + \GLSaccessfirstplural + \GLSaccesssymbol + \GLSaccesssymbolplural + \GLSaccessdesc + \GLSaccessdescplural + \GLSaccessshort + \GLSaccessshortpl + \GLSaccesslong + \glsaccesslongpl + \Glsaccesslongpl + \GLSaccesslongpl + + * Removed \glsxtrabbrvfmt and moved + \glssetabbrvfmt{\glscategory{\glslabel}} to \glsentryfmt + + * Added check for post-definition style switch. + + * Added \glsxtrnewabbrevpresetkeyhook + +0.5.1 (2015-12-07): + + * Removed \ifglsxtruseuchead + Now implemented through the "headuc" attribute. + Commands like \glsxtrheadshort modified to accommodate this. + + * Added: + \Glsaccessname + \Glsaccesstext + \Glsaccessplural + \Glsaccessfirst + \Glsaccessfirstplural + \Glsaccesssymbol + \Glsaccesssymbolplural + \Glsaccessdesc + \Glsaccessdescplural + + * Abbreviation styles (non-regular) now switch off regular + attribute if it has been set. (In case the style is + switched for a given category, e.g the "acronym" category.) + +0.5 (2015-12-07): + + * Renamed \glsentryfmtshort -> \glsfmtshort etc + These now use new commands \glsxtrtitleshort and + \glsxtrheadmarkshort etc to work better in page headers + that convert to upper case. + + * Added new commands for use in section headings: + \glsfmttext, \Glsfmttext, \glsfmtplural, \Glsfmtplural, + \glsfmtfirst, \Glsfmtfirst, \glsfmtfirstpl, + \Glsfmtfirstpl + + * New commands \glshascategoryattribute and \glshasattribute + + * Added \glsfirstabbrvdefaultfont and \glsfirstlongdefaultfont + Styles now set \glsfirstabbrvfont and \glsfirstlongfont + + * \markright and \markboth redefined so that they use + \glsxtrmarkhook (use \glsxtrRevertMarks to restore + original definitions). + + * Redefined \glsenableentrycount and added + \glsxtrifcounttrigger (support for "entrycount" + attribute). Added \GlsXtrEnableEntryCounting + + * Changed default behaviour of commands like \cgls + so they don't produce a warning if used without + \glsenableentrycount. Instead a warning is triggered + if \glsenableentrycount is used without setting + the "entrycount" attribute. + + * Added \cGLS, \cGLSpl + + * \acronymfont and \firstacronymfont redefined to + use \glsabbrvfont and \glsfirstabbrvfont (switched back + with \RestoreAcronyms). + + * New abbreviation styles: footnote-sc, postfootnote-sc, + long-short-sm, long-short-sm-desc, short-sm-long, + short-sm-long-desc, short-sm, short-sm-desc, short-desc, + long-sm, long-desc-sm, footnote-sm, postfootnote-sm, + long-short-em, long-short-em-desc, short-em-long, + short-em-long-desc, short-em, short-em-desc, short-desc, + long-em, long-desc-em, footnote-em, postfootnote-em. + + * New command \glsxtrsmfont for use in *-sm abbreviation + styles and \glsxtrsmsuffix for the default short plural + suffix. + + * New command \glsxtrscfont for use in *-sc abbreviation + styles and \glsxtrscsuffix for the default short plural + suffix. + +0.4 (2015-12-03): + + * The "abbreviations" option redefines \acronymtype if + the "acronym" option hasn't been used. + + * Redefinition of \newacronym sets the default type to + \acronymtype + + * Added \glsxtrifemptyglossary + + * \glsxtrnewsymbol and \glsxtrnewnumber adjusted so that the + name and label need to be supplied. + + * Fixed bug in \newterm + + * Changed \glsentryfmtshort etc to use \glsxtrshort etc + +0.3 (2015-12-03): + + * Added \glsxtrNoGlossaryWarning and "nomissingglstext" option. + + * Added \glsshortpltok and \glslongpltok. Abbreviation styles + now additionally set the first, firstplural and plural + keys even if the regular attribute isn't set to true. + (Allows the use of commands like \glsfirst, although + limitations apply.) + + * Added \glsxtrpostlinkAddDescOnFirstUse and + \glsxtrpostlinkAddSymbolOnFirstUse + + * \glsentryfmt also checks for the presence of the short key. + + * Added support for insertdots attribute. + + * Added \glsxtrpostlinkendsentence + + * Added \glsxtrshortpl etc. + + * Renamed \abbrvdefaultfont -> \glsabbrvdefaultfont + + * Added abbreviation plural shortcuts. + + * Added glossaries-accsupp support. + + * Bug fix in long-short-desc and short-long-desc abbreviation + styles + - argument of \glsxtrfullformat should be \the\glslabeltok + not \the\glsshorttok + + * Bug fix in *-sc abbreviation styles + +0.2 (2015-11-30): + + * Name changes: + + \glsxtrlongfont -> \glsfirstlongfont + \abbrvfont -> \glsabbrvfont + \firstabbrvfont -> \glsfirstabbrvfont + + * "short" abbreviation style uses "short (long)" + for the inline full style. + +0.1 (2015-11-22): Initial experimental release. diff --git a/macros/latex/contrib/glossaries-extra/README b/macros/latex/contrib/glossaries-extra/README new file mode 100644 index 0000000000..6f39a09e00 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/README @@ -0,0 +1,28 @@ +LaTeX Package : glossaries-extra v1.41 + +Last Modified : 2019-04-09 + +Author : Nicola Talbot + +This package provides improvements and extra features to the +glossaries package. Some of the default glossaries.sty behaviour +is changed by glossaries-extra.sty. See the user manual +glossaries-extra-manual.pdf for further details. + +Requires the glossaries package (and, naturally, all packages +required by glossaries.sty). + +The file example-glossaries-xr.tex contains dummy +entries with cross-references that may be used for creating +minimal working examples for testing the glossaries-extra +package. (The base glossaries package provides additional files, +but this one needs glossaries-extra.sty.) + +LICENCE + +This material is subject to the LaTeX Project Public License. +See http://www.ctan.org/license/lppl1.3 +for the details of that license. + +Author's home page: http://www.dickimaw-books.com/ + diff --git a/macros/latex/contrib/glossaries-extra/glossaries-extra-code.pdf b/macros/latex/contrib/glossaries-extra/glossaries-extra-code.pdf new file mode 100644 index 0000000000..8272e2c862 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/glossaries-extra-code.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.html b/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.html new file mode 100644 index 0000000000..bf636b8fa4 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.html @@ -0,0 +1,29815 @@ + + + + + + + + + + + + + +

+

+ + + +

+ + + +

+
+

+

glossaries-extra.sty v1.41: an extension to the +glossaries package +

+
+ +
Nicola L.C. Talbot
 
Dickimaw Books
http://www.dickimaw-books.com/
+
+

2019-04-09

+
+

+ + + +

+
+

+

Abstract

+

The glossaries-extra package is an extension to the glossaries package, providing +additional features. Some of the features provided by this package are only available +with glossaries version 4.19 (or above). This document assumes familiarity with the +glossaries package. +

The file example-glossaries-xr.tex contains dummy entries with cross-references +that may be used for creating minimal working examples for testing the +glossaries-extra package. (The base glossaries package provides additional files, but +this one needs glossaries-extra.) There are equivalent .bib files for use with +bib2gls. + + + +

+
+

Since glossaries-extra internally loads the glossaries package, you also need to have +glossaries installed and all the packages that glossaries depends on (including, but not +limited to, tracklang, mfirstuc, etoolbox, xkeyval (at least version dated 2006/11/18), +textcase, xfor, datatool-base and amsgen. These packages are all available in the +current TEX Live and MikTEX distributions. If any of them are missing, please +update your TEX distribution using your update manager. (For help on this see, for +example, How do I update my TEX distribution? or Updating TEX on Linux.) +
+

+

Additional resources:

+ + + + +

Contents

+
+ 1 Introduction +
 1.1 Package Defaults +
 1.2 New or Modified Package Options +
2 Modifications to Existing Commands and Styles +
 2.1 Entry Indexing +
 2.2 Cross-References (“see” and “see also”) +
 2.3 Entry Display Style Modifications +
 2.4 Entry Counting Modifications +
 2.5 First Use Flag +
 2.6 Plurals +
 2.7 Nested Links +
 2.8 Acronym Style Modifications +
 2.9 glossary-bookindex package +
 2.10 glossary-longextra package +
 2.11 glossary-topic package +
 2.12 Glossary Style Modifications +
  2.12.1 Style Hooks +
  2.12.2 Number List +
  2.12.3 The glossaries-extra-stylemods Package +
3 Abbreviations +
 3.1 Tagging Initials +
 3.2 Abbreviation Styles +
 3.3 Shortcut Commands +
 3.4 Predefined Abbreviation Styles +
  3.4.1 Predefined Abbreviation Styles that Set the Regular Attribute +
  3.4.2 Predefined Abbreviation Styles that Don’t Set the Regular Attribute +
 3.5 Defining New Abbreviation Styles +
4 Entries in Sectioning Titles, Headers, Captions and Contents +
5 Categories +
6 Counting References +
 6.1 Entry Counting (First Use Flag) +
 6.2 Link Counting +
7 Auto-Indexing +
8 On-the-Fly Document Definitions +
9 bib2gls: Managing Reference Databases + + + +
 9.1 Selection +
 9.2 Sorting and Displaying the Glossary +
 9.3 The glossaries-extra-bib2gls package +
  9.3.1 Supplemental Locations +
  9.3.2 Nameref Record +
  9.3.3 Helper Commands for Resource Options +
 9.4 Supplementary Commands +
 9.5 Record Counting +
10 Miscellaneous New Commands +
 10.1 Entry Fields +
 10.2 Display All Entries Without Sorting or Indexing +
 10.3 Standalone Entry Items +
 10.4 Entry Aliases +
11 Supplemental Packages +
 11.1 Prefixes or Determiners +
 11.2 Accessibility Support +
12 Sample Files +
13 Multi-Lingual Support +
Glossary +
+ + + +

1. Introduction

+

The glossaries package is a flexible package, but it’s also a heavy-weight package +that uses a lot of resources. As package developer, I’m caught between those users +who complain about the drawbacks of a heavy-weight package with a large user +manual and those users who want more features (which necessarily adds to the +package weight and manual size). +

The glossaries-extra package is an attempt to provide a compromise for this +conflict. Version 4.22 of the glossaries package is the last version to incorporate new +features.1.1 +Future versions of glossaries will just be bug fixes. New features will instead be added +to glossaries-extra. This means that the base glossaries package won’t increase in terms +of package loading time and allocation of resources, but those users who do want +extra features available will have more of a chance of getting their feature requests +accepted. +

+

Top

1.1 Package Defaults

+

I’m not happy with some of the default settings assumed by the glossaries package, +and, judging from code I’ve seen, other users also seem unhappy with them, as +certain package options are often used in questions posted on various sites. I can’t +change the default behaviour of glossaries as it would break backward compatibility, +but since glossaries-extra is a separate package, I have decided to implement some of +these commonly-used options by default. You can switch them back if they’re not +appropriate. +

The new defaults are:

+
    +
  • toc=true (add the glossaries to the table of contents). Use toc=false to + switch this back off. +
  • +
  • nopostdot=true (suppress the terminating full stop after the description + in the glossary). Use nopostdot=false or just postdot to restore the + terminating full stop (period). +
  • +
  • noredefwarn=true (suppress the warnings that occur when the theglossary + environment and \printglossary are redefined while glossaries is + loading). To restore the warnings, use noredefwarn=false. Note that this + won’t have any effect if the glossaries package has already been loaded + before you use the glossaries-extra package. +
  • +
  • If babel has been loaded, the translate=babel option is switched on. To + revert to using the translator interface, use translate=true. There is no + change to the default if babel hasn’t been loaded. +
+ + + +

The examples below illustrate the difference in explicit package options between +glossaries and glossaries-extra. There may be other differences resulting from +modifications to commands provided by glossaries (see §2 Modifications to Existing +Commands and Styles). +

+

    +
  1. + + + +
    + \documentclass{article} +  
    \usepackage{glossaries-extra} +
    +

    This is like: + + + +

    +
    + \documentclass{article} +  
    \usepackage[toc,nopostdot]{glossaries} +  
    \usepackage{glossaries-extra} +
    +

    +

  2. +
  3. + + + +
    + \documentclass[british]{article} +  
    \usepackage{babel} +  
    \usepackage{glossaries-extra} +
    +

    This is like: + + + +

    +
    + \documentclass[british]{article} +  
    \usepackage{babel} +  
    \usepackage[toc,nopostdot,translate=babel]{glossaries} +  
    \usepackage{glossaries-extra} +
    +

    +

  4. +
  5. + + + +
    + \documentclass{memoir} +  
    \usepackage{glossaries-extra} +
    +

    This is like: + + + +

    +
    + \documentclass{memoir} +  
    \usepackage[toc,nopostdot,noredefwarn]{glossaries} +  
    \usepackage{glossaries-extra} +
    +

    However + + + +

    +
    + \documentclass{memoir} +  
    \usepackage{glossaries} +  
    \usepackage{glossaries-extra} +
    +

    This is like: + + + +

    +
    + \documentclass{memoir} +  
    \usepackage[toc,nopostdot]{glossaries} +  
    \usepackage{glossaries-extra} +
    +

    Since by the time glossaries-extra has been loaded, glossaries has already + redefined memoir’s glossary-related commands.

+

Another noticeable change is that by default \printglossary will now display +information text in the document if the external glossary file doesn’t exist. This is +explanatory text to help new users who can’t work out what to do next to complete +the document build. Once the document is set up correctly and the external files have +been generated, this text will disappear. +

This change is mostly likely to be noticed by users with one or more +redundant empty glossaries who ignore transcript messages, explicitly use +makeindex/xindy on just the non-empty glossary (or glossaries) and use the iterative +\printglossaries command instead of \printglossary. For example, consider the +following: + + + +

+
+\documentclass{article} + 
\usepackage[acronym]{glossaries} + 
\makeglossaries + 
\newacronym{laser}{laser}{light amplification by stimulated + 
emission of radiation} + 
\begin{document} + 
\gls{laser} + 
\printglossaries + 
\end{document} +
+

The above document will only display the list of acronyms at the place where +\printglossaries occurs. However it will also attempt to input the .gls file +associated with the main glossary. +

If you use makeglossaries, you’ll get the warning message: + + + +

+
+Warning: File 'test.glo' is empty. + 
Have you used any entries defined in glossary 'main'? + 
Remember to use package option 'nomain' if you + 
don't want to use the main glossary. +
+

(where the original file is called test.tex) but if you simply call makeindex directly +to generate the .acr file (without attempting to create the .gls file) then the +transcript file will always contain the message: + + + +

+
+No file test.gls. +
+

This doesn’t occur with makeglossaries as it will create the .gls file containing +the single command \null. +

If you simply change from glossaries to glossaries-extra in this document, you’ll +find a change in the resulting PDF if you don’t use makeglossaries and you only +generate the .acr file with makeindex. +

The transcript file will still contain the message about the missing .gls, but now +you’ll also see information in the actual PDF document. The simplest remedy is to +follow the advice inserted into the document at that point, which is to add the +nomain package option: + + + +

+
+\documentclass{article} + 
\usepackage[nomain,acronym,postdot]{glossaries-extra} + 
\makeglossaries + 
\setabbreviationstyle[acronym]{long-short} + 
\newacronym{laser}{laser}{light amplification by stimulated + 
emission of radiation} + 
\begin{document} + 
\gls{laser} + 
\printglossaries + 
\end{document} +
+

(Note the need to set the acronym style using \setabbreviationstyle before +\newacronym. See §3 Abbreviations for further details.) +

+

+

Top

1.2 New or Modified Package Options

+

If you haven’t already loaded glossaries, you can use any of the package options +provided by glossaries when you load glossaries-extra and they will automatically be +passed to glossaries (which glossaries-extra will load). If glossaries has already +been loaded, then those options will be passed to \setupglossaries, but +remember that not all of the glossaries package options may be used in that +command. +

This section only lists options that are either unrecognised by the glossaries +package or are a modified version of options of the same name provided by glossaries. +See the glossaries user manual for details about the unmodified options. +
+

+

The new and modified options provided by glossaries-extra are described +below: + + + +

+debug
The glossaries package has a debug option that allows the values false, + true and showtargets. The debug=showtargets option was introduced to + glossaries v4.32, so if you want to use this option with glossaries-extra you + must make sure that your version of glossaries supports it. +

The glossaries-extra package extends this option to provide the additional + values debug=showwrgloss and debug=all. +

The debug=showwrgloss option implements debug=true and uses +


\glsxtrwrglossmark  \glsxtrwrglossmark

+

+ to show a mark just before the write operation performed by the + indexing commands. If you use record=alsoindex there will be a mark + for the write operation to the .aux file for bib2gls and a mark for + the write operation to the associated glossary file for makeindex or + xindy. +

The debug=all option implements both debug=showtargets and + debug=showwrgloss. +

+postdot
(New to version 1.12.) This option is just a shortcut for nopostdot=false. +
+postpunc
(New to version 1.21.) This option sets the post-description punctuation to + the given value. For example: postpunc=; does + + + +
+ \renewcommand{\glspostdescription}{;} +
+

The value may also be one of the following keywords: +

+ comma:
postpunc=comma is equivalent to + + + +
+ \renewcommand{\glspostdescription}{,} +
+

+

+ dot:
postpunc=dot is equivalent to + + + +
+ \renewcommand{\glspostdescription}{.\spacefactor\sfcode`\. } +
+

+

+ none:
postpunc=none is equivalent to + + + +
+ \renewcommand{\glspostdescription}{} +
+

+

The default definition is + + + +

+
+ \newcommand*{\glspostdescription}{% +  
  \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi +  
} +
+

where the conditional is determined by the nopostdot package option. + The postpunc option removes the conditional from the definition of + \glspostdescription. The package options nopostdot and postdot will restore + the original definition of \glspostdescription. +

The glossaries-extra-stylemods package adjusts the predefined styles + that had a hard-coded \space before the number list so that they use + \glsxtrprelocation instead (which is defined to \space). You can therefore + redefine this command in combination with postpunc to alter the separator + before the number list. For example, to have a comma followed by + \hfil: + + + +

+
+ \usepackage[postpunc=comma,stylemods]{glossaries-extra} +  
\renewcommand{\glsxtrprelocation}{\hfil} +
+

Be careful with doing this as it will look odd if the number list is missing. + (With bib2gls you can instead redefine \glsxtrprelocation to do nothing + and set the location prefixes with loc-prefix which will only apply if the entry + has a number list.) +

+accsupp
Load the glossaries-accsupp package (if not already loaded). +

If you want to define styles that can interface with the accessibility support + provided by glossaries-accsupp use the \glsaccessxxx⟩ type of commands + instead of \glsentryxxx⟩ (for example, \glsaccesstext instead of + \glsentrytext). If glossaries-accsupp hasn’t been loaded those commands are + equivalent (for example, \glsaccesstext just does \glsentrytext) but if it + has been loaded, then the \glsaccessxxx⟩ commands will add the + accessibility information. (See §11.2 Accessibility Support for further + details.) +

Note that the accsupp option can only be used as a package option (and can’t + be set with \glossariesextrasetup) since the glossaries-accsupp package must + be loaded before glossaries-extra if it’s required. +

+stylemods
This is a ⟨key⟩=⟨value⟩ option used to load the glossaries-extra-stylemods + package. The value may be a comma-separated list of options to pass to that + package. (Remember to group ⟨value⟩ if it contains any commas.) The value may + be omitted if no options need to be passed. See §2.12 Glossary Style + Modifications for further details. There are two special keyword values: + stylemods=default (equivalent to omitting the value) and stylemods=all, which + loads all the predefined styles. +
+undefaction
This is a ⟨key⟩=⟨value⟩ option, which has two allowed values: warn and + error. This indicates what to do if an undefined glossary entry is referenced. The + default behaviour is undefaction=error, which produces an error message (the + default for glossaries). You can switch this to a warning message (and ?? + appearing in the text) with undefaction=warn. +

Undefined entries can’t be picked up by any commands that iterate + over a glossary list. This includes \forglsentries and \glsaddall. +
+ + + +

+

Note that \ifglsused will display ?? in the document text with + undefaction=warn if the entry hasn’t been defined, as the underlying boolean + variable doesn’t exist and so is neither true nor false. (There will also + be a warning in the transcript.) See §2.5 First Use Flag for further + details. +

+indexcrossrefs
This is a boolean option. If true, this will automatically index any + cross-referenced entries that haven’t been marked as used at the end of the + document. Note that this necessarily adds to the overall document build time, + especially if you have defined a large number of entries, so this defaults to false, + but it will be automatically switched on if you use the see or seealso keys + in any entries (unless autoseeindex=false). To force it off, even if you + use the see or seealso key, you need to explicitly set indexcrossrefs to + false. +

Note that bib2gls can automatically find dependent entries when it + parses the .bib source file. The record option automatically implements + indexcrossrefs=false. +

+autoseeindex
(New to v1.16.) This is a boolean option. If true (default), this makes + the see and seealso keys automatically index the cross-reference when an entry + is defined. If false, the value of those keys will still be stored in their + corresponding fields (and can be accessed using commands like \glsxtrusesee + and \glsxtruseseealso) but cross-reference won’t be automatically + indexed. +

Note that the record=only option automatically implements autoseeindex=false. +

For example, if an entry is defined as + + + +

+
+ \newglossaryentry{foo}{name={foo},description={},see={bar,baz}} +
+

then with autoseeindex=true, this is equivalent to + + + +

+
+ \newglossaryentry{foo}{name={foo},description={}} +  
\glssee{foo}{bar,baz} +  
\glossariesextrasetup{indexcrossrefs=true} +  
\GlsXtrSetField{foo}{see}{bar,baz} +
+

but with autoseeindex=false, this is equivalent to + + + +

+
+ \newglossaryentry{foo}{name={foo},description={}} +  
\GlsXtrSetField{foo}{see}{bar,baz} +
+

Note that indexcrossrefs isn’t automatically implemented by the presence of the + see key when autoseeindex is false. +

It’s therefore possible to remove the cross-references from the location lists and + set their position within the glossary style. +

Another method of preventing the automatic indexing is to define the entries + before the external indexing files have been opened with \makeglossaries. + Since the appropriate file isn’t open, the information can’t be written to it. + This will need the package option seenoindex=ignore (provided by glossaries) to + prevent an error occurring. +

+record
(New to v1.08.) This is a ⟨key⟩=⟨value⟩ option provided for the benefit of + bib2gls (see §9 bib2gls: Managing Reference Databases). +

The option may only be set in the preamble and can’t be used after + \GlsXtrLoadResources. If the value is missing record=only is assumed. + Permitted values: +

+ off
This is the default setting. The indexing is performed as normal using + either \makeglossaries or \makenoidxglossaries. This setting + implements undefaction=error. +
+ only
The indexing is performed by bib2gls (see §9 bib2gls: + Managing Reference Databases). Neither \makeglossaries nor + \makenoidxglossaries is permitted. This setting implements + undefaction=warn and automatically loads the supplementary + glossaries-extra-bib2gls package. (There should be no need to explicitly + load glossaries-extra-bib2gls.) +

The glossaries should be displayed using \printunsrtglossary (or + \printunsrtglossaries). +

The document build process is (assuming the file is called myDoc.tex): + + + +

+
+ pdflatex myDoc +  
bib2gls myDoc +  
pdflatex myDoc +
+

+

Note that record=only will prevent the see from automatically + implementing \glssee. (bib2gls deals with the see field.) You + may explicitly use \glssee in the document, but bib2gls will + ignore the cross-reference if the see field was already set for that + entry. +

The record=only option will automatically set the glossaries package’s + sort=none option if available. (That option value was only introduced to + glossaries v4.30.) +

+ nameref
(New to v1.37 and requires bib2gls v1.8+.) This option is like + record=only but additionally records the current label information given by + \@currentlabel and \@currentHref, and provides a more reliable way of + saving the \theHcounter⟩ for the given location. This option requires + hyperref otherwise it will fall back on the usual location records. + Remember that \@currentHref is always globally updated whenever + \refstepcounter is used, but \@currentlabel isn’t. This can cause some + undesired side-effects with some settings. Remember also that the + indexcounter option increments the associated counter every time an entry + is indexed, which affects this option. See §9.3.2 Nameref Record for further + details. +

This option is best used with counter=chapter or counter=section if you + want the title included in the location list. If the indexing counter is the + default page, only the location number is shown. Similarly for + counter=equation (or equations=true). +

+ alsoindex
This is a hybrid setting that uses bib2gls to fetch entry information + from .bib files, but uses makeindex or xindy to create the glossary + files. This option should be used with \makeglossaries but not + with its optional argument. This option should not be used with + \makenoidxglossaries. You may need to change the transcript file used + by bib2gls to avoid a clash with the transcript file used by makeindex + or xindy. (This can be done with bib2gls’s --log-file or -t + option.) +

The glossaries should be displayed using \printglossary (or + \printglossaries). This option is expected to be used with bib2gls’s + sort=none setting and so glossaries-extra-bib2gls is not automatically + + + + loaded. +

The document build process is (assuming the file is called myDoc.tex): + + + +

+
+ pdflatex myDoc +  
bib2gls myDoc +  
pdflatex myDoc +  
makeglossaries myDoc +  
pdflatex myDoc +
+

+

With the recording on (record=only or record=alsoindex), any of the commands + that would typically index the entry (such as \gls, \glstext or \glsadd) + will add a \glsxtr@record entry to the .aux file. bib2gls can then + read these lines to find out which entries have been used. (Remember + that commands like \glsentryname don’t index, so any use of these + commands won’t add a corresponding \glsxtr@record entry to the + .aux file.) See §9 bib2gls: Managing Reference Databases for further + details. +

+equations
(New to v1.37.) This option will cause the default location counter to + automatically switch to equation when inside a numbered equation + environment, such as equation or align. The counter can be explicitly overridden + with counter in the optional arguments of commands like \glslink or \gls as + usual. +
+floats
(New to v1.37.) This option will cause the default location counter to + automatically switch to the corresponding counter when inside a floating + environment, such as figure or table. The counter can be explicitly overridden + with counter in the optional arguments of commands like \glslink or \gls as + usual. Remember that within floats it’s the \caption command that + actually uses \refstepcounter, so indexing before the caption will + result in the wrong reference. The commands for use in captions and + sections, such as \glsfmttext and \glsfmtshort, don’t index. (See §4 + Entries in Sectioning Titles, Headers, Captions and Contents). You may + want to consider using \glsadd after the caption (not before). For + example: + + + +
+ \begin{figure}[htbp] +  
  \centering +  
  \includegraphics{example-image} +  
  \caption{Sample \glsfmttext{foobar} figure} +  
  \glsadd{foobar} +  
\end{figure} +
+

+

+indexcounter
(New to v1.29.) This option (which doesn’t take a value) is primarily + intended for use with bib2gls (v1.4+) and hyperref. It can be used + with makeindex or xindy but it will interfere with the number list + collation, so you won’t have ranges and you’ll have duplicate page numbers + present (but each page number will link to the relevant part of the page + where the indexing occurred). This option automatically implements + counter=wrglossary. +

This option works by incrementing wrglossary and adding \label. This can + cause a problem if the indexing occurs in an equation environment as amsmath + forbids multiple occurrences of \label (resulting in the “Multiple \label’s” + error). It’s best to change the counter to page or equation when in maths mode + with this option. For example: + + + +

+
+ \renewcommand{\glslinkpresetkeys}{% +  
 \ifmmode \setkeys{glslink}{counter=equation}\fi} +  
\renewcommand{\glsaddpresetkeys}{% +  
 \ifmmode \setkeys{glossadd}{counter=equation}\fi} +
+

+

+

By default (with hyperref), the page numbers in number lists link back to the + top of the relevant page (provided the format uses \glshypernumber). The + indexcounter option is designed to link back to the place within the page where + the indexing occurred. It does this by creating a new counter (called wrglossary) + that’s incremented with \refstepcounter every time an entry is indexed (but + not via cross-referencing commands, such as \glssee). A \label is placed + immediately after the increment command allowing the back-referenced to be + obtained with \pageref. The location, as seen by the indexing application, is + the value of the wrglossary counter but this value is substituted with the page + reference when number list is typeset. Since the counter is used by all + entries and is incremented every time any indexing occurs, neither + makeindex nor xindy can correctly collate the lists. For example, if the first + term to be referenced is indexed three times on page 5 without any + intervening terms then the actual locations obtained from wrglossary + will be 1, 2 and 3, which xindy and makeindex will try to form into + the range 1–3, but they should actually all simply appear as page 5, + whereas it can actually end up with 5–5. Conversely, a range may not be + formed where it would naturally occur if just the page counter was + used. +

Since bib2gls is designed specifically to work with glossaries-extra, + bib2gls (v1.4+) will check for wrglossary locations. If the default + --merge-wrglossary-records is on, then any records for the same page + for a given entry will be merged. In the above example with three + references on page 5, only a single record for page 5 for that entry will be + added to the number list and it will link back to the first instance on + that page. Whereas if you use the --no-merge-wrglossary-records + switch, the number list will contain three instance of page 5, with + each linking to the corresponding place on that page. In both cases, + consecutive pages can form ranges, but it may look strange in the second + case. +

See the bib2gls documentation for the save-index-counter resource option + for more details. + + + +

+docdef
This option governs the use of \newglossaryentry. It was originally a + boolean option, but as from version 1.06, it can now take one of the following + values (if the value is omitted, true is assumed): +
    +
  • \newglossaryentry is not permitted in the document environment + (default). +
  • +
  • \newglossaryentry behaves as it does in the base glossaries package. + That is, where its use is permitted in the document environment, it + uses the .glsdefs temporary file to store the entry definitions so + that on the next LATEX run the entries are defined at the beginning + of the document environment. This allows the entry information + to be referenced in the glossary, even if the glossary occurs before + \newglossaryentry. (For example, when the glossary is displayed in + the front matter.) This method of saving the definitions for the next + LATEX run has drawbacks that are detailed in the glossaries user + manual. +

    Remember that if \newglossaryentry wouldn’t be allowed in the + document environment with the base glossaries package, then it still + won’t be allowed with docdefs=true. If your glossaries occur at the + end of the document, consider using docdef=restricted instead. +

  • +
  • (new to version 1.06) \newglossaryentry is permitted in the + document environment without using the .glsdefs file. This means + that all entries must be defined before the glossary is displayed, but + it avoids the complications associated with saving the entry details + in a temporary file. You will still need to take care about any changes + made to characters that are required by the ⟨key⟩=⟨value⟩ mechanism + (that is, the comma and equal sign) and any makeindex or xindy + character that occurs in the sort key or label. If any of those characters + are made active in the document, then it can cause problems with + the entry definition. This option will allow \newglossaryentry to + be used in the document with \makenoidxglossaries, but note that + \longnewglossaryentry remains a preamble-only command. +

    With this option, if an entry appears in the glossary before it has been + defined, an error will occur (or a warning if the undefaction=warn + option is used.) If you edit your document and either remove an entry + or change its label, you may need to delete the document’s temporary + files (such as the .aux and .gls files). +

  • +
  • (new to version 1.34) This option behaves like docdef=restricted but + creates the .glsdefs file for atom’s autocomplete support. This file + isn’t input by glossaries-extra and so associated problems with the + + + + use of this file are avoided, but it allows the autocomplete support + to find the labels in the file. As with docdef=restricted, entries may + be defined in the preamble or anywhere in the document, but they + may only be referenced after they have been defined. Entries must + be defined before the associated glossary is displayed. +
+

The glossaries package allows \newglossaryentry within the document + environment (when used with makeindex or xindy) but the user manual warns + against this usage. By default the glossaries-extra package prohibits this, only + allowing definitions within the preamble. If you are really determined to define + entries in the document environment, despite all the associated drawbacks, you + can restore this with docdef=true. Note that this doesn’t change the + prohibitions that the glossaries package has in certain circumstances (for + example, when using “option 1”). See the glossaries user manual for + further details. A better option if document definitions are required + is docdef=restricted. Only use docdef=true if document definitions + are necessary and one or more of the glossaries occurs in the front + matter. +

This option affects commands that internally use \newglossaryentry, such as + \newabbreviation, but not the “on-the-fly” commands described in §8 + On-the-Fly Document Definitions. +

+nomissingglstext
This is a boolean option. If true, this will suppress the + warning written to the transcript and the warning text that will appear + in the document if the external glossary files haven’t been generated + due to an incomplete document build. However, it’s probably simpler + just to fix whatever has caused the failure to build the external file or + files. +
+abbreviations
This option has no value and can’t be cancelled. If used, it will + automatically create a new glossary with the label abbreviations and + redefines \glsxtrabbrvtype to this label. In addition, it defines a shortcut + command +


\printabbreviations  \printabbreviations[options]

+

+ which is equivalent to

+
+ \printglossary[type=\glsxtrabbrvtype,options] + + + +
+
If glossaries-extra-bib2gls is also loaded then this option will additionally + provide: +


\printunsrtabbreviations  \printunsrtabbreviations[options] +

+

+ which uses \printunsrtglossary. +

The title of the new glossary is given by +


\abbreviationsname  \abbreviationsname

+

+ If this command is already defined, it’s left unchanged. Otherwise it’s defined + to “Abbreviations” if babel hasn’t been loaded or \acronymname if + babel has been loaded. However, if you’re using babel it’s likely you + will need to change this. (See §13 Multi-Lingual Support for further + details.) +

If you don’t use the abbreviations package option, the \abbreviationsname + command won’t be defined (unless it’s defined by an included language file). +
+

+

If the abbreviations option is used and the acronym option provided by the + glossaries package hasn’t been used, then \acronymtype will be set to + \glsxtrabbrvtype so that acronyms defined with \newacronym can be added + to the list of abbreviations. If you want acronyms in the main glossary and + other abbreviations in the abbreviations glossary then you will need to + redefine \acronymtype to main: + + + +

+
+ \renewcommand*{\acronymtype}{main} +
+

+

Note that there are no analogous options to the glossaries package’s acronymlists + option (or associated commands) as the abbreviation mechanism is handled + differently with glossaries-extra. +

+symbols
This is passed to glossaries but will additionally define +


\glsxtrnewsymbol  \glsxtrnewsymbol[options]{label}{symbol} +

+

+ which is equivalent to

+
+ \newglossaryentry{label}{name={symbol}, +
 sort={label},type=symbols,category=symbol,options} +
+
Note that the sort key is set to the ⟨label⟩ not the ⟨symbol⟩ as the symbol will + likely contain commands. +

If glossaries-extra-bib2gls is also loaded then this option will additionally + provide: +


\printunsrtsymbols  \printunsrtsymbols[options]

+

+ which uses \printunsrtglossary. +

+numbers
This is passed to glossaries but will additionally define +


\glsxtrnewnumber  \glsxtrnewnumber[options]{number}

+

+ which is equivalent to

+
+ \newglossaryentry{label}{name={number}, +
 sort={label},type=numbers,category=number,options} + + + +
+
+

If glossaries-extra-bib2gls is also loaded then this option will additionally + provide: +


\printunsrtnumbers  \printunsrtnumbers[options]

+

+ which uses \printunsrtglossary. +

+acronyms (or acronym)
This is passed to glossaries but if glossaries-extra-bib2gls is + also loaded then this option will additionally provide: +


\printunsrtacronyms  \printunsrtacronyms[options]

+

+ which uses \printunsrtglossary. +

This option defines a new glossary with the label acronym not acronyms. You + may find it easier to reference it with the command \acronymtype. +
+

+

+index
This is passed to glossaries but if glossaries-extra-bib2gls is also loaded then this + option will additionally provide: +


\printunsrtindex  \printunsrtindex[options]

+

+ which uses \printunsrtglossary. +

+shortcuts
Unlike the glossaries package option of the same name, this option isn’t + boolean but has multiple values: +
    +
  • shortcuts=acronyms (or shortcuts=acro): set the shortcuts provided + by the glossaries package for acronyms (such as \ac). Note that the + short and long forms don’t use \glsxtrshort and \glsxtrlong but + use the original \acrshort and \acrlong, which don’t recognise + multiple abbreviation styles. The better option with glossaries-extra + is shortcuts=ac. +
  • +
  • shortcuts=ac: set the shortcuts provided by the glossaries package for + acronyms (such as \ac) but uses the glossaries-extra interface (such + as \glsxtrshort rather than \acrshort). In this case \ac is defined + as \cgls rather than \gls. + + + +
  • +
  • shortcuts=abbreviations (or shortcuts=abbr): + set the abbreviation shortcuts provided by glossaries-extra. (See §3.3 + Shortcut Commands.) These settings don’t switch on the acronym + shortcuts provided by the glossaries package. +
  • +
  • shortcuts=other: set the “other” shortcut commands, but not the shortcut + commands for abbreviations or the acronym shortcuts provided by + glossaries. The “other” shortcuts are: +
      +
    • \newentry equivalent to \newglossaryentry +
    • +
    • \newsym equivalent to \glsxtrnewsymbol (see the symbols + option). +
    • +
    • \newnum equivalent to \glsxtrnewnumber (see the numbers + option).
    +
  • +
  • shortcuts=all (or shortcuts=true): implements shortcuts=ac, + shortcuts=abbreviations and shortcuts=other. +
  • +
  • shortcuts=none (or shortcuts=false): don’t define any of the shortcut + commands (default).
+

Note that multiple invocations of the shortcuts option within the same option + list will override each other.

+

After the glossaries-extra package has been loaded, you can set available options +using +


\glossariesextrasetup  \glossariesextrasetup{options}

+

+The abbreviations and docdef options may only be used in the preamble. Additionally, +docdef can’t be used after \makenoidxglossaries. + + + +

+

+

Top

2. Modifications to Existing Commands and Styles

+

The glossaries package provides \nopostdesc which may be used in the description +to suppress the post-description hook. The glossaries-extra package provides another +command +


\glsxtrnopostpunc  \glsxtrnopostpunc

+

+which has a similar function but only suppresses the post-description punctuation. It +doesn’t suppress the use of \glsxtrpostdescription which allows the use of +category-dependent post-description hooks. (Note that the punctuation, +which is in the original base hook \glspostdescription, comes after the +extended post-description hook \glsxtrpostdescription not before.) The +post-description hook can counter-act the effect of \glsxtrnopostpunc +using +


\glsxtrrestorepostpunc  \glsxtrrestorepostpunc

+

+These commands have no effect outside of the glossary (except with standalone +entries that use \glsxtractivatenopost and \glspostdescription, see §10.3 +Standalone Entry Items). +

The glossaries package provides +


\glsseeitemformat  \glsseeitemformat{label}

+

+to format items in a cross-reference list (identified with the see key or \glssee). This +was originally defined to use \glsentryname{label} since it makes more sense for the +cross-reference to match the way the term appears in the glossary. Unfortunately this +caused a problem when the name field was sanitized, which used to be the default +setting, so glossaries v3.0 changed the default definition of this command to +use \glsentrytext instead. Since the name and text field are quite often +the same, this change usually doesn’t have a noticeable effect. However, +now that the name field is no longer sanitized (following the redesign of +glossaries v4.0) it makes more sense to restore this command to its original +behaviour, but to take account of abbreviations glossaries-extra redefines this +as: + + + +

+
+\renewcommand*{\glsseeitemformat}[1]{% + 
 \ifglshasshort{\glslabel}{\glsaccesstext{#1}}{\glsaccessname{#1}}% + 
} +
+

If you want to restore the glossaries v3.0+ definition just do: + + + +

+
+\renewcommand*{\glsseeitemformat}[1]{\glsentrytext{#1}} +
+

The glossaries-extra package provides \glsxtrhiername and its case-changing +variants that may be used within the definition of \glsseeitemformat if required. +These display the hierarchy for sub-entries rather than just the name, which may be +more helpful in cross-references. See §2.2 Cross-References (“see” and “see also”) for +further details. +

The commands used by glossaries to automatically produce an error if an entry is +undefined (such as \glsdoifexists) are changed to take the undefaction option into +account. +

The \newignoredglossary{type} command now (as from v1.11) has a starred +version that doesn’t automatically switch off the hyperlinks. This starred version may +be used with the targeturl attribute to create a link to an external URL. (See §5 +Categories for further details.) As from v1.12 both the starred and unstarred version +check that the glossary doesn’t already exist. (The glossaries package omits this +check.) +

You can now provide an ignored glossary with: +


\provideignoredglossary  \provideignoredglossary{type}

+

+which will only define the glossary if it doesn’t already exist. This also has a starred +version that doesn’t automatically switch off hyperlinks. +

The individual glossary displaying commands \printglossary, \printnoidxglossary +and \printunsrtglossary have two extra keys: +

+
    +
  • target. This is a boolean key which can be used to switch off the automatic + hypertarget for each entry. Unlike \glsdisablehyper this doesn’t switch + off hyperlinks, so any cross-references within the glossary won’t be affected. + This is a way of avoiding duplicate target warnings if a glossary needs to + be displayed multiple times. +
  • +
  • targetnameprefix={prefix}. Another way of avoiding duplicate target names + is to set a prefix used for the names. Unlike changing \glolinkprefix + this doesn’t affect any hyperlinks (such as those created with \gls). +
  • +
  • prefix={prefix}. If you do actually want to locally change \glolinkprefix, + you can use the prefix key instead. You need to use the matching prefix + key in commands like \gls. +
  • +
  • label={label}. Labels the glossary with \label{label} and also defines + + + + \@currentlabelname to the glossary’s TOC title (to provide text for + \nameref). You can also set the label before the glossary using: +


    \glsxtrsetglossarylabel  \glsxtrsetglossarylabel{label}

    +

    + but take care of duplicate labels if it’s not scoped.

+

The \newglossaryentry command has three new keys:

+
    +
  • category, which sets the category label for the given entry. By default this + is general. See §5 Categories for further information about categories. +
  • +
  • alias, which allows an entry to be alias to another entry. See §10.4 Entry + Aliases for further details. +
  • +
  • seealso, which performs much like see, but allows for separate “see” and + “see also” treatment. See §2.2 Cross-References (“see” and “see also”) for + further details.
+

The test file example-glossaries-xr.tex contains dummy entries with a mixture of +see, alias and seealso keys for use with minimal working examples. There are also +example-glossaries-*.bib files that correspond to each example-glossaries-*.tex +file for testing bib2gls. +

The \longnewglossaryentry command now has a starred version (as from v1.12) +that doesn’t automatically insert + + + +

+
+\leavevmode\unskip\nopostdesc +
+

at the end of the description field. +


\longnewglossaryentry  \longnewglossaryentry*{label}{options} +{description}

+

+The descriptionplural key is left unset unless explicitly set in ⟨options⟩. +

The unstarred version no longer hard-codes the above code (which removes +trailing space and suppresses the post-description hook) but instead uses: +


\glsxtrpostlongdescription  \glsxtrpostlongdescription

+

+This can be redefined to allow the post-description hook to work but retain the +\unskip part if required. For example: + + + +

+
+\renewcommand*{\glsxtrpostlongdescription}{\leavevmode\unskip} +
+

This will discarded unwanted trailing space at the end of the description but won’t +suppress the post-description hook. +

The unstarred version also alters the base glossaries package’s treatment of the +descriptionplural key. Since a plural description doesn’t make much sense for +multi-paragraph descriptions, the default behaviour with glossaries-extra’s +\longnewglossaryentry is to simply leave the plural description unset +unless explicitly set using the descriptionplural key. The glossaries.sty version +of this command sets the description’s plural form to the same as the +singular.2.1 +

Note that this modified unstarred version doesn’t append \glsxtrpostlongdescription +to the description’s plural form. +

The \newterm command (defined through the index package option) is modified +so that the category defaults to index. The \newacronym command is modified +to use the new abbreviation interface provided by glossaries-extra. (See §3 +Abbreviations.) +

The \makeglossaries command now has an optional argument. +


\makeglossaries  \makeglossaries[list]

+

+If ⟨list⟩ is empty, \makeglossaries behaves as per its original definition in the +glossaries package, otherwise ⟨list⟩ can be a comma-separated list of glossaries that +need processing with an external indexing application. +

This command is not permitted with the record=only package option. Without +the optional argument, it’s permitted with record=alsoindex. With the optional +argument, it’s only permitted with the default record=off. +

It should then be possible to use \printglossary for those glossaries listed in ⟨list⟩ +and \printnoidxglossary for the other glossaries. (See the accompanying file +sample-mixedsort.tex for an example.) +

If you use the optional argument ⟨list⟩, you can’t define entries in the document +(even with the docdef option).
+

+

You will need at least version 2.20 of makeglossaries or at least version 1.3 of +the Lua alternative makeglossaries-lite (both distributed with glossaries v4.27) to +allow for this use of \makeglossaries[list]. Alternatively, use the automake +option. +

+

Top

2.1 Entry Indexing

+

As from version 1.31, there is a new command like \glsadd where the mandatory +argument is a comma-separated list of labels: + + + +


\glsaddeach  \glsaddeach[options]{list}

+

+This simply iterates over ⟨list⟩ and does \glsadd[options]{label} for each entry in the +list. +

As from version 1.37, you can make commands like \gls or \glslink +automatically use \glsadd with specific options when a given format is used +(identified with format={format} in the optional argument of the corresponding +\gls, \glslink etc). +


\GlsXtrAutoAddOnFormat  \GlsXtrAutoAddOnFormat[label]{format list} +{glsadd options}

+

+The optional argument ⟨label⟩ defaults to \glslabel and indicates the label to use in +\glsadd and so needs to be expandable. The ⟨format list⟩ is a comma-separated list of +format values that will trigger the automated adding. The ⟨glsadd options⟩ are +the options to pass to \glsadd with format={format} prepended to the +list. +

For example, with: + + + +

+
+\GlsXtrAutoAddOnFormat{hyperbf}{counter=chapter} +
+

then \gls[format=hyperbf]{sample} will be equivalent to + + + +

+
+\glsadd[format=hyperbf,counter=chapter]{sample}\gls[format=hyperbf]{sample} +
+

Note that the explicit range markers will prevent a match unless you include +them in ⟨format list⟩ (in which case, be sure to add both the start and end +formats). +

Here’s another example: + + + +

+
+\GlsXtrAutoAddOnFormat[dual.\glslabel]{hyperbf}{} +
+

In this case \gls[format=hyperbf]{sample} will now be equivalent to: + + + +

+
+\glsadd[format=hyperbf]{dual.sample}\gls[format=hyperbf]{sample} +
+

+

\GlsXtrAutoAddOnFormat is not applied to \glsadd as it could cause an infinite +loop.
+

+The glossaries-extra package provides extra keys for commands like \gls and +\glstext: +

+noindex
This is a boolean key. If true, this suppresses the indexing. (That is, + it prevents \gls or whatever from adding a line to the external glossary + file.) This is more useful than the indexonlyfirst package option provided + by glossaries, as the first use might not be the most pertinent use. (If you + want to apply indexonlyfirst to selected entries, rather than all of them, you + can use the indexonlyfirst attribute, see §5 Categories for further details.) + Note that the noindex key isn’t available for \glsadd (and \glsaddall) + since the whole purpose of that command is to index an entry. +
+wrgloss
(New to v1.14.) This is may only take the values before or after. By + default, commands that both index and display link text (such as \gls, + \glstext and \glslink), perform the indexing before the link text as the + indexing creates a whatsit that can cause problems if it occurs after the + link text. However, it may be that in some cases (such as long phrases) you + may actually want the indexing performed after the link text. In this case + you can use wrgloss=after for specific instances. Note that this option + doesn’t have an effect if the indexing has been suppressed through other + settings (such as noindex). +

The default value is set up using +


\glsxtrinitwrgloss  \glsxtrinitwrgloss

+

+ which is defined as: + + + +

+
+ \newcommand*{\glsxtrinitwrgloss}{% +  
 \glsifattribute{\glslabel}{wrgloss}{after}% +  
 {% +  
   \glsxtrinitwrglossbeforefalse +  
 }% +  
 {% +  
   \glsxtrinitwrglossbeforetrue +  
 }% +  
} +
+

This sets the conditional +


\ifglsxtrinitwrglossbefore  \ifglsxtrinitwrgloss

+

+ which is used to determine where to perform the indexing. +

This means you can set the wrgloss attribute to after to automatically use this + as the default for entries with that category attribute. (Note that adding + wrgloss to the default options in \GlsXtrSetDefaultGlsOpts will override + \glsxtrinitwrgloss.) +

+hyperoutside
(New to v1.21.) This is a boolean key. The default is hyperoutside=true, + which puts the hyperlink outside \glstextformat, so that commands like \gls + will effectively do
+
+ \hyperlink{target}{\glstextformat{link text}} +
+
This is the same behaviour as with the base glossaries package. With + hyperoutside=false, \hyperlink is placed inside the argument of + \glstextformat:
+
+ \glstextformat{\hyperlink{target}{link text}} +
+
You can use the hyperoutside category attribute to set the default for a + given category. This can be combined with the use of the textformat + attribute to counteract any interference caused by \hyperlink. For + example: + + + +
+ \glssetcategoryattribute{mathrelation}{hyperoutside}{false} +
+

will set hyperoutside=false for all entries that are assigned to the category + mathrelation and + + + +

+
+ \glssetcategoryattribute{mathrelation}{textformat}{mathrel} +
+

will use \mathrel instead of \glstextformat resulting in:

+
+ \mathrel{\hyperlink{target}{link text}} +
+
for entries with the category key set to mathrelation. +
+textformat
This key must have a control sequence name as its value. The + command formed from this name must exist and must take one argument. + (Use relax for default behaviour.) If set, this overrides the textformat + attribute and \glstextformat. See the soul example in §2.5 First Use + Flag. +
+prefix
Locally redefines \glolinkprefix to the given value. It should match the + prefix for the desired glossary. +
+thevalue
Explicitly set the location to this value (see below). +
+theHvalue
Set the corresponding hyperlink location (see below). +
+

There is a new hook that’s used each time indexing information is written to the +external glossary files: +


\glsxtrdowrglossaryhook  \glsxtrdowrglossaryhook{label}

+

+where ⟨label⟩ is the entry’s label. This does nothing by default but may be redefined. +(See, for example, the accompanying sample file sample-indexhook.tex, which uses +this hook to determine which entries haven’t been indexed.) +

There’s also a new hook (from v1.26) that’s used immediately before the options +are set by the \gls-like and \glstext-like commands: +


\glslinkpresetkeys  \glslinkpresetkeys

+

+(The base package provides \glslinkpostsetkeys that’s used immediately after the +options are set.) + + + +

As from version 1.30 there are also similar hooks for \glsadd: +


\glsaddpresetkeys  \glsaddpresetkeys

+

+and +


\glsaddpostsetkeys  \glsaddpostsetkeys

+

+For example, to default to using the equation counter in maths mode: + + + +

+
+\renewcommand{\glslinkpresetkeys}{% + 
 \ifmmode \setkeys{glslink}{counter=equation}\fi} + 
\renewcommand{\glsaddpresetkeys}{% + 
 \ifmmode \setkeys{glossadd}{counter=equation}\fi} +
+

In this case, the counter can be overridden with an explicit use of counter in the +optional argument of \gls or \glsadd. (As from version 1.37, a simpler method is to +just use the equations package option.) +

Alternatively, to enforce this (overriding the option argument): + + + +

+
+\renewcommand{\glslinkpostsetkeys}{% + 
 \ifmmode \setkeys{glslink}{counter=equation}\fi} + 
\renewcommand{\glsaddpostsetkeys}{% + 
 \ifmmode \setkeys{glossadd}{counter=equation}\fi} +
+

+

As from version 1.14, there are two new keys for \glsadd: thevalue and theHvalue. +These keys are designed for manually adding explicit locations rather than obtaining +the value from the associated counter. As from version 1.19, these two keys are also +available for commands like \gls and \glslink. The thevalue keys is intended +primarily for adding locations in supplementary material that can’t be obtained from +a counter. +

The principle key thevalue is for the location value. The other key theHvalue can +be used to extract a prefix value for the first argument of commands like +\glsnoidxdisplayloc. Its value must be in the format ⟨prefix⟩⟨location⟩. In general, +there’s little need for this key as the prefix is typically associated with a counter that +can be used to form hypertargets. +

If you use thevalue, you must make sure that you use an indexing application +that will accept the given value.
+

+

For example, makeindex will only accept locations in the form [⟨num⟩⟨sep⟩]*⟨num⟩ +where ⟨num⟩ is an arabic number (0, 1, …), roman numeral (i, ii, … or I, II, …) or a +character from a, …, z or A, …, Z, and [⟨num⟩⟨sep⟩]* indicates zero or more +instances of a number followed by the recognised separator character (set +with \glsSetCompositor). This means that makeindex won’t accept, for +example, + + + +

+
+\glsadd[thevalue={Supplementary Material}]{sample} +
+

This location value will be accepted by bib2gls, since it will allow any location and +will only try forming ranges if the location matches any of its numerical patterns. +In the case of xindy, you’ll need to add a rule that can match the value. +If you’re using hyperref, you may need to use the format key to prevent a +hyperlink if one can’t naturally be formed from the prefix, counter and location +value. +

For example, suppose the file suppl.tex contains: + + + +

+
+\documentclass{article} + 
\usepackage{glossaries-extra} + 
\newglossaryentry{sample}{name={sample},description={an example}} + 
\renewcommand{\thepage}{S.\arabic{page}} + 
\begin{document} + 
First page. + 
\newpage + 
\gls{sample}. + 
\end{document} +
+

This has an entry on page S.2. Suppose another document wants to include this +location in the glossary. Then this can be done by setting thevalue to S.2. For +example: + + + +

+
+\documentclass{article} + 
\usepackage{glossaries-extra} + 
\makeglossaries + 
\newglossaryentry{sample}{name={sample},description={an example}} + 
\begin{document} + 
Some \gls{sample} text. + 
\printglossaries + 
\glsadd[thevalue={S.2}]{sample} + 
\end{document} +
+

This location value will be accepted by makeindex as it’s in the form ⟨num⟩⟨sep⟩⟨num⟩. +

If you want hyperlinks, things are more complicated. First you need to set the +externallocation attribute to the location of the PDF file. For example: + + + +

+
+\glssetcategoryattribute{supplemental}{externallocation}{suppl.pdf} + 
\newglossaryentry{sample}{category=supplemental, + 
 name={sample},description={an example}} +
+

Next you need to add glsxtrsupphypernumber as the format: + + + +

+
+\glsadd[thevalue={S.2},format=glsxtrsupphypernumber]{sample} +
+

Both documents will need to use the hyperref package. Remember that the counter +used for the location also needs to match. If \theHcounter⟩ is defined in the other +document and doesn’t match in the referencing document, then you need to use +theHvalue to set the appropriate value. See the accompanying sample files +sample-suppl-hyp.tex and sample-suppl-main-hyp.tex for an example that uses +hyperref. +

The hyperlink for the supplementary location may or may not take you to the +relevant place in the external PDF file depending on your PDF viewer. Some may not +support external links, and some may take you to the first page or last visited page. +
+

+

For example, if both sample-suppl-hyp.pdf and sample-suppl-main-hyp.pdf +are in the same directory, then viewing sample-suppl-main-hyp.pdf in Evince will +take you to the correct location in the linked document (when you click on the S.2 +external link), but Okular will take you to the top of the first page of the linked +document. +

This method can only be used where there is one external source for the +designated category (identified by the externallocation attribute). For multiple +sources, you need to use bib2gls version 1.7+, which is the better method in +general as it can automatically fetch the relevant locations from the .aux files +of the designated external documents without the need to explicitly use +\glsadd. +

+

+

Top

2.2 Cross-References (“see” and “see also”)

+

The value of the see key is now saved as a field. This isn’t the case with glossaries, +where the see value is simply used to directly write a line to the corresponding +glossary file and is then discarded. This is why the see key can’t be used +before \makeglossaries (since the file hasn’t been opened yet). It’s also the +reason why the see key doesn’t have any effect when used in entries that +are defined in the document environment. Since the value isn’t saved, it’s +not available when the .glsdefs file is created at the end of the document +and so isn’t available at the start of the document environment on the next +run. +

This modification allows glossaries-extra to provide +


\glsxtraddallcrossrefs  \glsxtraddallcrossrefs

+ + + +

+which is used at the end of the document to automatically add any unused +cross-references unless the package option indexcrossrefs was set to false. +

As a by-product of this enhancement, the see key will now work for entries +defined in the document environment, but it’s still best to define entries in the +preamble, and the see key still can’t perform any indexing before the file has been +opened by \makeglossaries. Note that glossaries v4.24 introduced the seenoindex +package option, which can be used to suppress the error when the see key +is used before \makeglossaries, so seenoindex=ignore will allow the see +value to be stored even though it may not be possible to index it at that +point. +

As from version 1.06, you can display the cross-referenced information for a given +entry using +


\glsxtrusesee  \glsxtrusesee{label}

+

+This internally uses +


\glsxtruseseeformat  \glsxtruseseeformat{tag}{xr list}

+

+where ⟨tag⟩ and ⟨xr list⟩ are obtained from the value of the entry’s see field (if +non-empty). By default, this just does \glsseeformat[tag]{xr list}{}, +which is how the cross-reference is displayed in the number list. Note that +\glsxtrusesee does nothing if the see field hasn’t been set for the entry given by +⟨label⟩. +

As with the base glossaries package, \glsseeformat is defined to do \emph{tag} +\glsseelist{xr list}. The third argument is always ignored and is present for +makeindex, which always requires a final argument to encapsulate the associated +location. The command +


\glsseelist{xr list}

+

+used to iterate over the list of cross-reference labels is also unchanged from +the base glossaries package, with each item in the list formatted according +to: +


\glsseeitem{label}

+

+This is defined by the glossaries package to:

+
+\glshyperlink[\glsseeitemformat{label}]{label} +
+
So the actual formatting for each cross-referenced entry is performed by +\glsseeitemformat, which is redefined by glossaries-extra, as described in §2 +Modifications to Existing Commands and Styles. This now displays the value of the +text field for abbreviations and the value of the name field otherwise. There’s no +indication of the entry hierarchy, which could confuse the reader. Therefore, as from + + + +glossaries-extra v1.37, there are some new commands that include the hierarchical +information. You may prefer to redefine \glsseeitemformat to use one of this if you +have sub-entries. For example: + + + +
+\renewcommand*{\glsseeitemformat}[1]{\glsxtrhiername{#1}} +
+

+

The command: +


\glsxtrhiername  \glsxtrhiername{label}

+

+performs a recursive action: +

    +
  1. If the entry given by ⟨label⟩ has a parent, then \glsxtrhiername{parent + label} is done followed by \glsxtrhiernamesep then: +
  2. +
  3. If the entry given by ⟨label⟩ is an abbreviation (that is, it has the short field + set) then the short form is displayed (using \glsaccessshort) otherwise + the name is displayed (using \glsaccessname).
+

The first step above is skipped if the entry doesn’t have a parent. Each level is separated +by: +


\glsxtrhiernamesep  \glsxtrhiernamesep

+

+which defaults to “ ”. This can be redefined as appropriate. +

There are some case-changing variants: +


\Glsxtrhiername  \Glsxtrhiername{label}

+

+The top-level has the first letter changed to upper case (either \Glsaccessshort or +\Glsaccessname). There’s no case-change for sub-entries. +


\GlsXtrhiername  \GlsXtrhiername{label}

+

+All levels have the first letter changed to upper case (either \Glsaccessshort or +\Glsaccessname). +


\GLSxtrhiername  \GLSxtrhiername{label}

+

+The top-level is converted to upper case (either \GLSaccessshort or \GLSaccessname). +There’s no case-change for sub-entries. +


\GLSXTRhiername  \GLSXTRhiername{label}

+

+All levels are converted to upper case (either \GLSaccessshort or \GLSaccessname). +

Suppose you want to suppress the number list using nonumberlist. This +will automatically prevent the cross-references from being displayed. The +seeautonumberlist package option will automatically enable the number list for entries +that have the see key set, but this will also show the rest of the number +list. + + + +

Another approach in this situation is to use the post description hook +with \glsxtrusesee to append the cross-reference after the description. For +example: + + + +

+
+\renewcommand*{\glsxtrpostdescgeneral}{% + 
 \ifglshasfield{see}{\glscurrententrylabel} + 
 {, \glsxtrusesee{\glscurrententrylabel}}% + 
 {}% + 
} +
+

Now the cross-references can appear even though the number list has been +suppressed. +

As from v1.16, there’s a separate seealso key. Unlike see, this doesn’t have an +optional part for the textual tag. The syntax seealso={xr-labels} works in +much the same way as using see=[\seealsoname]{xr-labels} but the +information is stored in a separate field. If you need a different tag, use the see key +instead (or redefine \seealsoname or \glsxtruseseealsoformat, described +below). +

You can display the formatted list of cross-references stored in the seealso key +using: +


\glsxtruseseealso  \glsxtruseseealso{label}

+

+This works in much the same way as \glsxtrusesee but it internally uses +


\glsxtruseseeformat  \glsxtruseseealsoformat{xr list}

+

+For example: + + + +

+
+\renewcommand*{\glsxtrpostdescgeneral}{% + 
 \ifglshasfield{see}{\glscurrententrylabel} + 
 {, \glsxtrusesee{\glscurrententrylabel}}% + 
 {}% + 
 \ifglshasfield{seealso}{\glscurrententrylabel} + 
 { (\glsxtruseseealso{\glscurrententrylabel})}% + 
 {}% + 
} +
+

+

The actual unformatted comma-separated list ⟨xr-list⟩ stored in the seealso field +can be accessed with: +


\glsxtrseealsolabels  \glsxtrseealsolabels{label}

+

+This will just expand to the ⟨xr-labels⟩ provided in the value of the seealso key. There’s +no corresponding command to access the see field. If you really need to access it, you +can use commands like \glsxtrfielduse, but remember that it may start with +[tag], so it can’t be automatically treated as a simple comma-separated +list. +

As mentioned above, the base glossaries package provides \glsseelist, which +requires a comma-separated list of labels as the argument. The argument isn’t fully +expanded, so it’s not suitable to use, for example, \glsxtrseealsolabels{label} as +the argument. For convenience, glossaries-extra provides +


\glsxtrseelist  \glsxtrseelist{xr list}

+

+which fully expands its argument and passes it to \glsseelist. +

The seealso key implements the automatic indexing using +


\glsxtrindexseealso  \glsxtrindexseealso{label}{xr list}

+

+which just does

+
+\glssee[\seealsoname]{label}{xr list} +
+
unless the xindy option is used with glossaries v4.30+, in which case a distinct +seealso cross-reference class is used instead. +

+

+ + + +

Top

2.3 Entry Display Style Modifications

+

Recall from the glossaries package that commands such as \gls display text at +that point in the document (optionally with a hyperlink to the relevant +line in the glossary). This text is referred to as the “link-text” regardless of +whether or not it actually has a hyperlink. The actual text and the way +it’s displayed depends on the command used (such as \gls) and the entry +format. +

The default entry format (\glsentryfmt) used in the link-text by commands like +\gls, \glsxtrfull, \glsxtrshort and \glsxtrlong (but not commands like +\glslink, \glsfirst and \glstext) is changed by glossaries-extra to test for regular +entries, which are determined as follows: +

+
    +
  • If an entry is assigned to a category that has the regular attribute set (see §5 + Categories), the entry is considered a regular entry, even if it has a value + for the short key. In this case \glsentryfmt uses \glsgenentryfmt + (provided by glossaries), which uses the first (or firstplural) value on first + use and the text (or plural) value on subsequent use. +
  • +
  • An entry that doesn’t have a value for the short key is assumed to + be a regular entry, even if the regular attribute isn’t set to “true” + (since it can’t be an abbreviation without the short form). In this case + \glsentryfmt uses \glsgenentryfmt. +
  • +
  • If an entry does has a value for the short key and hasn’t been marked as + a regular entry through the regular attribute, it’s not considered a regular + entry. In this case \glsentryfmt uses \glsxtrgenabbrvfmt (defined by + glossaries-extra) which is governed by the abbreviation style (see §3.2 + Abbreviation Styles). +
+

This means that entries with a short form can be treated as regular entries rather +than abbreviations if it’s more appropriate for the desired style. +

As from version 1.04, \glsentryfmt now puts \glsgenentry in the argument of +the new command +


\glsxtrregularfont  \glsxtrregularfont{text}

+

+This just does its argument ⟨text⟩ by default. This means that if you want regular +entries in a different font but don’t want that font to apply to abbreviations, then +you can redefine \glsxtrregularfont. This is more precise than changing +\glstextformat which is applied to all linking commands for all entries, unless +overridden by the textformat attribute. +

For example: + + + +

+
+\renewcommand*{\glsxtrregularfont}[1]{\textsf{#1}} +
+

You can access the label through \glslabel. For example, you can query the +category: + + + +

+
+\renewcommand*{\glsxtrregularfont}[1]{% + 
 \glsifcategory{\glslabel}{general}{\textsf{#1}}{#1}} +
+

or query the category attribute, for example, provide a custom attribute called +font: + + + +

+
+\glssetcategoryattribute{general}{font}{sf} + 
\renewcommand*{\glsxtrregularfont}[1]{% + 
 \glsifattribute{\glslabel}{font}{sf}{\textsf{#1}}{#1}} +
+

As from version 1.21, it’s simpler to just do, for example: + + + +

+
+\glssetcategoryattribute{general}{textformat}{textsf} +
+

without redefining \glsxtrregularfont. +

As from version 1.30, there is also a command for abbreviations that encapsulates +\glsxtrgenabbrvfmt: +


\glsxtrabbreviationfont  \glsxtrabbreviationfont{text}

+

+This also just does its argument by default. Font changes made by abbreviation styles +are within ⟨text⟩. +

The \glspostlinkhook provided by the glossaries package to insert information +after the link-text produced by commands like \gls and \glstext is redefined +to +


\glsxtrpostlinkhook  \glsxtrpostlinkhook

+

+This command will discard a following full stop (period) if the discardperiod attribute +is set to “true” for the current entry’s category. It will also do +


\glsxtrpostlink  \glsxtrpostlink

+

+if a full stop hasn’t be discarded and +


\glsxtrpostlinkendsentence  \glsxtrpostlinkendsentence

+

+if a full stop has been discarded. +

It may be that you want to check some other setting (rather than a category +attribute) to determine whether or not to discard a following full stop. In which case +you can redefine: +


\glsxtrifcustomdiscardperiod  \glsxtrifcustomdiscardperiod{true} +{false}

+

+You can access the field’s label using \glslabel. This command should do ⟨true⟩ if the +post-link hook should check if a period follows and ⟨false⟩ otherwise. The default +definition is simply: + + + +

+
+\newcommand*{\glsxtrifcustomdiscardperiod}[2]{#2} +
+

which means that no additional checks are performed. (Only the recognised category +attributes will be checked.) +

Avoid the use of \gls-like and \glstext-like commands within the +post-link hook as they will cause interference. Consider using commands like +\glsentrytext, \glsaccesstext or \glsxtrp (§2.7 Nested Links) instead. +
+

+

By default \glsxtrpostlink just does \glsxtrpostlinkcategory if +it exists, where ⟨category⟩ is the category label for the current entry. (For +example, for the general category, \glsxtrpostlinkgeneral if it has been +defined.) +

You can define the post-link hook command using \newcommand, for +example: + + + +

+
+\newcommand*{\glsxtrpostlinkgeneral}{% + 
 \glsxtrpostlinkAddDescOnFirstUse + 
} +
+

or, as from v1.31, you can use +


\glsdefpostlink  \glsdefpostlink{category}{definition}

+

+This is simply a shortcut for:

+
+\csdef{glsxtrpostlinkcategory}{definition} +
+
Note that it doesn’t check if the command has already been defined. +

The sentence-ending hook is slightly more complicated. If the command +\glsxtrpostlinkcategory is defined the hook will do that and then insert a +full stop with the space factor adjusted to match the end of sentence. If +\glsxtrpostlinkcategory hasn’t been defined, the space factor is adjusted to match +the end of sentence. This means that if you have, for example, an entry that ends +with a full stop, a redundant following full stop will be discarded and the space factor +adjusted (in case the entry is in uppercase) unless the entry is followed by additional +material, in which case the following full stop is no longer redundant and needs to be +reinserted. +

There are some convenient commands you might want to use when customizing +the post-link-text category hooks: +


\glsxtrpostlinkAddDescOnFirstUse  \glsxtrpostlinkAddDescOnFirstUse +

+

+This will add the description in parentheses on first use. +

For example, suppose you want to append the description in parentheses on first +use for entries in the symbol category: + + + +

+
+\newcommand*{\glsxtrpostlinksymbol}{% + 
  \glsxtrpostlinkAddDescOnFirstUse + 
} +
+

+


\glsxtrpostlinkAddSymbolOnFirstUse  \glsxtrpostlinkAddSymbolOnFirstUse +

+

+This will append the symbol (if defined) in parentheses on first use. (Does nothing if +the symbol hasn’t been set.) +


\glsxtrpostlinkAddSymbolDescOnFirstUse  \glsxtrpostlinkAddSymbolDescOnFirstUse +

+

+(New to v1.31.) On first use, this will append \space(⟨symbol⟩, ⟨description⟩) if the +symbol is defined otherwise it just appends \space(⟨description⟩). +

If you want to provide your own custom format be aware that you can’t use +\ifglsused within the post-link-text hook as by this point the first use flag will have +been unset. Instead you can use +


\glsxtrifwasfirstuse  \glsxtrifwasfirstuse{true}{false}

+

+This will do ⟨true⟩ if the last used entry was the first use for that entry, otherwise it +will do ⟨false⟩. (Requires at least glossaries v4.19 to work properly.) This command is +locally set by commands like \gls, so don’t rely on it outside of the post-link-text +hook. +

Note that commands like \glsfirst and \glsxtrfull fake first use for the +benefit of the post-link-text hooks by setting \glsxtrifwasfirstuse to +\@firstoftwo. (Although, depending on the styles in use, they may not exactly +match the text produced by \gls-like commands on first use.) However, the +short-postfootnote style alters \glsxtrfull so that it fakes non-first use otherwise +the inline full format would include the footnote, which is inappropriate. +
+

+

For example, if you want to place the description in a footnote after the link-text +on first use for the general category: + + + +

+
+\newcommand*{\glsxtrpostlinkgeneral}{% + 
  \glsxtrifwasfirstuse{\footnote{\glsentrydesc{\glslabel}}}{}% + 
} +
+

+

The short-postfootnote abbreviation style uses the post-link-text hook to place the +footnote after trailing punctuation characters. +

You can set the default options used by \glslink, \gls etc with: +


\GlsXtrSetDefaultGlsOpts  \GlsXtrSetDefaultGlsOpts{options}

+

+For example, if you mostly don’t want to index entries then you can do: + + + +

+
+\GlsXtrSetDefaultGlsOpts{noindex} +
+

and then use, for example, \gls[noindex=false]{sample} when you actually want +the location added to the number list. These defaults may be overridden by other +settings (such as category attributes) in addition to any settings passed in the option +argument of commands like \glslink and \gls. +

Note that if you don’t want any indexing, just omit \makeglossaries and +\printglossaries (or analogous commands). If you want to adjust the +default for wrgloss, it’s better to do this by redefining \glsxtrinitwrgloss +instead. +

\GlsXtrSetDefaultGlsOpts doesn’t affect \glsadd.
+

+

If you want to change the default value of format, you can instead use: +


\GlsXtrSetDefaultNumberFormat{format}

+

+This has the advantage of also working for \glsadd. For example, if you +want all locations in the back matter to appear in italic (unless explicitly +overridden): + + + +

+
+\backmatter + 
\GlsXtrSetDefaultNumberFormat{hyperit} +
+

+

Commands like \gls have star (*) and plus (+) modifiers as a short cut for +hyper=false and hyper=true. The glossaries-extra package provides a way to add a +third modifier, if required, using +


\GlsXtrSetAltModifier  \GlsXtrSetAltModifier{char}{options} +

+

+where ⟨char⟩ is the character used as the modifier and ⟨options⟩ is the default set of +options (which may be overridden). Note that ⟨char⟩ must be a single character (not a +UTF-8 character, unless you are using XƎLATEX or LuaLATEX). +

When choosing the character ⟨char⟩ take care of any changes in category code. +
+

+

Example: + + + +

+
+\GlsXtrSetAltModifier{!}{noindex} +
+

This means that \gls!{sample} will be equivalent to \gls[noindex]{sample}. It’s +not possible to mix modifiers. For example, if you want to do + + + +

+
+\gls[noindex,hyper=false]{sample} +
+

you can use \gls*[noindex]{sample} or \gls![hyper=false]{sample} but you +can’t combine the * and ! modifiers. +

Location lists displayed with \printnoidxglossary internally use +


\glsnoidxdisplayloc  \glsnoidxdisplayloc{prefix}{counter}{format} +{location}

+

+This command is provided by glossaries, but is modified by glossaries-extra to check +for the start and end range formation identifiers ( and ) which are discarded to +obtain the actual control sequence name that forms the location formatting +command. +

If the range identifiers aren’t present, this just uses +


\glsxtrdisplaysingleloc  \glsxtrdisplaysingleloc{format}{location} +

+

+otherwise it uses +


\glsxtrdisplaystartloc  \glsxtrdisplaystartloc{format}{location} +

+

+for the start of a range (where the identifier has been stripped from ⟨format⟩) +or +


\glsxtrdisplayendloc  \glsxtrdisplayendloc{format}{location} +

+

+for the end of a range (where the identifier has been stripped from ⟨format⟩). +

By default the start range command saves the format in +


\glsxtrlocrangefmt  \glsxtrlocrangefmt

+

+and does +
\glsxtrdisplaysingleloc{format}{location} +
+(If the format is empty, it will be replaced with glsnumberformat.) +

The end command checks that the format matches the start of the range, +does +


\glsxtrdisplayendlochook  \glsxtrdisplayendlochook{format}{location} +

+

+(which does nothing by default), followed by +
\glsxtrdisplaysingleloc{format}{location} +
+and then sets \glsxtrlocrangefmt to empty. + + + +

This means that the list + + + +

+
+\glsnoidxdisplayloc{}{page}{(textbf}{1}, + 
\glsnoidxdisplayloc{}{page}{textbf}{1}, + 
\glsnoidxdisplayloc{}{page}{)textbf}{1}. +
+

doesn’t display any differently from + + + +

+
+\glsnoidxdisplayloc{}{page}{textbf}{1}, + 
\glsnoidxdisplayloc{}{page}{textbf}{1}, + 
\glsnoidxdisplayloc{}{page}{textbf}{1}. +
+

but it does make it easier to define your own custom list handler that can +accommodate the ranges. +

+

+

Top

2.4 Entry Counting Modifications

+

If you are using bib2gls you may find it more convenient to use the record +count commands described in §9 bib2gls: Managing Reference Databases +instead. +

The \glsenableentrycount command is modified to allow for the entrycount +attribute. This means that you not only need to enable entry counting with +\glsenableentrycount, but you also need to set the appropriate attribute (see §5 +Categories). +

For example, instead of just doing: + + + +

+
+\glsenableentrycount +
+

you now need to do: + + + +

+
+\glsenableentrycount + 
\glssetcategoryattribute{abbreviation}{entrycount}{1} +
+

This will enable the entry counting for entries in the abbreviation category, but any +entries assigned to other categories will be unchanged. +

Further information about entry counting, including the new per-unit feature, is +described in §6.1 Entry Counting (First Use Flag). +

+

+

Top

2.5 First Use Flag

+

The glossaries package provides +


\ifglsused{label}{true}{false}

+

+to determine whether or not an entry has been used. This requires the entry to have +been defined. If the entry is undefined, then the underlying boolean variable doesn’t +exist and so is neither true nor false. This command will produce an error with the +default undefaction=error mode and a warning with undefaction=warn and, where +appropriate, displays ?? in the document text to denote an undefined reference. +With both modes, neither ⟨true⟩ nor ⟨false⟩ will be performed if ⟨label⟩ doesn’t +exist. +

The record option automatically implements undefaction=warn since no entries +will be defined until they have been selected by bib2gls. In this case, you may prefer +to use: +


\GlsXtrIfUnusedOrUndefined  \GlsXtrIfUnusedOrUndefined{label}{true} +{false}

+

+(new to v1.34) which does ⟨true⟩ if the entry given by ⟨label⟩ is undefined or if +the entry is marked as unused. Remember that neither \ifglsused nor +\GlsXtrIfUnusedOrUndefined should be used in the post-link hook as the +first use flag will have already been unset before the hook is performed. +(Instead, \glsxtrifwasfirstuse should be used, see §2.3 Entry Display Style +Modifications.) +

There are two new commands provided with version 1.31+: +


\glslocalreseteach  \glslocalreseteach{list}

+

+and +


\glslocalunseteach  \glslocalunseteach{list}

+

+These behave like \glslocalreset and \glslocalunset but the argument is a + + + +comma-separated list of labels. +

The internal command used by \glsunset is modified first to allow for the +changing in entry counting, described above, but also to allow for buffering pending +unsets when commands like \gls are used in a context where changing a boolean +variable can cause things to go wrong. One example of this is using \gls in one of +the commands provided with the package. For example: + + + +

+
+\ul{Some text about \gls{html}.} +
+

This causes the confusing error: + + + +

+
+Glossary entry `{html}' has not been defined. +
+

The simplest workaround is to put \gls{html} inside the argument of \mbox. For +example: + + + +

+
+\ul{Some text about \mbox{\gls{html}}.} +
+

This can work provided it’s not the first use of this entry. It if is, then unsetting the +first use flag causes a problem and results in the error: + + + +

+
+! Package soul Error: Reconstruction failed. +
+

The glossaries-extra package provides a way of temporarily switching off \glsunset +so that it just makes a note of the entry’s label but doesn’t actually perform the +change: +


\GlsXtrStartUnsetBuffering  \GlsXtrStartUnsetBuffering

+

+The unstarred version doesn’t check for duplicates, so the internal list may +end up with multiple occurrences of the same label. The starred version +only adds a label to the internal list if it’s not already in it. Note that this +buffering only applies to the global \glsunset and does not affect the local +\glslocalunset. +

Later you can restore \glsunset and unset all buffered labels using: +


\GlsXtrStopUnsetBuffering  \GlsXtrStopUnsetBuffering

+

+The starred form \GlsXtrStopUnsetBuffering* uses \glslocalunset instead. For +example: + + + +

+
+\documentclass{article} + 
\usepackage[T1]{fontenc} + 
\usepackage{soul} + 
\usepackage{glossaries-extra} + 
\newabbreviation{html}{HTML}{hypertext markup language} + 
\begin{document} + 
\GlsXtrStartUnsetBuffering + 
\ul{Some text about \mbox{\gls{html}}.} + 
\GlsXtrStopUnsetBuffering + 
Next use: \gls{html}. + 
\end{document} +
+

Before you stop the unset buffering, you can iterate over the current buffer +using +


\GlsXtrForUnsetBufferedList  \GlsXtrForUnsetBufferedList{cs} +

+

+where ⟨cs⟩ is a control sequence that takes a single argument (which is the entry label). +This is best used with the starred version \GlsXtrStartUnsetBuffering* to avoid +duplicates. +

Note that since the change in the first use flag now doesn’t occur until +\GlsXtrStopUnsetBuffering, multiple references of the same term within the +buffering zone will always be treated as first use (if the term wasn’t used before the +buffering started).
+

+

There can still be a problem here as content within \mbox can’t break across a +line so you may end up with an overfull line or excessive white space within the +paragraph. +

An alternative is to use \protect: + + + +

+
+\GlsXtrStartUnsetBuffering + 
\ul{Some text about \protect\gls{html}.} + 
\GlsXtrStopUnsetBuffering +
+

but the formatting (underlining in this example) won’t be applied. Another +possibility is: + + + +

+
+\usepackage[T1]{fontenc} + 
\usepackage{soul} + 
\usepackage{glossaries-extra} + 
\newabbreviation{html}{HTML}{hypertext markup language} + 
\newrobustcmd{\gul}[1]{% + 
  {% + 
   \def\glsxtrabbreviationfont##1{\GlsXtrExpandedFmt{\ul}{##1}}% + 
   \def\glsxtrregularfont##1{\GlsXtrExpandedFmt{\ul}{##1}}% + 
   #1% + 
  }% + 
} + 
\begin{document} + 
\ul{Some text about }\gls[textformat=gul]{html}. + 
Next use: \gls{html}. + 
\end{document} +
+

This moves \gls outside of \ul and uses textformat to locally change the formatting +command used by \gls (which is normally given by \glstextformat or the +textformat attribute) to a custom command \gul, which locally changes the regular +font and the default abbreviation font to use \ul. It then uses +


\GlsXtrExpandedFmt  \GlsXtrExpandedFmt{cs}{text}

+

+which (protected) fully expands ⟨text⟩ before applying ⟨cs⟩, which must be a control +sequence that takes a single argument. This allows \ul to move much further inside +and increases its chances of working. It can still break if ⟨text⟩ expands to +something that \ul can’t deal with. For example, if an abbreviation style is used +that contains complex formatting or if the field value contains problematic +content. +

+

+

Top

2.6 Plurals

+

Some languages, such as English, have a general rule that plurals are formed from +the singular with a suffix appended. This isn’t an absolute rule. There are +plenty of exceptions (for example, geese, children, churches, elves, fairies, +sheep). The glossaries package allows the plural key to be optional when +defining entries. In some cases a plural may not make any sense (for example, + + + +the term is a symbol) and in some cases the plural may be identical to the +singular. +

To make life easier for languages where the majority of plurals can simply be +formed by appending a suffix to the singular, the glossaries package lets the plural +field default to the value of the text field with \glspluralsuffix appended. This +command is defined to be just the letter “s”. This means that the majority of terms +don’t need to have the plural supplied as well, and you only need to use it for the +exceptions. +

For languages that don’t have this general rule, the plural field will always need to +be supplied, where needed. +

There are other plural fields, such as firstplural, longplural and shortplural. Again, if +you are using a language that doesn’t have a simple suffix rule, you’ll have to +supply the plural forms if you need them (and if a plural makes sense in the +context). +

If these fields are omitted, the glossaries package follows these rules:

+
    +
  • If firstplural is missing, then \glspluralsuffix is appended to the first + field, if that field has been supplied. If the first field hasn’t been supplied + but the plural field has been supplied, then the firstplural field defaults to + the plural field. If the plural field hasn’t been supplied, then both the plural + and firstplural fields default to the text field (or name, if no text field) with + \glspluralsuffix appended. +
  • +
  • If the longplural field is missing, then \glspluralsuffix is appended to + the long field, if the long field has been supplied. +
  • +
  • If the shortplural field is missing then, with the base glossaries acronym + mechanism, \acrpluralsuffix is appended to the short field. +
+

This last case is changed with glossaries-extra. With this extension package, the +shortplural field defaults to the short field with \abbrvpluralsuffix appended +unless overridden by category attributes. This suffix command is set by the +abbreviation styles. This means that every time an abbreviation style is +implemented, \abbrvpluralsuffix is redefined. In most cases its redefined to +use +


\glsxtrabbrvpluralsuffix  \glsxtrabbrvpluralsuffix

+

+which defaults to just \glspluralsuffix. Some of the abbreviation styles have their +own command for the plural suffix, such as \glsxtrscsuffix, so if you want to +completely strip all the plural suffixes used for abbreviations then you need to +redefine \glsxtrabbrvpluralsuffix not \abbrvpluralsuffix, which changes with +the style. Redefining \acrpluralsuffix will have no affect, since it’s not used by the +new abbreviation mechanism. + + + +

If you require a mixture (for example, in a multilingual document), there are two +attributes that affect the short plural suffix formation. The first is aposplural which +uses the suffix + + + +

+
+'\abbrvpluralsuffix +
+

That is, an apostrophe followed by \abbrvpluralsuffix is appended. The second +attribute is noshortplural which suppresses the suffix and simply sets shortplural to the +same as short. +

+

+

Top

2.7 Nested Links

+

Complications arise when you use \gls in the value of the name field (or text or first +fields, if set). This tends to occur with abbreviations that extend other abbreviations. +For example, SHTML is an abbreviation for SSI enabled HTML, where SSI is an +abbreviation for Server Side Includes and HTML is an abbreviation for Hypertext +Markup Language. +

Things can go wrong if we try the following with the glossaries package: + + + +

+
+\newacronym{ssi}{SSI}{Server Side Includes} + 
\newacronym{html}{HTML}{Hypertext Markup Language} + 
\newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}} +
+

+

The main problems are: +

    +
  1. The first letter upper casing commands, such as \Gls, won’t work for the + shtml entry on first use if the long form is displayed before the short + form (which is the default abbreviation style). This will attempt to + do + + + +
    + \gls{\uppercase ssi} enabled \gls{html} +
    +

    which just doesn’t work. Grouping the \gls{ssi} doesn’t work either as this + will effectively try to do + + + +

    +
    + \uppercase{\gls{ssi}} enabled \gls{html} +
    +

    This will upper case the label ssi so the entry won’t be recognised. + This problem will also occur if you use the all capitals version, such as + \GLS. +

  2. +
  3. The long and abbreviated forms accessed through \glsentrylong and + \glsentryshort are no longer expandable and so can’t be used be used in + contexts that require this, such as PDF bookmarks. +
  4. +
  5. The nested commands may end up in the sort key, which will confuse the + indexing. +
  6. +
  7. The shtml entry produces inconsistent results depending on whether the ssi + or html entries have been used. Suppose both ssi and html are used before + shtml. For example: + + + +
    + This section discusses \gls{ssi}, \gls{html} and \gls{shtml}. +
    +

    This produces: +

    +

    This section discusses server side includes (SSI), hypertext + markup language (HTML) and SSI enabled HTML (SHTML).

    +

    So the first use of the shtml entry produces “SSI enabled HTML (SHTML)”. +

    Now let’s suppose the html entry is used before the shtml but the ssi entry is + used after the shtml entry, for example: + + + +

    +
    + The sample files are either \gls{html} or \gls{shtml}, but let's +  
    first discuss \gls{ssi}. +
    +

    This produces: +

    +

    The sample files are either hypertext markup language (HTML) + or server side includes (SSI) enabled HTML (SHTML), but let’s + first discuss SSI.

    +

    So the first use of the shtml entry now produces “server side includes (SSI) + enabled HTML (SHTML)”, which looks a bit strange. +

    Now let’s suppose the shtml entry is used before (or without) the other two + entries: + + + +

    +
    + This article is an introduction to \gls{shtml}. +
    +

    This produces: +

    +

    This article is an introduction to server side includes (SSI) + enabled hypertext markup language (HTML) (SHTML).

    +

    So the first use of the shtml entry now produces “server side includes (SSI) + enabled hypertext markup language (HTML) (SHTML)”, which is even more + strange. +

    This is all aggravated by setting the style using the glossaries package’s + \setacronymstyle. For example: + + + +

    +
    + \setacronymstyle{long-short} +
    +

    as this references the label through the use of \glslabel when displaying the + long and short forms, but this value changes with each use of \gls, so + instead of displaying “(SHTML)” at the end of the first use, it now + displays “(HTML)”, since \glslabel has been changed to html by + \gls{html}. +

    Another oddity occurs if you reset the html entry between uses of the shtml + entry. For example: + + + +

    +
    + \gls{shtml} ... \glsreset{html}\gls{shtml} +
    +

    The next use of shtml produces “Shypertext markup language (HTML)”, + which is downright weird. +

    Even without this, the short form has nested formatting commands, which + amount to \acronymfont{S\acronymfont{HTML}}. This may not be a problem + for some styles, but if you use one of the “sm” styles (that use \textsmaller), + this will produce an odd result. +

  8. +
  9. Each time the shtml entry is used, the html entry will also be indexed and + marked as used, and on first use this will happen to both the ssi and html + entries. This kind of duplication in the location list isn’t usually particularly + helpful to the reader. +
  10. +
  11. If hyperref is in use, you’ll get nested hyperlinks and there’s no consistent way + of dealing with this across the available PDF viewers. If on the first + use case, the user clicks on the “HTML” part of the “SSI enabled + HTML (SHTML)” link, they may be directed to the HTML entry + in the glossary or they may be directed to the SHTML entry in the + glossary. +
+

For these reasons it’s better to use the simple expandable commands +like \glsentrytext or \glsentryshort in the definition of other entries +(although that doesn’t fix the first problem). Alternatively use something +like: + + + +

+
+\newacronym + 
 [description={\acrshort{ssi} enabled \acrshort{html}}] + 
 {shtml}{SHTML}{SSI enabled HTML} +
+

with glossaries or: + + + +

+
+\newabbreviation + 
 [description={\glsxtrshort{ssi} enabled \glsxtrshort{html}}] + 
 {shtml}{SHTML}{SSI enabled HTML} +
+

with glossaries-extra. This fixes all the above listed problems (as long as you don’t +use \glsdesc). Note that replacing \gls with \acrshort in the original example +may fix the first use issue, but it doesn’t fix any of the other problems listed +above. +

If it’s simply that you want to use the abbreviation font, you can use +\glsabbrvfont: + + + +

+
+\setabbreviationstyle{long-short-sc} + 
\newabbreviation{ssi}{ssi}{server-side includes} + 
\newabbreviation{html}{html}{hypertext markup language} + 
\newabbreviation{shtml}{shtml}{\glsabbrvfont{ssi} enabled + 
\glsabbrvfont{html}} +
+

This will pick up the font style setting of the outer entry (shtml, in the above case). +This isn’t a problem in the above example as all the abbreviations use the same +style. +

However if you’re really determined to use \gls in a field that may be included +within some link-text, glossaries-extra patches internals used by the linking commands +so that if \gls (or plural or case changing variants) occurs in the link-text it will +behave as though you used \glstext[hyper=false,noindex] instead. Grouping is +also added so that, for example, when \gls{shtml} is used for the first time the long +form + + + +

+
+\gls{ssi} enabled \gls{html} +
+

is treated as + + + +

+
+{\glstext[hyper=false,noindex]{ssi}} enabled + 
{\glstext[hyper=false,noindex]{html}} +
+

This overcomes problems 4, 5 and 6 listed above, but still doesn’t fix problems 1 +and 2. Problem 3 usually won’t be an issue as most abbreviation styles set the sort +key to the short form, so using these commands in the long form but not the short +form will only affect entries with a style that sorts according to the long form (such +as long-noshort-desc). +

Additionally, any instance of the long form commands, such as \glsxtrlong or +\acrlong will be temporarily redefined to just use

+
+{\glsentrylong{label}insert} +
+
(or case-changing versions). Similarly the short form commands, such as +\glsxtrshort or \acrshort will use \glsentryshort in the argument of either +\glsabbrvfont (for \glsxtrshort) or \acronymfont (for \acrshort). So if the +shtml entry had instead been defined as: + + + +
+\newacronym{shtml}{SHTML}{\acrshort{ssi} enabled \acrshort{html}} +
+

then (using the long-short style) the first use will be like + + + +

+
+{\acronymfont{\glsentryshort{ssi}}} enabled + 
{\acronymfont{\glsentryshort{html}}} (SHTML) +
+

whereas if the entry is defined as: + + + +

+
+\newabbreviation{shtml}{SHTML}{\glsxtrshort{ssi} enabled + 
\glsxtrshort{html}} +
+

then the first use will be like: + + + +

+
+{\glsabbrvfont{\glsentryshort{ssi}}} enabled + 
{\glsabbrvfont{\glsentryshort{html}}} (SHTML) +
+

Note that the first optional argument of \acrshort or \glsxtrshort is ignored in +this context. (The final optional argument will be inserted, if present.) The +abbreviation style that governs \glsabbrvfont will be set for \glsxtrshort. Note +that \acrshort doesn’t set the abbreviation style. +

Alternatively you can use: +


\glsxtrp  \glsxtrp{field}{label}

+

+where ⟨field⟩ is the field label and corresponds to a command in the form \glsfield⟩ +(e.g. \glstext) or in the form \glsxtrfield⟩ (e.g. \glsxtrshort). +

There’s a shortcut command for the most common fields: +


\glsps  \glsps{label}

+

+which is equivalent to \glsxtrp{short}{label}, and +


\glspt  \glspt{label}

+

+which is equivalent to \glsxtrp{text}{label}. +

The \glsxtrp command behaves much like the \glsfmtfield⟩ commands described +in §4 Entries in Sectioning Titles, Headers, Captions and Contents but the post-link +hook is also suppressed and extra grouping is added. It automatically sets +hyper to false and noindex to true. If you want to change this, you can +use +


\glsxtrsetpopts  \glsxtrsetpopts{options}

+

+For example: + + + +

+
+\glsxtrsetpopts{hyper=false} +
+

will just switch off the hyperlinks but not the indexing. Be careful using +this command or you can end up back to the original problem of nested +links. +

The hyper link is re-enabled within glossaries. This is done through the +command: +


\glossxtrsetpopts  \glossxtrsetpopts

+

+which by default just does + + + +

+
+\glsxtrsetpopts{noindex} +
+

You can redefine this if you want to adjust the setting when \glsxtrp is used in the +glossary. For example: + + + +

+
+\renewcommand{\glossxtrsetpopts}{\glsxtrsetpopts{noindex=false}} +
+

+

For example, + + + +

+
+\glsxtrp{short}{ssi} +
+

is equivalent to + + + +

+
+{\let\glspostlinkhook\relax + 
 \glsxtrshort[hyper=false,noindex]{ssi}[]% + 
} +
+

in the main body of the document or + + + +

+
+{\let\glspostlinkhook\relax + 
 \glsxtrshort[noindex]{ssi}[]% + 
} +
+

inside the glossary. (Note the post-link hook is locally disabled.) +

If \glsxtrp{short}{ssi} occurs in a sectioning mark, it’s equivalent +to + + + +

+
+{\glsxtrheadshort{ssi}} +
+

(which recognises the headuc attribute.) +

If hyperref has been loaded, then the bookmark will use \glsentryfield⟩ +(\glsentryshort{ssi} in the above example). +

There are similar commands +


\Glsxtrp  \Glsxtrp{field}{label}

+

+for first letter upper case and +


\GLSxtrp  \GLSxtrp{field}{label}

+

+for all upper case. +

If you use any of the case-changing commands, such as \Gls or \Glstext, (either +all caps or first letter upper casing) don’t use any of the linking commands, such as +\gls or \glstext, in the definition of entries for any of the fields that may be used +by those case-changing commands.
+

+

You can, with care, protect against issue 1 by inserting an empty group at the +start if the long form starts with a command that breaks the first letter uppercasing +commands like \Gls, but you still won’t be able to use the all caps commands, such +as \GLS. +

If you really need nested commands, the safest method is + + + +

+
+\newabbreviation{shtml}{shtml}{{}\glsxtrp{short}{ssi} enabled + 
\glsxtrp{short}{html}} +
+

but be aware that it may have some unexpected results occasionally. +

Example document: + + + +

+
+\documentclass{report} + 
\usepackage[utf8]{inputenc} + 
\usepackage[T1]{fontenc} + 
\usepackage{slantsc} + 
\usepackage[colorlinks]{hyperref} + 
\usepackage[nopostdot=false]{glossaries-extra} + 
\makeglossaries + 
\setabbreviationstyle{long-short-sc} + 
\newabbreviation{ssi}{ssi}{server-side includes} + 
\newabbreviation{html}{html}{hypertext markup language} + 
\newabbreviation{shtml}{shtml}{{}\glsps{ssi} enabled {}\glsps{html}} + 
\pagestyle{headings} + 
\glssetcategoryattribute{abbreviation}{headuc}{true} + 
\glssetcategoryattribute{abbreviation}{glossdesc}{title} + 
\begin{document} + 
\tableofcontents + 
\chapter{\glsfmtfull{shtml}} + 
First use: \gls{shtml}, \gls{ssi} and \gls{html}. + 
Next use: \gls{shtml}, \gls{ssi} and \gls{html}. + 
\newpage + 
Next page. + 
\printglossaries + 
\end{document} +
+

+

+

+

Top

2.8 Acronym Style Modifications

+ + + +

The glossaries-extra package provides a new way of dealing with abbreviations and +redefines \newacronym to use \newabbreviation (see §3 Abbreviations). The +simplest way to update a document that uses \newacronym from glossaries to +glossaries-extra is do just add + + + +

+
+\setabbreviationstyle[acronym]{long-short} +
+

before you define any entries. For example, the following document using just +glossaries + + + +

+
+\documentclass{article} + 
\usepackage[acronym,nopostdot,toc]{glossaries} + 
\makeglossaries + 
\setacronymstyle{long-short} + 
\newacronym{html}{HTML}{hypertext markup language} + 
\begin{document} + 
\gls{html} + 
\printglossaries + 
\end{document} +
+

can be easily adapted to use glossaries-extra: + + + +

+
+\documentclass{article} + 
\usepackage[acronym]{glossaries-extra} + 
\makeglossaries + 
\setabbreviationstyle[acronym]{long-short} + 
\newacronym{html}{HTML}{hypertext markup language} + 
\begin{document} + 
\gls{html} + 
\printglossaries + 
\end{document} +
+

Table 2.1 lists the nearest equivalent glossaries-extra abbreviation styles for the +predefined acronym styles provided by glossaries, but note that the new styles use +different formatting commands. See §3.4 Predefined Abbreviation Styles for further +details. +

+
+ + + +


+ + + +
Table 2.1: Old Acronym Styles \setacronymstyle{old-style-name} Verses +New Abbreviation Styles \setabbreviationstyle[category]{new-style-name}
+
+ + + + + + + + + + + + + + + + + + + + +

Old Style Name

New Style Name

long-sc-short

long-short-sc

long-sm-short

long-short-sm

long-sp-short

long-short
with \renewcommand{\glsxtrfullsep}[1]{\glsacspace{#1}}

short-long

short-long

sc-short-long

short-sc-long

sm-short-long

short-sm-long

long-short-desc

long-short-desc

long-sc-short-desc

long-short-sc-desc

long-sm-short-desc

long-short-sm-desc

long-sp-short-desc

long-short-desc
with \renewcommand{\glsxtrfullsep}[1]{\glsacspace{#1}}

short-long-desc

short-long-desc

sc-short-long-desc

short-sc-long-desc

sm-short-long-desc

short-sm-long-desc

dua

long-noshort

dua-desc

long-noshort-desc

footnote

short-footnote

footnote-sc

short-sc-footnote

footnote-sm

short-sm-footnote

footnote-desc

short-footnote-desc

footnote-sc-desc

short-sc-footnote-desc

footnote-sm-desc

short-sm-footnote-desc

+ + + +

+
+

The reason for introducing the new style of abbreviation commands provided by +glossaries-extra is because the original acronym commands provided by glossaries are +too restrictive to work with the internal modifications made by glossaries-extra. +However, if you really want to restore the generic acronym function provided by +glossaries you can use +


\RestoreAcronyms  \RestoreAcronyms

+

+(before any use of \newacronym). +

\RestoreAcronyms should not be used in combination with the newer +glossaries-extra abbreviations. Don’t combine old and new style entries with the same +type. The original glossaries acronym mechanism doesn’t work well with the newer +glossaries-extra commands. +

If you use \RestoreAcronyms, don’t use any of the commands provided by +glossaries-extra intended for abbreviations (such as \glsxtrshort or \glsfmtshort) +with entries defined via \newacronym as it will cause unexpected results. +
+

+

In general, there’s rarely any need for \RestoreAcronyms. If you have a +document that uses \newacronymstyle, then it’s best to either stick with just +glossaries for that document or define an equivalent abbreviation style with +\newabbreviationstyle. (See §3.5 Defining New Abbreviation Styles for further +details.) +


\glsacspace  \glsacspace{label}

+

+The space command \glsacspace used by the long-sp-short acronym style provided +by glossaries is modified so that it uses +


\glsacspacemax  \glsacspacemax

+

+instead of the hard-coded 3em. This is a command not a length and so can be +changed using \renewcommand. +

Any of the new abbreviation styles that use \glsxtrfullsep (such as long-short) +can easily be changed to use \glsacspace with + + + +

+
+\renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}} +
+

+

The first use acronym font command +


\firstacronymfont{text}

+

+is redefined to use the first use abbreviation font command \glsfirstabbrvfont. +This will be reset if you use \RestoreAcronyms. +

The subsequent use acronym font command +


\acronymfont{text}

+

+is redefined to use the subsequent use abbreviation font command \glsabbrvfont. +This will be reset if you use \RestoreAcronyms. +

+

Top

2.9 glossary-bookindex package

+

As from v1.21, glossaries-extra has a new supplementary package glossary-bookindex +which provides the glossary style bookindex. This is very similar to the mcolindexgroup +style but is designed for indexes, so by default only the name and location list +are displayed. You can either load this package explicitly and then set the +style: + + + +

+
+\usepackage{glossaries-extra} + 
\usepackage{glossary-bookindex} + 
\setglossarystyle{bookindex} +
+

or use both the stylemods and style options: + + + +

+
+\usepackage[stylemods=bookindex,style=bookindex]{glossaries-extra} +
+

The bookindex style only supports a maximum hierarchical level of 2 (top-level, +level 1 and level 2). It’s primarily designed for use with bib2gls. It may be used +with other indexing options, but some features may not be present and UTF-8 +characters may cause a problem with non-Unicode engines in letter group +headings or PDF bookmarks. (bib2gls uses numeric identifies by default to +avoid these problems. If numbers show up in the group headings instead of +the appropriate characters, check that you have used the record package +option.) +

The number of columns is given by +


\glsxtrbookindexcols  \glsxtrbookindexcols

+

+which defaults to 2. +

This style uses the multicols environment. If the command +


\glsxtrbookindexcolspread  \glsxtrbookindexcolspread

+

+isn’t empty then it’s supplied as the optional argument following \begin{multicols} +{n}. You can switch from multicols to multicols* by redefining +


\glsxtrbookindexmulticolsenv  \glsxtrbookindexmulticolsenv

+

+For example + + + +

+
+\renewcommand{\glsxtrbookindexmulticolsenv}{multicols*} +
+

+

Each top-level entry is displayed using +


\glsxtrbookindexname  \glsxtrbookindexname{label}

+

+where the entry is identified by ⟨label⟩. This just does \glossentryname{label} by +default. For example, if you want the symbol to be included: + + + +

+
+\renewcommand*{\glsxtrbookindexname}[1]{% + 
 \glossentryname{#1}% + 
 \ifglshassymbol{#1}{\space (\glossentrysymbol{#1})}{}% + 
} +
+

or if you want the description (if set): + + + +

+
+\renewcommand*{\glsxtrbookindexname}[1]{% + 
 \glossentryname{#1}% + 
 \ifglshasdesc{#1}{\space \glossentrydesc{#1}\glspostdescription}{}% + 
} +
+

(which picks up the post-description hook). +

Alternatively you can use the \glsxtrpostnamecategory⟩ hook to append +information after the name according to the entry’s category. +

Sub-entries are displayed using +


\glsxtrbookindexsubname  \glsxtrbookindexsubname{label}

+

+which just defaults to \glsxtrbookindexname{label}. +

The separator used before the location list for top-level entries is given +by +


\glsxtrbookindexprelocation  \glsxtrbookindexprelocation{label} +

+

+where ⟨label⟩ is the entry’s label. This checks if the location field has been set. If it +has, it does + + + +

+
+,\glsxtrprelocation +
+

otherwise it just does \glsxtrprelocation (which defaults to \space). If you’re not +using bib2gls, the location field won’t be set. +

The separator used before the location list for sub-entries is given by +


\glsxtrbookindexsubprelocation  \glsxtrbookindexsubprelocation{label} +

+

+which defaults to \glsxtrbookindexprelocation{label}. +

The actual location list is encapsulated with: +


\glsxtrbookindexlocation  \glsxtrbookindexlocation{label}{location +list}

+

+for top-level entries and +


\glsxtrbookindexsublocation  \glsxtrbookindexsublocation{label} +{location list}

+

+for sub-entries. These both just do ⟨location list⟩ by default. +

The separator used between a top-level parent and child entry is given +by +


\glsxtrbookindexparentchildsep  \glsxtrbookindexparentchildsep +

+

+This defaults to \nopagebreak. +

The separator used between a sub-level parent and child entry is given +by +


\glsxtrbookindexparentsubchildsep  \glsxtrbookindexparentsubchildsep +

+

+This defaults to \glsxtrbookindexparentchildsep. +

The separator between top-level entries is given by +


\glsxtrbookindexbetween  \glsxtrbookindexbetween{label1}{label2} +

+

+This comes after the entry given by ⟨label1⟩, if the entry has no children, or after the +last descendent otherwise, so it always comes immediately before the entry given by +⟨label2⟩ unless the entry occurs at the start of a group. This does nothing by +default. +

The separator between two level 1 entries is given by +


\glsxtrbookindexsubbetween  \glsxtrbookindexsubbetween{label1}{label2} +

+ + + +

+

The separator between two level 2 entries is given by +


\glsxtrbookindexsubsubbetween  \glsxtrbookindexsubsubbetween{label1} +{label2}

+

+At the end of each letter group, the following hooks are done in order: +


\glsxtrbookindexsubsubatendgroup  \glsxtrbookindexsubsubatendgroup +{sub-sub-label}

+

+


\glsxtrbookindexsubatendgroup  \glsxtrbookindexsubatendgroup{sub-label} +

+

+


\glsxtrbookindexatendgroup  \glsxtrbookindexatendgroup{label} +

+

+where ⟨sub-sub-label⟩ is the label of the last level 2 entry, ⟨sub-label⟩ is the label of the +last level 1 entry and ⟨label⟩ is the label of the last level 0 entry. +

For example, the resource option seealso=omit instructs bib2gls to omit the +seealso cross-reference from the location list. (The see cross-reference will still be +added unless you also have see=omit.) The seealso cross-reference can instead be +appended after the child entries using: + + + +

+
+\renewcommand{\glsxtrbookindexatendgroup}[1]{% + 
  \glsxtrifhasfield{seealso}{#1}{\glstreesubitem\glsxtruseseealso{#1}}{}% + 
} + 
\renewcommand{\glsxtrbookindexbetween}[2]{% + 
  \glsxtrbookindexatendgroup{#1}% + 
}% + 
\renewcommand{\glsxtrbookindexsubatendgroup}[1]{% + 
  \glsxtrifhasfield{seealso}{#1}{\glstreesubsubitem\glsxtruseseealso{#1}}{}% + 
} + 
\renewcommand{\glsxtrbookindexsubbetween}[2]{% + 
  \glsxtrbookindexsubatendgroup{#1}% + 
} + 
\renewcommand{\glsxtrbookindexsubsubatendgroup}[1]{% + 
  \glsxtrifhasfield{seealso}{#1}% + 
  {\glstreeitem\hspace*{40pt}\glsxtruseseealso{#1}}{}% + 
} + 
\renewcommand{\glsxtrbookindexsubsubbetween}[2]{% + 
  \glsxtrbookindexsubsubatendgroup{#1}% + 
} +
+

This uses \glstreesubitem and \glstreesubsubitem to indent the cross-reference +according to the next level down, so the cross-reference for a top-level entry is aligned +with the sub-entries, and a level 1 entry has its cross-reference aligned with +sub-sub-entries. In the event that a level 2 entry has a cross-reference, this is +indented a bit further (but it won’t be aligned with any deeper level as the bookindex +style only supports a maximum of two sub-levels). +

The bookindex style uses group headings. (If you use bib2gls remember to invoke +it with the --group or -g switch.) The heading will use +


\glsxtrbookindexbookmark  \glsxtrbookindexbookmark{group title}{name} +

+

+If \pdfbookmark has been defined, this will use that command to bookmark the +group title. If section=chapter is set (default if chapters are defined) then this +uses level 1 otherwise it uses level 2. You can redefine this command if this +isn’t appropriate. If \pdfbookmark hasn’t been defined, this command does +nothin. +

The group heading is formatted according to +


\glsxtrbookindexformatheader  \glsxtrbookindexformatheader{group title} +

+ + + +

+which is defined as + + + +

+
+\newcommand*{\glsxtrbookindexformatheader}[1]{% + 
  \par{\centering\glstreegroupheaderfmt{#1}\par}% + 
} +
+

where \glstreegroupheaderfmt is provided by the glossary-tree package, which is +automatically loaded. Note that the entry names aren’t encapsulated with +\glstreenamefmt. +

The glossary-bookindex package provides some supplementary commands that +aren’t used by default, but may be used when adjusting the style. These commands +should only be used within one of the \print…glossary commands. (That is, they +should only be used in glossary styles.) +


\glsxtrbookindexmarkentry  \glsxtrbookindexmarkentry{label}

+

+This writes information to the .aux file that can be read on the next run to obtain +the first and last entry on each page of the glossary. +

You can display the first entry associated with the current page using: +


\glsxtrbookindexfirstmark  \glsxtrbookindexfirstmark

+

+and the last entry associated with the current page using: +


\glsxtrbookindexlastmark  \glsxtrbookindexlastmark

+

+These do nothing if there are no entries marked on the current page (or if the +document build isn’t up to date). +

The entry is formatted using: +


\glsxtrbookindexfirstmarkfmt  \glsxtrbookindexfirstmarkfmt{label} +

+

+for the first instance and +


\glsxtrbookindexlastmarkfmt  \glsxtrbookindexlastmarkfmt{label} +

+

+for the last. +

These commands are designed for use in page headers or footers where the page +number is stable. For example, \glsxtrbookindexname can be redefined to mark the +current entry: + + + +

+
+\renewcommand{\glsxtrbookindexname}[1]{% + 
  \glsxtrbookindexmarkentry{#1}% + 
  \glossentryname{#1}% + 
} +
+

If you only want to mark the top-level entries, remember to redefine +\glsxtrbookindexsubname as it defaults to \glsxtrbookindexname: + + + +

+
+\renewcommand{\glsxtrbookindexsubname}[1]{% + 
  \glossentryname{#1}% + 
} +
+

+

Then if you’re using fancyhdr you can set the page style to show the first and last +entry for the current page with: + + + +

+
+  \pagestyle{fancy}% + 
  \lhead{\thepage}% + 
  \lfoot{\glsxtrbookindexfirstmark}% + 
  \cfoot{}% + 
  \rfoot{\glsxtrbookindexlastmark}% +
+

+

+

+

Top

2.10 glossary-longextra package

+

As from version 1.37, the glossaries-extra package comes with the supplementary +package glossary-longextra that provides additional styles, listed below, that use the +longtable environment. If you know that your glossary won’t span more than a page +and you need to use it in a context that’s incompatible with longtable, you can +instead setup these styles to use tabular instead. In order to do this you must +use +


\GlsLongExtraUseTabulartrue  \GlsLongExtraUseTabulartrue

+

+before the style is set. For example: + + + +

+
+\GlsLongExtraUseTabulartrue + 
\setglossarystyle{long-name-desc} +
+

or + + + +

+
+\GlsLongExtraUseTabulartrue + 
\printunsrtglossary[style={long-name-desc}] +
+

If you use this setting, you can change the default vertical alignment with: +


\glslongextraTabularVAlign  \glslongextraTabularVAlign

+

+The default definition is c. +

The column titles are formatted according to: +


\glslongextraHeaderFmt  \glslongextraHeaderFmt{text}

+

+which simply does \textbf{text} by default. +

The name column has the title given by \entryname and the column alignment is +given by: +


\glslongextraNameAlign  \glslongextraNameAlign

+

+which expands to l (left) by default. +

The symbol column (where applicable) has the title given by \symbolname and +the column alignment is given by: +


\glslongextraSymbolAlign  \glslongextraSymbolAlign

+

+which expands to c (centred) by default. +

The location list column (where applicable) has the title given by \pagelistname +and the column alignment is given by: +


\glslongextraLocationAlign  \glslongextraLocationAlign

+

+which expands to + + + +

+
+>{\raggedright}p{\glspagelistwidth} +
+

by default. (Ragged-right paragraph, \glspagelistwidth is defined in glossary-long, +which is automatically loaded.) +

The description column has the title given by \descriptionname and the column +alignment is given by: +


\glslongextraDescAlign  \glslongextraDescAlign

+

+which expands to + + + +

+
+>{\raggedright}p{\glsdescwidth} +
+

by default. (Ragged-right paragraph, \glsdescwidth is defined in glossary-long, +which is automatically loaded.) +

Unlike the long styles provided by the base glossaries package, these new styles try +to determine the value of \glsdescwidth at the start of the glossary according to the +number of columns provided by the style. The calculations are performed by the +following commands: +


\glslongextraSetDescWidth  \glslongextraSetDescWidth

+

+This is used by the styles that have a name and description column. The value of +\glsdescwidth is computed as: +

+
+\glsdescwidth = \linewidth- 4\tabcolsep- W
+
+

where W is a guess at the width of the name column. This is first set to the width of +the name column header:

+
+\settowidth{width}{\glslongextraHeaderFmt\entryname} +
+
If any names in that column are larger than this, then you need to specify the widest +name using: +


\glslongextraSetWidest  \glslongextraSetWidest{widest name}

+

+or +


\glslongextraUpdateWidest  \glslongextraUpdateWidest{text}

+

+These work like the analogous commands \glssetwidest and \glsupdatewidest +provided with the alttree style, but in this case there’s no hierarchy. The default +widest name is obtained from the alttree top-level name if set, otherwise it’s empty, +so you can use bib2gls’s set-widest option. If you have the entry counter enabled, +you will need to include this with the name for the extra material to be taken into +account. +

The name isn’t shown for child entries by default, but if you change this and you +want to use bib2gls’s set-widest option (for bib2gls v1.8+) then you need to +redefine: + + + +


\glslongextraUpdateWidestChild  \glslongextraUpdateWidestChild{level} +{text}

+

+This does nothing by default, but if you are including the child names then you need +to redefine this command: + + + +

+
+\renewcommand{\glslongextraUpdateWidestChild}[2]{% + 
 \glslongextraUpdateWidest{#2}% + 
} +
+

+

If you prefer to set an explicit width for the description column then you need to +redefine \glslongextraSetDescWidth. For example: + + + +

+
+\renewcommand{\glslongextraSetDescWidth}{% + 
  \setlength{\glsdescwidth}{0.6\linewidth}% + 
} +
+

+

The styles that have a name, symbol and description, \glsdescwidth is set +with: +


\glslongextraSymSetDescWidth  \glslongextraSymSetDescWidth

+

+This first uses \glslongextraSetDescWidth and then subtracts 2\tabcolsep and +the width of the symbol column header from \glsdescwidth. This assumes that the +symbol column header is larger than any of the symbols. If this isn’t appropriate then +you can redefine this command. For example: + + + +

+
+\renewcommand{\glslongextraSymSetDescWidth}{% + 
  \glslongextraSetDescWidth + 
  \addtolength{\glsdescwidth}{-3cm}% + 
} +
+

or + + + +

+
+\renewcommand{\glslongextraSymSetDescWidth}{% + 
  \setlength{\glsdescwidth}{.5\linewidth}% + 
} +
+

+

For the styles that have a name, description and location column, \glsdescwidth +is set using: +


\glslongextraLocSetDescWidth  \glslongextraLocSetDescWidth

+

+This uses \glslongextraSetDescWidth and then subtracts 2\tabcolsep and +\glspagelistwidth from \glsdescwidth. You can redefine this command to set +both \glsdescwidth and \glspagelistwidth if appropriate. +

For the styles that have a name, description, symbol and location column, +\glsdescwidth is set using: +


\glslongextraSymLocSetDescWidth  \glslongextraSymLocSetDescWidth +

+

+This uses \glslongextraSymSetDescWidth and then subtracts 2\tabcolsep and +\glspagelistwidth from \glsdescwidth. Again, you can redefine this command to +explicitly set both lengths. +

In all cases, the top-level name is formatted according to: +


\glslongextraNameFmt  \glslongextraNameFmt{label}

+

+This does

+
+\glsentryitem{label}\glstarget{label}{\glossentryname{label}} +
+
which includes the entry counter (if enabled), the target and the post-name +link. +

The top-level description is formatted according to: +


\glslongextraDescFmt  \glslongextraDescFmt{label}

+

+This does \glossentrydesc{label} followed by the post-description hook. +

The styles that have a symbol column format the symbol using: +


\glslongextraSymbolFmt  \glslongextraSymbolFmt{label}

+

+This just does \glossentrysymbol{label}. +

The styles that have a location list column format the list using: +


\glslongextraLocationFmt  \glslongextraLocationFmt{label}{locations} +

+ + + +

+This just does ⟨locations⟩ and ignores the label. +

The child entries have their name formatted according to: +


\glslongextraSubNameFmt  \glslongextraSubNameFmt{level}{label} +

+

+where ⟨level⟩ is the hierarchical level. This defaults to:

+
+\glssubentryitem{label}\glstarget{label}{\strut} +
+
This includes the sub-entry counter (if enabled) and the target but doesn’t show the +name. The child description is formatted according to: +


\glslongextraSubDescFmt  \glslongextraSubDescFmt{level}{label} +

+

+which defaults to just \glslongextraDescFmt{label} +

The child symbol is formatted (where appropriate) according to: +


\glslongextraSubSymbolFmt  \glslongextraSubSymbolFmt{level}{label} +

+

+This just does \glslongextraSymbolFmt{label} by default. +

The styles that have a location list column format the list for child entries +using: +


\glslongextraLocationFmt  \glslongextraSubLocationFmtlevel{label} +{locations}

+

+This just does ⟨locations⟩ and ignores the level and label. +

The letter group headings are formatted according to: +


\glslongextraGroupHeading  \glslongextraGroupHeading{n}{label} +

+

+which does nothing by default. The first argument ⟨n⟩ is the number of columns in the +table. The second argument ⟨label⟩ is the group label (not the title, although they may +happen to be the same). +

This can be redefined to show the group heading. For example: + + + +

+
+\renewcommand*{\glslongextraGroupHeading}[2]{% + 
  \glsxtrgetgrouptitle{#2}{\thisgrptitle}% + 
  \glslongextraHeaderFmt{\thisgrptitle}% + 
  \tabularnewline + 
  \noalign{\vskip\normalbaselineskip}% + 
} +
+

This ignores the first argument and just puts the group title in the first column +formatted according to \glslongextraHeaderFmt (to match the column +header). +

Remember that you can also adjust the styles through category attributes. The +name column’s title is given by \entryname, the description column’s title is given by +\descriptionname and (where present) the symbol column’s title is given by +\symbolname, as for the other long styles that have headers. +

+
long-name-desc This is like the longragged-booktabs style but doesn’t show the + location list (regardless of the nonumberlist option). The name is shown in + the first column and the description in the second. +

The symbol is not displayed. The header row is produced with: +


\glslongextraNameDescHeader  \glslongextraNameDescHeader

+

+ This essentially uses the same code as for longragged-booktabs but makes it + easier to adjust the header without having to define a new style. This is defined + as: + + + +

+
+ \glslongextraNameDescTabularHeader\endhead +  
\glslongextraNameDescTabularFooter\endfoot +
+

where: +


\glslongextraNameDescTabularHeader  \glslongextraNameDescTabularHeader +

+

+ sets up the header and +


\glslongextraNameDescTabularFooter  \glslongextraNameDescTabularFooter +

+

+ sets up the footer. If you have setup the tabular version of this style then the + above two commands are used at the start and end of the tabular environment + (and \glslongextraNameDescHeader isn’t used). +

For example, to simply remove the header and footer (for the default longtable + version of the style): + + + +

+
+ \renewcommand{\glslongextraNameDescHeader}{} +
+

Or to change the name alignment to centred: + + + +

+
+ \renewcommand{\glslongextraNameAlign}{c} +
+

+

+
long-name-desc-loc This is like the long-name-desc style but has a third column for + the location list. The longtable header is given by: +


\glslongextraNameDescLocationHeader  \glslongextraNameDescLocationHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraNameDescLocationTabularHeader  \glslongextraNameDescLocationTabularHeader +

+

+ and +


\glslongextraNameDescLocationTabularFooter  \glslongextraNameDescLocationTabularFooter +

+

+

+
long-desc-name This is like the long-name-desc style but swaps the columns. Note + that if the entry counter is displayed it will appear at the start of the + second column by default. The longtable header is formatted according + to: +


\glslongextraDescNameHeader  \glslongextraDescNameHeader

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraDescNameTabularHeader  \glslongextraDescNameTabularHeader +

+

+ and +


\glslongextraDescNameTabularFooter  \glslongextraDescNameTabularFooter +

+

+ + + +

+
long-loc-desc-name This has three columns containing the location list, + description and name. The longtable header is formatted according + to: +


\glslongextraLocationDescNameHeader  \glslongextraLocationDescNameHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraLocationDescNameTabularHeader  \glslongextraLocationDescNameTabularHeader +

+

+ and +


\glslongextraLocationDescNameTabularFooter  \glslongextraLocationDescNameTabularFooter +

+

+

+
long-name-desc-sym This is has three columns, with the name in the first, the + description in the second and the symbol in the third. +

The longtable header row is produced with: +


\glslongextraNameDescSymHeader  \glslongextraNameDescSymHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraNameDescSymTabularHeader  \glslongextraNameDescSymTabularHeader +

+

+ and +


\glslongextraNameDescSymTabularFooter  \glslongextraNameDescSymTabularFooter +

+

+

+
long-name-desc-sym-loc This is has four columns, with the name in the first, the + description in the second, the symbol in the third and the location list in the + fourth. +

The longtable header row is produced with: + + + +


\glslongextraNameDescSymLocationHeader  \glslongextraNameDescSymLocationHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraNameDescSymLocationTabularHeader  + \glslongextraNameDescSymLocationTabularHeader

+

+ and +


\glslongextraNameDescSymLocationTabularFooter  + \glslongextraNameDescSymLocationTabularFooter

+

+

+
long-name-sym-desc This is like the long-name-desc-sym but the second and third + column are swapped. The longtable header row is given by: +


\glslongextraNameSymDescHeader  \glslongextraNameSymDescHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraNameSymDescTabularHeader  \glslongextraNameSymDescTabularHeader +

+

+ and +


\glslongextraNameSymDescTabularFooter  \glslongextraNameSymDescTabularFooter +

+

+

+
long-name-sym-desc-loc This is like the long-name-desc-sym-loc but the second and + third column are swapped. The longtable header row is given by: +


\glslongextraNameSymDescLocationHeader  \glslongextraNameSymDescLocationHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraNameSymDescLocationTabularHeader  + \glslongextraNameSymDescLocationTabularHeader

+ + + +

+ and +


\glslongextraNameSymDescLocationTabularFooter  + \glslongextraNameSymDescLocationTabularFooter

+

+

+
long-sym-desc-name This has the symbol in the first column, the description in the + second and the name in the third. The longtable header row is given + by: +


\glslongextraSymDescNameHeader  \glslongextraSymDescNameHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraSymDescNameTabularHeader  \glslongextraSymDescNameTabularHeader +

+

+ and +


\glslongextraSymDescNameTabularFooter  \glslongextraSymDescNameTabularFooter +

+

+

+
long-loc-sym-desc-name This has the location list in the first column, symbol in the + second column, the description in the third and the name in the fourth. The + longtable header row is given by: +


\glslongextraLocationSymDescNameHeader  \glslongextraLocationSymDescNameHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraLocationSymDescNameTabularHeader  + \glslongextraLocationSymDescNameTabularHeader

+

+ and +


\glslongextraLocationSymDescNameTabularFooter  + \glslongextraLocationSymDescNameTabularFooter

+

+ + + +

+
long-desc-sym-name This has the description in the first column, the symbol in the + second and the name in the third. The longtable header row is given + by: +


\glslongextraDescSymNameHeader  \glslongextraDescSymNameHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraDescSymNameTabularHeader  \glslongextraDescSymNameTabularHeader +

+

+ and +


\glslongextraDescSymNameTabularFooter  \glslongextraDescSymNameTabularFooter +

+

+

+
long-loc-desc-sym-name This has the location list in the first column, the description + in the second column, the symbol in the third and the name in the fourth. The + longtable header row is given by: +


\glslongextraLocationDescSymNameHeader  \glslongextraLocationDescSymNameHeader +

+

+ which similarly defined in terms of the commands used for the tabular + version: +


\glslongextraLocationDescSymNameTabularHeader  + \glslongextraLocationDescSymNameTabularHeader

+

+ and +


\glslongextraLocationDescSymNameTabularFooter  + \glslongextraLocationDescSymNameTabularFooter

+

+

+
+ + + +

+

+

Top

2.11 glossary-topic package

+

As from version 1.40, the glossaries-extra package comes with the supplementary +package glossary-topic that provides glossary styles designed for hierarchical glossaries +where the top-level entries are topic titles. This package automatically loads the +multicols package. If the glossary-tree package is also loaded then commands like +\glssetwidest can be used on these styles in much the same way as for the alttree +style. If a widest value isn’t set then these styles behave more like the tree +style. +

+topic
This style is similar to the tree style but the indentation doesn’t start until + the second sub-item level. The top-level entries have the name displayed + in a larger font with the description following in a new paragraph. This + style doesn’t support the nogroupskip setting. +
+topicmcols
This style is like the topic style but the sub-entries are placed inside a + multicols environment. The environment name is supplied in the value of the + command: +


\glstopicColsEnv  \glstopicColsEnv

+

+ You can change this to the starred form. For example: + + + +

+
+ \renewcommand{\glstopicColsEnv}{multicols*} +
+

The number of columns is given by the command: +


\glstopicCols  \glstopicCols

+

+ The default value is 2.

+

Both styles use the following commands. +


\glstopicParIndent  \glstopicParIndent

+

+This command is a length that’s used for the paragraph indentation in any +multi-paragraph description for top-level entries, but not for the first paragraph (at +the start of the description) which isn’t indented. +


\glstopicSubIndent  \glstopicSubIndent

+

+This command is a length that’s used to calculate the hanging indentation for +sub-entries. The level 1 sub-entries don’t indent the name. Level n sub-entries have +the name indented by (n- 1)×\glstopicSubIndent. The hanging indent depends on +whether or not a widest name has been set for the level. +


\glstopicInit  \glstopicInit

+

+Hook used at the start of the glossary. Does nothing by default. +

Although the styles don’t support letter groups by default, if you have many +topics (top-level entries) and you feel that it would help the reader to divide them up +into headed letter groups, you can redefine: +


\glstopicGroupHeading  \glstopicGroupHeading{group label}

+

+This does nothing by default. If you want to redefine it, you can fetch the +title corresponding to the group label with \glsxtrgetgrouptitle. For +example: + + + +

+
+\renewcommand*{\glstopicGroupHeading}[1]{% + 
  \glsxtrgetgrouptitle{#1}{\thisgrptitle}% + 
  \section*{\thisgrptitle}% + 
} +
+

Remember that if you use bib2gls, you will need the --group (or -g) switch to +support this. +


\glstopicItem  \glstopicItem{label}{location list}

+

+Used to format the name, symbol, description and location list for the top-level +entries. This starts with a paragraph break followed by: +


\glstopicPreSkip  \glstopicPreSkip

+

+which defaults to \medskip. There is then a hook: +


\glstopicMarker  \glstopicMarker{label}

+

+which does nothing by default, but may be redefined. For example, to add a line to +the table of contents. The name and symbol are set in the form of a title +using: +


\glstopicTitle  \glstopicTitle{label}

+

+This uses \Glossentryname which converts the first letter to upper case. If there’s a +symbol, this is added in parentheses. Both name and symbol (if present) are +encapsulated by +


\glstopicTitleFont  \glstopicTitleFont{text}

+

+This uses a bold, large font by default. +

If the entry has the description key set (tested with \ifglshasdesc) then a +paragraph break is inserted followed by: +


\glstopicMidSkip  \glstopicMidSkip

+

+which defaults to \smallskip. This is followed by the description which is formatted +according to: +


\glstopicDesc  \glstopicDesc{label}

+

+This just does \Glossentrydesc{label} followed by the post-description +hook. +

A paragraph break followed by: +


\glstopicPostSkip  \glstopicPostSkip

+

+comes next regardless of whether or not the description was displayed. This defaults +to \smallskip. This is then followed by: + + + +


\glstopicLoc  \glstopicLoc{label}{location list}

+

+which may be used to display the location list, but does nothing by default. +

The sub-entries first set up the paragraph and hanging indentations using: +


\glstopicAssignSubIndent  \glstopicAssignSubIndent{level}

+

+This uses: +


\glstopicAssignWidest  \glstopicAssignWidest{level}

+

+to determine if a widest name has been set for the given level. +

The sub-entry has its information displayed using: +


\glstopicSubItem  \glstopicSubItem{level}{label}{location} +

+

+This encapsulates the name with: +


\glstopicSubNameFont  \glstopicSubNameFont{text}

+

+By default this just uses \textbf. This is followed by: +


\glstopicSubItemSep  \glstopicSubItemSep

+

+which defaults to \quad. The name and separator are passed in the ⟨text⟩ argument +of: +


\glstopicSubItemBox  \glstopicSubItemBox{level}{text}

+

+If a widest name was set for the given level, this will put ⟨text⟩ inside a box of that +width otherwise it just does ⟨text⟩. +

This is followed by the symbol in parentheses if set. Then, if the description is set, +the description and post-description hook are displayed followed by: +


\glstopicSubPreLocSep  \glstopicSubPreLocSep

+

+(This command isn’t used if the description isn’t set.) +

Finally the location list is displayed using: +


\glstopicSubLoc  \glstopicSubLoc{label}{location}

+

+which just does ⟨location⟩ by default. +

+

+

Top

2.12 Glossary Style Modifications

+

The glossaries-extra-stylemods package (more conveniently loaded through the +glossaries-extra stylemods option) modifies some of the predefined styles that are +provided with the glossaries package. These modifications are described in more detail +in §2.12.3 The glossaries-extra-stylemods Package. + + + +

The glossaries package tries to determine the group title from its label by first +checking if \labelgroupname exists. If it doesn’t exist, then the title is assumed to be +the same as the label. For example, when typesetting the “A” letter group, glossaries +first checks if \Agroupname exists. This could potentially cause conflict with another +package that may have some other meaning for \Agroupname, so glossaries-extra first +checks for the existence of the internal command \glsxtr@grouptitle@label⟩ +which shouldn’t clash with another package. You can set the group title +using +


\glsxtrsetgrouptitle  \glsxtrsetgrouptitle{label}{title}

+

+For example: + + + +

+
+\glsxtrsetgrouptitle{A}{A (a)} +
+

This uses a global assignment. If you need to scope the change you can +use +


\glsxtrlocalsetgrouptitle  \glsxtrlocalsetgrouptitle{label}{title} +

+

+

+

+

Top

2.12.1 Style Hooks

+

The commands \glossentryname and \glossentrydesc are modified to take into +account the glossname, glossdesc and glossdescfont attributes (see §5 Categories). This +means you can make simple case-changing modifications to the name and description +without defining a new glossary style. +

If you want to adapt a style to use another field instead of name, you can +use +


\glossentrynameother  \glossentrynameother{label}{field}

+

+This behaves just like \glossentryname (that is, it obeys glossname, glossnamefont or +\glsnamefont and uses the post-name hook) but it uses the given ⟨field⟩ instead of +name. The ⟨field⟩ argument must be the internal field name (for example desc rather +than description). See the key to field mappings table in the glossaries user +manual. +

There is a hook after \glossentryname and \Glossentryname: +


\glsxtrpostnamehook  \glsxtrpostnamehook{label}

+

+By default this checks the indexname attribute. If the attribute exists for the +category to which the label belongs, then the name is automatically indexed +using +


\glsxtrdoautoindexname{label}{indexname}

+

+See §7 Auto-Indexing for further details. +

As from version 1.04, the post-name hook \glsxtrpostnamehook will also use +\glsxtrpostnamecategory⟩ if it exists. You can use \glscurrententrylabel to +obtain the entry label with the definition of this command. For example, +suppose you are using a glossary style the doesn’t display the symbol, you can +insert the symbol after the name for a particular category, say, the “symbol” +category: + + + +

+
+\newcommand*{\glsxtrpostnamesymbol}{\space + 
 (\glsentrysymbol{\glscurrententrylabel})} +
+

For convenience, as from v1.31, you can use +


\glsdefpostname  \glsdefpostname{category}{definition}

+

+This is simply a shortcut for:

+
+\csdef{glsxtrpostnamecategory}{definition} +
+
Note that it doesn’t check if the command has already been defined. +

As from version 1.25, the post-name hook also does +


\glsextrapostnamehook  \glsextrapostnamehook{label}

+

+(before \glsxtrpostnamecategory⟩) to allow for additional non-category related code. +This does nothing by default. +

The post-description code used within the glossary is modified so that it also +does +


\glsxtrpostdescription  \glsxtrpostdescription

+

+This occurs before the original \glspostdescription, so if the nopostdot=false +option is used, it will be inserted before the terminating full stop. +

This new command will do \glsxtrpostdesccategory⟩ if it exists, where +⟨category⟩ is the category label associated with the current entry. For example +\glsxtrpostdescgeneral for entries with the category set to general or +\glsxtrpostdescacronym for entries with the category set to acronym. For +convenience, as from v1.31, you can use +


\glsdefpostdesc  \glsdefpostdesc{category}{definition}

+

+This is simply a shortcut for:

+
+\csdef{glsxtrpostdesccategory}{definition} +
+
Note that it doesn’t check if the command has already been defined. +

Since both \glossentry and \subglossentry set +


\glscurrententrylabel  \glscurrententrylabel

+ + + +

+to the label for the current entry, you can use this within the definition of these +post-description hooks if you need to reference the label. +

For example, suppose you want to insert the plural form in brackets after the +description in the glossary, but only for entries in the general category, then you could +do: + + + +

+
+\renewcommand{\glsxtrpostdescgeneral}{\space + 
 (plural: \glsentryplural{\glscurrententrylabel})} +
+

This means you don’t have to define a custom glossary style, which you may find +more complicated. (It also allows more flexibility if you decide to change the +underlying glossary style.) +

This feature can’t be used for glossary styles that ignore \glspostdescription or if +you redefine \glspostdescription without including \glsxtrpostdescription. +(For example, if you redefine \glspostdescription to do nothing instead of using +the nopostdot option to suppress the terminating full stop.) See §2.12.3 The +glossaries-extra-stylemods Package to patch the predefined styles provided by glossaries +that are missing \glspostdescription.
+

+

+

+

Top

2.12.2 Number List

+

The number list is now placed inside the argument of +


\GlsXtrFormatLocationList  \GlsXtrFormatLocationList{number list} +

+

+This is internally used by \glossaryentrynumbers. The nonumberlist option +redefines \glossaryentrynumbers so that it doesn’t display the number list, but it +still saves the number list in case it’s required. +

If you want to suppress the number list always use the nonumberlist option +instead of redefining \glossaryentrynumbers to do nothing.
+

+

If you want to, for example, change the font for the entire number list +then redefine \GlsXtrFormatLocationList as appropriate. Don’t modify +\glossaryentrynumbers. +

Sometimes users like to insert “page” or “pages” in front of the number list. This +is quite fiddly to do with the base glossaries package, but glossaries-extra provides a +way of doing this. First you need to enable this option and specify the text to display +using: +


\GlsXtrEnablePreLocationTag  \GlsXtrEnablePreLocationTag{page}{pages} +

+

+where ⟨page⟩ is the text to display if the number list only contains a single location and +⟨pages⟩ is the text to display otherwise. For example: + + + +

+
+\GlsXtrEnablePreLocationTag{Page: }{Pages: } +
+

An extra run is required when using this command. +

Use glsignore not @gobble as the format if you want to suppress the page +number (and only index the entry once).
+

+

See the accompanying sample file sample-pages.tex. +

Note that bib2gls can be instructed to insert a prefix at the start of non-empty +location lists, which can be used as an alternative to \GlsXtrEnablePreLocationTag. +

+

+

Top

2.12.3 The glossaries-extra-stylemods Package

+

As from v1.02, glossaries-extra now includes the package glossaries-extra-stylemods that +will redefine the predefined styles to include the post-description hook (for those that +are missing it). You will need to make sure the styles have already been defined +before loading glossaries-extra. For example: + + + +

+
+\usepackage{glossaries-extra} + 
\usepackage{glossary-longragged} + 
\usepackage{glossaries-extra-stylemods} +
+

Alternatively you can load glossary-name.sty at the same time by passing ⟨name⟩ +as a package option to glossaries-extra-stylemods. For example: + + + +

+
+\usepackage{glossaries-extra} + 
\usepackage[longragged]{glossaries-extra-stylemods} +
+

Another option is to use the stylemods key when you load glossaries-extra. You can +omit a value if you only want to use the predefined styles that are automatically +loaded by glossaries (for example, the long3col style): + + + +

+
+\usepackage[style=long3col,stylemods]{glossaries-extra} +
+

Or the value of stylemods may be a comma-separated list of the style package +identifiers. For example: + + + +

+
+\usepackage[style=mcoltree,stylemods=mcols]{glossaries-extra} +
+

Remember to group the value if it contains any commas: + + + +

+
+\usepackage[stylemods={mcols,longbooktabs}]{glossaries-extra} +
+

+

Note that the inline style is dealt with slightly differently. The original definition +provided by the glossary-inline package uses \glspostdescription at the end of the +glossary (not after each entry description) within the definition of \glspostinline. +The style modification changes this so that \glspostinline just does a full stop +followed by space factor adjustment, and the description \glsinlinedescformat and +sub-entry description formats \glsinlinesubdescformat are redefined to include +\glsxtrpostdescription (not \glspostdescription). This means that the +modified inline style isn’t affected by the nopostdot option, but the post-description +category hook can still be used. +

The tabular-like styles, such as long are adjusted so that the \ifglsnogroupskip +conditional (set with nogroupskip) is moved outside of the definition of +\glsgroupskip to avoid problems that cause an “Incomplete \iftrue” error with +\printunsrtglossary and \printnoidxglossary. This means that if you want to +change this conditional using \setupglossaries or using the nogroupskip option in +\printglossary, \printnoidxglossary or \printunsrtglossary, you must also +reset the glossary style. +

As from version 1.21, the hard-coded \space before the number list in many of +the predefined styles is replaced with +


\glsxtrprelocation  \glsxtrprelocation

+

+This just defaults to \space but may be redefined as required. For example: + + + +

+
+\renewcommand{\glsxtrprelocation}{\dotfill} +
+

+

The list styles use +


\glslistprelocation  \glslistprelocation

+

+(which defaults to \glsxtrprelocation) for top-level items and +


\glslistchildprelocation  \glslistchildprelocation

+

+(which defaults to \glslistprelocation) for child items. +

As from v1.31, the description (including the post-description hook) is governed +by: +


\glslistdesc  \glslistdesc{label}

+

+for the list and altlist styles (but not the listdotted variations). +

For just the list style and its letter group variations (not the altlist or listdotted +variations) the number list for child entries is followed by +


\glslistchildpostlocation  \glslistchildpostlocation

+

+which defaults to a full stop. +

The default value of \glslistdottedwidth is changed so that it’s set at the start +of the document (if it hasn’t been changed in the preamble). This should +take into account situations where \hsize isn’t set until the start of the +document. +

The separator between groups (if not nogroupskip) is now given by: +


\glslistgroupskip  \glslistgroupskip

+

+This defaults to \indexspace with penalties to deter page breaks. This command +isn’t used if nogroupskip is set. +

The glossary-tree package introduced two new commands in glossaries version 4.22, +\glstreegroupheaderfmt and \glstreenavigationfmt, which are used to format +the letter group headings and the navigation elements for the appropriate styles. +These two new commands are defined in terms of \glstreenamefmt since that was +the command originally used for the group headings and navigation. This +now allows these different elements to be defined independently, but the +most common redefinition is for \glstreenamefmt to remove the bold in +the name. If the bold is still required for the group heading and navigation +elements, then both other commands also need redefining. To simplify matters, if +\glstreenamefmt has been defined, as from v1.31 glossaries-extra-stylemods +defines: +


\glstreedefaultnamefmt  \glstreedefaultnamefmt{text}

+ + + +

+which simply does \textbf{text} and redefines \glstreenamefmt, +\glstreegroupheaderfmt and \glstreenavigationfmt all in terms of +\glstreedefaultnamefmt. This means that if you want to change all three to use a +particular style you only need to redefine \glstreedefaultnamefmt, but if you only +want to redefine \glstreenamefmt without affecting the other two commands, then +you now can. +

The separator between groups (if not nogroupskip) is now given by: +


\glstreegroupskip  \glstreegroupskip

+

+This defaults to \indexspace with penalties to deter page breaks. This command +isn’t used if nogroupskip is set (except for the styles that display the group +titles). +

The styles that display the group titles now use: +


\glstreePreHeader  \glstreePreHeader{label}{title}

+

+where ⟨label⟩ is the group label and ⟨title⟩ is the group title. This does nothing by +default and is inserted before the group title. You can redefine it to add the group +title to the PDF bookmarks. For example, if the glossary title uses \chapter +then: + + + +

+
+\renewcommand{\glstreePreHeader}[2]{% + 
 \pdfbookmark[1]{#2}{\currentglossary.#1}% + 
} +
+

will insert section-level bookmarks. The use of \currentglossary helps to provide +unique bookmark labels in the event of multiple glossaries. +

The index-like and tree-like styles insert the pre-number list space with +


\glstreeprelocation  \glstreeprelocation

+

+(which defaults to \glsxtrprelocation) for top-level items and +


\glstreechildprelocation  \glstreechildprelocation

+

+(which defaults to \glstreeprelocation) for child items. +

As from version 1.31, the glossaries-extra-stylemods package also provides: +


\glstreenonamedesc  \glstreenonamedesc{label}

+

+which is used by the treenoname styles to display the pre-description separator, the +description and the post-description hook. Similarly for the symbol: +


\glstreenonamesymbol  \glstreenonamesymbol{label}

+

+The above are just used for top-level entries. Child entries don’t have the name or +symbol displayed for the treenoname styles, so there’s only a command for the child +description: +


\glstreenonamechilddesc  \glstreenonamechilddesc{label}

+

+

For the tree styles (but not the treenoname or alttree styles), the description is +displayed using: +


\glstreedesc  \glstreedesc{label}

+

+and the symbol with: +


\glstreesymbol  \glstreesymbol{label}

+

+Again the above two commands are just for top-level entries. The child entries +use: +


\glstreechilddesc  \glstreechilddesc{label}

+

+for the description and +


\glstreechildsymbol  \glstreechildsymbol{label}

+

+for the symbol. + + + +

As from version 1.41, there are now wrapper commands for \glstreedesc and +\glstreechilddesc that check for the description and symbol to determine whether +or not to insert a space (\glstreeprelocation or \glstreechildprelocation) +before the page list. These are: +


\glstreeDescLoc  \glstreeDescLoc{label}{location}

+

+for top-level entries and +


\glstreeChildDescLoc  \glstreeChildDescLoc{label}{location} +

+

+for sub-entries. This prevents a spurious space for terms that don’t have a symbol or +description but do have a location list (for example, aliases). +

As from version 1.05, the glossaries-extra-stylemods package provides some +additional commands for use with the alttree style to make it easier to modify. These +commands are only defined if the glossary-tree package has already been loaded, +which is typically the case unless the notree option has been used when loading +glossaries. +


\gglssetwidest  \gglssetwidest[level]{name}

+

+(New to version 1.21.) This is like \glssetwidest (provided by glossary-tree) but +performs a global assignment. +


\eglssetwidest  \eglssetwidest[level]{name}

+

+This is like \glssetwidest but performs a protected expansion on ⟨name⟩. This has a +localised effect. For a global setting, use +


\xglssetwidest  \xglssetwidest[level]{name}

+

+The following only set the value if ⟨name⟩ is wider than the current value (new to +version 1.23). Local update: +


\glsupdatewidest  \glsupdatewidest[level]{name}

+

+Global update: +


\gglsupdatewidest  \gglsupdatewidest[level]{name}

+

+Locale update (expands ⟨name⟩): +


\eglsupdatewidest  \eglsupdatewidest[level]{name}

+

+Global update (expands ⟨name⟩): +


\xglsupdatewidest  \xglsupdatewidest[level]{name}

+

+

The widest entry value can later be retrieved using +


\glsgetwidestname  \glsgetwidestname

+

+for the top-level entries and +


\glsgetwidestsubname  \glsgetwidestsubname{level}

+ + + +

+for sub-entries, where ⟨level⟩ is the level number. +

Note that if you are using bib2gls, you can use the resource option set-widest +which will try to determine the widest name of all the selected entries. This isn’t +guaranteed to work as it may depend on fonts or commands that bib2gls +can’t replicate, but it should be suitable for names that just consist of text, +and can be more efficient than iterating over all the defined entries using +TEX. +

The command \glsfindwidesttoplevelname provided by glossary-tree has a +CamelCase synonym: +


\glsFindWidestTopLevelName  \glsFindWidestTopLevelName[glossary list] +

+

+Similar commands are also provided: +


\glsFindWidestUsedTopLevelName  \glsFindWidestUsedTopLevelName[glossary +list]

+

+This has an additional check that the entry has been used. Naturally this is only +useful if the glossaries that use the alttree style occur at the end of the document. +This command should be placed just before the start of the glossary. (Alternatively, +place it at the end of the document and save the value in the auxiliary file for the +next run.) +


\glsFindWidestUsedAnyName  \glsFindWidestUsedAnyName[glossary list] +

+

+This is like the previous command but if doesn’t check the parent key. This is useful if +all levels should have the same width for the name. +


\glsFindWidestAnyName  \glsFindWidestAnyName[glossary list]

+

+This is like the previous command but doesn’t check if the entry has been +used. +


\glsFindWidestUsedLevelTwo  \glsFindWidestUsedLevelTwo[glossary list] +

+

+This is like \glsFindWidestUsedTopLevelName but also sets the first two sub-levels +as well. Any entry that has a great-grandparent is ignored. +


\glsFindWidestLevelTwo  \glsFindWidestLevelTwo[glossary list] +

+

+This is like the previous command but doesn’t check if the entry has been +used. +


\glsFindWidestUsedAnyNameSymbol  \glsFindWidestUsedAnyNameSymbol +[glossary list]{register}

+

+This is like \glsFindWidestUsedAnyName but also measures the symbol. The length +of the widest symbol is stored in ⟨register⟩. + + + +


\glsFindWidestAnyNameSymbol  \glsFindWidestAnyNameSymbol[glossary +list]{register}

+

+This is like the previous command but it doesn’t check if the entry has been +used. +


\glsFindWidestUsedAnyNameSymbolLocation  \glsFindWidestUsedAnyNameSymbolLocation +[glossary list]{symbol register}{location register}

+

+This is like \glsFindWidestUsedAnyNameSymbol but also measures the number list. +This requires \glsentrynumberlist (see the glossaries user manual). The length of +the widest symbol is stored in ⟨symbol register⟩ and the length of the widest number +list is stored in ⟨location register⟩. +


\glsFindWidestAnyNameSymbolLocation  \glsFindWidestAnyNameSymbolLocation +[glossary list]{symbol register}{location register}

+

+This is like the previous command but it doesn’t check if the entry has been +used. +


\glsFindWidestUsedAnyNameLocation  \glsFindWidestUsedAnyNameLocation +[glossary list]{register}

+

+This is like \glsFindWidestUsedAnyNameSymbolLocation but doesn’t measure the +symbol. The length of the widest number list is stored in ⟨register⟩. +


\glsFindWidestAnyNameLocation  \glsFindWidestAnyNameLocation[glossary +list]{register}

+

+This is like the previous command but doesn’t check if the entry has been +used. +

The layout of the symbol, description and number list is governed by +


\glsxtralttreeSymbolDescLocation  \glsxtralttreeSymbolDescLocation +{label}{number list}

+

+for top-level entries and +


\glsxtralttreeSubSymbolDescLocation  \glsxtralttreeSubSymbolDescLocation +{label}{number list}

+

+for sub-entries. +

There is now a user level command that performs the initialisation for the alttree +style: +


\glsxtralttreeInit  \glsxtralttreeInit

+

+

The paragraph indent for subsequent paragraphs in multi-paragraph descriptions +is provided by the length +


\glsxtrAltTreeIndent  \glsxtrAltTreeIndent

+

+ + + +

For additional commands that are available with the alttree style, see the +documented code (glossaries-extra-code.pdf). For examples, see the +accompanying sample files sample-alttree.tex, sample-alttree-sym.tex and +sample-alttree-marginpar.tex. + + + +

+

+

Top

3. Abbreviations

+

The new abbreviation system provided by glossaries-extra is more flexible +than the acronym handling provided by the base glossaries package. The +glossaries-extra package modifies the underlying formatting used by \gls (and +its variants) so that terms that are recognised as abbreviations can have +their formatting dealt with by the style. You therefore need to select an +abbreviation style that ensures that \gls (and its variants) displays the desired +output. +

Don’t use commands like \glstext or \glsfirst with abbreviations as they +aren’t flexible enough to handle some abbreviation styles and unexpected +results may occur. Use commands like \glsfmtshort or \glsfmtlong in +section headings or captions instead of \gls. If you don’t want the full form +to show on first use of \gls use one of the “nolong” or “noshort” styles. +
+

+

Abbreviations include acronyms (words formed from initial letters, such as +“laser”), initialisms (initial letters of a phrase, such as “html”, that aren’t +pronounced as words) and contractions (where parts of words are omitted, often +replaced by an apostrophe, such as “don’t”). The “acronym” code provided by the +glossaries package is misnamed as it’s more often than not used for initialisms instead. +Acronyms tend not to be expanded on first use (although they may need +to be described for readers unfamiliar with the term). They are therefore +more like a regular term, which may or may not require a description in the +glossary. +

The glossaries-extra package corrects this misnomer, and provides better +abbreviation handling, with +


\newabbreviation  \newabbreviation[options]{label}{short}{long} +

+

+

This sets the category key to abbreviation by default, but that value may be +overridden in ⟨options⟩. The category may have attributes that modify the way +abbreviations are defined. For example, the insertdots attribute will automatically +insert full stops (periods) into ⟨short⟩ or the noshortplural attribute will set the default +value of the shortplural key to just ⟨short⟩ (without appending the plural suffix). See §5 +Categories for further details. +

See §2.7 Nested Links regarding the pitfalls of using commands like \gls or +\glsxtrshort within ⟨short⟩ or ⟨long⟩. +

Make sure that you set the category attributes before defining new abbreviations +or they may not be correctly applied.
+

+

The \newacronym command provided by the glossaries package is redefined by + + + +glossaries-extra to use \newabbreviation with the category set to acronym (see also +§2.8 Acronym Style Modifications) so +


\newacronym  \newacronym[options]{label}{short}{long}

+

+is +now +equivalent +to + +
\newabbreviation[type=\acronymtype,category=acronym,options] +{label} +{short} +{long} +
+

The \newabbreviation command is superficially similar to the glossaries +package’s \newacronym but you can apply different styles to different categories. The +default style is short-nolong for entries in the acronym category and short-long for +entries in the abbreviation category. (These aren’t the same as the acronym +styles provided by the glossaries package, although they may produce similar +results.) +

The way the abbreviations are displayed by commands like \gls varies according +to the abbreviation style. The styles are set according to the entry’s category so, +unlike the base glossaries package, you can have different abbreviation styles within +the same glossary. +

There are two types of full forms. The display full form, which is used on +first use by commands like \gls and the inline full form, which is used by +commands like \glsxtrfull. For some of the abbreviation styles, such as +long-short, the display and inline forms are the same. In the case of styles +such as short-nolong or short-footnote, the display and inline full forms are +different. +

These formatting commands aren’t stored in the short, shortplural, long or +longplural fields, which means they won’t be used within commands like +\glsentryshort (but they are used within commands like \glsxtrshort and +\glsfmtshort). Note that \glsxtrlong and the case-changing variants don’t use +\glsfirstlongfont. +

You can apply the formatting command used for the short form to some arbitrary +text using +


\glsuseabbrvfont  \glsuseabbrvfont{text}{category}

+

+where ⟨category⟩ is the category label that identifies the abbreviation style. Similarly +for the formatting command use by the long form: +


\glsuselongfont  \glsuselongfont{text}{category}

+

+ + + +

+

Top

3.1 Tagging Initials

+

If you would like to tag the initial letters in the long form such that those letters are +underlined in the glossary but not in the main part of the document, you can +use +


\GlsXtrEnableInitialTagging  \GlsXtrEnableInitialTagging{categories} +{cs}

+

+before you define your abbreviations. +

This command (robustly) defines ⟨cs⟩ (a control sequence) to accept a single +argument, which is the letter (or letters) that needs to be tagged. The normal +behaviour of this command within the document is to simply do its argument, but in +the glossary it’s activated for those categories that have the tagging attribute set to +“true”. For those cases it will use +


\glsxtrtagfont  \glsxtrtagfont{text}

+

+This command defaults to \underline{text} but may be redefined as required. +

The control sequence ⟨cs⟩ can’t already be defined when used with the unstarred +version of \GlsXtrEnableInitialTagging for safety reasons. The starred +version will overwrite any previous definition of ⟨cs⟩. As with redefining any +commands, ensure that you don’t redefine something important. In fact, just +forget the existence of the starred version and let’s pretend I didn’t mention +it. +

The first argument of \GlsXtrEnableInitialTagging is a comma-separated list +of category names. The tagging attribute will automatically be set for those +categories. You can later set this attribute for other categories (see §5 Categories) but +this must be done before the glossary is displayed. +

The accompanying sample file sample-mixtures.tex uses initial tagging for both +the acronym and abbreviation categories: + + + +

+
+\GlsXtrEnableInitialTagging{acronym,abbreviation}{\itag} +
+

This defines the command \itag which can be used in the definitions. For +example: + + + +

+
+\newacronym + 
 [description={a system for detecting the location and + 
 speed of ships, aircraft, etc, through the use of radio + 
 waves}% description of this term + 
 ] + 
 {radar}% identifying label + 
 {radar}% short form (i.e. the word) + 
 {\itag{ra}dio \itag{d}etection \itag{a}nd \itag{r}anging} + 
\newabbreviation{xml}{XML} + 
 {e\itag{x}tensible \itag{m}arkup \itag{l}anguage} +
+

The underlining of the tagged letters only occurs in the glossary and then only for +entries with the tagging attribute set. +

+

+

Top

3.2 Abbreviation Styles

+

The abbreviation style must be set before abbreviations are defined using: +


\setabbreviationstyle  \setabbreviationstyle[category]{style-name} +

+

+where ⟨style-name⟩ is the name of the style and ⟨category⟩ is the category label +(abbreviation by default). New abbreviations will pick up the current style +according to their given category. If there is no style set for the category, the fallback +is the style for the abbreviation category. Some styles may automatically +modify one or more of the attributes associated with the given category. For +example, the long-noshort and short-nolong styles set the regular attribute to +true. +

If you want to apply different styles to groups of abbreviations, assign a +different category to each group and set the style for the given category. +
+

+

Note that \setacronymstyle is disabled by glossaries-extra. Use

+
+\setabbreviationstyle[acronym]{style-name} + + + +
+
instead. The original acronym interface can be restored with \RestoreAcronyms (see +§2.8 Acronym Style Modifications). However the original acronym interface is +incompatible with all the commands described here. +

Abbreviations can be used with the standard glossaries commands, such as \gls, +but don’t use the acronym commands like \acrshort (which use \acronymfont). +The short form can be produced with: +


\glsxtrshort  \glsxtrshort[options]{label}[insert]

+

+(Use this instead of \acrshort.) +

The long form can be produced with +


\glsxtrlong  \glsxtrlong[options]{label}[insert]

+

+(Use this instead of \acrlong.) +

The inline full form can be produced with +


\glsxtrfull  \glsxtrfull[options]{label}[insert]

+

+(This this instead of \acrfull.) +

In general, it’s best not to use commands like \glsfirst for abbreviations, +especially if you use the ⟨insert⟩ optional argument. Use either \gls (possibly with a +reset) or \glsxtrfull.
+

+

As mentioned earlier, the inline full form may not necessarily match the format +used on first use with \gls. For example, the short-nolong style only displays the +short form on first use, but the full form will display the long form followed by the +short form in parentheses. +

If you want to use an abbreviation in a chapter or section title, use the +commands described in §4 Entries in Sectioning Titles, Headers, Captions and +Contents instead.
+

+

The arguments ⟨options⟩, ⟨label⟩ and ⟨insert⟩ are the same as for commands such as +\glstext. There are also analogous case-changing commands: +

First letter upper case short form: +


\Glsxtrshort  \Glsxtrshort[options]{label}[insert]

+

+

First letter upper case long form: +


\Glsxtrlong  \Glsxtrlong[options]{label}[insert]

+

+

First letter upper case inline full form: +


\Glsxtrfull  \Glsxtrfull[options]{label}[insert]

+

+

All upper case short form: + + + +


\Glsxtrshort  \GLSxtrshort[options]{label}[insert]

+

+

All upper case long form: +


\Glsxtrlong  \GLSxtrlong[options]{label}[insert]

+

+

All upper case inline full form: +


\GLSxtrfull  \GLSxtrfull[options]{label}[insert]

+

+

Plural forms are also available. +

Short form plurals: +


\glsxtrshortpl  \glsxtrshortpl[options]{label}[insert]

+

+


\Glsxtrshortpl  \Glsxtrshortpl[options]{label}[insert]

+

+


\GLSxtrshortpl  \GLSxtrshortpl[options]{label}[insert]

+

+

Long form plurals: +


\glsxtrlongpl  \glsxtrlongpl[options]{label}[insert]

+

+


\Glsxtrlongpl  \Glsxtrlongpl[options]{label}[insert]

+

+


\GLSxtrlongpl  \GLSxtrlongpl[options]{label}[insert]

+

+

Full form plurals: +


\glsxtrfullpl  \glsxtrfullpl[options]{label}[insert]

+

+


\Glsxtrfullpl  \Glsxtrfullpl[options]{label}[insert]

+

+


\GLSxtrfullpl  \GLSxtrfullpl[options]{label}[insert]

+

+

Be careful about using \glsentryfull, \Glsentryfull, \glsentryfullpl and +\Glsentryfullpl. These commands will use the currently applied style rather +than the style in use when the entry was defined. If you have mixed styles, +you’ll need to use \glsxtrfull instead. Similarly for \glsentryshort etc. + + + +
+

+

+

+

Top

3.3 Shortcut Commands

+

The abbreviation shortcut commands can be enabled using the package option +shortcuts=abbreviation (or shortcuts=abbr) or shortcuts=ac. (You can use +both settings at the same time.) The provided shortcut commands listed in +table 3.1. +

+
+ + + +


+ + + +
Table 3.1: Abbreviation Shortcut Commands
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Shortcut Shortcut Equivalent Command
(shortcuts=abbreviation)(shortcuts=ac)
\ab \ac \cgls
\abp \acp \cglspl
\as \acs \glsxtrshort
\asp \acsp \glsxtrshortpl
\al \acl \glsxtrlong
\alp \aclp \glsxtrlongpl
\af \acf \glsxtrfull
\afp \acfp \glsxtrfullpl
\Ab \Ac \cgls
\Abp \Acp \cglspl
\As \Acs \Glsxtrshort
\Asp \Acsp \Glsxtrshortpl
\Al \Acl \Glsxtrlong
\Alp \Aclp \Glsxtrlongpl
\Af \Acf \Glsxtrfull
\Afp \Acfp \Glsxtrfullpl
\AB \AC \cGLS
\ABP \ACP \cGLSpl
\AS \ACS \GLSxtrshort
\ASP \ACSP \GLSxtrshortpl
\AL \ACL \GLSxtrlong
\ALP \ACLP \GLSxtrlongpl
\AF \ACF \GLSxtrfull
\AFP \ACFP \GLSxtrfullpl
\newabbr \newabbr \newabbreviation
+ + + +

+
+

Top

3.4 Predefined Abbreviation Styles

+

There are two types of abbreviation styles: those that treat the abbreviation as a +regular entry (so that \gls uses \glsgenentryfmt) and those that don’t treat the +abbreviation as a regular entry (so that \gls uses \glsxtrgenabbrvfmt). +

The regular entry abbreviation styles set the regular attribute to “true” for the +category assigned to each abbreviation with that style. This means that on first use, +\gls uses the value of the first field and on subsequent use \gls uses the value of the +text field (and analogously for the plural and case-changing versions). The short and +long fields are set as appropriate and may be accessed through commands like +\glsxtrshort. +

The other abbreviation styles don’t modify the regular attribute. The first +and text fields (and their plural forms) are set and can be accessed through +commands like \glsfirst, but they aren’t used by commands like \gls, which +instead use the short form (stored in the short key) and the display full +format (through commands like \glsxtrfullformat that are defined by the +style). +

In both cases, the first use of \gls may not match the text produced by +\glsfirst (and likewise for the plural and case-changing versions). +

The sample file sample-abbr-styles.tex demonstrates all predefined styles +described here. +

For the “sc” styles that use \textsc, be careful about your choice of fonts as +some only have limited support. For example, you may not be able to combine bold +and small-caps. I recommend that you at least use the fontenc package with the T1 +option or something similar.
+

+

The parenthetical styles, such as long-short, use +


\glsxtrparen  \glsxtrparen{text}

+

+to set the parenthetical material. This just puts parentheses around the text: +(⟨text⟩). +

The basic abbreviation styles, such as long-short and short-long use +


\glsabbrvdefaultfont  \glsabbrvdefaultfont{text}

+

+for the short form. This just does ⟨text⟩ by default. (That is, no font change is +applied.) On first use, +


\glsfirstabbrvdefaultfont  \glsfirstabbrvdefaultfont{text}

+

+is used instead. By default, this just does \glsabbrvdefaultfont. The long form is +formatted according to +


\glslongdefaultfont  \glslongdefaultfont{text}

+ + + +

+which again just does ⟨text⟩ (no font change). On first use, +


\glsfirstlongdefaultfont  \glsfirstlongdefaultfont{text}

+

+is used instead. This just does \glslongdefaultfont. The plural suffix used for the +short form is given by +


\glsxtrabbrvpluralsuffix  \glsxtrabbrvpluralsuffix

+

+which defaults to \glspluralsuffix. +

The small-cap styles, such as long-short-sc and short-sc-long, use +


\glsabbrvscfont  \glsabbrvscfont{text}

+

+which uses \textsc.3.1 +On first use +


\glsabbrvdefaultfont  \glsfirstabbrvscfont{text}

+

+is used instead. This uses \glsabbrvscfont by default. So redefine, \glsabbrvscfont +to change first and subsequent uses or \glsfirstabbrvscfont to change just the +first use. +

The long form for the small-cap styles uses \glslongdefaultfont or +\glsfirstlongdefaultfont, as with the basic style. The suffix is given +by +


\glsxtrscsuffix  \glsxtrscsuffix

+

+This is defined as + + + +

+
+\newcommand*{\glsxtrscsuffix}{\glstextup{\glsxtrabbrvpluralsuffix}} +
+

The \glstextup command is provided by glossaries and is used to switch off the +small caps font for the suffix. If you override the default short plural using the +shortplural key when you define the abbreviation you will need to make the +appropriate adjustment if necessary. (Remember that the default plural suffix +behaviour can be modified through the use of the aposplural and noshortplural +attributes. See §5 Categories for further details.) +

The small styles, such as long-short-sm and short-sm-long, use +


\glsabbrvsmfont  \glsabbrvsmfont{text}

+

+which uses \textsmaller. (This requires the relsizes package, which isn’t loaded by +glossaries-extra, so must be loaded explicitly.) On first use +


\glsfirstabbrvsmfont  \glsfirstabbrvsmfont{text}

+

+is used instead. This uses \glsabbrvsmfont by default. +

The long form for the smaller styles uses \glslongdefaultfont or +\glsfirstlongdefaultfont, as with the basic style. The suffix is given +by +


\glsxtrsmsuffix  \glsxtrsmsuffix

+

+which defaults to just \glsxtrabbrvpluralsuffix. +

The “short-em” (emphasize short) styles, such as long-short-em or short-em-long, +use +


\glsabbrvemfont  \glsabbrvemfont{text}

+

+On first use +


\glsfirstabbrvemfont  \glsfirstabbrvemfont{text}

+

+is used instead. This uses \glsabbrvemfont by default. The suffix is given +by +


\glsxtremsuffix  \glsxtremsuffix

+

+which defaults to just \glsxtrabbrvpluralsuffix. The long form is as for the basic +style unless the style is a “long-em” style. +

The “long-em” (emphasize long) styles, such as long-em-short-em or short-em-long-em, +use +


\glsfirstlongemfont  \glsfirstlongemfont{long-form}

+

+instead of \glsfirstlongdefaultfont{long-form} and +


\glslongemfont  \glslongemfont{long-form}

+ + + +

+instead of \glslongdefaultfont{long-form}. The first form \glsfirstlongemfont +is initialised to use \glslongemfont. +

The user styles have similar commands: +


\glsabbrvuserfont  \glsabbrvuserfont{text}

+

+for the short form, +


\glsfirstabbrvuserfont  \glsfirstabbrvuserfont{text}

+

+for the first use short form, +


\glslonguserfont  \glslonguserfont{text}

+

+for the long form, +


\glsfirstlonguserfont  \glsfirstlonguserfont{text}

+

+for the first use long form, and +


\glsxtrusersuffix  \glsxtrusersuffix

+

+for the short plural suffix. +

Similarly for the hyphen styles: +


\glsabbrvhyphenfont  \glsabbrvhyphenfont{text}

+

+for the short form, +


\glsfirstabbrvhyphenfont  \glsfirstabbrvhyphenfont{text}

+

+for the first use short form, +


\glslonghyphenfont  \glslonghyphenfont{text}

+

+for the long form, +


\glsfirstlonghyphenfont  \glsfirstlonghyphenfont{text}

+

+for the first use long form, and +


\glsxtrhyphensuffix  \glsxtrhyphensuffix

+

+for the short plural suffix. +

Similarly for the “only” styles, such as long-only-short-only: +


\glsabbrvonlyfont  \glsabbrvonlyfont{text}

+

+for the short form, +


\glsfirstabbrvonlyfont  \glsfirstabbrvonlyfont{text}

+

+for the first use short form, +


\glslongonlyfont  \glslongonlyfont{text}

+

+for the long form, +


\glsfirstlongonlyfont  \glsfirstlongonlyfont{text}

+ + + +

+for the first use long form, and +


\glsxtronlysuffix  \glsxtronlysuffix

+

+for the short plural suffix. +

Note that by default inserted material (provided in the final optional argument of +commands like \gls), is placed outside the font command in the predefined styles. To +move it inside, use: +


\glsxtrinsertinsidetrue  \glsxtrinsertinsidetrue

+

+This applies to all the predefined styles. For example: + + + +

+
+\setabbreviationstyle{long-short} + 
\renewcommand*{\glsfirstlongdefaultfont}[1]{\emph{#1}} + 
\glsxtrinsertinsidetrue +
+

This will make the long form and the inserted text emphasized, whereas the default +(without \glsxtrinsertinsidetrue) would place the inserted text outside of the +emphasized font. +

Note that for some styles, such as the short-long, the inserted text would be +placed inside the font command for the short form (rather than the long form in the +above example). +

Remember that \textsc renders lowercase letters as small capitals. Uppercase +letters are rendered as normal uppercase letters, so if you specify the short form in +uppercase, you won’t get small capitals unless you redefine \glsabbrvscfont to +convert its argument to lowercase. For example: + + + +

+
+\renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeLowercase{#1}}} +
+

+

If you want to easily switch between the “sc” and “sm” styles, you may find it +easier to redefine this command to convert case: + + + +

+
+\renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeTextLowercase{#1}}} + 
\renewcommand*{\glsabbrvsmfont}[1]{\textsmaller{\MakeTextUppercase{#1}}} +
+

+

Some of the styles use +


\glsxtrfullsep  \glsxtrfullsep{label}

+

+as a separator between the long and short forms. This is defined as a space by +default, but may be changed as required. For example: + + + +

+
+\renewcommand*{\glsxtrfullsep}[1]{~} +
+

or + + + +

+
+\renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}} +
+

+

The new naming scheme for abbreviation styles is as follows:

+
    +
  • field1⟩[-modifier1⟩]-[post]⟨field2⟩[-modifier2⟩][-user] +

    This is for the parenthetical styles. The -modifier⟩ parts may be omitted. + These styles display ⟨field1⟩ followed by ⟨field2⟩ in parentheses. If ⟨field1⟩ or + ⟨field2⟩ starts with “no” then that element is omitted from the display style + (no parenthetical part) but is included in the inline style. +

    If the -modifier⟩ part is present, then the field has a font changing command + applied to it. The special modifier -only indicates that field is only present + according to whether or not the entry has been used. +

    If post is present then ⟨field2⟩ is placed after the link-text using the + post-link hook. +

    If the -user part is present, then the user1 value, if provided, is inserted + into the parenthetical material . (The field used for the inserted material + may be changed.) +

    Examples:

    +
      +
    • long-noshort-sc: ⟨field1⟩ is the long form, the short form is set in + smallcaps but omitted in the display style. +
    • +
    • long-em-short-em: both the long form and the short form are + emphasized. The short form is in parentheses. +
    • +
    • long-short-em: the short form is emphasized but not the long form. + The short form is in parentheses. +
    • +
    • long-short-user: if the user1 key has been set, this produces the style + ⟨long⟩ (⟨short⟩, ⟨user1⟩) otherwise it just produces ⟨long⟩ (⟨short⟩). +
    • +
    • long-hyphen-postshort-hyphen: the short form and the inserted + material (provided by the final optional argument of commands like + \gls) is moved to the post-link hook. The long form is formatted + according to \glslonghyphenfont (or \glsfirstlonghyphenfont + on first use). The short form is formatted according to + \glsabbrvhyphenfont (or \glsfirstabbrvhyphenfont on first + use).
    + + + +
  • +
  • style-noreg +

    Some styles set the regular attribute. In some cases, there’s a version of the + style that doesn’t set this attribute. For example, long-em-noshort-em sets the + regular attribute. The long-em-noshort-em-noreg style is a minor variation that + style that doesn’t set the attribute. +

    There are a few “noshort” styles, such as long-hyphen-noshort-noreg, that have + “-noreg” version without a regular version. This is because the style won’t work + properly with the regular set, but the naming scheme is maintained for + consistency with the other “noshort” styles. +

  • +
  • field1⟩[-modifier1⟩]-[post]footnote +

    The display style uses ⟨field1⟩ followed by a footnote with the other field in it. If + post is present then the footnote is placed after the link-text using the + post-link hook. The inline style does ⟨field1⟩ followed by the other field in + parentheses. +

    If -modifier1⟩ is present, ⟨field1⟩ has a font-changing command applied to + it. +

    Examples:

    +
      +
    • short-footnote: short form in the text with the long form in the + footnote. +
    • +
    • short-sc-postfootnote: short form in smallcaps with the long form in + the footnote outside of the link-text.
    +

    Take care with the footnote styles. Remember that there are some situations + where \footnote doesn’t work.
    +

    +

  • +
  • style-desc +

    Like ⟨style⟩ but the description key must be provided when defining abbreviations + with this style. +

    Examples:

    + + + + +
+

Not all combinations that fit the above syntax are provided. Pre-version 1.04 +styles that didn’t fit this naming scheme are either provided with a synonym (where +the former name wasn’t ambiguous) or provided with a deprecated synonym (where +the former name was confusing). The deprecated style names generate a warning +using: +


\GlsXtrWarnDeprecatedAbbrStyle  \GlsXtrWarnDeprecatedAbbrStyle +{old-name}{new-name}

+

+where ⟨old-name⟩ is the deprecated name and ⟨new-name⟩ is the preferred name. You +can suppress these warnings by redefining this command to do nothing. +

+

+

Top

3.4.1 Predefined Abbreviation Styles that Set the Regular Attribute

+

The following abbreviation styles set the regular attribute to “true” for all categories +that have abbreviations defined with any of these styles. +

+short-nolong
This only displays the short form on first use. The name is set to the + short form through the command +


\glsxtrshortnolongname  \glsxtrshortnolongname

+

+ (Similarly for the other shortmodifier-nolongmodifier⟩ styles, unless indicated + otherwise.) This command is expanded as the entry is defined, so any + redefinition must be done before \newabbreviation (or \newacronym) for it to + take effect. Make sure to \protect any formatting commands (or anything else + that shouldn’t be expanded). +

The description is set to the long form. The inline full form displays ⟨short⟩ + (⟨long⟩). The long form on its own can be displayed through commands like + \glsxtrlong. +

+short
A synonym for short-nolong. +
+nolong-short
Like short-nolong but the inline full form displays ⟨long⟩ (⟨short⟩). +
+short-sc-nolong
Like short-nolong but redefines \glsabbrvfont to use + \glsabbrvscfont (which defaults to \textsc). +
+short-sc
A synonym for short-sc-nolong + + + +
+nolong-short-sc
Like short-sc-nolong but the inline full form displays ⟨long⟩ (⟨short⟩). + The name is still obtained from \glsxtrshortnolongname (similarly for the + other styles in the form nolongmodifier-shortmodifier⟩ unless indicated + otherwise). +
+short-sm-nolong
Like short-nolong but redefines \glsabbrvfont to use + \glsabbrvsmfont (which defaults to \textsmaller). +
+short-sm
A synonym for short-sm-nolong. +
+nolong-short-sm
Like short-sm-nolong but the inline full form displays ⟨long⟩ + (⟨short⟩). +
+short-em-nolong
Like short-nolong but redefines \glsabbrvfont to use + \glsabbrvemfont. +
+short-em
A synonym for short-em-nolong +
+nolong-short-em
Like short-em-nolong but the inline full form displays ⟨long⟩ + (⟨short⟩). +
+short-nolong-desc
Like the short-nolong style, but the name is set to the full form + obtained by expanding +


\glsxtrshortdescname  \glsxtrshortdescname

+

+ (Similarly for the other shortmodifier-nolongmodifier-desc styles, unless + indicated otherwise.) This command is expanded when the entry is defined, so + \protect fragile and formatting commands and only redefine this command + before \newabbreviation (or \newacronym). +

The description must be supplied by the user. You may prefer to use + the short-nolong style with the post-description hook set to display + the long form and override the description key. (See the sample file + sample-acronym-desc.tex.) +

+short-desc
A synonym for short-nolong-desc. +
+short-sc-nolong-desc
Like short-nolong but redefines \glsabbrvfont to use + \glsabbrvscfont (which defaults to \textsc). + + + +
+short-sc-desc
A synonym for short-sc-nolong-desc. +
+short-sm-nolong-desc
Like short-nolong-desc but redefines \glsabbrvfont to use + \glsabbrvsmfont (which defaults to \textsmaller). +
+short-sm-desc
A synonym for short-sm-nolong-desc. +
+short-em-nolong-desc
Like short-nolong-desc but redefines \glsabbrvfont to use + \glsabbrvemfont. +
+short-em-desc
A synonym for short-em-nolong-desc. +
+long-noshort-desc
This style only displays the long form, regardless of first or + subsequent use of commands \gls. The short form may be accessed + through commands like \glsxtrshort. The inline full form displays ⟨long⟩ + (⟨short⟩). +

The sort key are set to the long form. The name key is also set to the long form, + but this is done by expanding +


\glsxtrlongnoshortdescname  \glsxtrlongnoshortdescname

+

+ (Similarly for the other longmodifier-noshortmodifier-desc styles, unless + indicated otherwise.) This command should only be redefined before + abbreviations are defined, and any fragile or formatting commands within it + need protecting. +

The description must be provided by the user. The predefined glossary styles + won’t display the short form. You can use the post-description hook to + automatically append the short form to the description. The inline full form + will display ⟨long⟩ (⟨short⟩). +

+long-desc
A synonym for long-noshort-desc. +
+long-noshort-sc-desc
Like the long-noshort-desc style but the short form (accessed + through commands like \glsxtrshort) use \glsabbrvscfont. (This style was + originally called long-desc-sc. Renamed in version 1.04, but original name + retained as a deprecated synonym for backward-compatibility.) +
+long-noshort-sm-desc
Like long-noshort-desc but redefines \glsabbrvfont to use + \glsabbrvsmfont. (This style was originally called long-desc-sm. Renamed in + version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) + + + +
+long-noshort-em-desc
Like long-noshort-desc but redefines \glsabbrvfont to use + \glsabbrvemfont. The long form isn’t emphasized. (This style was originally + called long-desc-em. Renamed in version 1.04, but original name retained as a + deprecated synonym for backward-compatibility.) +
+long-em-noshort-em-desc
New to version 1.04, like long-noshort-desc but + redefines \glsabbrvfont to use \glsabbrvemfont. The long form uses + \glsfirstlongemfont and \glslongemfont. +
+long-noshort
This style doesn’t really make sense if you don’t use the short form + anywhere in the document, but is provided for completeness. This is + like the long-noshort-desc style, but the sort key is set to the short + form. The name key is also set to the short form, but this is done by + expanding +


\glsxtrlongnoshortname  \glsxtrlongnoshortname

+

+ (Similarly for other longmodifier-noshortmodifier⟩ styles, unless indicated + otherwise.) This command should only be redefined before abbreviations are + defined, and fragile or formatting commands should be protected. +

The description is set to the long form. +

+long
A synonym for long-noshort +
+long-noshort-sc
Like the long-noshort style but the short form (accessed through + commands like \glsxtrshort) use \glsabbrvscfont. (This style was originally + called long-sc. Renamed in version 1.04, but original name retained as a + deprecated synonym for backward-compatibility.) +
+long-noshort-sm
Like long-noshort but redefines \glsabbrvfont to use + \glsabbrvsmfont. (This style was originally called long-sm. Renamed in + version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) +
+long-noshort-em
This style is like long-noshort but redefines \glsabbrvfont to use + \glsabbrvemfont. The long form isn’t emphasized. (This style was originally + called long-em. Renamed in version 1.04, but original name retained as a + deprecated synonym for backward-compatibility.) +
+long-em-noshort-em
New to version 1.04, this style is like long-noshort but redefines + + + + \glsabbrvfont to use \glsabbrvemfont, \glsfirstlongfont to use + \glsfirstlongemfont and \glslongfont to use \glslongemfont. The short + form isn’t used by commands like \gls, but can be obtained using + \glsxtrshort. The related style long-em-noshort-em-noreg doesn’t set the + regular attribute. +
+

+

+

Top

3.4.2 Predefined Abbreviation Styles that Don’t Set the Regular Attribute

+

The following abbreviation styles will set the regular attribute to “false” if it has +previously been set. If it hasn’t already been set, it’s left unset. Other attributes may +also be set, depending on the style. +

+long-short
On first use, this style uses the format ⟨long⟩ (⟨short⟩). The inline and + display full forms are the same. The sort key is set to the short form. The name + is also set to the short form through +


\glsxtrlongshortname  \glsxtrlongshortname

+

+ (Similarly for other longmodifier-shortmodifier⟩ styles, unless indicated + otherwise.) Any redefinition of this command must come before the + abbreviations are defined as it expands on definition. Make sure you protect + any commands that shouldn’t be expanded. The long form can be referenced + with \the\glslongtok and the short form can be referenced with + \the\glsshorttok. +

The description is set to the long form. The long and short forms are separated + by \glsxtrfullsep. If you want to insert material within the parentheses + (such as a translation), try the long-short-user style. +

+long-short-sc
Like long-short but redefines \glsabbrvfont to use \glsabbrvscfont. +
+long-short-sm
Like long-short but redefines \glsabbrvfont to use \glsabbrvsmfont. +
+long-short-em
Like long-short but redefines \glsabbrvfont to use \glsabbrvemfont. +
+long-em-short-em
New to version 1.04, this style is like long-short-em but redefines + \glsfirstlongfont to use \glsfirstlongemfont. + + + +
+long-only-short-only
New to version 1.17, this style only shows the long form on first + use and only shows the short form on subsequent use. The inline full form + \glsxtrfull shows the long form followed by the short form in parentheses. + The name field is obtained from +


\glsxtronlyname  \glsxtronlyname

+

+ Any redefinition of this command must come before the abbreviations + are defined as it expands on definition. Make sure you protect any + commands that shouldn’t be expanded. The long form can be referenced + with \the\glslongtok and the short form can be referenced with + \the\glsshorttok. +

+long-only-short-only-desc
New to version 1.17, this style is like long-only-short-only + but the user must supply the description. The name field is obtained + from +


\glsxtronlydescname  \glsxtronlydescname

+

+ Any redefinition of this command must come before the abbreviations + are defined as it expands on definition. Make sure you protect any + commands that shouldn’t be expanded. The long form can be referenced + with \the\glslongtok and the short form can be referenced with + \the\glsshorttok. +

+long-em-noshort-em-noreg
New to version 1.17, this style is like long-em-noshort-em + but doesn’t set the regular attribute. +
+long-short-user
This style was introduced in version 1.04. It’s like the long-short style + but additional information can be inserted into the parenthetical material. This + checks the value of the field given by +


\glsxtruserfield  \glsxtruserfield

+

+ (which defaults to useri) using \ifglshasfield (provided by glossaries). If the + field hasn’t been set, the style behaves like the long-short style and produces + ⟨long⟩ (⟨short⟩) but if the field has been set, the contents of that field are inserted + within the parentheses in the form ⟨long⟩ (⟨short⟩, ⟨field-value⟩). The format is + governed by +


\glsxtruserparen  \glsxtruserparen{text}{label}

+

+ where ⟨text⟩ is the short form (for the long-short-user style) or the long form (for + the short-long-user style). This command first inserts a space using + + + + \glsxtrfullsep and then the parenthetical content (using \glsxtrparen). + The description is set to +


\glsuserdescription  \glsuserdescription{long}{label}

+

+ The default definition ignores the ⟨label⟩ and encapsulates ⟨long⟩ with + \glslonguserfont. +

The name is obtained by expanding \glsxtrlongshortname (see above). The + ⟨text⟩ argument includes the font formatting command, \glsfirstabbrvfont + {short} in the case of the long-short-user style and \glsfirstlongfont{long} + in the case of the short-long-user style. +

For example: + + + +

+
+ \setabbreviationstyle[acronym]{long-short-user} +  
\newacronym{tug}{TUG}{\TeX\ User Group} +  
\newacronym +  
 [user1={German Speaking \TeX\ User Group}] +  
 {dante}{DANTE}{Deutschsprachige Anwendervereinigung \TeX\ e.V} +
+

On first use, \gls{tug} will appear as: +

+

TEX User Group (TUG)

+

whereas \gls{dante} will appear as: +

+

Deutschsprachige Anwendervereinigung TEX e.V (DANTE, + German Speaking TEX User Group)

+

The short form is formatted according to +


\glsabbrvuserfont  \glsabbrvuserfont{text}

+

+ and the plural suffix is given by +


\glsxtrusersuffix  \glsxtrusersuffix

+

+

These may be redefined as appropriate. For example, if you want a smallcaps + style, you can just set these commands to those used by the long-short-sc + style: + + + +

+
+ \renewcommand{\glsabbruserfont}[1]{\glsabbrvscfont{#1}} +  
\renewcommand{\glsxtrusersuffix}{\glsxtrscsuffix} +
+

+

+long-noshort-noreg
This style is like long-noshort but it doesn’t set the regular + attribute. +
+long-noshort-desc-noreg
This style is like long-noshort-desc but it doesn’t set the + regular attribute. +
+long-short-desc
On first use, this style uses the format ⟨long⟩ (⟨short⟩). The + inline and display full forms are the same. The name is set to the full + form. The sort key is set to ⟨long⟩ (⟨short⟩). Before version 1.04, this was + incorrectly set to the short form. If you want to revert back to this you can + redefine +


\glsxtrlongshortdescsort  \glsxtrlongshortdescsort

+

+ For example: + + + +

+
+ \renewcommand*{\glsxtrlongshortdescsort}{\the\glsshorttok} +
+

The description must be supplied by the user. The long and short + forms are separated by \glsxtrfullsep. The name field is obtained + from +


\glsxtrlongshortdescname  \glsxtrlongshortdescname

+

+ (Similarly for other longmodifier-shortmodifier-desc styles, unless indicated + otherwise.) Any redefinition of this command must come before the + abbreviations are defined as it expands on definition. Make sure you protect + any commands that shouldn’t be expanded. The long form can be referenced + with \the\glslongtok and the short form can be referenced with + \the\glsshorttok. +

+long-short-sc-desc
Like long-short-desc but redefines \glsabbrvfont to use + \glsabbrvscfont. +
+long-short-sm-desc
Like long-short-desc but redefines \glsabbrvfont to use + \glsabbrvsmfont. +
+long-short-em-desc
Like long-short-desc but redefines \glsabbrvfont to use + \glsabbrvemfont. +
+long-em-short-em-desc
New to version 1.04, this style is like long-short-em-desc but + redefines \glsfirstlongfont to use \glsfirstlongemfont. +
+long-em-noshort-em-desc-noreg
New to version 1.17, this style is like + long-em-noshort-em-desc but doesn’t set the regular attribute. +
+long-short-user-desc
New to version 1.04, this style is like a cross between the + long-short-desc style and the long-short-user style. The display and + inline forms are as for long-short-user and the name key is obtained + from +


\glsxtrlongshortuserdescname  \glsxtrlongshortuserdescname

+ + + +

+ Again, this should only be redefined before \newabbreviation (or + \newacronym), and fragile and formatting commands need protecting. +

The description key must be supplied in the optional argument of + \newabbreviation (or \newacronym). The sort key is set to ⟨long⟩ (⟨short⟩) as per + the long-short-desc style. +

+short-nolong-noreg
This is like short-nolong but doesn’t set the regular attribute. +
+nolong-short-noreg
This is like nolong-short but doesn’t set the regular attribute. +
+short-long
On first use, this style uses the format ⟨short⟩ (⟨long⟩). The inline and + display full forms are the same. The name and sort keys are set to the + short form. The description is set to the long form. The short and long + forms are separated by \glsxtrfullsep. If you want to insert material + within the parentheses (such as a translation), try the short-long-user + style. +

The name field is obtained from +


\glsxtrshortlongname  \glsxtrshortlongname

+

+ (Similarly for other shortmodifier-longmodifier⟩ styles, unless indicated + otherwise.) Any redefinition of this command must come before the + abbreviations are defined as it expands on definition. Make sure you protect + any commands that shouldn’t be expanded. The long form can be referenced + with \the\glslongtok and the short form can be referenced with + \the\glsshorttok. +

+short-sc-long
Like short-long but redefines \glsabbrvfont to use \glsabbrvscfont. +
+short-sm-long
Like short-long but redefines \glsabbrvfont to use \glsabbrvsmfont. +
+short-em-long
Like short-long but redefines \glsabbrvfont to use \glsabbrvemfont. +
+short-em-long-em
New to version 1.04, this style is like short-em-long but redefines + \glsfirstlongfont to use \glsfirstlongemfont. +
+short-long-user
New to version 1.04. This style is like the long-short-user style but + with the long and short forms switched. The parenthetical material is governed + by the same command \glsxtruserparen, but the first argument supplied to it + + + + is the long form instead of the short form. The name field is obtained by + expanding +


\glsxtrshortlongname  \glsxtrshortlongname

+

+ Again, this should only be redefined before \newabbreviation (or + \newacronym) and commands that should be expanded need to be protected. + The description is set to \glsuserdescription{long}{label}. +

+short-nolong-desc-noreg
This style is like short-nolong-desc but it doesn’t set the + regular attribute. +
+short-long-desc
On first use, this style uses the format ⟨short⟩ (⟨long⟩). The + inline and display full forms are the same. The name is set to the full + form. The description must be supplied by the user. The short and long + forms are separated by \glsxtrfullsep. The name field is obtained + from +


\glsxtrshortlongdescname  \glsxtrshortlongdescname

+

+ (Similarly for other shortmodifier-longmodifier-desc styles, unless indicated + otherwise.) Any redefinition of this command must come before the + abbreviations are defined as it expands on definition. Make sure you protect + any commands that shouldn’t be expanded. The long form can be referenced + with \the\glslongtok and the short form can be referenced with + \the\glsshorttok. +

+short-sc-long-desc
Like short-long-desc but redefines \glsabbrvfont to use + \glsabbrvscfont. +
+short-sm-long-desc
Like short-long-desc but redefines \glsabbrvfont to use + \glsabbrvsmfont. +
+short-em-long-desc
Like short-long-desc but redefines \glsabbrvfont to use + \glsabbrvemfont. +
+short-em-long-em-desc
New to version 1.04, this style is like short-em-long-desc but + redefines \glsfirstlongfont to use \glsfirstlongemfont. +
+short-long-user-desc
New to version 1.04, this style is like a cross between the + short-long-desc style and the short-long-user style. The display and + inline forms are as for short-long-user, but the name key is obtained + from + + + +


\glsxtrshortlonguserdescname  \glsxtrshortlonguserdescname

+

+ Again, this should only be redefined before \newabbreviation (or + \newacronym), and fragile and formatting commands need protecting. +

The description key must be supplied in the optional argument of + \newabbreviation (or \newacronym). +

+short-footnote
On first use, this style displays the short form with the long form as + a footnote. This style automatically sets the nohyperfirst attribute to “true” for + the supplied category, so the first use won’t be hyperlinked (but the footnote + marker may be, if the hyperref package is used). +

The inline full form uses the ⟨short⟩ (⟨long⟩) style. The name is set to the short + form. The description is set to the long form. The name key is obtained by + expanding +


\glsxtrfootnotename  \glsxtrfootnotename

+

+ (Similarly for other shortmodifier-modifierfootnote styles, unless + indicated otherwise.) Again, this command should only be redefined before + \newabbreviation (or \newacronym), and fragile or formatting commands + should be protected from expansion. +

As from version 1.05, all the footnote styles use: +


\glsfirstlongfootnotefont  \glsfirstlongfootnotefont{text} +

+

+ to format the long form on first use or for the full form and +


\glslongfootnotefont  \glslongfootnotefont{text}

+

+ to format the long form elsewhere (for example, when used with \glsxtrlong). +

As from version 1.07, all the footnote styles use: +


\glsxtrabbrvfootnote  \glsxtrabbrvfootnote{label}{long}

+

+ By default, this just does \footnote{long} (the first argument is ignored). For + example, to make the footnote text link to the relevant place in the + glossary: + + + +

+
+ \renewcommand{\glsxtrabbrvfootnote}[2]{% +  
  \footnote{\glshyperlink[#2]{#1}}% +  
} +
+

or to include the short form with a hyperlink: + + + +

+
+ \renewcommand{\glsxtrabbrvfootnote}[2]{% +  
  \footnote{\glshyperlink[\glsfmtshort{#1}]{#1}: #2}% +  
} +
+

Note that I haven’t used commands like \glsxtrshort to avoid interference + (see §2.3 Entry Display Style Modifications and §2.7 Nested Links). +

+footnote
A synonym for short-footnote. +
+short-sc-footnote
Like short-footnote but redefines \glsabbrvfont to use + \glsabbrvscfont. (This style was originally called footnote-sc. Renamed in + version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) +
+short-sc-footnote
Like short-footnote but redefines \glsabbrvfont to use + \glsabbrvsmfont. (This style was originally called footnote-sm. Renamed in + version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) +
+short-em-footnote
Like short-footnote but redefines \glsabbrvfont to use + \glsabbrvemfont. (This style was originally called footnote-em. Renamed in + version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) +
+short-postfootnote
This is similar to the short-footnote style but doesn’t modify the + category attribute. Instead it changes \glsxtrpostlinkcategory to insert the + footnote after the link-text on first use. This will also defer the footnote + until after any following punctuation character that’s recognised by + \glsxtrifnextpunc. +

The inline full form uses the ⟨short⟩ (⟨long⟩) style. The name is set to the short + form. The description is set to the long form. Note that this style will change + \glsxtrfull (and its variants) so that it fakes non-first use. (Otherwise the + footnote would appear after the inline form.) +

+postfootnote
A synonym for short-postfootnote. + + + +
+short-sc-postfootnote
Like short-postfootnote but redefines \glsabbrvfont to use + \glsabbrvscfont. (This style was originally called postfootnote-sc. Renamed in + version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) +
+short-sm-postfootnote
Like short-postfootnote but redefines \glsabbrvfont to use + \glsabbrvsmfont. (This style was originally called postfootnote-sm. Renamed + in version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) +
+short-em-postfootnote
Like short-postfootnote but redefines \glsabbrvfont to use + \glsabbrvemfont. (This style was originally called postfootnote-em. Renamed + in version 1.04, but original name retained as a deprecated synonym for + backward-compatibility.) +
+short-postlong-user
This style was introduced in version 1.12. It’s like the + short-long-user style but defers the parenthetical material to after the link-text. + This means that you don’t have such a long hyperlink (which can cause + problems for the DVI LATEX format) and it also means that the user supplied + material can include a hyperlink to another location. The name key is obtained + from \glsxtrshortlongname. +
+short-postlong-user-desc
This style was introduced in version 1.12. It’s like the + above short-postlong-user style but the description must be specified. The name + is obtained from \glsxtrshortlonguserdescname. +
+long-postshort-user
This style was introduced in version 1.12. It’s like the + above short-postlong-user style but the long form is shown first and + the short form is in the parenthetical material (as for long-short-user) + style. +
+long-postshort-user-desc
This style was introduced in version 1.12. It’s like the + above long-postshort-user style but the description must be specified. The name + is obtained from \glsxtrlongshortuserdescname. +
+long-hyphen-short-hyphen
This style (new to v1.17) is designed to work + with the markwords category attribute. The full form is formatted + using +


\glsxtrlonghyphenshort  \glsxtrlonghyphenshort{label}{long}{short} + {insert}

+ + + +

+ where ⟨insert⟩ is the inserted material provided in the final optional argument of + commands like \insert. If ⟨insert⟩ start with a hyphen, then this locally + redefines \glsxtrwordsep to a hyphen, which means that if the markwords + attribute is set then the long form will become hyphenated. (If this attribute + isn’t set, there’s no alteration to the way the long form is displayed.) The name + key is obtained from \glsxtrlongshortname. +

Unlike the other ⟨long⟩ (⟨short⟩) type of styles, such as long-short, this style also + repeats the insertion in the parenthetical part, so that the first use form + is: +

+

\glsfirstlonghyphenfont{long}insert⟩ + (\glsfirstabbrvhyphenfont{short}insert⟩)

+

The space before the parenthetical material is actually given by + \glsxtrfullsep{label} which defaults to a space. The ⟨insert⟩ may be + moved into the formatting commands according to the conditional + \ifglsxtrinsertinside. +

For example, if ip is defined using: + + + +

+
+ \glssetcategoryattribute{english}{markwords}{true} +  
\setabbreviationstyle[english]{long-hyphen-short-hyphen} +  
\newabbreviation[category=english]{ip}{IP}{Internet Protocol} +
+

then + + + +

+
+ \gls{ip}[-Adressen] +
+

will do +

+

Internet-Protocol-Adressen (IP-Adressen)

+

on first use, whereas + + + +

+
+ \gls{ip}[ Address] +
+

will do +

+

Internet Protocol Address (IP Address)

+

on first use. +

Note that the hyphenation isn’t applied when using commands like + \glsxtrlong. This means that + + + +

+
+ \glsxtrlong{ip}[-Adressen] +
+

will do +

+

Internet Protocol-Adressen

+
+

+

If the markwords attribute hadn’t been set, then the first use of + + + +

+
+ \gls{ip}[-Adressen] +
+

would do +

+

Internet Protocol-Adressen (IP-Adressen)

+

instead. +

If the inserted material ⟨insert⟩ is likely to contain commands like \gls, + then use long-hyphen-postshort-hyphen instead to avoid nested links. +
+

+

If you want the short version in small-caps, you can just redefine + \glsabbrvhyphenfont and \glsxtrhyphensuffix to use the small-caps + versions. For example: + + + +

+
+ \renewcommand{\glsabbrvhyphenfont}{\glsabbrvscfont} +  
\renewcommand{\glsxtrhyphensuffix}{\glsxtrscsuffix} +
+

Similarly for other font-changing variations. +

+long-hyphen-noshort-desc-noreg
New to version 1.17, this style is like + long-hyphen-short-hyphen-desc except that the parenthetical part is omitted and + the long form is displayed on subsequent use. The short form can be accessed + with \glsxtrshort but just uses the default abbreviation font. There’s + no regular version of this style as the regular form doesn’t have the + flexibility to deal with the hyphen switch. The name is obtained from + \glsxtrlongnoshortdescname. +
+long-hyphen-noshort-noreg
New to version 1.17, this style is like + long-hyphen-noshort-desc-noreg but the name is set to the short form and the + description is set to the long form. +
+long-hyphen-short-hyphen-desc
+

New to version 1.17. This is similar to long-hyphen-short-hyphen but the user + supplies the description. The name is obtained from \glsxtrlongshortdescname. +

+long-hyphen-postshort-hyphen
+

New to version 1.17. This is similar to long-hyphen-short-hyphen but the + inserted and parenthetical material are moved to the post-link hook. On first + use, \gls{label}[insert] will do +
\glsxtrlonghyphen{long}{label}{insert}\glsxtrposthyphenshort + {label}insert⟩ +
+ where +


\glsxtrposthyphenshort  \glsxtrposthyphenshort{label}insert⟩ +

+

+ is in the post-link hook. This uses the format: +
insert⟩ (\glsfirstabbrvhyphenfont{short}isnert⟩) +
+ + + +

The singular short form is always used here, even with \glspl. (Unlike + long-hyphen-long-hyphen.)
+

+

The part in the link-text on first use: +


\glsxtrlonghyphen  \glsxtrlonghyphen{long}{label}{insert} +

+

+ checks if ⟨insert⟩ starts with a hyphen. If it does, then \glsxtrwordsep is locally + redefined to a hyphen. This command only uses ⟨insert⟩ to test if it starts with a + hyphen. The actual insertion code isn’t typeset until the post-link hook and it’s + also localised, which means that you can use commands like \gls in ⟨insert⟩ for + this style without causing nested hyperlinks, but only for commands like + \gls. +

Don’t use \gls in the ⟨insert⟩ part for commands like \glsxtrfull, + \glsxtrshort or \glsxtrlong.
+

+

The inline full display format used by commands like \glsxtrfull + behaves differently to the first use of \gls with this style. It’s better + to use \glsreset{label}\gls{label} if you want to ensure the full + format. +

+long-hyphen-postshort-hyphen-desc
+

New to version 1.17. This is similar to long-hyphen-postshort-hyphen + but the user supplies the description. The name is obtained from + \glsxtrlongshortdescname. +

+short-hyphen-long-hyphen
This style (new to v1.17) is like long-hyphen-short-hyphen, + except that the short form is displayed first followed by the long form in + parentheses. The full form is formatted using +


\glsxtrshorthyphenlong  \glsxtrshorthyphenlong{label}{short}{long} + {insert}

+

+ which behaves in an analogous way to \glsxtrlonghyphenshort. The name is + obtained from \glsxtrshortlongname. +

+short-hyphen-long-hyphen-desc
+

New to version 1.17. This is similar to short-hyphen-long-hyphen but the user + supplies the description. The name is obtained from \glsxtrshortlongdescname. + + + +

+short-hyphen-postlong-hyphen
This style (new to v1.17) is like + long-hyphen-postshort-hyphen, but the short form is displayed first followed by + the long form in parentheses. On first use, \gls{label}[insert] will do + +
\glsxtrshorthyphen{short}{label}{insert}\glsxtrposthyphenlong + {label}insert⟩ +
+ where +


\glsxtrposthyphenlong  \glsxtrposthyphenlong{label}insert⟩ +

+

+ is in the post-link hook. These commands behave in an analogous manner to + those used with long-hyphen-postshort-hyphen. The name is obtained from + \glsxtrshortlongname. +

Don’t use \gls in the ⟨insert⟩ part for commands like \glsxtrfull, + \glsxtrshort or \glsxtrlong.
+

+

The inline full display format used by commands like \glsxtrfull + behaves differently to the first use of \gls with this style. It’s better + to use \glsreset{label}\gls{label} if you want to ensure the full + format. +

+short-hyphen-postlong-hyphen-desc
+

New to version 1.17. This is similar to short-hyphen-postlong-hyphen + but the user supplies the description. The name is obtained from + \glsxtrshortlongdescname. +

+
+

+

+

Top

3.5 Defining New Abbreviation Styles

+

New abbreviation styles may be defined using: +


\newabbreviationstyle  \newabbreviationstyle{name}{setup}{fmts} +

+

+ + + +

where ⟨name⟩ is the name of the new style (as used in the mandatory argument of +\setabbreviationstyle). This is similar but not identical to the glossaries package’s +\newacronymstyle command. +

You can’t use styles defined by \newacronymstyle with glossaries-extra +unless you have reverted \newacronym back to its generic definition from +glossaries (using \RestoreAcronyms). The acronym styles from the glossaries +package can’t be used with abbreviations defined with \newabbreviation. +
+

+

The ⟨setup⟩ argument deals with the way the entry is defined and may +set attributes for the given abbreviation category. This argument should +redefine +


\CustomAbbreviationFields  \CustomAbbreviationFields

+

+to set the entry fields including the name (defaults to the short form if omitted), +sort, first, firstplural. Other fields may also be set, such as text, plural and +description. +

\CustomAbbreviationFields is expanded by \newabbreviation so take care to +protect commands that shouldn’t be expanded.
+

+

For example, the long-short style has the following in ⟨setup⟩: + + + +

+
+  \renewcommand*{\CustomAbbreviationFields}{% + 
    name={\protect\glsabbrvfont{\the\glsshorttok}}, + 
    sort={\the\glsshorttok}, + 
    first={\protect\glsfirstlongfont{\the\glslongtok}% + 
     \protect\glsxtrfullsep{\the\glslabeltok}% + 
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshorttok}}},% + 
    firstplural={\protect\glsfirstlongfont{\the\glslongpltok}% + 
     \protect\glsxtrfullsep{\the\glslabeltok}% + 
     \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshortpltok}}},% + 
    plural={\protect\glsabbrvfont{\the\glsshortpltok}},% + 
    description={\the\glslongtok}}% +
+

Note that the first and firstplural are set even though they’re not used by +\gls. +

The basic styles, such as long-short, use commands like \glsabbrvfont (which are +redefined whenever the style formatting is set) within \CustomAbbreviationFields. +Other styles, such as long-em-short-em directly use their own custom commands, such +as \glsabbrvemfont. With these styles, commands like \glsabbrvfont still need to +be defined as appropriate in the ⟨fmts⟩ argument even if they’re not used within +\CustomAbbreviationFields. +

The ⟨setup⟩ argument may also redefine +


\GlsXtrPostNewAbbreviation  \GlsXtrPostNewAbbreviation

+

+which can be used to assign attributes. (This will automatically be initialised to do +nothing.) +

For example, the short-footnote includes the following in ⟨setup⟩: + + + +

+
+  \renewcommand*{\GlsXtrPostNewAbbreviation}{% + 
    \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% + 
    \glshasattribute{\the\glslabeltok}{regular}% + 
    {% + 
      \glssetattribute{\the\glslabeltok}{regular}{false}% + 
    }% + 
    {}% + 
  }% +
+

This sets the nohyperfirst attribute to “true”. It also unsets the regular attribute if it +has previously been set. Note that the nohyperfirst attribute doesn’t get unset by +other styles, so take care not to switch styles for the same category. +

You can access the short, long, short plural and long plural values through the +following token registers. +

Short value (defined by glossaries): +


\glsshorttok  \glsshorttok

+

+

Short plural value (defined by glossaries-extra): +


\glsshortpltok  \glsshortpltok

+

+(This may be the default value or, if provided, the value provided by the user +through the shortplural key in the optional argument of \newabbreviation.) +

Long value (defined by glossaries): +


\glslongtok  \glslongtok

+

+

Long plural value (defined by glossaries-extra): +


\glslongpltok  \glslongpltok

+

+(This may be the default value or, if provided, the value provided by the user +through the longplural key in the optional argument of \newabbreviation.) +

The short or long values may be modified by attributes (such as markwords). The +above registers reflect the modification. If you want to access the original +(unmodified) short or long form (as provided in the final two arguments of +\newabbreviation), then use the commands: +


\glsxtrorgshort  \glsxtrorgshort

+

+for the short form and +


\glsxtrorglong  \glsxtrorglong

+

+for the long form. (These may be useful for the sort key to avoid any formatting that + + + +may be added by the attribute setting.) +

There are two other registers available that are defined by glossaries: +


\glslabeltok  \glslabeltok

+

+which contains the entry’s label and +


\glskeylisttok  \glskeylisttok

+

+which contains the values provided in the optional argument of \newabbreviation. +

Remember put \the in front of the register command as in the examples above. +The category label can be access through the command (not a register): +


\glscategorylabel  \glscategorylabel

+

+This may be used inside the definition of \GlsXtrPostNewAbbreviation. +

If you want to base a style on an existing style, you can use +


\GlsXtrUseAbbrStyleSetup  \GlsXtrUseAbbrStyleSetup{name}

+

+where ⟨name⟩ is the name of the existing style. For example, the long-noshort-sc-desc +style simply does + + + +

+
+\GlsXtrUseAbbrStyleSetup{long-noshort-desc} +
+

within ⟨setup⟩. +

The ⟨fmts⟩ argument deals with the way the entry is displayed in the document. +This argument should redefine the following commands. +

The default suffix for the plural short form (if not overridden by the shortplural +key): +


\abbrvpluralsuffix  \abbrvpluralsuffix

+

+(Note that this isn’t used for the plural long form, which just uses the regular +\glspluralsuffix.) +

The font used for the short form on first use or in the full forms: +


\glsfirstabbrvfont  \glsfirstabbrvfont{text}

+

+

The font used for the short form on subsequent use or through commands like +\glsxtrshort: +


\glsabbrvfont  \glsabbrvfont{text}

+

+

The font used for the long form on first use or in the full forms: +


\glsfirstlongfont  \glsfirstlongfont{text}

+

+

The font used for the long form in commands like \glsxtrlong use: +


\glslongfont  \glslongfont{text}

+

+

Display full form singular no case-change (used by \gls on first use for +abbreviations without the regular attribute set): +


\glsxtrfullformat  \glsxtrfullformat{label}{insert}

+

+

Display full form singular first letter converted to upper case (used by \Gls on +first use for abbreviations without the regular attribute set): +


\Glsxtrfullformat  \Glsxtrfullformat{label}{insert}

+

+

Display full form plural no case-change (used by \glspl on first use for +abbreviations without the regular attribute set): +


\glsxtrfullplformat  \glsxtrfullplformat{label}{insert}

+ + + +

+

Display full form plural first letter converted to upper case (used by \Glspl on +first use for abbreviations without the regular attribute set): +


\Glsxtrfullplformat  \Glsxtrfullplformat{label}{insert}

+

+

In addition ⟨fmts⟩ may also redefine the following commands that govern the inline +full formats. If the style doesn’t redefine them, they will default to the same as the +display full forms. +

Inline singular no case-change (used by \glsentryfull, \glsxtrfull and +\GLSxtrfull): +


\glsxtrinlinefullformat  \glsxtrinlinefullformat{label}{insert} +

+

+

Inline singular first letter converted to upper case (used by \Glsentryfull and +\Glsxtrfull): +


\Glsxtrinlinefullformat  \Glsxtrinlinefullformat{label}{insert} +

+

+

Inline plural no case-change (used by \glsentryfullpl, \glsxtrfullpl and +\GLSxtrfullpl): +


\glsxtrinlinefullplformat  \glsxtrinlinefullplformat{label}{insert} +

+

+

Inline plural first letter converted to upper case (used by \Glsentryfullpl and +\Glsxtrfullpl): +


\Glsxtrinlinefullplformat  \Glsxtrinlinefullplformat{label}{insert} +

+

+

(New to version 1.17.) You can also modify the way the subsequent use is +formatted by redefining the following four commands, but these won’t be used for +abbreviations with the regular attribute set. If the style doesn’t redefine these +commands, the default values are used. +

Singular with no case-change: +


\glsxtrsubsequentfmt  \glsxtrsubsequentfmt{label}{insert}

+

+

Singular with first letter upper case: +


\Glsxtrsubsequentfmt  \Glsxtrsubsequentfmt{label}{insert}

+

+ + + +

Plural with no case-change: +


\glsxtrsubsequentplfmt  \glsxtrsubsequentplfmt{label}{insert} +

+

+

Plural with first letter upper case: +


\Glsxtrsubsequentplfmt  \Glsxtrsubsequentplfmt{label}{insert} +

+

+

If you want to provide support for glossaries-accsupp use the following +\glsaccessxxx⟩ commands (§11.2 Accessibility Support) within the definitions of +\glsxtrfullformat etc instead of the analogous \glsentryxxx⟩ commands. (If you +don’t use glossaries-accsupp, they will just do the corresponding \glsentryxxx⟩ +command.) +

For example, the short-long style has the following in ⟨fmts⟩: + + + +

+
+  \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + 
  \renewcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{##1}}% + 
  \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + 
  \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + 
  \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% + 
  \renewcommand*{\glsxtrfullformat}[2]{% + 
    \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + 
    \ifglsxtrinsertinside\else##2\fi + 
    \glsxtrfullsep{##1}% + 
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + 
  }% + 
  \renewcommand*{\glsxtrfullplformat}[2]{% + 
    \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + 
    \ifglsxtrinsertinside\else##2\fi + 
    \glsxtrfullsep{##1}% + 
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + 
  }% + 
  \renewcommand*{\Glsxtrfullformat}[2]{% + 
    \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + 
    \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + 
    \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + 
  }% + 
  \renewcommand*{\Glsxtrfullplformat}[2]{% + 
    \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + 
     \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + 
    \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + 
  }% +
+

Since the inline full commands aren’t redefined, they default to the same as the +display versions. +

If you want to base a style on an existing style, you can use +


\GlsXtrUseAbbrStyleFmts  \GlsXtrUseAbbrStyleFmts{name}

+

+within ⟨fmts⟩, where ⟨name⟩ is the name of the existing style. For example, the +long-short-desc style has the following in ⟨fmts⟩: + + + +

+
+  \GlsXtrUseAbbrStyleFmts{long-short}% +
+

+

Here’s an example of an abbreviation style that’s based on long-short that displays +the short form within \textsf: + + + +

+
+\newabbreviationstyle + 
{custom-sf}% label + 
{% setup + 
  \GlsXtrUseAbbrStyleSetup{short-long}% + 
}% + 
{% fmts + 
  \GlsXtrUseAbbrStyleFmts{short-long}% + 
  \renewcommand*{\glsabbrvfont}[1]{\textsf{##1}}% + 
} +
+

Note that this wouldn’t work if it was instead based on one of the modified versions +such as short-sc-long as they explicitly use their own formatting commands, such as +\glsabbrvemfont. The base styles, such as short-long, use the more generic +\glsabbrvfont etc which makes them easier to adapt than the modified +styles. +

For further details, see the “Abbreviations” section in the documented code +(glossaries-extra-code.pdf). + + + +

+

+

Top

4. Entries in Sectioning Titles, Headers, Captions and Contents

+

The glossaries user manual cautions against using commands like \gls in chapter +or section titles. The principle problems are:

+
    +
  • if you have a table of contents, the first use flag will be unset in the contents + rather than later in the document; +
  • +
  • if you have the location lists displayed in the glossary, unwanted locations + will be added to it corresponding to the table of contents (if present) and + every page that contains the entry in the page header (if the page style in + use adds the chapter or section title to the header); +
  • +
  • if the page style in use adds the chapter or section title to the header and + attempts to convert it to upper case, the entry label (in the argument + of \gls etc) will be converted to upper case and the entry won’t be + recognised; +
  • +
  • if you use hyperref, commands like \gls can’t be expanded to a simple + string and only the label will appear in the PDF bookmark (with a warning + from hyperref); +
  • +
  • if you use hyperref, you will end up with nested hyperlinks in the table of + contents.
+

Similar problems can also occur with captions (except for the page header and bookmark +issues). +

To get around all these problems, the glossaries user manual recommends +using the expandable non-hyperlink commands, such as \glsentrytext +(for regular entries) or \glsentryshort (for abbreviations). This is the +simplest solution, but doesn’t allow for special formatting that’s applied to +the entry through commands like \glstext or \glsxtrshort. This means +that if, for example, you are using one of the abbreviation styles that uses +\textsc then the short form displayed with \glsentryshort won’t use +small caps. If you only have one abbreviation style in use, you can explicitly +enclose \glsentryshort{label} in the argument of \glsabbrvfont, like +this: + + + +

+
+\chapter{A Chapter about \glsabbrvfont{\glsentryshort{html}}} +
+

Or, if you are using hyperref: + + + +

+
+\chapter{A Chapter about + 
\texorpdfstring{\glsabbrvfont{\glsentryshort{html}}}{\glsentryshort{html}}} +
+

+

Since this is a bit cumbersome, you might want to define a new command to do +this for you. However, if you have mixed styles this won’t work as commands like +\gls and \glsxtrshort redefine \glsabbrvfont to match the entry’s style before +displaying it. In this case, the above example doesn’t take into account the shifting +definitions of \glsabbrvfont and will use whatever happens to be the last +abbreviation style in use. More complicated solutions interfere with the upper casing +used by the standard page styles that display the chapter or section title in the page +header using \MakeUppercase. +

The glossaries-extra package tries to resolve this by modifying \markright and +\markboth and \@starttoc. If you don’t like this change, you can restore their +former definitions using +


\glsxtrRevertMarks  \glsxtrRevertMarks

+

+If you only want to restore \@starttoc you can use: +


\glsxtrRevertTocMarks  \glsxtrRevertTocMarks

+

+If you restore the header or table of contents commands, you’ll have to use the +glossaries manual’s recommendations of either simply using \glsentryshort (as +above) or use the sectioning command’s option argument to provide an alternative +for the table of contents and page header. For example: + + + +

+
+\chapter[A Chapter about \glsentryshort{html}]{A Chapter about \gls{html}} +
+

Alternatively, you need to find a way to insert \glsxtrmarkhook and \@glsxtrinmark +at the start of the header or table of contents either scoped or afterwards cancelled +with \@glsxtrnotinmark and \glsxtrrestoremarkhook. +

If you don’t revert the mark commands back with \glsxtrRevertMarks, you can +use the commands described below in the argument of sectioning commands. You can +still use them even if the mark commands have been reverted, but only where they +don’t conflict with the page style. +

The commands listed below all use \texorpdfstring if hyperref has been +loaded so that the expandable non-formatted version is added to the PDF +bookmarks. Note that since the commands that convert the first letter to +upper case aren’t expandable, the non-case-changing version is used for the +bookmarks. +

These commands essentially behave as though you have used \glsxtrshort (or +equivalent) with the options noindex and hyper=false. The text produced won’t be +converted to upper case in the page headings by default. If you want the text +converted to upper case you need to set the headuc attribute to “true” for the +appropriate category. +

If you use one of the \textsc styles, be aware that the default fonts don’t +provide bold small-caps or italic small-caps. This means that if the chapter +or section title style uses bold, this may override the small-caps setting, +in which case the abbreviation will just appear as lower case bold. If the +heading style uses italic, the abbreviation may appear in upright small-caps, +even if you have set the headuc attribute since the all-capitals form still uses +\glsabbrvfont. You may want to consider using the slantsc package in this case. +
+

+

Display the short form: +


\glsfmtshort  \glsfmtshort{label}

+

+

Display the plural short form: +


\glsfmtshortpl  \glsfmtshortpl{label}

+

+

First letter upper case singular short form: +


\Glsfmtshort  \Glsfmtshort{label}

+

+(No case-change applied to PDF bookmarks.) +

First letter upper case plural short form: + + + +


\Glsfmtshortpl  \Glsfmtshortpl{label}

+

+(No case-change applied to PDF bookmarks.) +

Display the long form: +


\glsfmtlong  \glsfmtlong{label}

+

+

Display the plural long form: +


\glsfmtlongpl  \glsfmtlongpl{label}

+

+

First letter upper case singular long form: +


\Glsfmtlong  \Glsfmtlong{label}

+

+(No case-change applied to PDF bookmarks.) +

First letter upper case plural long form: +


\Glsfmtlongpl  \Glsfmtlongpl{label}

+

+(No case-change applied to PDF bookmarks.) +

There are similar commands for the full form, but note that these use the inline +full form, which may be different from the full form used by \gls. +

Display the full form: +


\glsfmtfull  \glsfmtfull{label}

+

+

Display the plural full form: +


\glsfmtfullpl  \glsfmtfullpl{label}

+

+

First letter upper case singular full form: +


\Glsfmtfull  \Glsfmtfull{label}

+

+(No case-change applied to PDF bookmarks.) +

First letter upper case plural full form: +


\Glsfmtfullpl  \Glsfmtfullpl{label}

+

+(No case-change applied to PDF bookmarks.) +

There are also equivalent commands for the value of the text field: +


\glsfmttext  \glsfmttext{label}

+

+

First letter converted to upper case: +


\Glsfmttext  \Glsfmttext{label}

+

+(No case-change applied to PDF bookmarks.) +

The plural equivalents: + + + +


\glsfmtplural  \glsfmtplural{label}

+

+and +


\Glsfmtplural  \Glsfmtplural{label}

+

+

Likewise for the value of the name field: +


\glsfmtname  \glsfmtname{label}

+

+

First letter converted to upper case: +


\Glsfmtname  \Glsfmtname{label}

+

+(No case-change applied to PDF bookmarks.) +

Similarly for the value of the first field: +


\glsfmtfirst  \glsfmtfirst{label}

+

+

First letter converted to upper case: +


\Glsfmtfirst  \Glsfmtfirst{label}

+

+(No case-change applied to PDF bookmarks.) +

The plural equivalents: +


\glsfmtfirstpl  \glsfmtfirstpl{label}

+

+and +


\Glsfmtfirstpl  \Glsfmtfirstpl{label}

+

+ + + +

+

+

Top

5. Categories

+

Each entry defined by \newglossaryentry (or commands that internally use it +such as \newabbreviation) is assigned a category through the category key. You may +add any category that you like, but since the category is a label used in the creation +of some control sequences, avoid problematic characters within the category label. +(So take care if you have babel shorthands on that make some characters +active.) +

The use of categories can give you more control over the way entries are displayed +in the text or glossary. Note that an entry’s category is independent of the glossary +type. Be careful not to confuse category with type. +

The default category assumed by \newglossaryentry is labelled general. +Abbreviations defined with \newabbreviation have the category set to abbreviation +by default. Abbreviations defined with \newacronym have the category set to +acronym by default. +

Additionally, if you have enabled \newterm with the index package option +that command will set the category to index by default. If you have enabled +\glsxtrnewsymbol with the symbols package option, that command will set the +category to symbol. If you have enabled \glsxtrnewnumber with the numbers package +option, that command will set the category to number. +

You can obtain the category label for a given entry using +


\glscategory  \glscategory{label}

+

+This is equivalent to commands like \glsentryname and so may be used in an +expandable context. No error is generated if the entry doesn’t exist. +

You can test the category for a given entry using +


\glsifcategory  \glsifcategory{entry-label}{category-label}{true +part}{false part}

+

+This is equivalent to

+
+\ifglsfieldeq{entry-label}{category}{category-label}{true +
part}{false part} +
+
so any restrictions that apply to \ifglsfieldeq also apply to \glsifcategory. +

Each category may have a set of attributes. For example, the general and acronym +categories have the attribute regular set to “true” to indicate that all entries with +either of those categories are regular entries (as opposed to abbreviations). +This attribute is accessed by \glsentryfmt to determine whether to use +\glsgenentryfmt or \glsxtrgenabbrvfmt. +

Other attributes recognised by glossaries-extra are: +

+nohyperfirst
When using commands like \gls this will automatically suppress the + + + + hyperlink on first use for entries with a category that has this attribute set to + “true”. (This settings can be overridden by explicitly setting the hyper + key on or off in the optional argument of commands like \gls.) As + from version 1.07, \glsfirst, \Glsfirst, \GLSfirst and their plural + versions (which should ideally behave in a similar way to the first use of + \gls or \glspl) now honour this attribute (but not the package-wide + hyperfirst=false option, which matches the behaviour of glossaries). If you want + commands like \glsfirst to ignore the nohyperfirst attribute then just + redefine +


\glsxtrchecknohyperfirst  \glsxtrchecknohyperfirst{label}

+

+ to do nothing. +

+nohyper
When using commands like \gls this will automatically suppress the + hyperlink for entries with a category that has this attribute set to “true”. (This + settings can be overridden by explicitly setting the hyper key on or off in the + optional argument of commands like \gls.) +
+indexonlyfirst
This is similar to the indexonlyfirst package option but only for entries + that have a category with this attribute set to “true”. +
+wrgloss
When using commands like \gls, if this attribute is set to “after”, it will + automatically implement wrgloss=after. (New to v1.14.) +
+discardperiod
If set to “true”, the post-link-text hook will discard a full stop + (period) that follows non-plural commands like \gls or \glstext. (Provided + for entries such as abbreviations that end with a full stop.) This attribute is + only applicable to entries defined using \newabbreviation (or \newacronym if + it’s using \newabbreviation.) This attribute doesn’t apply to the accessibility + fields. +

Note that this can cause a problem if you access a field that doesn’t end with a + full stop. For example: + + + +

+
+ \newabbreviation +  
 [user1={German Speaking \TeX\ User Group}] +  
 {dante}{DANTE e.V.}{Deutschsprachige Anwendervereinigung \TeX\ +  
e.V.} +
+

Here the short and long fields end with a full stop, but the user1 field doesn’t. + The simplest solution in this situation is to put the sentence terminator in the + final optional argument. For example: + + + +

+
+ \glsuseri{dante}[.] +
+

This will bring the punctuation character inside the link-text and it won’t be + discarded. +

+pluraldiscardperiod
If this attribute is set to “true” and the discardperiod attribute is + set to “true”, this will behave as above for the plural commands like \glspl or + \glsplural. This attribute is only applicable to entries defined using + \newabbreviation (or \newacronym if it’s using \newabbreviation.) +
+retainfirstuseperiod
If this attribute is set to “true” then the full stop won’t be + discarded for first use instances, even if discardperiod or pluraldiscardperiod are + set. This is useful for ⟨short⟩ (⟨long⟩) abbreviation styles where only the + short form has a trailing full stop. This attribute is only applicable to + entries defined using \newabbreviation (or \newacronym if it’s using + \newabbreviation.) This attribute doesn’t apply to the accessibility + fields. +
+markwords
If this attribute is set to “true” any entry defined using \newabbreviation + will automatically have spaces in the long form replaced with +


\glsxtrwordsep  \glsxtrwordsep

+

+ and each word is encapsulated with +


\glsxtrword  \glsxtrword{word}

+

+ For example: + + + +

+
+ \glssetcategoryattribute{abbreviation}{markwords}{true} +  
\newabbreviation{ip}{IP}{Internet Protocol} +
+

is essentially the same as + + + +

+
+ \newabbreviation{ip}{IP} +  
{\glsxtrword{Internet}\glsxtrwordsep\glsxtrword{Protocol}} +
+

The “hyphen” styles, such as long-hyphen-short-hyphen, take advantage of this + markup. If the inserted material (provided in the final argument of commands + like \gls) starts with a hyphen then \glsxtrwordsep is locally redefined to a + hyphen. (The default value is a space). Note that this only applies to + commands like \gls and not like \glsxtrlong. You can provide your own + localised switch, if required. For example: + + + +

+
+ \newcommand{\hyplong}[2][]{% +  
 {\def\glsxtrwordsep{-}\glsxtrlong[#1]{#2}}} +
+

+

This setting will also adjust the long plural. This attribute is only applicable to + entries defined using \newabbreviation (or \newacronym if it’s using + \newabbreviation.) +

This setting may result in the \glsxtrword and \glsxtrwordsep markup + ending up in the sort field, depending on the style in use.
+

+

+markshortwords
This is similar to markwords but applies to the short form. (Only + useful for abbreviations that contain spaces.) This attribute is only applicable + to entries defined using \newabbreviation (or \newacronym if it’s using + \newabbreviation.) +

This setting will only adjust the short plural if the shortplural key isn’t used. + This setting will take precedence over insertdots. +

This setting may result in the \glsxtrword and \glsxtrwordsep markup + ending up in the sort field, depending on the style in use.
+

+

+insertdots
If this attribute is set to “true” any entry defined using \newabbreviation + will automatically have full stops (periods) inserted after each letter. The entry + will be defined with those dots present as though they had been present in the + ⟨short⟩ argument of \newabbreviation (rather than inserting them every time + the entry is used). The short plural form defaults to the new dotted version of + the original ⟨short⟩ form with the plural suffix appended. This setting is + incompatible with markshortwords. This attribute is only applicable to + entries defined using \newabbreviation (or \newacronym if it’s using + \newabbreviation.) +

If you explicitly override the short plural using the shortplural key, you must + explicitly insert the dots yourself (since there’s no way for the code to + determine if the plural has a suffix that shouldn’t be followed by a dot). +
+

+ + + +

This attribute is best used with the discardperiod attribute set to “true”. +

+aposplural
If this attribute is set to “true”, \newabbreviation will insert an + apostrophe (’) before the plural suffix for the short plural form (unless + explicitly overridden with the shortplural key). The long plural form is + unaffected by this setting. This setting overrides noshortplural. This + attribute is only applicable to entries defined using \newabbreviation (or + \newacronym if it’s using \newabbreviation.) Check with your supervisor, + publisher or editor if you want to use this attribute as this usage is + controversial. +
+noshortplural
If this attribute is set to “true”, \newabbreviation won’t append + the plural suffix for the short plural form. This means the short and + shortplural values will be the same unless explicitly overridden. This setting + is incompatible with aposplural. This attribute is only applicable to + entries defined using \newabbreviation (or \newacronym if it’s using + \newabbreviation.) +
+accessinsertdots
If this attribute is set to “true” and the glossaries-accsupp package + has been loaded (with the accsupp option), then this behaves like insertdots but + for the shortaccess field instead of the short field. This can be used to assist the + screen reader for initialisms that should be read out letter by letter rather than + as a word. For example: + + + +
+ \glssetcategoryattribute{initialism}{accessinsertdots}{true} +  
\newabbreviation[category=initialism]{pi}{PI}{Private Investigator} +
+

This setting will be overridden by an explicit use of the shortaccess key in the + optional argument of \newabbreviation (or \newacronym). This attribute is + only applicable to entries defined using \newabbreviation (or \newacronym if + it’s using \newabbreviation.) +

+nameshortaccess
If this attribute is set to “true”, the access field (used for the name + field’s accessibility support) is set to the shortaccess value. This attribute has no + effect if there’s no accessibility support or if the shortaccess field hasn’t been + assigned or if the access field is used explicitly. This attribute is only applicable + to entries defined using \newabbreviation (or \newacronym if it’s using + \newabbreviation.) +
+textshortaccess
Like nameshortaccess but applies to the textaccess field (for use with + regular abbreviations). +
+firstshortaccess
Like nameshortaccess but applies to the firstaccess field (for use with + regular abbreviations). +
+accessaposplural
This boolean attribute overrides aposplural for the shortpluralaccess + key. Has no effect if there’s no accessibility support or if the shortaccess key + hasn’t been set or if the shortpluralaccess key is explicitly set. If the aposplural is + set and this attribute isn’t set and the shortaccess key is set, then the + aposplural setting governs the default shortpluralaccess setting. If you want + aposplural but don’t want it applied to the accessibility support, set the + accessaposplural attribute to “false”. This attribute is only applicable to + entries defined using \newabbreviation (or \newacronym if it’s using + \newabbreviation.) +
+accessnoshortplural
This boolean attribute overrides noshortplural for the + shortpluralaccess key. The same conditions apply as for accessaposplural. This + attribute is only applicable to entries defined using \newabbreviation (or + \newacronym if it’s using \newabbreviation.) +
+headuc
If this attribute is set to “true”, commands like \glsfmtshort will use the + upper case version in the page headers. + + + +
+tagging
If this attribute is set to “true”, the tagging command defined by + \GlsXtrEnableInitialTagging will be activated to use \glsxtrtagfont in + the glossary (see §3.1 Tagging Initials). +
+entrycount
Unlike the above attributes, this attribute isn’t boolean but instead must + be an integer value and is used in combination with \glsenableentrycount + (see §2.4 Entry Counting Modifications). Leave blank or undefined for + categories that shouldn’t have this facility enabled. The value of this attribute + is used by \glsxtrifcounttrigger to determine how commands such as \cgls + should behave. +

With glossaries, commands like \cgls use \cglsformat only if the previous + usage count for that entry was equal to 1. With glossaries-extra the test is now + for entries that have the entrycount attribute set and where the previous + usage count for that entry is less than or equal to the value of that + attribute. +

+linkcount
This attribute is set to true by \GlsXtrEnableLinkCounting (see §6.2 + Link Counting). +
+linkcountmaster
This attribute is set to the name of the master counter by + \GlsXtrEnableLinkCounting if the optional argument is provided (see §6.2 + Link Counting). +
+glossdesc
The \glossentrydesc command (used in the predefined glossary styles) is + modified by glossaries-extra to check for this attribute. The attribute may have + one of the following values: +
    +
  • firstuc: the first letter of the description will be converted to upper + case (using \Glsentrydesc). +
  • +
  • title: the description will be used in the argument of the title casing + command \capitalisewords (provided by mfirstuc). If you want to use a + different command you can redefine: +


    \glsxtrfieldtitlecasecs  \glsxtrfieldtitlecasecs{phrase cs} +

    +

    + For example: + + + +

    +
    + \newcommand*{\glsxtrfieldtitlecasecs}[1]{\xcapitalisefmtwords*{#1}} +
    +

    (Note that the argument to \glsxtrfieldtitlecasecs will be a control + sequence whose replacement text is the entry’s description, which is why + \xcapitalisefmtwords is needed instead of \capitalisefmtwords.) +

    +
+

Any other values of this attribute are ignored. Remember that there are design + limitations for both the first letter uppercasing and the title casing commands. + See the mfirstuc user manual for further details. +

+glossdescfont
(New to version 1.04) In addition to the above, the modified + \glossentrydesc command also checks this attribute. If set, it should be the + name of a control sequence (without the leading backslash) that takes one + argument. This control sequence will be applied to the description text. For + example: + + + +
+ \glssetcategoryattribute{general}{glossdescfont}{emph} +
+

+

+glossname
As glossdesc but applies to \glossentryname. Additionally, if this + attribute is set to “uc” the name is converted to all capitals. +
+indexname
If set, the \glsxtrpostnamehook hook used at the end of \glossentryname + will index the entry using \index. See §7 Auto-Indexing for further + details. +
+glossnamefont
(New to version 1.04) In addition to the above, the modified + \glossentryname command also checks this attribute. If set, it should be the + name of a control sequence (without the leading backslash) that takes one + argument. This control sequence will be applied to the name text. For + example: + + + +
+ \glssetcategoryattribute{general}{glossnamefont}{emph} +
+

Note that this overrides \glsnamefont which will only be used if this attribute + hasn’t been set. +

Remember that glossary styles may additionally apply a font change, + such as the list styles which put the name in the optional argument of + \item. +

+textformat
(New to version 1.21.) Commands like \gls and \glstext have the link + text encapsulated in the argument of \glstextformat by default. If this + attribute is set, the control sequence given by the attribute value will be used + instead. As with the above, the attribute value should be the name (without + the leading backslash) of a command that takes a single argument (the link + text). Remember that the abbreviation styles may apply an additional font + change. +
+hyperoutside
(New to v1.21.) The attribute value may be false, true or unset. If + unset, true is assumed. This indicates the default setting of the hyperoutside + key, described in §2.1 Entry Indexing. +
+dualindex
If set, whenever a glossary entry has information written to the external + glossary file through commands like \gls and \glsadd, a corresponding line + will be written to the indexing file using \index. See §7 Auto-Indexing for + further details. +
+targeturl
If set, the hyperlink generated by commands like \gls will be set to the + URL provided by this attributes value. For example: + + + +
+ \glssetcategoryattribute{general}{targeturl}{master-doc.pdf} +
+

(See also the accompanying sample file sample-external.tex.) If the URL + contains awkward characters (such as % or ~) remember that the base glossaries + package provides commands like \glspercentchar and \glstildechar that + expand to literal characters. +

If you want to a named anchor within the target URL (notionally adding + #name⟩ to the URL), then you also need to set targetname to the anchor ⟨name⟩. + You may use \glslabel within ⟨name⟩ which is set by commands like \gls to + the entry’s label. +

All the predefined glossary styles start each entry listing with \glstarget + which sets the anchor to \glolinkprefix\glslabel, so if you want + entries to link to glossaries in the URL given by targeturl, you can just + do: + + + +

+
+ \glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel} +
+

(If the target document changed \glolinkprefix then you will need to adjust + the above as appropriate.) +

If the anchor is in the form ⟨name1.name2⟩ then use targetname for the ⟨name2⟩ + part and targetcategory for the ⟨name1⟩ part. +

For example: + + + +

+
+ \glssetcategoryattribute{general}{targeturl}{master-doc.pdf} +  
\glssetcategoryattribute{general}{targetcategory}{page} +  
\glssetcategoryattribute{general}{targetname}{7} +
+

will cause all link text for general entries to link to master-doc.pdf#page.7 + (page 7 of that PDF). +

If you want a mixture in your document of entries that link to an internal + glossary and entries that link to an external URL then you can use + the starred form of \newignoredglossary for the external list. For + example: + + + +

+
+ \newignoredglossary*{external} +  
\glssetcategoryattribute{external}{targeturl}{master-doc.pdf} +  
\glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel} +  
\newglossaryentry{sample}{name={sample},description={local example}} +  
\newglossaryentry{sample2}{name={sample2}, +  
  type=external, +  
  category=external, +  
  description={external example}} +
+

+

+externallocation
The value should be the file name of the target document when + manually indexing an external location (see §2.1 Entry Indexing). In general, + it’s better to use bib2gls v1.7+ which can handle multiple external sources + and doesn’t require this attribute. +
+

An attribute can be set using: +


\glssetcategoryattribute  \glssetcategoryattribute{category-label} +{attribute-label}{value}

+

+where ⟨category-label⟩ is the category label, ⟨attribute-label⟩ is the attribute label and +⟨value⟩ is the new value for the attribute. +

There is a shortcut version to set the regular attribute to “true”: +


\glssetregularcategory  \glssetregularcategory{category-label} +

+

+

If you need to lookup the category label for a particular entry, you can use the +shortcut command: +


\glssetattribute  \glssetattribute{entry-label}{attribute-label} +{value}

+

+This uses \glssetcategoryattribute with \glscategory to set the attribute. Note +that this will affect all other entries that share this entry’s category. +

You can fetch the value of an attribute for a particular category using: +


\glsgetcategoryattribute  \glsgetcategoryattribute{category-label} +{attribute-label}

+ + + +

+Again there is a shortcut if you need to lookup the category label for a given +entry: +


\glsgetattribute  \glsgetattribute{entry-label}{attribute-label} +

+

+

You can test if an attribute has been assigned to a given category using: +


\glshascategoryattribute  \glshascategoryattribute{category-label} +{attribute-label}{true code}{false code}

+

+This uses etoolbox’s \ifcsvoid and does ⟨true code⟩ if the attribute has been set and +isn’t blank and isn’t \relax. The shortcut if you need to lookup the category label +from an entry is: +


\glshasattribute  \glshasattribute{entry-label}{attribute-label}{true +code}{false code}

+

+

You can test the value of an attribute for a particular category using: +


\glsifcategoryattribute  \glsifcategoryattribute{category-label} +{attribute-label}{value} {true-part}{false-part}

+

+This tests if the attribute (given by ⟨attribute-label⟩) for the category (given by +⟨category-label⟩) is set and equal to ⟨value⟩. If true, ⟨true-part⟩ is done. If the attribute +isn’t set or is set but isn’t equal to ⟨value⟩, ⟨false part⟩ is done. +

For example: + + + +

+
+\glsifcategoryattribute{general}{nohyper}{true}{NO HYPER}{HYPER} +
+

This does “NO HYPER” if the general category has the nohyper attribute set to +true otherwise if does “HYPER”. +

With boolean-style attributes like nohyper, make sure you always test for true +not false in case the attribute hasn’t been set. +

Again there’s a shortcut if you need to lookup the category label from a particular +entry: +


\glsifattribute  \glsifattribute{entry-label}{attribute-label}{value} +{true-part} {false-part}

+

+

There’s also a shortcut to determine if a particular category has the regular +attribute set to “true”: +


\glsifregularcategory  \glsifregularcategory{category-label} +{true-part}{false-part}

+

+Alternatively, if you need to lookup the category for a particular entry: +


\glsifregular  \glsifregular{entry-label}{true-part}{false-part} +

+

+Note that if the regular attribute hasn’t be set, the above do ⟨false-part⟩. There +are also reverse commands that test if the regular attribute has been set to +“false”: +


\glsifnotregularcategory  \glsifnotregularcategory{category-label} +{true-part}{false-part}

+

+or for a particular entry: +


\glsifnotregular  \glsifnotregular{entry-label}{true-part}{false-part} +

+

+Again, if the regular attribute hasn’t been set, the above do ⟨false-part⟩, so these +reverse commands aren’t logically opposite in the strict sense. +

You can iterate through all entries with a given category using: +


\glsforeachincategory[glossary-labels]{category-label} {glossary-cs} +{label-cs}{body}

+

+This iterates through all entries in the glossaries identified by the comma-separated +list ⟨glossary-labels⟩ that have the category given by ⟨category-label⟩ and performs ⟨body⟩ +for each match. Within ⟨body⟩, you can use ⟨glossary-cs⟩ and ⟨label-cs⟩ (which much be +control sequences) to access the current glossary and entry label. If ⟨glossary-labels⟩ is +omitted, all glossaries are assumed. + + + +

Similarly, you can iterate through all entries that have a category with a given +attribute using: +


\glsforeachwithattribute  \glsforeachwithattribute[glossary-labels] +{attribute-label} {attribute-value}{glossary-cs}{label-cs}{body} +

+

+This will do ⟨body⟩ for each entry that has a category with the attribute ⟨attribute-label⟩ +set to ⟨attribute-value⟩. The remaining arguments are as the previous command. +

You can change the category for a particular entry using the standard glossary +field changing commands, such as \glsfielddef. Alternatively, you can +use +


\glsxtrsetcategory  \glsxtrsetcategory{entry-labels}{category-label} +

+

+This will change the category to ⟨category-label⟩ for each entry listed in the +comma-separated list ⟨entry-labels⟩. This command uses \glsfieldxdef so it will +expand ⟨category-label⟩ and make the change global. +

You can also change the category for all entries with a glossary or glossaries +using: +


\glsxtrsetcategoryforall  \glsxtrsetcategoryforall{glossary-labels} +{category-label}

+

+where ⟨glossary-labels⟩ is a comma-separated list of glossary labels. + + + +

+

+

Top

6. Counting References

+

There are three basic ways of counting entry references: +

    +
  1. Counting the total number of times \glsunset is used (\glsreset resets + the count and is best avoided). This is provided by the base glossaries + package and is intended for documents where the term should be displayed + differently if it’s only been used a certain number of times. The information + has to be written to the .aux file so that it’s available on the next + LATEX run. +

    This method is extended by glossaries-extra and is described in §6.1 Entry + Counting (First Use Flag). +

  2. +
  3. Counting the total number of records. This method is only available with + bib2gls and is intended for documents where the term should be displayed + differently if it’s only been recorded (indexed) a certain number of times. + See §9.5 Record Counting for further details. +
  4. +
  5. Counting the number of times the \gls-like or \glstext-like + commands are used. (That is, those commands that internally use + \@gls@link.) Unlike the other two methods, this just provides a + running total rather than the total from the previous LATEX run. + This method is intended to make it more convenient to work with + hooks like \glslinkcheckfirsthyperhook, \glslinkpostsetkeys or + \glslinkpresetkeys. See §6.2 Link Counting for further details.
+

Top

6.1 Entry Counting (First Use Flag)

+

As mentioned in §2.4 Entry Counting Modifications, glossaries-extra modifies the +\glsenableentrycount command to allow for the entrycount attribute. This means +that you not only need to enable entry counting with \glsenableentrycount, but +you also need to set the appropriate attribute (see §5 Categories). +

Remember that entry counting only counts the number of times an entry is used +by commands that change the first use flag. (That is, all those commands +that mark the entry as having been used.) There are many commands that +don’t modify this flag and they won’t contribute to the entry use count. +
+

+

With glossaries-extra, you may use \cgls instead of \gls even if you haven’t enabled +entry counting. You will only get a warning if you use \glsenableentrycount +without setting the entrycount attribute. (With glossaries, commands like \cgls +will generate a warning if \glsenableentrycount hasn’t been used.) The + + + +abbreviation shortcut \ab uses \cgls (see §3.3 Shortcut Commands). The +acronym shortcut \ac uses \cgls if it’s been defined with shortcuts=ac (or +shortcuts=all) but uses \gls if it’s been defined with shortcuts=acronyms (or +shortcuts=acro). +

All upper case versions (not provided by glossaries) are also available: +


\cGLS  \cGLS[options]{label}[insert]

+

+and +


\cGLSpl  \cGLSpl[options]{label}[insert]

+

+These are analogous to \cgls and \cglspl but they use +


\cGLSformat  \cGLSformat{label}{insert}

+

+and +


\cGLSplformat  \cGLSplformat{label}{insert}

+

+which convert the analogous \cglsformat and \cglsplformat to upper +case. +

Just using glossaries: + + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\makeglossaries + 
\glsenableentrycount + 
\newacronym{html}{HTML}{hypertext markup language} + 
\newacronym{xml}{XML}{extensible markup language} + 
\begin{document} + 
Used once: \cgls{html}. + 
Used twice: \cgls{xml} and \cgls{xml}. + 
\printglossaries + 
\end{document} +
+

+

If you switch to glossaries-extra you must set the entrycount attribute: + + + +

+
+\documentclass{article} + 
\usepackage{glossaries-extra} + 
\makeglossaries + 
\glsenableentrycount + 
\glssetcategoryattribute{abbreviation}{entrycount}{1} + 
\newabbreviation{html}{HTML}{hypertext markup language} + 
\newabbreviation{xml}{XML}{extensible markup language} + 
\begin{document} + 
Used once: \cgls{html}. + 
Used twice: \cgls{xml} and \cgls{xml}. + 
\printglossaries + 
\end{document} +
+

+

When activated with \glsenableentrycount, commands such as \cgls now +use +


\glsxtrifcounttrigger  \glsxtrifcounttrigger{label}{trigger code} +{normal code}

+

+to determine if the entry trips the entry count trigger. The ⟨trigger code⟩ uses +commands like \cglsformat and unsets the first use flag. The ⟨normal code⟩ is the +code that would ordinarily be performed by whatever the equivalent command is (for +example, \cgls will use \cglsformat in ⟨trigger code⟩ but the usual \gls behaviour in +⟨normal code⟩). +

The default definition is: + + + +

+
+\newcommand*{\glsxtrifcounttrigger}[3]{% + 
 \glshasattribute{#1}{entrycount}% + 
 {% + 
   \ifnum\glsentryprevcount{#1}>\glsgetattribute{#1}{entrycount}\relax + 
    #3% + 
   \else + 
    #2% + 
   \fi + 
 }% + 
 {#3}% + 
} +
+

This means that if an entry is assigned to a category that has the entrycount +attribute then the ⟨trigger code⟩ will be used if the previous count value (the number of +times the entry was used on the last run) is greater than the value of the +attribute. +

For example, to trigger normal use if the previous count value is greater than +four: + + + +

+
+\glssetcategoryattribute{abbreviation}{entrycount}{4} +
+

+

There is a convenient command provided to enable entry counting, set the +entrycount attribute and redefine \gls, etc to use \cgls etc: +


\GlsXtrEnableEntryCounting  \GlsXtrEnableEntryCounting{categories} +{value}

+

+The first argument ⟨categories⟩ is a comma-separated list of categories. For each +category, the entrycount attribute is set to ⟨value⟩. In addition, this does: + + + +

+
+\renewcommand*{\gls}{\cgls}% + 
\renewcommand*{\Gls}{\cGls}% + 
\renewcommand*{\glspl}{\cglspl}% + 
\renewcommand*{\Glspl}{\cGlspl}% + 
\renewcommand*{\GLS}{\cGLS}% + 
\renewcommand*{\GLSpl}{\cGLSpl}% +
+

This makes it easier to enable entry-counting on existing documents. +

If you use \GlsXtrEnableEntryCounting more than once, subsequent uses will +just set the entrycount attribute for each listed category. +

The above example document can then become: + + + +

+
+\documentclass{article} + 
\usepackage{glossaries-extra} + 
\makeglossaries + 
\GlsXtrEnableEntryCounting{abbreviation}{1} + 
\newabbreviation{html}{HTML}{hypertext markup language} + 
\newabbreviation{xml}{XML}{extensible markup language} + 
\begin{document} + 
Used once: \gls{html}. + 
Used twice: \gls{xml} and \gls{xml}. + 
\printglossaries + 
\end{document} +
+

+

The standard entry-counting function describe above counts the number of times +an entry has been marked as used throughout the document. (The reset commands +will reset the total back to zero.) If you prefer to count per sectional-unit, you can +use +


\GlsXtrEnableEntryUnitCounting  \GlsXtrEnableEntryUnitCounting +{categories}{value}{counter-name}

+

+where ⟨categories⟩ is a comma-separated list of categories to which this feature should +be applied, ⟨value⟩ is the trigger value and ⟨counter-name⟩ is the name of the counter +used by the sectional unit. +

Due to the asynchronous nature of TEX’s output routine, discrepancies will +occur in page spanning paragraphs if you use the page counter.
+

+

Note that you can’t use both the document-wide counting and the per-unit +counting in the same document. +

The counter value is used as part of a label, which means that \thecounter-name⟩ +needs to be expandable. Since hyperref also has a similar requirement and provides +\theHcounter-name⟩ as an expandable alternative, glossaries-extra will use +\theHcounter-name⟩ if it exists otherwise it will use \thecounter-name⟩. +

The per-unit counting function uses two attributes: entrycount (as before) and + + + +unitcount (the name of the counter). +

Both the original document-wide counting mechanism and the per-unit counting +mechanism provide a command that can be used to access the current count value for +this run: +


\glsentrycurrcount  \glsentrycurrcount{label}

+

+and the final value from the previous run: +


\glsentryprevcount  \glsentryprevcount{label}

+

+In the case of the per-unit counting, this is the final value for the current unit. In +both commands ⟨label⟩ is the entry’s label. +

The per-unit counting mechanism additionally provides: +


\glsentryprevtotalcount  \glsentryprevtotalcount{label}

+

+which gives the sum of all the per-unit totals from the previous run for the entry +given by ⟨label⟩, and +


\glsentryprevmaxcount  \glsentryprevmaxcount{label}

+

+which gives the maximum per-unit total from the previous run. +

The above two commands are unavailable for the document-wide counting. +

Example of per-unit counting, where the unit is the chapter: + + + +

+
+\documentclass{report} + 
\usepackage{glossaries-extra} + 
\GlsXtrEnableEntryUnitCounting{abbreviation}{2}{chapter} + 
\makeglossaries + 
\newabbreviation{html}{HTML}{hypertext markup language} + 
\newabbreviation{css}{CSS}{cascading style sheet} + 
\newglossaryentry{sample}{name={sample},description={sample}} + 
\begin{document} + 
\chapter{Sample} + 
Used once: \gls{html}. + 
Used three times: \gls{css} and \gls{css} and \gls{css}. + 
Used once: \gls{sample}. + 
\chapter{Another Sample} + 
Used once: \gls{css}. + 
Used twice: \gls{html} and \gls{html}. + 
\printglossaries + 
\end{document} +
+

In this document, the css entry is used three times in the first chapter. This is +more than the trigger value of 2, so \gls{css} is expanded on first use +with the short form used on subsequent use, and the css entries in that +chapter are added to the glossary. In the second chapter, the css entry is +only used once, which trips the suppression trigger, so in that chapter, the +long form is used and \gls{css} doesn’t get a line added to the glossary +file. +

The html is used a total of three times, but the expansion and indexing +suppression trigger is tripped in both chapters because the per-unit total (1 for the +first chapter and 2 for the second chapter) is less than or equal to the trigger +value. +

The sample entry has only been used once, but it doesn’t trip the indexing +suppression because it’s in the general category, which hasn’t been listed in +\GlsXtrEnableEntryUnitCounting. + + + +

The per-unit entry counting can be used for other purposes. In the following +example document the trigger value is set to zero, which means the index suppression +won’t be triggered, but the unit entry count is used to automatically suppress the +hyperlink for commands like \gls by modifying the hook +


\glslinkcheckfirsthyperhook  \glslinkcheckfirsthyperhook

+

+which is used at the end of the macro the determines whether or not to suppress the +hyperlink. + + + +

+
+\documentclass{article} + 
\usepackage[colorlinks]{hyperref} + 
\usepackage{glossaries-extra} + 
\makeglossaries + 
\GlsXtrEnableEntryUnitCounting{general}{0}{page} + 
\newglossaryentry{sample}{name={sample},description={an example}} + 
\renewcommand*{\glslinkcheckfirsthyperhook}{% + 
  \ifnum\glsentrycurrcount\glslabel>0 + 
   \setkeys{glslink}{hyper=false}% + 
  \fi + 
} + 
\begin{document} + 
A \gls{sample} entry. + 
Next use: \gls{sample}. + 
\newpage + 
Next page: \gls{sample}. + 
Again: \gls{sample}. + 
\printglossaries + 
\end{document} +
+

This only produces a hyperlink for the first instance of \gls{sample} on each +page. +

The earlier warning about using the page counter still applies. If the +first instance of \gls occurs at the top of the page within a paragraph that +started on the previous page, then the count will continue from the previous +page. +

+

+

Top

6.2 Link Counting

+

As from version 1.26, an alternative method of entry counting is to count the number + + + +of times the \gls-like or \glstext-like commands are used. (The “link” in this +method’s name refers to the use of the internal command \@gls@link not to +\hyperlink although \@gls@link may use \hyperlink when displaying the +link-text.) +

To enable link counting use the preamble-only command: +


\GlsXtrEnableLinkCounting  \GlsXtrEnableLinkCounting[master counter] +{categories}

+

+where ⟨categories⟩ is a list of category labels. The optional argument ⟨master +counter⟩ may be used to identify a master counter (which must be defined). If +present, the associated link counter will be reset when the master counter is +incremented. This command automatically sets the linkcount attribute for the given +categories. If the optional argument is present, it also sets the linkcountmaster +attribute. +

When enabled, commands like \gls and \glstext increment the associated +counter using +


\glsxtrinclinkcounter  \glsxtrinclinkcounter{counter name}

+

+This just does \stepcounter{counter name} by default but if you need +\refstepcounter instead, just redefine this command: + + + +

+
+\renewcommand*{\glsxtrinclinkcounter}[1]{\refstepcounter{#1}} +
+

+

You can access the internal count register using +


\GlsXtrLinkCounterValue  \GlsXtrLinkCounterValue{label}

+

+where ⟨label⟩ is the entry’s label. This will expand to 0 if the counter hasn’t been +defined. +

It’s also possible to access the display value (\thecounter⟩) using +


\GlsXtrTheLinkCounter  \GlsXtrTheLinkCounter{counter}

+

+(This will expand to 0 if the counter hasn’t been defined.) +

In order to conserve resources, the counter is only defined when it first +needs to be incremented so terms that have been defined but haven’t been +used in the document won’t have the associated count register allocated. +
+

+

You can test if the counter has been defined using: +


\GlsXtrIfLinkCounterDef  \GlsXtrIfLinkCounterDef{label}{true}{false} +

+

+where ⟨label⟩ is the entry’s label. +

The counter name can be obtained using +


\GlsXtrLinkCounterName  \GlsXtrLinkCounterName{label}

+

+This simply expands to the counter name associated with the entry given by ⟨label⟩ +without any check for existence. For example, to change the display command +(\thecounter⟩) using etoolbox: + + + +

+
+\csdef{the\GlsXtrLinkCounterName{duck}}{\Roman{\GlsXtrLinkCounterName{duck}}} +
+

This is useful if you just want to change the display for specific entries but isn’t +convenient if you want to change the display for all entries. Instead, it’s simpler to +redefine \GlsXtrTheLinkCounter. For example: + + + +

+
+\renewcommand*{\GlsXtrTheLinkCounter}[1]{% + 
 \GlsXtrIfLinkCounterDef{#1}% + 
 {\Roman{\GlsXtrLinkCounterName{#1}}}% + 
 {0}% + 
} +
+

In both cases, the redefinition should be implemented after \GlsXtrEnableLinkCounting. +

Here’s an example document that uses link counting to disable the hyperlink after +the first reference. This redefines \glslinkpresetkeys (which is used by both \gls +and \glstext) instead of \glslinkcheckfirsthyperhook (which is used by \gls +but not by \glstext). + + + +

+
+\documentclass{article} + 
\usepackage[colorlinks]{hyperref} + 
\usepackage{glossaries-extra} + 
\makeglossaries + 
\renewcommand*{\glslinkpresetkeys}{% + 
 \ifnum\GlsXtrLinkCounterValue{\glslabel}>1 + 
  \setkeys{glslink}{hyper=false}% + 
 \fi + 
} + 
\GlsXtrEnableLinkCounting{general} + 
\newglossaryentry{sample1}{name={sample1},description={an example}} + 
\newglossaryentry{sample2}{name={sample2},description={another example}} + 
\newabbreviation{ex}{ex}{example} + 
\begin{document} + 
\section{Sample Section} + 
\Gls{sample1}, \gls{sample2} and \gls{ex}. + 
\Glstext{sample1} and \gls{ex} again. + 
\section{Another Sample Section} + 
\Gls{sample1}, \gls{sample2} and \gls{ex}. + 
\printglossaries + 
\end{document} +
+

The use of \glslinkpresetkeys means that the options can override this. For +example + + + +

+
+\gls[hyper=true]{sample1} +
+

will override the hyper=false setting in \glslinkpresetkeys. If \glslinkpostsetkeys +is used instead, the hyper=false setting will override the setting provided in the +optional argument. +

The abbreviation category doesn’t have the linkcount attribute set (since it’s not +listed in the argument of \GlsXtrEnableLinkCounting). This means that +\GlsXtrLinkCounterValue always expands to 0 for the abbreviation (ex), so the +inequality test + + + +

+
+\ifnum\GlsXtrLinkCounterValue{\glslabel}>1 +
+

will always be false. This means that the abbreviation won’t have hyper=false +applied. If the test is changed to + + + +

+
+\ifnum\GlsXtrLinkCounterValue{\glslabel}=1 + 
\else + 
 \setkeys{glslink}{hyper=false}% + 
\fi +
+

Then the abbreviation will always have hyper=false applied. +

To reset the counter every section use the optional argument to set the master +counter: + + + +

+
+\GlsXtrEnableLinkCounting[section]{general} +
+

+ + + +

+

+

Top

7. Auto-Indexing

+

It’s possible that you may also want a normal index as well as the glossary, +and you may want entries to automatically be added to the index (as in +this document). There are two attributes that govern this: indexname and +dualindex. +

The auto-indexing is designed for makeindex syntax. If you’ve used the xindy +package option, the automatic escaping of xindy special characters in the sort field +may result in an incorrect sort value for the \index command used by the +auto-indexing. Note also that texindy has a fixed set of special characters +(corresponding to makeindex’s defaults) that can’t be customized. You may want +to consider using bib2gls and its dual entries as an alternative approach. +
+

+

The \glsxtrpostnamehook macro, used at the end of \glossentryname and +\Glossentryname, checks the indexname attribute for the category associated with +that entry. Since \glossentryname is used in the default glossary styles, this +makes a convenient way of automatically indexing each entry name at its +location in the glossary without fiddling around with the value of the name +key. +

The internal macro used by the glossaries package to write the information to the +external glossary file is modified to check for the dualindex attribute. +

In both cases, the indexing is done through +


\glsxtrdoautoindexname  \glsxtrdoautoindexname{label}{attribute-label} +

+

+This uses the standard \index command with the sort value taken from the entry’s +sort key and the actual value set to \glsentryname{label}. As from v1.16, there are +user-level commands available to change the sort and actual value used by the +automated index. +

The actual value is given by +


\glsxtrautoindexentry  \glsxtrautoindexentry{label}

+

+where ⟨label⟩ is the entry’s label. The default definition is: + + + +

+
+\newcommand*{\glsxtrautoindexentry}[1]{\string\glsentryname{#1}} +
+

Note the use of \string to prevent \glsentryname from being expanded as it’s +written to the index file. +

The sort value is assigned using: +


\glsxtrautoindexassignsort  \glsxtrautoindexassignsort{cs}{label} +

+

+where ⟨label⟩ is the entry label and ⟨cs⟩ is the command which needs to be set to the +sort value. The default definition is: + + + +

+
+\newcommand*{\glsxtrautoindexassignsort}[2]{% + 
  \glsletentryfield{#1}{#2}{sort}% + 
} +
+

After this macro is called, ⟨cs⟩ is then processed to escape any of makeindex’s special +characters. Note that this escaping is only performed on the sort not on the actual +value. The escaping of the sort value is performed by +


\glsxtrautoindexesc  \glsxtrautoindexesc

+

+You can redefine this to do nothing if you want to omit the escaping. You may want +to consider providing another field to obtain the appropriate sort value if the one +provided in the sort field isn’t suitable (because it may already have had special +characters escaped or it may be a numeric value in the case of sort by use or +definition). +

The command used to perform the actual indexing is: +


\glsxtrautoindex  \glsxtrautoindex{text}

+

+This just does \index{text} by default. +

The entry’s parent field isn’t referenced in this automated indexing. +
+

+

For example, to index the value of the first key, instead of the name key: + + + +

+
+\renewcommand*{\glsxtrautoindexentry}[1]{\string\glsentryfirst{#1}} +
+

and if the sort value also needs to be set to the long field, if present, otherwise the +sort field: + + + +

+
+\renewcommand*{\glsxtrautoindexassignsort}[2]{% + 
  \ifglshaslong{#2}% + 
  {\glsletentryfield{#1}{#2}{long}}% + 
  {\glsletentryfield{#1}{#2}{sort}}% + 
} +
+

+

If the value of the attribute given by ⟨attribute-label⟩ is “true”, no encap will be +added, otherwise the encap will be the attribute value. For example: + + + +

+
+\glssetcategoryattribute{general}{indexname}{textbf} +
+

will set the encap to textbf which will display the relevant page number in bold +whereas + + + +

+
+\glssetcategoryattribute{general}{dualindex}{true} +
+

won’t apply any formatting to the page number in the index. +

The location used in the index will always be the page number not the counter +used in the glossary. (Unless some other loaded package has modified the definition of +\index to use some thing else.)
+

+

By default the format key won’t be used with the dualindex attribute. You can +allow the format key to override the attribute value by using the preamble-only +command: +


\GlsXtrEnableIndexFormatOverride  \GlsXtrEnableIndexFormatOverride +

+

+If you use this command and hyperref has been loaded, then the theindex +environment will be modified to redefine \glshypernumber to allow formats that use +that command. +

The dualindex attribute will still be used on subsequent use even if the +indexonlyfirst attribute (or indexonlyfirst package option) is set. However, the dualindex +attribute will honour the noindex key.
+

+

The \glsxtrdoautoindexname command will attempt to escape any of +\makeindex’s special characters, but there may be special cases where it fails, so take +care. This assumes the default makeindex actual, level, quote and encap values +(unless any of the commands \actualchar, \levelchar, \quotechar or \encapchar +have been defined before glossaries-extra is loaded). +

If this isn’t the case, you can use the following preamble-only commands to set +the correct characters. +

Be very careful of possible shifting category codes!
+

+


\GlsXtrSetActualChar  \GlsXtrSetActualChar{char}

+

+Set the actual character to ⟨char⟩. +


\GlsXtrSetLevelChar  \GlsXtrSetLevelChar{char}

+

+Set the level character to ⟨char⟩. +


\GlsXtrSetEscChar  \GlsXtrSetEscChar{char}

+

+Set the escape (quote) character to ⟨char⟩. +


\GlsXtrSetEncapChar  \GlsXtrSetEncapChar{char}

+ + + +

+Set the encap character to ⟨char⟩. + + + +

+

+

Top

8. On-the-Fly Document Definitions

+

The commands described here may superficially look like ⟨word\index{word}, +but they behave rather differently. If you want to use \index then just use \index. +
+

+

The glossaries package advises against defining entries in the document +environment. As mentioned in §1.2 New or Modified Package Options above, this +ability is disabled by default with glossaries-extra but can be enabled using the +docdefs package options. +

Although this can be problematic, the glossaries-extra package provides a way of +defining and using entries within the document environment without the tricks used +with the docdefs option. There are limitations with this approach, so take care with it. +This function is disabled by default, but can be enabled using the preamble-only +command: +


\GlsXtrEnableOnTheFly  \GlsXtrEnableOnTheFly

+

+When used, this defines the commands described below. +

The commands \glsxtr, \glsxtrpl, \Glsxtr and \Glsxtrpl can’t be used after +the glossaries have been displayed (through \printglossary etc). It’s best not to +mix these commands with the standard glossary commands, such as \gls or there +may be unexpected results.
+

+


\glsxtr  \glsxtr[gls-options][dfn-options]{label}

+

+If an entry with the label ⟨label⟩ has already been defined, this just does \gls +[gls-options]{label}. If ⟨label⟩ hasn’t been defined, this will define the entry using: +

+
+\newglossaryentry{label}{name={label}, +
 category=\glsxtrcat, +
 description={\nopostdesc}, +
 dfn-options} +
+
+

The ⟨label⟩ must contain any non-expandable commands, such as formatting +commands or problematic characters. If the term requires any of these, they must be +omitted from the ⟨label⟩ and placed in the name key must be provided in the optional +argument ⟨dfn-options⟩.
+

+ + + +

The second optional argument ⟨dfn-options⟩ should be empty if the entry has +already been defined, since it’s too late for them. If it’s not empty, a warning will be +generated with +


\GlsXtrWarning  \GlsXtrWarning{dfn-options}{label}

+

+

For example, this warning will be generated on the second instance of \glsxtr +below: + + + +

+
+\glsxtr[][plural=geese]{goose} + 
 ... later + 
\glsxtr[][plural=geese]{goose} +
+

+

If you are considering doing something like: + + + +

+
+\newcommand*{\goose}{\glsxtr[][plural=geese]{goose}} + 
\renewcommand*{\GlsXtrWarning}[2]{} + 
 ... later + 
\goose\ some more text here +
+

then don’t bother. It’s simpler and less problematic to just define the entries in the +preamble with \newglossaryentry and then use \gls in the document. +

There are plural and case-changing alternatives to \glsxtr: +


\glsxtrpl  \glsxtrpl[gls-options][dfn-options]{label}

+

+This is like \glsxtr but uses \glspl instead of \gls. +


\Glsxtr  \Glsxtr[gls-options][dfn-options]{label}

+

+This is like \glsxtr but uses \Gls instead of \gls. +


\Glsxtrpl  \Glsxtrpl[gls-options][dfn-options]{label}

+

+This is like \glsxtr but uses \Glspl instead of \gls. +

If you use UTF-8 and don’t want the inconvenient of needing to use an +ASCII-only label, then it’s better to use XƎLATEX or LuaLATEX instead of +LATEX (or pdfLATEX). If you really desperately want to use UTF-8 entry labels +without switching to XƎLATEX or LuaLATEX then there is a starred version of +\GlsXtrEnableOnTheFly that allows you to use UTF-8 characters in ⟨label⟩, but it’s +experimental and may not work in some cases. +

If you use the starred version of \GlsXtrEnableOnTheFly don’t use any +commands in the ⟨label⟩, even if they expand to just text.
+

+ + + +

+

+

Top

9. bib2gls: Managing Reference Databases

+

There is a new command line application called bib2gls, which works in much +the same way as a combination of bibtex and makeindex/xindy. Instead of +storing all your entry definitions in a .tex and loading them using \input or +\loadglsentries, the entries can instead be stored in a .bib file and bib2gls can +selectively write the appropriate commands to a .glstex file which is loaded using +\glsxtrresourcefile (or \GlsXtrLoadResources). +

This means that you can use a reference managing system, such as JabRef, to +maintain the database and it reduces the TEX overhead by only defining the entries +that are actually required in the document. If you currently have a .tex file that +contains hundreds of definitions, but you only use a dozen or so in your +document, then the build time is needlessly slowed by the unrequired definitions +that occur when the file is input. (You can convert an existing .tex file +containing glossary definitions to a .bib file using convertgls2bib, supplied with +bib2gls.) +

There are some new commands and options added to glossaries-extra to help assist +the integration of bib2gls into the document build process. +

This chapter just provides a general overview of bib2gls. The full details and +some sample documents are provided in the bib2gls manual. +

An example of the contents of .bib file that stores glossary entries that can be +extracted with bib2gls: + + + +

+
+@entry{bird, + 
  name={bird}, + 
  description = {feathered animal}, + 
  see={[see also]{duck,goose}} + 
} + 
@entry{duck, + 
  name={duck}, + 
  description = {a waterbird with short legs} + 
} + 
@entry{goose, + 
  name="goose", + 
  plural="geese", + 
  description={a waterbird with a long neck} + 
} +
+

+

The follow provides some abbreviations: + + + +

+
+@string{ssi={server-side includes}} + 
@string{html={hypertext markup language}} + 
@abbreviation{shtml, + 
  short="shtml", + 
  long= ssi # " enabled " # html, + 
  description={a combination of \gls{html} and \gls{ssi}} + 
} + 
@abbreviation{html, + 
  short ="html", + 
  long  = html, + 
  description={a markup language for creating web pages} + 
} + 
@abbreviation{ssi, + 
  short="ssi", + 
  long = ssi, + 
  description={a simple interpreted server-side scripting language} + 
} +
+

+

Here are some symbols: + + + +

+
+preamble{"\providecommand{\mtx}[1]{\boldsymbol{#1}}"} + 
@symbol{M, + 
  name={$\mtx{M}$}, + 
  text={\mtx{M}}, + 
  description={a matrix} + 
} + 
@symbol{v, + 
  name={$\vec{v}$}, + 
  text={\vec{v}}, + 
  description={a vector} + 
} + 
@symbol{S, + 
  name={$\mathcal{S}$}, + 
  text={\mathcal{S}}, + 
  description={a set} + 
} +
+

+

To ensure that bib2gls can find out which entries have been used in the +document, you need the record package option: + + + +

+
+\usepackage[record]{glossaries-extra} +
+

If this option’s value is omitted (as above), the normal indexing will be switched off, +since bib2gls can also sort the entries and collate the locations. +

If you still want to use an indexing application (for example, you need a custom +xindy rule), then just use record=alsoindex and continue to use \makeglossaries +and \printglossary (or \printglossaries), but you also need to instruct +bib2gls to omit sorting to save time and to prevent the sort key from being +set. +

The .glstex file created by bib2gls is loaded using: +


\glsxtrresourcefile  \glsxtrresourcefile[options]{filename} +

+

+(Don’t include the file extension in ⟨filename⟩.) There’s a shortcut version +(recommended over the above) that sets ⟨filename⟩ to use \jobname: +


\GlsXtrLoadResources  \GlsXtrLoadResources[options]

+

+On the first use, this command is a shortcut for

+
+\glsxtrresourcefile[options]{\jobname} +
+
On subsequent use,9.1 this +command is a shortcut for
+
+\glsxtrresourcefile[options]{\jobname-n} +
+
where ⟨n⟩ is the current value of +


\glsxtrresourcecount

+

+which is incremented at the end of \GlsXtrLoadResources. Any advisory notes +regarding \glsxtrresourcefile also apply to \GlsXtrLoadResources. +

The \glsxtrresourcefile command writes the line

+
+\glsxtr@resource{options}{filename} +
+
to the .aux file and will input ⟨filename.glstex if it +exists.9.2 + + + +

Since the .glstex file won’t exist on the first LATEX run, the record package +option additionally switches on undefaction=warn. Any use of commands like \gls or +\glstext will produce ?? in the document, since the entries are undefined at this +point. Once bib2gls has created the .glstex file the references should be resolved. +This may cause a shift in the locations if the actual text produced once the entry is +defined is significantly larger than the placeholder ?? (as this can alter the page +breaking). +

Note that as from v1.12, \glsxtrresourcefile temporarily switches the +category code of @ to 11 (letter) while it reads the file to allow for any internal +commands stored in the location field. +

+

Top

9.1 Selection

+

The default behaviour is for bib2gls to select all entries that have a record in the +.aux file, and any dependent entries (including parent and cross-references). The +glsignore format (for example, \gls[format=glsignore]{duck}) is recognised by +bib2gls as a special ignored record. This means that it will match the selection +criteria but the record won’t be added to the location list. This means that you won’t +get spurious commas in the location list (as can happen with the other indexing +methods), so you can do, for example, + + + +

+
+\GlsXtrSetDefaultNumberFormat{glsignore} +
+

at the start of the front matter and + + + +

+
+\GlsXtrSetDefaultNumberFormat{glsnumberformat} +
+

at the start of the main matter to prevent any records in the front matter from +occurring in the location lists. +

Note that commands like \glsaddall and \glsaddallunused don’t +work with bib2gls as the command has to iterate over the internal lists of +defined entry labels, which will be empty on the first run and on subsequent +runs will only contain those entries that have been selected by bib2gls. +
+

+

If you want to add all entries to the glossary, you need to tell bib2gls this in the +options list. For example: + + + +

+
+\GlsXtrLoadResources[src={terms},selection={all}] +
+

This will add all entries, regardless of whether or not they have any records in the +.aux file. Those that don’t have any records will have an empty location list. See the +bib2gls user manual for more details of this option. +

+

+

Top

9.2 Sorting and Displaying the Glossary

+

There are many sorting options provided by bib2gls. The default is to sort +according to the system locale. If the document has a language setting, you can use +sort=doc to instruct bib2gls to sort according to that. (The language tag obtained +from tracklang’s interface is written to the .aux file.) For a multilingual document +you need to explicitly set the locale using a well-formed language tag. For +example: + + + +

+
+\GlsXtrLoadResources[ + 
  src=terms, % data in terms.bib + 
  sort=de-DE-1996 % sort according to this locale + 
] +
+

The locale-sensitive sort methods usually ignore most punctuation so for lists of +symbols you may find it more appropriate to use one of the letter-base sort methods +that sort according to the Unicode value of each character. Alternatively you can +provide a custom rule. See the bib2gls manual for full details of all the available sort +methods. +

Since the .glstex file only defines those references required within the document +(selected according to the selection option) and the definitions have been written in +the order corresponding to bib2gls’s sorted list, the glossaries can simply be +displayed using \printunsrtglossary (or \printunsrtglossaries), described in +§10.2 Display All Entries Without Sorting or Indexing. +

Suppose the .bib examples shown above have been stored in the files terms.bib, +abbrvs.bib and symbols.bib which may either be in the current directory or on +TEX’s path. Then the document might look like: + + + +

+
+\documentclass{article} + 
\usepackage[record]{glossaries-extra} + 
\setabbreviationstyle{long-short-desc} + 
\GlsXtrLoadResources[src={terms,abbrvs,symbols}] + 
\begin{document} + 
\gls{bird} + 
\gls{shtml} + 
\gls{M} + 
\printunsrtglossaries + 
\end{document} +
+

The document build process (assuming the document is called mydoc) is: + + + +

+
+pdflatex mydoc + 
bib2gls mydoc + 
pdflatex mydoc +
+

This creates a single glossary containing the entries: bird, duck, goose, html, M, +shtml and ssi (in that order). The bird, shtml and M entries were added because +bib2gls detected (from the .aux file) that they had been used in the document. The +other entries were added because bib2gls detected (from the .bib files) that they +are referenced by the used entries. In the case of duck and goose, they are +in the see field for bird. In the case of ssi and html, they are referenced +in the description field of shtml. These cross-referenced entries won’t have +a location list when the glossary is first displayed, but depending on how +they are referenced, they may pick up a location list on the next document +build. +

The entries can be separated into different glossaries with different sort +methods: + + + +

+
+\documentclass{article} + 
\usepackage[record,abbreviations,symbols]{glossaries-extra} + 
\setabbreviationstyle{long-short-desc} + 
\GlsXtrLoadResources[src={terms},sort={en-GB},type=main] + 
\GlsXtrLoadResources + 
 [src={abbrvs},sort={letter-nocase},type=abbreviations] + 
\GlsXtrLoadResources + 
 [src={symbols},sort={use},type={symbols}] + 
\begin{document} + 
\gls{bird} + 
\gls{shtml} + 
\gls{M} + 
\printunsrtglossaries + 
\end{document} +
+

+

Or you can have multiple instance of \GlsXtrLoadResources with the same +type, which will produce a glossary with ordered sub-blocks. For example: + + + +

+
+\documentclass{article} + 
\usepackage[record,style=indexgroup]{glossaries-extra} + 
\setabbreviationstyle{long-short-desc} + 
\GlsXtrLoadResources + 
 [src={abbrvs},sort={letter-nocase},type=main, + 
  group={Abbreviations}] + 
\GlsXtrLoadResources + 
 [src={symbols},sort={use},type=main, + 
  group={Symbols}] + 
\GlsXtrLoadResources[src={terms},sort={en-GB},type=main] + 
\begin{document} + 
\gls{bird} + 
\gls{shtml} + 
\gls{M} + 
\printunsrtglossaries + 
\end{document} +
+

This will result in a glossary where the first group has the title “Abbreviations”, the +second group has the title “Symbols” and then follow the usual letter groups. Note +that for this example to work, you must run bib2gls with the --group (or -g) +switch. For example, if the document is called myDoc.tex: + + + +

+
+pdflatex myDoc + 
bib2gls -g myDoc + 
pdflatex myDoc +
+

The value of the group field must always be a label. You can set the corresponding +title with \glsxtrsetgrouptitle (see §2.12 Glossary Style Modifications). If no title +is set then the label is used as the group title. +

You can provide your own custom sort rule. For example, if you are using +XƎLATEX or LuaLATEX:

+
+\GlsXtrLoadResources[ +
  src=terms, % entries in terms.bib +
  sort=custom, % custom sort rule +
  sort-rule={% required with sort=custom +
  < æ;Æ < a;á;å;ä,Ä;Á;Å;Ä < b,B +
  < c;ć,C;Ć < d,D < e;é,E;É < f,F < g,G +
  < h,H < i;í,I;Í < j,J < l;ł,L;Ł < m,M < n,N +
  < o;ö;ø,O;Ö < p,P < q,Q < r,R < s;ś,S;Ś +
  < t,T < u;ú,U;Ú < v,V < w,W < x,X < y,Y < +
  z;ż,Z;Ż +
  } +
] +
+
Remember that if you are using inputenc then extended characters, such as é or ø, +are active and will expand when written to the .aux file. So with PDFLATEX the +above would have to be changed to protect against expansion. Some of the +options, including sort-rule, allow Unicode characters to be indicated in the +format \uhex⟩ (or \u ⟨hex⟩) in the .aux file. bib2gls will recognise this as the +character given by the hexadecimal value ⟨hex⟩. The \u also needs protection from +expansion, so with a non-Unicode aware engine, the character æ needs to be +written as \string\uE6 and so on. This is quite cumbersome, but you can +use the shortcut \glshex E6 instead, so the above needs to be written as: +
+
+\GlsXtrLoadResources[ +
  src=terms, % entries in terms.bib +
  sort=custom, % custom sort rule + + + +
  sort-rule={% required with sort=custom +
  < \glshex E6;\glshex C6 +
  < a;\glshex E1;\glshex E5,\glshex E4,A;\glshex C1;\glshex C5;\glshex C4 +
  < b,B < c;\glshex 0107,C;\glshex 0106 < d,D +
  < e;\glshex E9,E;\glshex C9 < f,F < g,G +
  < h,H < i;\glshex ED,I;\glshex CD < j,J +
  < l;\glshex 0142,L;\glshex 0141 < m,M < n,N +
  < o;\glshex F6;\glshex F8,O;\glshex D6;\glshex D8 +
  < p,P < q,Q < r,R < s;\glshex 013F,S;\glshex 015A +
  < t,T < u;\glshex FA,U;\glshex DA < v,V < w,W < x,X < y,Y +
  < z;\glshex 017C,Z;\glshex 017B +
  }] +
+
+

+

+

Top

9.3 The glossaries-extra-bib2gls package

+

The package option record=only (or simply record) automatically loads the +supplementary package glossaries-extra-bib2gls, which provides some commands that +are specific to bib2gls. The package isn’t loaded by record=alsoindex as that option +is intended for sorting with makeindex or xindy and it is expected that the sorting +will be switched off (with the resource option sort=none). +

If glossaries-extra-bib2gls is loaded via the record package option then the +check for associated language resource files (see §13 Multi-Lingual Support) +will also search for the existence of glossariesxtr-script.ldf for each +document dialect (where ⟨script⟩ is the four letter script identifier, such as +Latn). +

This package provides some shortcut commands that use \printunsrtglossary if the +relevant package option has defined the associated glossary: \printunsrtabbreviations, +\printunsrtacronyms, \printunsrtsymbols, \printunsrtnumbers and +\printunsrtindex. +


\glsxtrprovidecommand  \glsxtrprovidecommand{cs}[n][default] +{definition}

+

+This command is intended for use in @preamble. It’s simply defined to +\providecommand in glossaries-extra-bib2gls but bib2gls’s interpreter treats it as +\renewcommand. This means that you can override bib2gls’s internal definition of a +command without overriding the command definition in the document (if it’s already +defined before the resource file is input). For example + + + +

+
+@preamble{"\glsxtrprovidecommand{\int}{integral}"} +
+

This will force bib2gls to treat \int as the word “integral” to assist sorting but if +this preamble code is written to the .glstex file (as it is by default) then it won’t +override the current definition (provided by the kernel or redefined by a +package). +

The helper commands in the resource files are defined using \providecommand. +For many of them, if you want to provide an alternative definition then you need to +define the command before the resource file is loaded. There are a few that may be +redefined afterwards but if you use \renewcommand then you will get an error on the +first LATEX run when the .glstex file doesn’t exist. In this case, you may prefer to +use: +


\glsrenewcommand  \glsrenewcommand{cs}[n][default]{definition} +

+

+This behaves like \renewcommand but only generates a warning rather than an error +if the command isn’t already defined so it won’t interrupt the document +build. +


\GlsXtrIndexCounterLink  \GlsXtrIndexCounterLink{text}{label} +

+

+If the \hyperref command has been defined (that is, hyperref has been +loaded before glossaries-extra) then this command checks for the existence of +the indexcounter field. If this field is set for the entry given by ⟨label⟩, this +command does \hyperref[wrglossary.value]{text}, where ⟨value⟩ is the +value of the indexcounter field. If the field isn’t set or if \hyperref hasn’t +been defined, this just does ⟨text⟩. This command is provided for use with the +indexcounter package option combined with bib2gls’s save-index-counter +resource option. See the bib2gls manual for further details (at least version +1.4). +

If you use the set-widest resource option, bib2gls v1.8+ will now +use: +


\glsxtrSetWidest  \glsxtrSetWidest{type}{level}{text}

+

+(if it has been defined) to set the widest name for the given glossary type and level. +This allows for both the alttree style and the styles provided by glossary-longextra, +which need to know the widest name. +

If bib2gls can’t determine the widest name (typically because the name field +consists of commands that aren’t recognised by the interpreter) then bib2gls v1.8+ +will now use: +


\glsxtrSetWidestFallback  \glsxtrSetWidestFallback{max depth}{list} +

+ + + +

+(if defined). Currently the maximum hierarchical depth ⟨max depth⟩ may only be 0 or +2. This command requires commands provided by the glossaries-extra-stylemods +package with the alttree style enabled. In this case, it may be simpler to just use +\glssetwidest. +

+

+

Top

9.3.1 Supplemental Locations

+


\glsxtrdisplaysupploc  \glsxtrdisplaysupploc{prefix}{counter}{format} +{src}{location}

+

+This is used by bib2gls version 1.7+ for supplemental locations, instead of using +\glsxtrsupphypernumber with the externallocation attribute. This command sets up +the location counter and prefix (used in the formation of hyperlinks) and then +uses +


\glsxtrmultisupplocation  \glsxtrmultisupplocation{location}{src} +{format}

+

+to format the actual location (with an external hyperlink, if supported). +

+

+

Top

9.3.2 Nameref Record

+

Normally locations are recorded in the .aux file in the form: +


\glsxtr@record{label}{prefix}{counter}{format}{location} +

+

+The record=nameref option, which requires at least bib2gls v1.8, instead +uses: +


\glsxtr@record@nameref{label}{prefix}{counter}{format}{location} +{title}{href}{hcounter}

+

+where ⟨title⟩ is obtained from \@currentlabelname and ⟨href ⟩ is obtained from +\@currentHref. These commands require hyperref. If they are undefined, ⟨title⟩ and +⟨href ⟩ will be left empty and bib2gls will treat it as a regular record. +

Be careful with this option as ⟨href ⟩ will globally change on every instance of +\refstepcounter but ⟨title⟩ won’t necessarily change. It can therefore cause +unexpected behaviour.
+

+

The final argument ⟨hcounter⟩ is obtained from \theHcounter⟩ which provides the +partial target name associated with the indexing counter. With the original + + + +makeindex/xindy approach, it’s not possible to include this information in the +location, so the base glossaries package attempts to derive a prefix from which the +⟨hcounter⟩ value can be reconstituted by appending the prefix. Unfortunately, not all +definitions of \theHcounter⟩ are in the form ⟨prefix\thecounter⟩ (most notably the +equation counter with chapters) so this can fail. +

Since bib2gls is customized specifically for use with glossaries-extra, it’s now +possible to save ⟨hcounter⟩, so the record=nameref option does this. By providing both +⟨href ⟩ and ⟨hcounter⟩, you can determine which target you would rather use. The default +is to use ⟨hcounter⟩, which will take you to the place where the corresponding counter +was incremented with \refstepcounter. However, you may choose to switch to +using the ⟨href ⟩ target, which will take you to the nearest target before the indexing +took place. +

With bib2gls v1.8+, normal locations are displayed using: +


\glsnoidxdisplayloc{prefix}{counter}{format}{location}

+

+This is provided by the base glossaries package and is simply defined to do: +


\setentrycounter[prefix]{counter}\csuse{format}{location} +

+

+Earlier versions of bib2gls only used this in the loclist field and explicitly used +\setentrycounter in the location field followed by \format{location}, which follows +the code that’s created with the default makeindex setting. The \setentrycounter +command sets up the prefix needed for \glshypernumber to reform the target name +from the given location. +

The locations identified by \glsxtr@record@nameref are written by bib2gls to +the location list using: +


\glsxtrdisplaylocnameref  \glsxtrdisplaylocnameref{prefix}{counter} +{format}{location}{title}{href}{hcounter}{file}

+

+With normal internal locations, ⟨file⟩ will always be empty. With supplemental +locations, ⟨file⟩ will be the external file reference. +

The default definition is: + + + +

+
+\newcommand*{\glsxtrdisplaylocnameref}[8]{% + 
  \ifstrequal{#2}{equation}% + 
  {\glsxtrnamereflink{#3}{(#4)}{#2.#7}{#8}}% + 
  {% + 
     \ifstrempty{#5}% + 
     {% + 
       \glsxtrnamereflink{#3}{#4}{#2.#7}{#8}% + 
     }% + 
     {% + 
       \ifstrequal{#2}{page}% + 
       {\glsxtrnamereflink{#3}{#4}{#2.#7}{#8}}% + 
       {\glsxtrnamereflink{#3}{#5}{#2.#7}{#8}}% + 
     }% + 
  }% + 
} +
+

which uses: +


\glsxtrnamereflink  \glsxtrnamereflink{format}{title}{target}{file} +

+

+This ignores the ⟨prefix⟩, ⟨counter⟩ and {location} arguments and instead creates a +hyperlink with the target name obtained from ⟨target⟩ (and ⟨file⟩, if not empty). +

Since pages and equations typically don’t have titles, the default definition of +\glsxtrdisplaylocnameref checks the counter was used as the location. If it’s page +or if ⟨title⟩ is empty, then just the location is used as the hyperlink text. If the counter +equation, then the text is the location in parentheses. Otherwise the text is obtained +from ⟨title⟩. +

If ⟨file⟩ is empty an internal link is created with: +


\glsxtrfmtinternalnameref  \glsxtrfmtinternalnameref{target}{format} +{title}

+

+otherwise an external link is created with: +


\glsxtrfmtexternalnameref  \glsxtrfmtexternalnameref{target}{format} +{title}{file}

+

+The ⟨file⟩ argument is set by bib2gls for supplemental locations. +

Here’s alternative definition that uses the ⟨prefix⟩ and ⟨counter⟩ to reform the +target name (as \glsnoidxdisplayloc) but uses the ⟨title⟩ as the hyperlink +text: + + + +

+
+\renewcommand*{\glsxtrdisplaylocnameref}[7]{% + 
 \glsxtrnamereflink{#3}{#5}{#6}{#7}% + 
} +
+

which uses: +


\glsxtrnameloclink  \glsxtrnameloclink{prefix}{counter}{format} +{location}{title}{file}

+

+This uses the same commands as \glsxtrnamereflink to produce the hyperlinks. +

In both cases, the link is encapsulated with the text-block command whose +name is given by ⟨format⟩, but \glshypernumber is first locally redefined to +\@firstofone to prevent a conflict with the usual location hyperlink formation. +This means that if the ⟨format⟩ is hyperbf then it will simply behave like +textbf. +

For compactness, bib2gls merges normal records if the ⟨prefix⟩, ⟨counter⟩ and +⟨location⟩ all match. (An order of precedence can be provided for format conflicts.) +With nameref records, you can use the --merge-nameref-on switch provided by +bib2gls v1.8+ to determine how to merge nameref records. This switch +must be followed by one of the following keywords: hcounter (merge on +⟨hcounter⟩, default) href (merge on ⟨href ⟩), title (merge on ⟨title⟩) and location +(merge on ⟨location⟩, as regular records). In all cases, the ⟨counter⟩ must also +match. +

+

+

Top

9.3.3 Helper Commands for Resource Options

+


\glshex  \glshex

+

+This is just defined as \string\u, which is required when you need to indicate a +Unicode character in the form \uhex⟩ in some of the resource options (as illustrated +above). +


\glscapturedgroup  \glscapturedgroup

+

+This is just defined as \string\$ and is used for the captured group reference in a +replacement part of a regular expression substitution (requires at least bib2gls +version 1.5). For example: + + + +

+
+sort-replace={{([a-zA-Z])\string\.}{\glscapturedgroup1}} +
+

This only removes a full stop that follows any of the characters a,…,z or +A,…,Z. +

If you use the save-child-count resource option, you can test if the childcount +field is non-zero using: +


\GlsXtrIfHasNonZeroChildCount  \GlsXtrIfHasNonZeroChildCount{label} +{true}{false}

+

+This internally uses \GlsXtrIfFieldNonZero and will do ⟨false⟩ if the field isn’t set. +Within ⟨true⟩ and ⟨false⟩ you can use \glscurrentfieldvalue to access the value. (It +will be 0 in ⟨false⟩ if the field isn’t set.) +

A convenient shortcut for use in the entry-type-aliases setting: +


\GlsXtrBibTeXEntryAliases  \GlsXtrBibTeXEntryAliases

+

+This provides aliases for BibTEX’s standard entry types to bib2gls’s @bibtexentry +entry type (requires at least bib2gls version 1.4). +

You may also want to provide storage keys for BibTEX’s standard fields rather +than having to alias them all. This can be done with: +


\GlsXtrProvideBibTeXFields  \GlsXtrProvideBibTeXFields

+

+Note that BibTEX’s type field clashes with the glossaries package’s type key, so +this command provides the key bibtextype instead. You can alias it with +field-aliases=type=bibtextype in the resource options. Each storage +key is provided with a convenient command to access the value in the form +\glsxtrbibfield⟩. For example, \glsxtrbibaddress. The bibtextype field can be +accessed with \glsxtrbibtype. Each of these commands takes the entry label as the +sole argument. +

The glossaries-extra-bib2gls package also provides definitions of the missing +mathematical Greek commands: \Alpha, \Beta, \Epsilon, \Zeta, \Eta, \Iota, +\Kappa, \Mu, \Nu, \Omicron, \Rho, \Tau, \Chi, \Digamma, \omicron. These are all +defined with \providecommand, so they won’t override any definitions provided by +any package loaded before glossaries-extra. Since bib2gls’s interpreter recognises +these commands, using them instead of explicitly using the Latin characters with the +same shape helps to keep the Greek symbols together when sorting. Similarly, +if upgreek has been loaded, the missing upright Greek commands are also +provided. +

The remaining commands provide common rule blocks for use in the +sort-rule resource option. If you want a rule for a specific locale, you can +provide similar commands in a file called glossariesxtr-tag.ldf, where ⟨tag⟩ +identifies the dialect, locale, region or root language. See the description of +\IfTrackedLanguageFileExists in the tracklang documentation for further details. + + + +If this file is on TEX’s path and the tracklang package (automatically loaded by +glossaries) detects that the document has requested that language or locale, then the +file will automatically be loaded. For example, if you want to provide a rule +block for Welsh, then create a file called glossariesxtr-welsh.ldf that +contains: + + + +

+
+\ProvidesGlossariesExtraLang{welsh}[2018/02/23 v1.0] + 
\@ifpackageloaded{glossaries-extra-bib2gls} + 
{ + 
  \newcommand{\glsxtrWelshRules}{% + 
   \glsxtrLatinA + 
   \string<b,B + 
   \string<c,C + 
   \string<ch,CH + 
   \string<d,D + 
   \string<dd,DD + 
   \string<\glsxtrLatinE + 
   \string<f,F + 
   \string<ff,FF + 
   \string<g,G + 
   \string<ng,NG + 
   \string<\glsxtrLatinH + 
   \string<\glsxtrLatinI + 
   \string<j,J + 
   \string<\glsxtrLatinL + 
   \string<ll,LL + 
   \string<\glsxtrLatinM + 
   \string<\glsxtrLatinN + 
   \string<\glsxtrLatinO + 
   \string<\glsxtrLatinP + 
   \string<ph,PH + 
   \string<r,R + 
   \string<rh,RH + 
   \string<\glsxtrLatinS + 
   \string<\glsxtrLatinT + 
   \string<th,TH + 
   \string<u,U + 
   \string<w,W + 
   \string<y,Y + 
  } + 
} + 
{}% glossaries-extra-bib2gls.sty not loaded +
+

(The use of \string is in case the < character has been made active.) You can +provide more than one rule-block per local, to allow for loanwords or foreign words. +For example, you could provide \glsxtrWelshIRules, \glsxtrWelshIIRules +etc. +

If the rules are for a particular script (independent of language or region) then +they can be provided in a file given by glossariesxtr-script.ldf instead. For +example, the file glossariesxtr-Cyrl.ldf could contain: + + + +

+
+\ProvidesGlossariesExtraLang{Cyrl}[2018/02/23 v1.0] + 
\newcommand*{\glsxtrGeneralCyrillicIRules}{% + 
  % Cyrillic rules + 
} + 
\newcommand*{\glsxtrGeneralCyrillicIIRules}{% + 
  % an alternative set of Cyrillic rules + 
} +
+

(Remember that the required document language scripts need to be tracked through +the tracklang package, in order for these files to be automatically loaded. This +essentially means ensuring you load the appropriate language package before +tracklang is loaded by the base glossaries package or any other package that uses it. +See the tracklang documentation for further details.) +

Alternatively, if the rules are specific to a subject rather than a region or +language, then you can provide a supplementary package. For example, if you have a +package called, say, mapsymbols that provides map symbols, then the file +mapsymbols.sty might contain: + + + +

+
+\NeedsTeXFormat{LaTeX2e} + 
\ProvidesPackage{mapsymbols} + 
 some package or font loading stuff here to provide + 
 the appropriate symbols + 
\newcommand{\Stadium}{...} + 
\newcommand{\Battlefield}{...} + 
\newcommand{\Harbour}{...} + 
 etc + 
 Provide a rule block: + 
\newcommand{\MapSymbolOrder}{% + 
 \glshex 2694 % crossed-swords 0x2694 + 
 \string< \glshex 2693 % anchor 0x2693 + 
 \string< \glshex 26BD % football 0x26BD + 
} +
+

and the supplementary file mapsymbols.bib can provide the appropriate definitions +for bib2gls: + + + +

+
+@preamble{"\glsxtrprovidecommand{\Harbour}{\char"2693} + 
\glsxtrprovidecommand{\Battlefield}{\char"2694} + 
\glsxtrprovidecommand{\Stadium}{\char"26BD}"} +
+

Now both the preamble and rule block can be used in the resource set: + + + +

+
+\usepackage{mapsymbols}% my custom package + 
\usepackage[record]{glossaries-extra} + 
\GlsXtrLoadResources[ + 
  src={mapsymbols,% <--- my custom mapsymbols.bib + 
   entries% data in entries.bib + 
  }, + 
  sort={custom}, + 
  sort-rule={\glsxtrcontrolrules % control codes + 
 ;\glsxtrspacerules % space characters + 
 ;\glsxtrnonprintablerules % non-printable characters + 
 ;\glsxtrcombiningdiacriticrules % combining diacritics + 
 ,\glsxtrhyphenrules % hyphens + 
 <\glsxtrgeneralpuncrules % general punctuation + 
 <\glsxtrdigitrules % 0, ..., 9 + 
 <\glsxtrfractionrules % fraction symbols + 
 <\MapSymbolOrder % <--- custom map symbols + 
 <\glsxtrMathItalicGreekIrules % math-greek symbols + 
 <\glsxtrGeneralLatinIrules % Latin letters + 
 } + 
] +
+

+

The following commands are provided by glossaries-extra-bib2gls. They should be +separated by the rule separator characters ; (semi-colon) or , (comma) or +& (ampersand) or < (less than). See Java’s RuleBasedCollator documentation for +details of the rule syntax. +

For example, the following will place the mathematical Greek symbols (\alpha, +\Alpha, \beta, \Beta etc) in a block before Latin characters: + + + +

+
+sort-rule={\glsxtrcontrolrules + 
 ;\glsxtrspacerules + 
 ;\glsxtrnonprintablerules + 
 ;\glsxtrcombiningdiacriticrules + 
 ,\glsxtrhyphenrules + 
 <\glsxtrgeneralpuncrules + 
 <\glsxtrdigitrules + 
 <\glsxtrfractionrules + 
 <\glsxtrMathItalicGreekIrules + 
 <\glsxtrGeneralLatinIVrules + 
 <\glsxtrLatinAA + 
 <\glsxtrLatinOslash + 
} +
+

+


\glsxtrcontrolrules  \glsxtrcontrolrules

+

+These are control characters that are usually placed at the start of a rule in the +ignored section. They typically won’t occur in any sort values, but if they do they +should normally be ignored. +


\glsxtrspacerules  \glsxtrspacerules

+

+These are space characters. They typically come after the control characters with the +two blocks separated by a ; (semi-colon). +


\glsxtrnonprintablerules  \glsxtrnonprintablerules

+

+These are non-printable characters (BOM, tabs, line feed and carriage return). They +typically come after the spaces separated by a ; (semi-colon). These characters +aren’t checked for by bib2gls when it determines whether or not to use the +interpreter, so a TAB or newline character may end up in the sort value if it wasn’t +interpreted. +


\glsxtrcombiningdiacriticrules  \glsxtrcombiningdiacriticrules +

+

+These are combining diacritic marks which typically follow the space and +non-printable blocks (separated by a semi-colon). This command is defined in terms +of sub-block commands: + + + +

+
+\newcommand*{\glsxtrcombiningdiacriticrules}{% + 
 \glsxtrcombiningdiacriticIrules\string; + 
 \glsxtrcombiningdiacriticIIrules\string; + 
 \glsxtrcombiningdiacriticIIIrules\string; + 
 \glsxtrcombiningdiacriticIVrules + 
} +
+

If you prefer, you can use the sub-blocks directly in your required ordered. +


\glsxtrcombiningdiacriticIrules  \glsxtrcombiningdiacriticIrules +

+

+This contains the combining diacritics: acute, grave, breve, circumflex, caron, ring, +vertical line above, diaeresis (umlaut), double acute, tilde, dot above, combining +macron. +


\glsxtrcombiningdiacriticIIrules  \glsxtrcombiningdiacriticIIrules +

+

+This contains the combining diacritics: short solidus overlay, cedilla, ogonek, dot +below, low line, overline, hook above, double vertical line above, double grave +accent, candrabindu, inverted breve, turned comma above, comma above, +reversed comma above, comma above right, grave accent below, acute accent +below. +


\glsxtrcombiningdiacriticIIIrules  \glsxtrcombiningdiacriticIIIrules +

+

+This contains the combining diacritics: left tack below, right tack below, left angle +above, horn, left half ring below, up tack below, down tack below, plus sign below, +minus sign below, palatalized hook below, retroflex hook below, diaresis below, ring +below, comma below, vertical line below, bridge below, inverted double arch below, +caron below, circumflex accent below, breve below, inverted breve below, tilde below, +macron below, double low line, tilde overlay, short stroke overlay, long stroke overlay, +long solidus overlay, right half ring below, inverted bridge below, square below, +seagull below, x above, vertical tilde, double overline, Greek perispomeni, Greek +dialytika tonos, Greek ypogegrammeni, double tilde, double inverted breve, +Cyrillic titlo, Cyrillic palatalization, Cyrillic dasia pneumata, Cyrillic psili +pneumata. +


\glsxtrcombiningdiacriticIVrules  \glsxtrcombiningdiacriticIVrules +

+

+This contains the combining diacritics: left harpoon above, right harpoon above, long +vertical line overlay, short vertical line overlay, anticlockwise arrow above, clockwise +arrow above, left arrow above, right arrow above, ring overlay, clockwise ring overlay, + + + +anticlockwise ring overlay, three dots above, four dots above, enclosing circle, +enclosing square, enclosing diamond, enclosing circle backslash, left right arrow +above. +


\glsxtrhyphenrules  \glsxtrhyphenrules

+

+This contains hyphens (including the minus sign 0x2212). This rule block typically +comes after the diacritic rules separated by a comma. +


\glsxtrgeneralpuncrules  \glsxtrgeneralpuncrules

+

+This contains punctuation characters. This rule block typically comes after the +hyphen rules separated by a less than (<). As with the combining diacritics, this +command is defined in terms of sub-blocks which may be used directly instead if a +different order is required: + + + +

+
+\newcommand*{\glsxtrgeneralpuncrules}{% + 
  \glsxtrgeneralpuncIrules + 
  \string<\glsxtrcurrencyrules + 
  \string<\glsxtrgeneralpuncIIrules + 
} +
+

+


\glsxtrgeneralpuncIrules  \glsxtrgeneralpuncIrules

+

+This is the first punctuation sub-block containing: underscore, macron, comma, +semi-colon, colon, exclamation mark, inverted exclamation mark, question +mark, inverted question mark, solidus, full stop, acute accent, grave accent, +circumflex accent, diaersis, tilde, middle dot, cedilla, straight apostrophe, +straight double quote, left guillemet, right guillemet, left parenthesis, right +parenthesis, left square bracket, right square bracket, left curly bracket, right +curly bracket, section sign, pilcrow sign, copyright sign, registered sign, at +sign. +


\glsxtrcurrencyrules  \glsxtrcurrencyrules

+

+This sub-block contains some currency symbols: currency sign, Thai currency symbol +baht, cent sign, colon sign, cruzeiro sign, dollar sign, dong sign, euro sign, French +franc sign, lira sign, mill sign, naira sign, peseta sign, pound sign, rupee sign, new +sheqel sign, won sign, yen sign. +


\glsxtrgeneralpuncIIrules  \glsxtrgeneralpuncIIrules

+

+This sub-block contains some other punctuation symbols: asterisk, backslash, +ampersand, hash sign, percent sign, plus sign, plus-minus sign, division sign, +multiplication sign, less-than sign, equals sign, greater-than sign, not sign, vertical +bar (pipe), broken bar, degree sign, micron sign. +


\glsxtrdigitrules  \glsxtrdigitrules

+

+This rule block contains the Basic Latin digits (0, …, 9) and the subscript and +superscript digits (0 0 etc) made equivalent to the corresponding Basic Latin digit. +The digit block typically comes after the punctuation rules separated by a less than +(<). +


\glsxtrBasicDigitrules  \glsxtrBasicDigitrules

+

+This rule block contains just the Basic Latin digits (0, …, 9). +


\glsxtrSubScriptDigitrules  \glsxtrSubScriptDigitrules

+

+This rule block contains just the subscript digits (0 … 9). +


\glsxtrSuperScriptDigitrules  \glsxtrSuperScriptDigitrules

+ + + +

+This rule block contains just the superscript digits (0 … 9). +


\glsxtrfractionrules  \glsxtrfractionrules

+

+This rule block contains vulgar fraction characters. The digit block typically comes +after the digit rules separated by a less than (<). +

There are a number of Latin rule blocks. Some of these included extended +characters or ligatures (such as ß or œ) but they don’t include accented +characters. If you require a Latin rule block that includes accented characters, +digraphs, trigraphs or other extended characters, then it’s best to provide similar +commands in a glossariesxtr-tag.ldf file for the particular language or +region. +


\glsxtrGeneralLatinIrules  \glsxtrGeneralLatinIrules

+

+This is just the basic (non-extended) Latin alphabet with the superscript and +subscript Latin letters (a a etc) treated as the equivalent basic Latin letter. (If you +don’t want the subscripts and superscripts included you can redefine \glsxtrLatinA +etc to omit them.) +


\glsxtrGeneralLatinIIrules  \glsxtrGeneralLatinIIrules

+

+This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’ +and eszett (ß) treated as ‘ss’. +


\glsxtrGeneralLatinIIIrules  \glsxtrGeneralLatinIIIrules

+

+This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’ +and eszett (ß) treated as ‘sz’. +


\glsxtrGeneralLatinIVrules  \glsxtrGeneralLatinIVrules

+

+This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’, +ae-ligature (æ) is treated as ‘ae’, oe-ligature (œ) is treated as ‘oe’, eszett (ß) treated +as ‘ss’ and thorn (þ) is treated as ‘th’. +


\glsxtrGeneralLatinVrules  \glsxtrGeneralLatinVrules

+

+This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’, +eszett (ß) treated as ‘ss’ and thorn (þ) treated as ‘th’. +


\glsxtrGeneralLatinVIrules  \glsxtrGeneralLatinVIrules

+

+This is like \glsxtrGeneralLatinIrules but it includes eth (Ð) between ‘D’ and ‘E’, +eszett (ß) treated as ‘sz’ and thorn (þ) treated as ‘th’. +


\glsxtrGeneralLatinVIIrules  \glsxtrGeneralLatinVIIrules

+

+This is like \glsxtrGeneralLatinIrules but it includes ae-ligature (æ) between ‘A’ +and ‘B’, eth (Ð) between ‘D’ and ‘E’, insular G (Ᵹ) instead of ‘G’, oe-ligature between +‘O’ and ‘P’, long s (ſ) equivalent to ‘s’, thorn (þ) between ‘T’ and ‘U’ and wynn (Ƿ) +instead of W. +


\glsxtrGeneralLatinVIIIrules  \glsxtrGeneralLatinVIIIrules

+ + + +

+This is like \glsxtrGeneralLatinIrules but ae-ligature (æ) is treated as ‘ae’, +oe-ligature (œ) is treated as ‘oe’, eszett (ß) treated as ‘ss’, thorn (þ) is treated as ‘th’, +Ø is treated as ‘O’ and ‘Ł’ is treated as ‘L’. +


\glsxtrLatinA  \glsxtrLatinA

+

+A mini-rule that just covers ‘A’ but includes the sub- and superscript A. +


\glsxtrLatinE  \glsxtrLatinE

+

+A mini-rule that just covers ‘E’ but includes the subscript E. +


\glsxtrLatinH  \glsxtrLatinH

+

+A mini-rule that just covers ‘H’ but includes the subscript H. +


\glsxtrLatinK  \glsxtrLatinK

+

+A mini-rule that just covers ‘K’ but includes the subscript K. +


\glsxtrLatinI  \glsxtrLatinI

+

+A mini-rule that just covers ‘I’ but includes the superscript I. +


\glsxtrLatinL  \glsxtrLatinL

+

+A mini-rule that just covers ‘L’ but includes the subscript L. +


\glsxtrLatinM  \glsxtrLatinM

+

+A mini-rule that just covers ‘M’ but includes the subscript M. +


\glsxtrLatinN  \glsxtrLatinN

+

+A mini-rule that just covers ‘N’ but includes the sub- and superscript N. +


\glsxtrLatinO  \glsxtrLatinO

+

+A mini-rule that just covers ‘O’ but includes the sub- and superscript O. +


\glsxtrLatinP  \glsxtrLatinP

+

+A mini-rule that just covers ‘P’ but includes the subscript P. +


\glsxtrLatinS  \glsxtrLatinS

+

+A mini-rule that just covers ‘S’ but includes the subscript S. +


\glsxtrLatinT  \glsxtrLatinT

+

+A mini-rule that just covers ‘T’ but includes the subscript T. +


\glsxtrLatinX  \glsxtrLatinX

+

+A mini-rule that just covers ‘X’ but includes the subscript X. +


\glsxtrLatinEszettSs  \glsxtrLatinEszettSs

+

+A mini-rule that just covers eszett (ß) and makes long s (ſ) followed by short ‘s’ + + + +equivalent to ‘ß’. (This is used in the above blocks that treat ‘ß’ as ‘ss’.) +


\glsxtrLatinEszettSz  \glsxtrLatinEszettSz

+

+A mini-rule that just covers eszett (ß) and makes long s (ſ) followed by ‘z’ equivalent +to ‘ß’. (This is used in the above blocks that treat ‘ß’ as ‘sz’.) +


\glsxtrLatinEth  \glsxtrLatinEth

+

+A mini-rule for eth (Ð) so you don’t need to remember the Unicode values. +


\glsxtrLatinThorn  \glsxtrLatinThorn

+

+A mini-rule for thorn (þ) so you don’t need to remember the Unicode values. +


\glsxtrLatinAELigature  \glsxtrLatinAELigature

+

+A mini-rule for ae-ligature (æ) so you don’t need to remember the Unicode +values. +


\glsxtrLatinOELigature  \glsxtrLatinOELigature

+

+A mini-rule for oe-ligature (œ) so you don’t need to remember the Unicode +values. +


\glsxtrLatinOslash  \glsxtrLatinOslash

+

+A mini-rule for ‘Ø’ so you don’t need to remember the Unicode values. +


\glsxtrLatinLslash  \glsxtrLatinLslash

+

+A mini-rule for ‘Ł’ so you don’t need to remember the Unicode values. +


\glsxtrLatinWynn  \glsxtrLatinWynn

+

+A mini-rule for wynn (Ƿ) so you don’t need to remember the Unicode values. +


\glsxtrLatinInsularG  \glsxtrLatinInsularG

+

+A mini-rule for insular G (Ᵹ) so you don’t need to remember the Unicode +values. +


\glsxtrLatinSchwa  \glsxtrLatinSchwa

+

+A mini-rule that just covers schwa (Ə) but includes the subscript schwa. (Not used in +any of the provided Latin rule blocks described above.) +


\glsxtrLatinAA  \glsxtrLatinAA

+

+A mini-rule for ‘Å’ so you don’t need to remember the Unicode values. (Not used in +any of the provided Latin rule blocks described above.) +


\glsxtrMathGreekIrules  \glsxtrMathGreekIrules

+

+A rule block for mathematical Greek (\alpha, \beta etc) and upright Greek +(\upalpha, etc, from the upgreek package) characters that includes digamma +(\digamma and \Digamma) between epsilon and zeta. The upright and italic versions +are gathered together into the same letter group. + + + +


\glsxtrMathGreekIIrules  \glsxtrMathGreekIIrules

+

+As \glsxtrMathGreekIrules but doesn’t include digamma. +


\glsxtrMathUpGreekIrules  \glsxtrMathUpGreekIrules

+

+A rule block for upright Greek (\upalpha, etc, from the upgreek package) +characters that includes digamma (\digamma and \Digamma) between epsilon and +zeta. +


\glsxtrMathUpGreekIIrules  \glsxtrMathUpGreekIIrules

+

+A rule block for upright Greek (\upalpha, etc, from the upgreek package) that +doesn’t include digamma. +


\glsxtrMathItalicGreekIrules  \glsxtrMathItalicGreekIrules

+

+A rule block for mathematical Greek (\alpha, \Alpha, etc) characters that includes +digamma (\diagamma and \Digamma) between epsilon and zeta. Note that even +though the upper case \Delta etc are actually rendered upright by LATEX, +bib2gls’s interpreter treats them as italic to help keep them close to the lower case +versions. +


\glsxtrMathItalicGreekIIrules  \glsxtrMathItalicGreekIIrules

+

+A rule block for mathematical Greek (\alpha, \Alpha, etc) characters that doesn’t +include digamma. +


\glsxtrMathItalicUpperGreekIrules  \glsxtrMathItalicUpperGreekIrules +

+

+A rule block for upper case mathematical Greek (\Alpha, \Beta, etc) characters that +includes digamma (\Digamma) between epsilon and zeta. +


\glsxtrMathItalicUpperGreekIIrules  \glsxtrMathItalicUpperGreekIIrules +

+

+A rule block for upper case mathematical Greek (\Alpha, \Beta, etc) characters that +doesn’t include digamma. +


\glsxtrMathItalicLowerGreekIrules  \glsxtrMathItalicLowerGreekIrules +

+

+A rule block for lower case mathematical Greek (\alpha, \beta, etc) characters that +includes digamma (\digamma) between epsilon and zeta. +


\glsxtrMathItalicLowerGreekIIrules  \glsxtrMathItalicLowerGreekIIrules +

+

+A rule block for lower case mathematical Greek (\alpha, \beta, etc) characters that +doesn’t include digamma. +

Additionally, there are commands in the form \glsxtrUpAlpha, \glsxtrUpBeta +etc and \glsxtrMathItalicAlpha, \glsxtrMathItalicBeta etc that just cover the +upper and lower case forms of a special Greek character (\Upalpha, \upalpha etc + + + +and \Alpha, \alpha etc) as well as the following: +


\glsxtrMathItalicPartial  \glsxtrMathItalicPartial

+

+The partial derivative symbol (). +


\glsxtrMathItalicNabla  \glsxtrMathItalicNabla

+

+The nabla symbol (). +

+

+

Top

9.4 Supplementary Commands

+

These commands are provided by glossaries-extra for use with bib2gls. +

The information provided with \GlsXtrLoadResources is written to the .aux file +using

+
+\protected@write\@auxout{\glsxtrresourceinit}{information} +
+
where ⟨information⟩ is the information to pass to bib2gls. The command in the +second argument +


\glsxtrresourceinit  \glsxtrresourceinit

+

+may be used to temporarily redefine commands before the information is written to +the file. This does nothing by default, but may be redefined to allow the use of short +commands for convenience. For example, with: + + + +

+
+\renewcommand{\glsxtrresourceinit}{\let\u\glshex} +
+

you can just use, for example, \u E6 instead of \string\uE6 in the custom rule. +This redefinition of \u is scoped so its original definition is restored after the write +operation. +

If you have multiple resource commands and you want a default set of options you +can supply them in the definition of: +


\GlsXtrDefaultResourceOptions  \GlsXtrDefaultResourceOptions

+

+For example: + + + +

+
+\renewcommand{\GlsXtrDefaultResourceOptions}{selection=all} +
+

This should be done before the resource commands. +

It’s possible to specify label prefixes. For example, modifying the earlier +example: + + + +

+
+\documentclass{article} + 
\usepackage[record,style=indexgroup]{glossaries-extra} + 
\setabbreviationstyle{long-short-desc} + 
\GlsXtrLoadResources + 
 [src={abbrvs},sort={letter-nocase},type=main, + 
  label-prefix={abr.}, + 
  group={Abbreviations}] + 
\GlsXtrLoadResources + 
 [src={symbols},sort={use},type=main, + 
  label-prefix={sym.}, + 
  group={Symbols}] + 
\GlsXtrLoadResources[src={terms},sort={en-GB},type=main + 
  label-prefix={trm.}] + 
\begin{document} + 
\gls{trm.bird} + 
\gls{abr.shtml} + 
\gls{sym.M} + 
\printunsrtglossaries + 
\end{document} +
+

If you do something like this, you may find it more convenient to define custom +commands that set the prefix. For example: + + + +

+
+\newcommand*{\sym}[2][]{\gls[#1]{sym.#2}} +
+

The problem with this is that the custom command \sym doesn’t allow for modifiers +(such as \gls* or \gls+). Instead you can use: +


\glsxtrnewgls  \glsxtrnewgls[default options]{prefix}{cs}

+

+which defines the command ⟨cs⟩ that behaves like

+
+\glsmodifier[default options,options]{prefix⟩⟨label}[insert] +
+
For example: + + + +
+\glsxtrnewgls{sym.}{\sym} +
+

or (to default to no hyperlinks) + + + +

+
+\glsxtrnewgls[hyper=false]{sym.}{\sym} +
+

now you can use \sym+{M} to behave like \gls+{sym.M}. +

If you also want the plural and first letter upper case versions you can +use +


\glsxtrnewglslike  \glsxtrnewglslike[default options]{prefix} +{\gls-like cs}{\glspl-like cs}{\Gls-like cs}{\Glspl-like cs} +

+

+For example: + + + +

+
+\glsxtrnewglslike[hyper=false]{idx.}{\idx}{\idxpl}{\Idx}{\Idxpl} +
+

For the all caps versions: +


\glsxtrnewGLSlike  \glsxtrnewGLSlike[default options]{prefix} +{\GLS-like cs}{\GLSpl-like cs}

+

+For example: + + + +

+
+\glsxtrnewGLSlike[hyper=false]{idx.}{\IDX}{\IDXpl} +
+

+

There’s an analogous command for \rgls: +


\glsxtrnewrgls  \glsxtrnewrgls[default options]{prefix}{cs} +

+

+and for \rgls, \rglspl, \rGls and \rGlspl: +


\glsxtrnewrglslike  \glsxtrnewrglslike[default options]{prefix} +{\rgls-like cs}{\rglspl-like cs}{\rGls-like cs}{\rGlspl-like cs} +

+

+and for the all caps: +


\glsxtrnewrGLSlike  \glsxtrnewrGLSlike[default options]{prefix} +{\rGLS-like cs}{\rGLSpl-like cs}

+

+

If you provide your own custom command with just \newcommand that +has syntax that starts with [options]{label}, then you can notify bib2gls +using: +


\glsxtridentifyglslike  \glsxtridentifyglslike{prefix}{command} +

+

+This writes information to the .aux file so that bib2gls can search for the given +command when looking for dependencies. +

Another possibility is to set up known label prefixes, with each one identified +by: +


\glsxtraddlabelprefix  \glsxtraddlabelprefix{prefix}

+

+These should be listed in order of precedence. Since no entries are defined on the first +LATEX run, the final prefix should be the fallback. You can prepend a prefix to the +list using: +


\glsxtrprependlabelprefix  \glsxtrprependlabelprefix{prefix} +

+

+which gives it the highest order of precedence. +

The ⟨prefix⟩ argument may be empty. You can clear the list with: +


\glsxtrclearlabelprefixes  \glsxtrclearlabelprefixes

+

+

You can test if a prefix is already in the list with: + + + +


\glsxtrifinlabelprefixlist  \glsxtrifinlabelprefixlist{prefix}{true} +{false}

+

+In general it’s best to avoid adding multiple instances of the same prefix, so you can +check with this command before adding a prefix to the list. However, it can be useful +to repeat a prefix at the end of the list so that it can be used as a fallback for entries +that haven’t yet been defined. +

With the list of possible prefixes set up (including an empty prefix if necessary), +you can use: +


\dgls  \dgls[options]{label}[insert]

+

+which behaves like

+
+\gls[options]{prefix⟩⟨label}[insert] +
+
where ⟨prefix⟩ is the first prefix in the list such that ⟨prefix⟩⟨label⟩ matches a defined +entry (or the last entry in the prefix list if none match). +

There are also analogous commands for the plural and case-changing +versions: +


\dglspl  \dglspl[options]{label}[insert]

+

+(uses \glspl), +


\dGls  \dGls[options]{label}[insert]

+

+(uses \Gls), +


\dGlspl  \dGlspl[options]{label}[insert]

+

+(uses \Glspl), +


\dGLS  \dGLS[options]{label}[insert]

+

+(uses \GLS), +


\dGLSpl  \dGLSpl[options]{label}[insert]

+

+(uses \GLSpl), +


\dglslink  \dglslink[options]{label}[insert]

+

+(uses \glslink), +


\dglsdisp  \dglsdisp[options]{label}[insert]

+

+(uses \glsdisp). +

These commands are essentially provided for a mixture of single and dual entries. +Suppose the file entries.bib contains: + + + +

+
+@index{duck} + 
@dualindexabbreviation{svm, + 
  short={SVM}, + 
  long={support vector machine} + 
} + 
@dualindexsymbol{pi, + 
  symbol={\ensuremath{\pi}}, + 
  description={ratio of a circle's circumference to its + 
    diameter} + 
} +
+

and suppose the document code is: + + + +

+
+\documentclass{article} + 
\usepackage{hyperref} + 
\usepackage[record,abbreviations,symbols]{glossaries-extra} + 
\newcommand{\bibglsnewdualindexsymbolsecondary}[5]{% + 
 \longnewglossaryentry*{#1}{name={#3},category={symbol}, + 
   type={symbols},symbol={#4},#2}{#5}% + 
} + 
\GlsXtrLoadResources[src=entries] + 
\begin{document} + 
First use: \gls{duck}, \gls{svm}, \gls{pi}. + 
Next use: \gls{duck}, \gls{svm}, \gls{pi}. + 
\printunsrtglossaries + 
\end{document} +
+

This uses the default empty primary prefix and dual. for the dual prefix, so +\gls{svm} is referencing the primary entry, which is (essentially) an @index type +not an abbreviation. It therefore doesn’t follow the abbreviation style, and +it also hyperlinks to the index not to the list of abbreviations. Similarly +for \gls{pi}, which references the primary @index entry rather than the +symbol. +

What’s really needed is: + + + +

+
+\gls{duck}, \gls{dual.svm}, \gls{dual.pi}. +
+

or with + + + +

+
+\GlsXtrLoadResources[src=entries, + 
 label-prefix={idx.}, + 
 dual-prefix={} + 
] +
+

then only the entries without a dual need a prefix: + + + +

+
+\gls{idx.duck}, \gls{svm}, \gls{pi}. +
+

Using \glsxtrnewglslike, as earlier, this can be simplified to: + + + +

+
+\idx{duck}, \gls{svm}, \gls{pi}. +
+

but this requires remembering which terms have duals. +

An alternative is to use \dgls instead: + + + +

+
+\documentclass{article} + 
\usepackage{hyperref} + 
\usepackage[record,abbreviations,symbols]{glossaries-extra} + 
\newcommand{\bibglsnewdualindexsymbolsecondary}[5]{% + 
 \longnewglossaryentry*{#1}{name={#3},category={symbol}, + 
   type={symbols},symbol={#4},#2}{#5}% + 
} + 
\GlsXtrLoadResources[src=entries] + 
\glsxtraddlabelprefix{dual.} + 
\glsxtraddlabelprefix{} + 
\begin{document} + 
First use: \dgls{duck}, \dgls{svm}, \dgls{pi}. + 
Next use: \dgls{duck}, \dgls{svm}, \dgls{pi}. + 
\printunsrtglossaries + 
\end{document} +
+

On the first LATEX call (when the .glstex file doesn’t exist), neither +dual.svm nor svm exists, so \dgls uses the last prefix (which is empty in this +case). This means that on the first LATEX run, \dgls{svm} behaves like +\gls{svm}, which adds a record for the primary svm entry. The default +primary-dual dependency means that this will cause both the primary (svm) and +dual (dual.svm) entry to be selected. The location will be added to the +primary entry’s location list, unless overridden by resource options, such as +combine-dual-locations. +

Once bib2gls has been run and the .glstex file exists, then dual.svm exists. +So \dgls{svm} will again first try dual.svm (as dual. is the first in the +list of label prefixes). That now exists, so \dgls{svm} now behaves like +\gls{dual.svm}, which follows the abbreviation style and hyperlinks to the list of +abbreviations. +

Similarly for the index-symbol combination dual.pi and pi. In the case of +\dgls{duck}, the label dual.duck never exists, so that’s never selected. The empty +prefix is the only one that matches, so \dgls{duck} always behaves like +\gls{duck}. +

If you haven’t used combine-dual-locations an extra bib2gls+LATEX run +may be required to correct the location lists. +

If you change the label prefixes, remember to update the corresponding +\glsxtraddlabelprefix{prefix}. If no prefixes have been added to the list (or if the +list is cleared), just an empty prefix is assumed. +

As from version 1.8, bib2gls provides hooks that identify the label prefixes in the + + + +.glstex file:

+
+\bibglstertiaryprefixlabel{prefix} +
\bibglsdualprefixlabel{prefix} +
\bibglsprimaryprefixlabel{prefix} +
+
These do nothing by default, but they can be defined before the resource file is +loaded to set up the prefix list. For example: + + + +
+\newcommand{\bibglsprimaryprefixlabel}[1]{\glsxtraddlabelprefix{#1}} + 
\newcommand{\bibglsdualprefixlabel}[1]{\glsxtrprependlabelprefix{#1}} + 
\GlsXtrLoadResources[src=entries] +
+

Remember that this will only have an effect once the .glstex file has been created. +The prefix list will be empty on the first run (which is treated as a single empty +prefix). If this isn’t a suitable fallback, it may be necessary to add one after all the +resource commands: + + + +

+
+\newcommand{\bibglsprimaryprefixlabel}[1]{\glsxtraddlabelprefix{#1}} + 
\newcommand{\bibglsdualprefixlabel}[1]{\glsxtrprependlabelprefix{#1}} + 
\GlsXtrLoadResources[src=entries,label-prefix={idx.}] + 
\glsxtraddlabelprefix{idx.} +
+

Although this rather defeats the purpose of using the hooks as you still have to keep +track of the fallback prefix. +

+

+

Top

9.5 Record Counting

+

As from version 1.1 of bib2gls, you can save the total record count for each entry by +invoking bib2gls with the --record-count or --record-count-unit switches. +These options will ensure that when each entry is written to the .glstex file +bib2gls will additionally set the following internal fields for that entry: +

+
    +
  • recordcount: set to the total number of records found for the entry; +
  • +
  • recordcount.counter⟩: set to the total number of records found for the + entry for the given counter.
+

If --record-count-unit is used then additionally:

+
    +
  • recordcount.counter.location⟩: set to the total number of records + found for the entry for the given counter with the given location.
+

Only use the unit counting option if the locations don’t contain any special characters. If +you really need it with locations that may contain formatting commands, then you +can try redefining: +


\glsxtrdetoklocation  \glsxtrdetoklocation{location}

+

+so that it detokenizes ⟨location⟩ but take care when using \GlsXtrLocationRecordCount +with commands like \thepage as they can end up becoming detokenized too +early. +

Note that the record count includes locations that bib2gls discards, such as +ignored records, duplicates and partial duplicates. It doesn’t include cross-reference +records. For example, if \gls{bird} is used twice on page 1, once on page 2 and +fours times on page 3, and \gls[counter=section]{bird} is used once in + + + +section 3, then the total record count (stored in the recordcount field) is +2 + 1 + 4 + 1 = 8, the total for the page counter (stored in the recordcount.page +field) is 2 + 1 + 4 = 7, and the total for the section counter (stored in the +recordcount.section field) is 1. +

With the unit counting on as well, the field recordcount.page.1 is set to +2, recordcount.page.2 is set to 1, recordcount.page.3 is set to 4 and +recordcount.section.3 is set to 1. +

You can access these fields using the following commands which will expand to +the field value if set or to 0 if unset: +


\GlsXtrTotalRecordCount  \GlsXtrTotalRecordCount{label}

+

+This expands to the total record count for the entry given by ⟨label⟩. + + + +

+
+\GlsXtrTotalRecordCount{bird} +
+

expands to 8. +


\GlsXtrRecordCount  \GlsXtrRecordCount{label}{counter}

+

+This expands to the counter total for the entry given by ⟨label⟩ where ⟨counter⟩ is the +counter name. For example: + + + +

+
+\GlsXtrRecordCount{bird}{page} +
+

expands to 7 and + + + +

+
+\GlsXtrRecordCount{bird}{section} +
+

expands to 1. +


\GlsXtrLocationRecordCount  \GlsXtrLocationRecordCount{label}{counter} +{location}

+

+This expands to the total for the given location. For example + + + +

+
+\GlsXtrLocationRecordCount{bird}{page}{3} +
+

expands to 4. Be careful about using \thepage in the ⟨location⟩ part. Remember that +due to TEX’s asynchronous output routine, \thepage may not be correct. +

There are commands analogous to the entry counting commands like \cgls +and \cglsformat that are triggered by the record count. These are listed +below. +


\rgls  \rglsmodifier[options]{label}[insert]

+

+


\rglspl  \rglsplmodifier[options]{label}[insert]

+

+


\rGls  \rGlsmodifier[options]{label}[insert]

+

+


\rGlspl  \rGlsplmodifier[options]{label}[insert]

+

+


\rGLS  \rGLSmodifier[options]{label}[insert]

+

+


\rGLSpl  \rGLSplmodifier[options]{label}[insert]

+

+These commands check the recordcount attribute which, if set, should be a number. +For example: + + + +

+
+\glssetcategoryattribute{abbreviation}{recordcount}{1} +
+

For convenience, you can use +


\GlsXtrSetRecordCountAttribute  \GlsXtrSetRecordCountAttribute{category +list}{n}

+

+to set the recordcount attribute to ⟨n⟩ for all the categories listed in ⟨category +list⟩. +

The \rgls-like commands use +


\glsxtrifrecordtrigger  \glsxtrifrecordtrigger{label}{trigger code} +{normal}

+

+to determine whether the \rgls-like command should behave like its \gls +counterpart (⟨normal⟩) or whether it should instead use ⟨trigger code⟩. +

This command checks if the recordcount attribute is set. If not is just does +⟨normal⟩, otherwise it tests if +


\glsxtrrecordtriggervalue  \glsxtrrecordtriggervalue{label}

+

+is greater than the value given in the recordcount attribute for that entry’s category. +If true, this does ⟨normal⟩ otherwise it does ⟨trigger code⟩. The default definition of the +trigger value command is: + + + +

+
+\newcommand*{\glsxtrrecordtriggervalue}[1]{% + 
 \GlsXtrTotalRecordCount{#1}% + 
} +
+

The ⟨trigger code⟩ part writes a record with the format set to glstriggerrecordformat +(which bib2gls v1.1+ recognises as a special type of ignored location format) and +does ⟨trigger format⟩. Then it unsets the first use flag. Note that it doesn’t implement +the post-link hook. This ensures that the record count is correct on the next +run. +

The ⟨trigger format⟩ depends on the \rgls-like command used and will be one of +the following: +


\rglsformat  \rglsformat{label}{insert}

+

+


\rglsplformat  \rglsplformat{label}{insert}

+

+


\rGlsformat  \rGlsformat{label}{insert}

+

+


\rGlsplformat  \rGlsplformat{label}{insert}

+

+


\rGLSformat  \rGLSformat{label}{insert}

+

+


\rGLSplformat  \rGLSplformat{label}{insert}

+

+These all behave much like their \cglsformat counterparts. If the entry’s regular +attribute is set or if the entry doesn’t have a long form, the first or first plural is +used, otherwise the long or long plural form is used. +

You can use +


\glsxtrenablerecordcount  \glsxtrenablerecordcount

+

+to redefine \gls, \glspl, \Gls, \Glspl, \GLS, \GLSpl to \rgls, \rglspl, \rGls, +\rGlspl, \rGLS, \rGLSpl, respectively, for convenience. +

If you don’t want the entries that use ⟨trigger code⟩ to appear in the glossary, you +need to use the resource option trigger-type to assign them to another glossary. +For example: + + + +

+
+\documentclass{article} + 
\usepackage[record]{glossaries-extra} + 
\newignoredglossary{ignored} + 
\GlsXtrLoadResources[ + 
 src=example-glossaries-acronym, + 
 trigger-type=ignored, + 
 category=abbreviation + 
] + 
\glsxtrenablerecordcount + 
\GlsXtrSetRecordCountAttribute{abbreviation}{1} + 
\begin{document} + 
\gls{lid}.  \gls{stc}. \gls{lid}.  \gls{aeu}. + 
\gls{upa}. \gls{aeu}. + 
\printunsrtglossaries + 
\end{document} +
+

In the above, stc and upa both only have one record, so they are assigned to the +ignored glossary instead of the main one. + + + +

+

+

Top

10. Miscellaneous New Commands

+

The glossaries package provides \glsrefentry entry to cross-reference entries +when used with the entrycounter or subentrycounter options. The glossaries-extra +package provides a supplementary command +


\glsxtrpageref  \glsxtrpageref{label}

+

+that works in the same way except that it uses \pageref instead of \ref. +

You can copy an entry to another glossary using +


\glsxtrcopytoglossary  \glsxtrcopytoglossary{entry-label}{glossary-type} +

+

+This appends ⟨entry-label⟩ to the end of the internal list for the glossary given by +⟨glossary-type⟩. Be careful if you use the hyperref package as this may cause duplicate +hypertargets. You will need to change \glolinkprefix to another value or disable +hyperlinks when you display the duplicate. Alternatively, use the new target key to +switch off the targets: + + + +

+
+\printunsrtglossary[target=false] +
+

+

The glossaries package allows you to set preamble code for a given glossary +type using \setglossarypreamble. This overrides any previous setting. +With glossaries-extra (as from v1.12) you can instead append to the preamble +using +


\apptoglossarypreamble  \apptoglossarypreamble[type]{code}

+

+or prepend using +


\pretoglossarypreamble  \pretoglossarypreamble[type]{code}

+

+

+

Top

10.1 Entry Fields

+

A field may now be used to store the name of a text-block command that takes a +single argument. The field is given by +


\GlsXtrFmtField  \GlsXtrFmtField

+

+The default value is useri. Note that the value must be the control sequence name +without the initial backslash. +

For example: + + + +

+
+\newcommand*{\mtx}[1]{\boldsymbol{#1}} + 
\newcommand*{\mtxinv}[1]{\mtx{#1}\sp{-1}} + 
\newglossaryentry{matrix}{% + 
  name={matrix}, + 
  symbol={\ensuremath{\mtx{M}}}, + 
  plural={matrices}, + 
  user1={mtx}, + 
  description={rectangular array of values} + 
} + 
\newglossaryentry{identitymatrix}{% + 
  name={identity matrix}, + 
  symbol={\ensuremath{\mtx{I}}}, + 
  plural={identity matrices}, + 
  description={a diagonal matrix with all diagonal elements equal to + 
1 and all other elements equal to 0} + 
} + 
\newglossaryentry{matrixinv}{% + 
  name={matrix inverse}, + 
  symbol={\ensuremath{\mtxinv{M}}}, + 
  user1={mtxinv}, + 
  description={a square \gls{matrix} such that + 
   $\mtx{M}\mtxinv{M}=\glssymbol{identitymatrix}$} + 
} +
+

+

There are two commands provided that allow you to apply the command to an +argument: +


\glsxtrfmt  \glsxtrfmt[options]{label}{text}

+

+This effectively does

+
+\glslink[default-options,options]{label}{\glsxtrfmtdisplay +{cs name}{text}{}} +
+
where ⟨cs name⟩ is the control sequence name supplied in the provided field, which +must be defined to take a single required argument. Although it effectively acts like +\glslink it misses out the post-link hook. +

The default ⟨default-options⟩ are given by + + + +


\GlsXtrFmtDefaultOptions  \GlsXtrFmtDefaultOptions

+

+This is defined as noindex but may be redefined as appropriate. Note that the +replacement text of \GlsXtrFmtDefaultOptions is prepended to the optional +argument of \glslink. +

As from version 1.23, there’s also a starred version of this command that has a +final optional argument: +


\glsxtrfmt*  \glsxtrfmt*[options]{label}{text}[insert]

+

+Both the starred and unstarred versions use: +


\glsxtrfmtdisplay  \glsxtrfmtdisplay{cs name}{text}{insert} +

+

+within the link text. In the case of the unstarred version ⟨insert⟩ will be empty. It will +also be empty if the final option argument is missing from the starred form. If the +entry given by ⟨label⟩ is undefined \glsxtrfmt and \glsxtrfmt* will issue an error (or +warning if undefaction=warn). There won’t be a warning or error if the entry is +defined by the given field is missing. In either case, (the entry is undefined or the field +is missing) ⟨cs name⟩ will be @firstofone otherwise it will be the field value. The +default definition is: + + + +

+
+\newcommand{\glsxtrfmtdisplay}[3]{\csuse{#1}{#2}#3} +
+

which puts ⟨text⟩ inside the argument of the control sequence and ⟨insert⟩ outside it +(but it will still be inside the link text). +

Remember that nested links cause a problem so avoid using commands like \gls +or \glsxtrfmt within ⟨text⟩.
+

+

For example: + + + +

+
+\[ + 
  \glsxtrfmt{matrix}{A} + 
  \glsxtrfmt{matrixinv}{A} + 
  = + 
  \glssymbol{identitymatrix} + 
\] +
+

If the default options are set to noindex then \glsxtrfmt won’t index, but will +create a hyperlink (if hyperref has been loaded). This can be changed so that it also +suppresses the hyperlink: + + + +

+
+\renewcommand{\GlsXtrFmtDefaultOptions}{hyper=false,noindex} +
+

+

Note that \glsxtrfmt won’t work with PDF bookmarks. Instead you can +use +


\glsxtrentryfmt  \glsxtrentryfmt{label}{text}

+

+This uses \texorpdfstring and will simply expand to ⟨text⟩ within the PDF +bookmarks, but in the document it will do ⟨cs{text} if a control sequence name has +been provided or just ⟨text⟩ otherwise. +

The glossaries package provides \glsaddstoragekey to add new keys. This +command will cause an error if the key has already been defined. The glossaries-extra +package provides a supplementary command that will only define the key if it doesn’t +already exist: +


\glsxtrprovidestoragekey  \glsxtrprovidestoragekey{key}{default}{cs} +

+

+If the key has already been defined, it will still provide the command given in the +third argument ⟨cs⟩ (if it hasn’t already been defined). Unlike \glsaddstoragekey, ⟨cs⟩ +may be left empty if you’re happy to just use \glsfieldfetch to fetch the value of +this new key. +

You can test if a key has been provided with: +


\glsxtrifkeydefined  \glsxtrifkeydefined{key}{true}{false}

+

+This tests if ⟨key⟩ is available for use in the ⟨key⟩= list in the second argument of +\newglossaryentry (or the optional argument of commands like \newabbreviation). +The corresponding field may not have been set for any of the entries if no default was +provided. +

There are now commands provided to set individual fields. Note that +these only change the specified field, not any related values. For example, +changing the value of the text field won’t update the plural field. There are also +some fields that should really only be set when entries are defined (such as +the parent field). Unexpected results may occur if they are subsequently +changed. +


\GlsXtrSetField  \GlsXtrSetField{label}{field}{value}

+

+Sets the field given by ⟨field⟩ to ⟨value⟩ for the entry given by ⟨label⟩. No expansion is +performed. It’s not necessary for the field to have been defined as a key. You can +access the value later with \glsxtrusefield. Note that \glsxtrifkeydefined only +tests if a key has been defined for use with commands like \newglossaryentry. If a +field without a corresponding key is assigned a value, the key remains undefined. This +command is robust. + + + +

\GlsXtrSetField uses +


\glsxtrsetfieldifexists  \glsxtrsetfieldifexists{label}{field}{code} +

+

+where ⟨label⟩ is the entry label and ⟨code⟩ is the assignment code. +

This command just uses \glsdoifexists{label}{code} (ignoring the +⟨field⟩ argument), so by default it causes an error if the entry doesn’t exist. +This can be changed to a warning with undefaction=warn. You can redefine +\glsxtrsetfieldifexists to simply do ⟨code⟩ if you want to skip the existence check. +Alternatively you can instead use +


\glsxtrdeffield  \glsxtrdeffield{label}{field}arguments{replacement +text}

+

+This simply uses etoolbox’s \csdef without any checks. This command +isn’t robust. There is also a version that uses \protected@csedef +instead:10.1 +


\glsxtredeffield  \glsxtredeffield{label}{field}arguments{replacement +text}

+

+


\gGlsXtrSetField  \gGlsXtrSetField{label}{field}{value}

+

+As \GlsXtrSetField but globally. +


\eGlsXtrSetField  \eGlsXtrSetField{label}{field}{value}

+

+As \GlsXtrSetField but uses protected expansion. +


\xGlsXtrSetField  \xGlsXtrSetField{label}{field}{value}

+

+As \gGlsXtrSetField but uses protected expansion. +


\GlsXtrLetField  \GlsXtrLetField{label}{field}{cs}

+

+Sets the field given by ⟨field⟩ to the replacement text of ⟨cs⟩ for the entry given by ⟨label⟩ +(using \let). +


\csGlsXtrLetField  \csGlsXtrLetField{label}{field}{cs name} +

+

+As \GlsXtrLetField but the control sequence name is supplied instead. +


\GlsXtrLetFieldToField  \GlsXtrLetFieldToField{label-1}{field-1} +{label-2}{field-2}

+

+Sets the field given by ⟨field-1⟩ for the entry given by ⟨label-1⟩ to the field given by +⟨field-2⟩ for the entry given by ⟨label-2⟩. There’s no check for the existence of ⟨label-2⟩, +but \glsxtrsetfieldifexists{label-1}{field-1}{code} is still used, as for +\GlsXtrSetField. +

The glossaries package provides \ifglshasfield to determine if a field has been +set. The glossaries-extra package provides a simpler version: + + + +


\glsxtrifhasfield  \glsxtrifhasfield{field}{label}{true}{false} +

+

+(New to v1.19.) Note that in this case the ⟨field⟩ must be the internal field label (for +example, useri rather than user1). Unlike \ifglshasfield, this version +doesn’t complain if the entry (given by ⟨label⟩) or the field don’t exist and +will simply do ⟨false⟩. If the field does exist for the given entry and it’s not +empty, the ⟨true⟩ part is done otherwise it does ⟨false⟩. Within ⟨true⟩ you may +use +


\glscurrentfieldvalue  \glscurrentfieldvalue

+

+to access the field value. This command includes grouping which scopes the ⟨true⟩ and +⟨false⟩ parts. The starred version +


\glsxtrifhasfield*  \glsxtrifhasfield*{field}{label}{true}{false} +

+

+omits the implicit grouping. +

Be careful of keys that use \relax as the default value (such as the symbol). Use +\ifglshassymbol instead.
+

+

There is also a version that simply uses \ifcsundef. It doesn’t save the field +value, but can be used if you only need to check if the field is defined without +accessing it: +


\GlsXtrIfFieldUndef  \GlsXtrIfFieldUndef{field}{label}{true}{false} +

+

+

There’s a difference between an undefined field and an unset field. An undefined +field hasn’t been assigned any value (no associated internal control sequence +has been defined). If a defined field has been defined to empty, then it’s +considered unset. \GlsXtrIfFieldUndef implement ⟨false⟩ for a defined but +empty field whereas \glsxtrifhasfield and \ifglshasfield will implement +⟨false⟩ a defined but empty field. Remember that any keys that may be used +in \newglossaryentry will have a default value if not provided. In many +cases, the default value is empty, so only use \GlsXtrIfFieldUndef for +fields that can only be defined through commands like \GlsXtrSetField. +
+

+

You can test if a field value equals a string using +


\GlsXtrIfFieldEqStr  \GlsXtrIfFieldEqStr{field}{label}{text}{true} +{false}

+

+If the entry exists and has the given field set to the given text then this does ⟨true⟩ +otherwise it does ⟨false⟩. This uses \glsxtrifhasfield to test if the field exists and + + + +then compares the replacement text of \glscurrentfieldvalue with ⟨text⟩ using +etoolbox’s \ifdefstring. Version 1.39 introduced a starred form of this command, +which uses the starred form of \glsxtrifhasfield. +

As from version 1.31, there’s a similar command: +


\GlsXtrIfFieldEqXpStr  \GlsXtrIfFieldEqXpStr{field}{label}{text} +{true}{false}

+

+This is like \GlsXtrIfFieldEqStr but first (protected) fully expands ⟨text⟩ (but not +the field value). If you want to compare the (protected) full expansion of both the +field value and ⟨text⟩ use: +


\GlsXtrIfXpFieldEqXpStr  \GlsXtrIfXpFieldEqXpStr{field}{label}{text} +{true}{false}

+

+Again, version 1.39 introduced a starred form of these commands, which use the +starred form of \glsxtrifhasfield. +

As from v1.31, if a field represents a numeric (integer) value, you can use the +following two numeric tests. If the field is set, it must expand to an integer. You may +use \glscurrentfieldvalue within ⟨true⟩ or ⟨false⟩ to access the actual value. Both +⟨true⟩ and ⟨false⟩ are scoped. If the field is undefined or empty, the value is assumed to +be 0, and \glscurrentfieldvalue is set accordingly. As from version 1.39, these +numeric tests have starred versions. The unstarred versions add implicit grouping. +The starred versions don’t. +

To test if the value is non-zero: +


\GlsXtrIfFieldNonZero  \GlsXtrIfFieldNonZero{field}{label}{true} +{false}

+

+Alternatively, you can test if the field expands to a specific number using: +


\GlsXtrIfFieldEqNum  \GlsXtrIfFieldEqNum{field}{label}{n}{true} +{false}

+

+This does ⟨true⟩ if the field value equals ⟨n⟩ (using \ifnum for the comparison) +otherwise it does ⟨false⟩. For a more general numeric comparison you can +use: +


\GlsXtrIfFieldCmpNum  \GlsXtrIfFieldCmpNum{field}{label}{comparison} +{n}{true}{false}

+

+where ⟨comparison⟩ is one of =, < or >. +

The glossaries package provides \glsfieldfetch which can be used to fetch the +value of the given field and store it in a control sequence. The glossaries-extra package +provides another way of accessing the field value: +


\glsxtrusefield  \glsxtrusefield{entry-label}{field-label}

+

+This works in the same way as commands like \glsentrytext but the field label is +specified in the first argument. Note that the ⟨field-label⟩ corresponds to the internal +field tag, which isn’t always the same as the key name. See Table 4.1 of the glossaries +manual. No error occurs if the entry or field haven’t been defined. This command is + + + +not robust. +

There is also a version that converts the first letter to uppercase (analogous to +\Glsentrytext): +


\Glsxtrusefield  \Glsxtrusefield{entry-label}{field-label}

+

+and, as from v1.37, a command that converts the entire value to upper case: +


\GLSxtrusefield  \GLSxtrusefield{entry-label}{field-label}

+

+

If you want to use a field to store a list that can be used as an etoolbox internal +list, you can use the following command that adds an item to the field using +etoolbox’s \listcsadd: +


\glsxtrfieldlistadd  \glsxtrfieldlistadd{label}{field}{item} +

+

+where ⟨label⟩ is the entry’s label, ⟨field⟩ is the entry’s field and ⟨item⟩ is the item to +add. There are analogous commands that use \listgadd, \listeadd and +\listxadd: +


\glsxtrfieldlistgadd  \glsxtrfieldlistgadd{label}{field}{item} +

+

+


\glsxtrfieldlisteadd  \glsxtrfieldlisteadd{label}{field}{item} +

+

+


\glsxtrfieldlistxadd  \glsxtrfieldlistxadd{label}{field}{item} +

+

+You can then iterate over the list using: +


\glsxtrfielddolistloop  \glsxtrfielddolistloop{label}{field} +

+

+or +


\glsxtrfieldforlistloop  \glsxtrfieldforlistloop{label}{field} +{handler}

+

+that internally use \dolistcsloop and \forlistloop, respectively. +

There are also commands that use \ifinlistcs: +


\glsxtrfieldifinlist  \glsxtrfieldifinlist{label}{field}{item}{true} +{false}

+

+and \xifinlistcs +


\glsxtrfieldxifinlist  \glsxtrfieldxifinlist{label}{field}{item} +{true}{false}

+ + + +

+

See the etoolbox’s user manual for further details of these commands, in particular +the limitations of \ifinlist. +

If the field has a comma-separated list value instead, you can iterate over it +using: +


\glsxtrforcsvfield  \glsxtrforcsvfield{label}{field}{handler} +

+

+where again ⟨handler⟩ is a control sequence that takes a single argument. Unlike the +etoolbox loops, this doesn’t ignore empty elements nor does it discard leading / +trailing spaces. Internally it uses \@for (modified by xfor which is automatically +loaded by glossaries). The xfor package modifies the behaviour of \@for to allow the +loop to be broken prematurely using \@endfortrue. The \glsxtrforcsvfield +command locally defines a user level command: +


\glsxtrendfor  \glsxtrendfor

+

+which is just a synonym for \@endfortrue. +

The loop is performed within the true part of \glsxtrifhasfield so scoping is +automatically applied. +

As from version 1.32, if the field given by +


\GlsXtrForeignTextField  \GlsXtrForeignTextField

+

+(which defaults to userii) contains a locale tag, then +


\GlsXtrForeignText  \GlsXtrForeignText{entry label}{text}

+

+can be used to encapsulate ⟨text⟩ in \foreignlanguage{dialect}{text} where ⟨dialect⟩ is +obtained from the locale tag through tracklang’s \GetTrackedDialectFromLanguageTag +command. You need at least tracklang v1.3.6 for this to work properly. The ⟨dialect⟩ +must be one that’s tracked (which typically means that babel or polyglossia has been +loaded with the appropriate setting for that language). If \foreignlanguage hasn’t +been defined, this just does ⟨text⟩. For example: + + + +

+
+\documentclass{article} + 
\usepackage[main=british,brazilian,ngerman]{babel} + 
\usepackage{glossaries-extra} + 
\setabbreviationstyle{long-short-user} + 
\newabbreviation + 
 [user1={Associa\c{c}\~ao Brasileria de Normas T\'ecnicas}, + 
  user2= {pt-BR} + 
 ] + 
 {abnt}{ABNT}{Brazilian National Standards Organization} + 
\newabbreviation + 
 [user1={Deutsches Institut f\"ur Normung e.V.}, + 
  user2={de-DE-1996}] + 
 {din}{DIN}{German Institute for Standardization} + 
\renewcommand*{\glsxtruserparen}[2]{% + 
  \glsxtrfullsep{#2}% + 
  \glsxtrparen + 
  {#1% + 
   \ifglshasfield{\glsxtruserfield}{#2}% + 
   {, \emph{\GlsXtrForeignText{#2}{\glscurrentfieldvalue}}}% + 
   {}% + 
  }% + 
} + 
\begin{document} + 
\gls{abnt}, \gls{din}. + 
\end{document} +
+

+

When using the record option, in addition to recording the usual location, you can +also record the current value of another counter at the same time using the +preamble-only command: +


\GlsXtrRecordCounter  \GlsXtrRecordCounter{counter name}

+

+For example: + + + +

+
+\usepackage[record]{glossaries-extra} + 
\GlsXtrRecordCounter{section} +
+

Each time an entry is referenced with commands like \gls or \glstext, +the .aux file will not only contain the \glsxtr@record command but also +

+
+\glsxtr@counterrecord{label}{section}{n} +
+
where ⟨n⟩ is the current expansion of \thesection and ⟨label⟩ is the entry’s +label. On the next run, when the .aux file is run, this command will do +
+
+\glsxtrfieldlistgadd{label}{record.counter}{n} +
+
In the above example, if \gls{bird} is used in section 1.2 this would be + + + +
+\glsxtrfieldlistgadd{bird}{record.section}{1.2} +
+

Note that there’s no key corresponding to this new record.section field, but its +value can be accessed with \glsxtrfielduse or the list can be iterated over with +\glsxtrfielddolistloop etc. +

+

+

Top

10.2 Display All Entries Without Sorting or Indexing

+


\printunsrtglossary  \printunsrtglossary[options]

+

+This behaves like \printnoidxglossary but never sorts the entries and +always lists all the defined entries for the given glossary (and doesn’t require +\makenoidxglossaries). If you want to use one of the tabular-like styles with +\printunsrtglossary, make sure you load glossaries-extra-stylemods which modifies +the definition of \glsgroupskip to avoid the “Incomplete \iftrue” error that may +otherwise occur. +

There’s also a starred form +


\printunsrtglossary*  \printunsrtglossary*[options]{code}

+

+which is equivalent to

+
+\begingroup +
 code\printunsrtglossary[options]% +
\endgroup +
+
Note that unlike \glossarypreamble, the supplied ⟨code⟩ is done before the glossary +header. +

This means you now have the option to simply list all entries on the first +LATEX run without the need for a post-processor, however there will be no number +list in this case, as that has to be set by a post-processor such as bib2gls (see §9 +bib2gls: Managing Reference Databases). +

No attempt is made to gather hierarchical elements. If child entries aren’t defined +immediately after their parent entry, they won’t be together in the glossary when +using \printunsrtglossary.
+

+ + + +

There’s a difference in behaviour depending on whether or not the group key is +defined. If not defined (default), the group label will be formed from the first +letter of the name field. The corresponding group title will be obtained as +discussed in §2.12 Glossary Style Modifications. This can lead to an odd effect if +you are using a style that separates letter groups when the ordering isn’t +alphabetical. +

If the group key is defined (which it is with the record option) then the group label +will be obtained from the value of that field. If the field is empty, no grouping is +performed, even if the style supports it. (That is, there won’t be a header or a vertical +separation.) If the group field is non-empty, then the corresponding title is obtained +as described earlier. +

If you want to use a different field, you can redefine +


\glsxtrgroupfield  \glsxtrgroupfield

+

+to the relevant internal field label, but the group key must still be defined (through +the record option or with commands like \glsaddstoragekey) to ensure that +\printunsrtglossary uses \glsxtrgroupfield. (This method is used by bib2gls +for secondary entries, which have the group label stored in the secondarygroup +internal field.) +

If you have any entries with the see key set, you will need the glossaries package +option seenoindex=ignore or seenoindex=warn to prevent an error occurring from the +automated \glssee normally triggered by this key. The record=only package option +will automatically deal with this. +

For example: + + + +

+
+\documentclass{article} + 
\usepackage{glossaries-extra} + 
\newglossaryentry{zebra}{name={zebra},description={stripy animal}} + 
\newglossaryentry{ant}{name={ant},description={an insect}} + 
\begin{document} + 
\gls{ant} and \gls{zebra} + 
\printunsrtglossaries + 
\end{document} +
+

In the above, zebra will be listed before ant as it was defined first. +

If you allow document definitions with the docdefs option, the document will +require a second LATEX run if the entries are defined after \printunsrtglossary. +

The optional argument is as for \printnoidxglossary (except for the sort key, +which isn’t available). +

All glossaries may be displayed in the order of their definition using: +


\printunsrtglossaries  \printunsrtglossaries

+

+which is analogous to \printnoidxglossaries. This just iterates over all defined +glossaries (that aren’t on the ignored list) and does \printunsrtglossary[type=⟨type⟩]. +

To avoid complications caused by tabular-like glossary styles, \printunsrtglossary +iterates over all entries in the selected glossary and appends the appropriate code to +an internal command. Once the construction of this command is complete, then it’s +performed to display the glossary. This puts the loop outside the style code. For +convenience, there’s a hook used within the loop: +


\printunsrtglossaryentryprocesshook  \printunsrtglossaryentryprocesshook +{label}

+

+This hook should not display any content, but may be used to perform calculations. +For example, to calculate widths. Within this hook you can use: +


\printunsrtglossaryskipentry  \printunsrtglossaryskipentry

+

+to skip the current entry. This will prevent the entry from being added to the internal +command. +

There’s another hook immediately before the internal command containing the +glossary code is performed: +


\printunsrtglossarypredoglossary  \printunsrtglossarypredoglossary +

+

+ + + +

The internal command uses +


\printunsrtglossaryhandler  \printunsrtglossaryhandler{label} +

+

+to display each item in the list, where ⟨label⟩ is the current label. +

By default the handler just does +


\glsxtrunsrtdo  \glsxtrunsrtdo{label}

+

+which determines whether to use \glossentry or \subglossentry and checks the +location and loclist fields for the number list. If you want to use a different field to be +used instead of location then redefine: +


\GlsXtrLocationField  \GlsXtrLocationField

+

+to the internal name of the desired field. For example: + + + +

+
+\renewcommand{\GlsXtrLocationField}{primarylocation} +
+

+

Note that if the given location field is undefined or unset, the handler will +fallback on the loclist field.
+

+You can instruct bib2gls to omit setting the loclist field with the resource option +--save-loclist=false to prevent it from being used as a fallback. +

You can redefine the handler if required. For example, you may want to filter +entries according to the category label. You can test if a label is contained in a +comma-separated list of labels using: +


\glsxtriflabelinlist  \glsxtriflabelinlist{label}{label list}{true} +{false}

+

+The ⟨label⟩ and ⟨label list⟩ will be fully expanded. +

If you redefine the handler to exclude entries, you may end up with an empty +glossary. This could cause a problem for the list-based styles.
+

+

For example, if the preamble includes: + + + +

+
+\usepackage[record,style=index]{glossaries-extra} + 
\GlsXtrRecordCounter{section} +
+

then you can print the glossary but first redefine the handler to only select entries +that include the current section number in the record.section field: + + + +

+
+\renewcommand{\printunsrtglossaryhandler}[1]{% + 
  \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + 
  {\glsxtrunsrtdo{#1}}% + 
  {}% + 
} +
+

+

Alternatively you can use the starred form of \printunsrtglossary which will +localise the change: + + + +

+
+\printunsrtglossary*{% + 
  \renewcommand{\printunsrtglossaryhandler}[1]{% + 
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + 
    {\glsxtrunsrtdo{#1}}% + 
    {}% + 
  }% + 
} +
+

+

If you are using the hyperref package and want to display the same glossary more +than once, you can also add a temporary redefinition of \glolinkprefix to avoid +duplicate hypertarget names. For example: + + + +

+
+\printunsrtglossary*{% + 
  \renewcommand{\printunsrtglossaryhandler}[1]{% + 
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + 
    {\glsxtrunsrtdo{#1}}% + 
    {}% + 
  }% + 
  \ifcsundef{theHsection}% + 
  {% + 
    \renewcommand*{\glolinkprefix}{record.\csuse{thesection}.}% + 
  }% + 
  {% + 
    \renewcommand*{\glolinkprefix}{record.\csuse{theHsection}.}% + 
  }% + 
} +
+

Note that this will cause a problem if your descriptions contain commands like \gls +that need to link an entry that doesn’t appear in the summary. In this case, it’s a +better approach to use: + + + +

+
+\printunsrtglossary*{% + 
  \renewcommand{\printunsrtglossaryhandler}[1]{% + 
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + 
    {\glsxtrunsrtdo{#1}}% + 
    {}% + 
  }% + 
  \ifcsundef{theHsection}% + 
  {% + 
    \setkeys{printgloss}{targetnameprefix={record.\csuse{thesection}.}}% + 
  }% + 
  {% + 
    \setkeys{printgloss}{targetnameprefix={record.\csuse{theHsection}.}}% + 
  }% + 
} +
+

+

If it’s a short summary at the start of a section, you might also want to suppress +the glossary header and add some vertical space afterwards: + + + +

+
+\printunsrtglossary*{% + 
  \renewcommand{\printunsrtglossaryhandler}[1]{% + 
    \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + 
    {\glsxtrunsrtdo{#1}}% + 
    {}% + 
  }% + 
  \ifcsundef{theHsection}% + 
  {% + 
    \renewcommand*{\glolinkprefix}{record.\csuse{thesection}.}% + 
  }% + 
  {% + 
    \renewcommand*{\glolinkprefix}{record.\csuse{theHsection}.}% + 
  }% + 
  \renewcommand*{\glossarysection}[2][]{}% + 
  \appto\glossarypostamble{\glspar\medskip\glspar}% + 
} +
+

+

There’s a shortcut command that essentially does this: +


\printunsrtglossaryunit  \printunsrtglossaryunit[options]{counter +name}

+

+The above example can simply be replaced with: + + + +

+
+\printunsrtglossaryunit{section} +
+

+

This shortcut command is actually defined to use \printunsrtglossary* +with +


\printunsrtglossaryunitsetup  \printunsrtglossaryunitsetup{counter +name}

+

+so if you want to just make some minor modifications you can do + + + +

+
+\printunsrtglossary*{\printunsrtglossaryunitsetup{section}% + 
  \renewcommand*{\glossarysection}[2][]{\subsection*{Summary}}% + 
} +
+

which will start the list with a subsection header with the title “Summary” +(overriding the glossary’s title). +

Note that this shortcut command is only available with the record (or +record=alsoindex) package option. +

This temporary change in the hypertarget prefix means you need to explicitly use +\hyperlink to create a link to it as commands like \gls will try to link to the target +created with the default definition of \gloslinkprefix. This isn’t a problem if you +want a primary glossary of all terms produced using just \printunsrtglossary (in +the front or back matter) which can be the target for all glossary references and then +just use \printunsrtglossaryunit for a quick summary at the start of a section +etc. +

+

+

Top

10.3 Standalone Entry Items

+

It may be that you don’t want a list but would rather display entry details +throughout the document. You can simply do \glsentryname followed by +\glsentrydesc. (Remember that if you don’t want a sorted list, use sort=none to +skip the construction of the sort field.) For example, in the preamble provide a +custom command: + + + +

+
+\newcommand{\displayterm}[1]{% + 
 \par\medskip\par\noindent + 
 Definition: \glsentryname{#1}.\par + 
 \glsentrydesc{#1} + 
 \par\medskip + 
} +
+

define your entries + + + +

+
+\newglossaryentry{function}{name={function}, + 
  description={a relation or expression involving variables} + 
} +
+

and then later in the text: + + + +

+
+\displayterm{function} +
+

+

However, if may be that you want to use hyperref and have commands like \gls +link back to the place where the term is described. Instead of using \glsentryname +use +


\glsxtrglossentry  \glsxtrglossentry{label}

+

+where ⟨label⟩ is the entry’s label. +

This is designed to behave much like the way the name is displayed in the +glossary. It performs the following:

+
    +
  • Defines \glscurrententrylabel to the entry’s label. This is usually + done at the start of the glossary style commands \glossentry and + \subglossentry and may be used by hooks, such as the post-name + hooks. Here the definition is localised so that it’s only available for use in + \glossentryname. +
  • +
  • Defines \currentglossary to the entry’s glossary type. This is usually done at + the start of commands like \printglossary and may be used by style hooks. + Here the definition is localised so that it’s only available for use in + \glsentryitem and \glssubentryitem. The value is obtained by fully + expanding: +


    \GlsXtrStandaloneGlossaryType  \GlsXtrStandaloneGlossaryType +

    +

    + which defaults to the value of the type field for the current entry. +

  • +
  • Increments and display the entry counters if the entrycounter or subentrycounter + package options are set. If the entry doesn’t have a parent, then this + does +
      +
    • \glsentryitem{label}
    +

    otherwise it does (as from v1.31)

    +
      +
    • \GlsXtrStandaloneSubEntryItem + {label} which defaults to \glssubentryitem{label} if the entry has + a parent but not a grandparent.
    + + + +

    This reflects the behaviour of the predefined hierarchical styles. A bug in + pre-version 1.31 used \glsentryitem for all child levels, which doesn’t match + the hierarchical glossary styles. If you want to restore this behaviour, just + do: + + + +

    +
    + \renewcommand*{\GlsXtrStandaloneSubEntryItem}[1]{\glssubentryitem{#1}} +
    +

    +

  • +
  • Sets the hyper-target if supported (using \glstarget) and displays the entry + name using: +


    \GlsXtrStandaloneEntryName  \GlsXtrStandaloneEntryName{label} +

    +

    + which uses \glstarget{label}{\glossentryname{label}} by default. + Remember that \glossentryname uses \glsnamefont or picks up the style + from category attributes such as glossnamefont.

+

If you have used \nopostdesc or \glsxtrnopostpunc in any of your description fields, +you can use +


\glsxtractivatenopost  \glsxtractivatenopost

+

+to make these commands behave as they normally do within a glossary. This needs to +be placed before

+
+\glossentrydesc{label}\glspostdescription +
+
and scoped. Note that \glsnonextpages and \glsnextpages have no effect outside +of the glossary and are not intended for use in a standalone context. +

It’s also possible to select a different field (rather than using name): +


\glsxtrglossentryother  \glsxtrglossentryother{header}{label}{field} +

+

+The ⟨field⟩ must be given using its internal field label which may not be the same as +the key used to set the field. See the key to field mappings table in the glossaries user +manual. The ⟨header⟩ argument is the code to pass to the third argument of +\glsxtrtitleorpdforheading. It may be left empty in which case the default is +determined as follows:

+
    +
  • If \glsxtrheadfield⟩ is defined, then ⟨header⟩ is \glsxtrheadfield⟩ + {label}. + + + +
  • +
  • Otherwise ⟨header⟩ is simply the field value.
+

The \glsxtrglossentryother command internally uses +


\GlsXtrStandaloneEntryOther  \GlsXtrStandaloneEntryOther{label}{field} +

+

+instead of \GlsXtrStandaloneEntryName, which uses \glossentrynameother{label} +{field} instead of \glossentryname{label}. +

If you have loaded the glossaries-accsupp package (through the accsupp option) +then accessibility support will be provided if there’s a corresponding command +

+
+\glsfieldaccessdisplay{text}{label} +
+
(for example, \glssymbolaccessdisplay). +

This means that my custom command can be changed to: + + + +

+
+\newcommand{\displayterm}[1]{% + 
 \par\medskip\par\noindent + 
 Definition: \glsxtrglossentry{#1}.\par + 
 \glsentrydesc{#1} + 
 \par\medskip + 
} +
+

If I want numbered definitions, then I can use the package options entrycounter or +subentrycounter and remove the colon: + + + +

+
+\newcommand{\displayterm}[1]{% + 
 \par\medskip\par\noindent + 
 Definition \glsxtrglossentry{#1}.\par + 
 \glsentrydesc{#1} + 
 \par\medskip + 
} +
+

The counter label uses a dot after the number by default but this can be changed to +a colon: + + + +

+
+\renewcommand*{\glsentrycounterlabel}{\theglossaryentry:\space} +
+

It’s now possible to not only use \gls to link back to the definition but also use +\glsrefentry to reference the counter and \glsxtrpageref to reference the page +number. +

If I want the description to behave more like it does in a glossary in need to make +the following modification: + + + +

+
+\newcommand{\displayterm}[1]{% + 
 \par\medskip\par\noindent + 
 Definition \glsxtrglossentry{#1}.\par + 
 \begingroup + 
  \glsxtractivatenopost + 
  \glossentrydesc{#1}\glspostdescription + 
 \endgroup + 
 \par\medskip + 
} +
+

(Note the grouping to localise \glsxtractivatenopost.) +

You can also use \glsxtrglossentry within section headings. For example: + + + +

+
+\section{\glsxtrglossentry{function}} +
+

This will use \glsentryname in PDF bookmarks (if \texorpdfstring is defined) +and will use \glsxtrheadname in page headers and table of contents. (If you’re using +a page style or table of contents that doesn’t use \markright or \markbook or +\@starttoc then you need to insert \glsxtrmarkhook and \@glsxtrinmark at the +start of the header or table of contents either scoped or afterwards cancelled with +\@glsxtrnotinmark and \glsxtrrestoremarkhook.) +

+

+

Top

10.4 Entry Aliases

+

An entry can be made an alias of another entry using the alias key. The +value should be the label of the other term. There’s no check for the other’s +existence when the aliased entry is defined. This is to allow the possibility of +defining the other entry after the aliased entry. (For example, when used with +bib2gls.) +

If an entry ⟨entry-1⟩ is made an alias of ⟨entry-2⟩ then:

+
    +
  • If the see field wasn’t provided when ⟨entry-1⟩ was defined, the alias key will + automatically trigger
    +
    + \glssee{entry-1}{entry-2} +
    +
    +
  • +
  • If the hyperref package has been loaded then \gls{entry-1} will link to + ⟨entry-2⟩’s target. (Unless the targeturl attribute has been set for ⟨entry-1⟩’s + category.) +
  • +
  • With record=off or record=alsoindex, the noindex setting will automatically + be triggered when referencing ⟨entry-1⟩ with commands like \gls or + \glstext. This prevents ⟨entry-1⟩ from have a location list (aside from + the cross-reference added with \glssee) unless it’s been explicitly + indexed with \glsadd or if the indexing has been explicitly set using + noindex=false. + + + +

    Note that with record=only, the location list for aliased entries is controlled + with bib2gls’s settings.

+

The index suppression trigger is performed by +


\glsxtrsetaliasnoindex  \glsxtrsetaliasnoindex

+

+This is performed after the default options provided by \GlsXtrSetDefaultGlsOpts +have been set. With record=only, \glsxtrsetaliasnoindex will default to do +nothing. +

Within the definition of \glsxtrsetaliasnoindex you can use +


\glsxtrindexaliased  \glsxtrindexaliased

+

+to index ⟨entry-2⟩. +

The index suppression command can be redefined to index the main term instead. +For example: + + + +

+
+\renewcommand{\glsxtrsetaliasnoindex}{% + 
 \glsxtrindexaliased + 
 \setkeys{glslink}{noindex}% + 
} +
+

+

The value of the alias field can be accessed using +


\glsxtralias  \glsxtralias{label}

+

+ + + +

+

+

Top

11. Supplemental Packages

+

The glossaries bundle provides additional support packages glossaries-prefix (for +prefixing) and glossaries-accsupp (for accessibility support). These packages aren’t +automatically loaded. +

+

Top

11.1 Prefixes or Determiners

+

If prefixing is required, you can simply load glossaries-prefix after glossaries-extra. For +example: + + + +

+
+\documentclass{article} + 
\usepackage{glossaries-extra} + 
\usepackage{glossaries-prefix} + 
\makeglossaries + 
\newabbreviation + 
 [prefix={an\space}, + 
 prefixfirst={a~}] + 
 {svm}{SVM}{support vector machine} + 
\begin{document} + 
First use: \pgls{svm}. + 
Next use: \pgls{svm}. + 
\printglossaries + 
\end{document} +
+

+

+

+

Top

11.2 Accessibility Support

+

The glossaries-accsupp package needs to be loaded before glossaries-extra or through +the accsupp package option: + + + +

+
+\usepackage[accsupp]{glossaries-extra} +
+

If you don’t load glossaries-accsupp or you load glossaries-accsupp after glossaries-extra +the new \glsaccessxxx⟩ commands described below will simply be equivalent to the +corresponding \glsentryxxx⟩ commands. +

The following \glsaccessxxx⟩ commands add accessibility information wrapped +around the corresponding \glsentryxxx⟩ commands. There is no check for existence +of the entry nor do any of these commands add formatting, hyperlinks or indexing +information. +


\glsaccessname  \glsaccessname{label}

+

+This displays the value of the name field for the entry identified by ⟨label⟩. +

If the glossaries-accsupp package isn’t loaded, this is simply defined as: + + + +

+
+\newcommand*{\glsaccessname}[1]{\glsentryname{#1}} +
+

otherwise it’s defined as: + + + +

+
+\newcommand*{\glsaccessname}[1]{% + 
  \glsnameaccessdisplay + 
  {% + 
    \glsentryname{#1}% + 
  }% + 
  {#1}% + 
} +
+

(\glsnameaccessdisplay is defined by the glossaries-accsupp package.) The first +letter upper case version is: +


\Glsaccessname  \Glsaccessname{label}

+

+Without the glossaries-accsupp package this is just defined as: + + + +

+
+\newcommand*{\Glsaccessname}[1]{\Glsentryname{#1}} +
+

With the glossaries-accsupp package this is defined as: + + + +

+
+\newcommand*{\Glsaccessname}[1]{% + 
  \glsnameaccessdisplay + 
  {% + 
    \Glsentryname{#1}% + 
  }% + 
  {#1}% + 
} +
+

+

The following commands are all defined in an analogous manner. +


\glsaccesstext  \glsaccesstext{label}

+

+This displays the value of the text field. +


\Glsaccesstext  \Glsaccesstext{label}

+

+This displays the value of the text field with the first letter converted to upper +case. +


\glsaccessplural  \glsaccessplural{label}

+

+This displays the value of the plural field. +


\Glsaccessplural  \Glsaccessplural{label}

+

+This displays the value of the plural field with the first letter converted to upper +case. +


\glsaccessfirst  \glsaccessfirst{label}

+

+This displays the value of the first field. +


\Glsaccessfirst  \Glsaccessfirst{label}

+

+This displays the value of the first field with the first letter converted to upper +case. +


\glsaccessfirstplural  \glsaccessfirstplural{label}

+

+This displays the value of the firstplural field. +


\Glsaccessfirstplural  \Glsaccessfirstplural{label}

+

+This displays the value of the firstplural field with the first letter converted to upper +case. +


\glsaccesssymbol  \glsaccesssymbol{label}

+

+This displays the value of the symbol field. +


\Glsaccesssymbol  \Glsaccesssymbol{label}

+ + + +

+This displays the value of the symbol field with the first letter converted to upper +case. +


\glsaccesssymbolplural  \glsaccesssymbolplural{label}

+

+This displays the value of the symbolplural field. +


\Glsaccesssymbolplural  \Glsaccesssymbolplural{label}

+

+This displays the value of the symbolplural field with the first letter converted to +upper case. +


\glsaccessdesc  \glsaccessdesc{label}

+

+This displays the value of the description field. +


\Glsaccessdesc  \Glsaccessdesc{label}

+

+This displays the value of the description field with the first letter converted to upper +case. +


\glsaccessdescplural  \glsaccessdescplural{label}

+

+This displays the value of the descriptionplural field. +


\Glsaccessdescplural  \Glsaccessdescplural{label}

+

+This displays the value of the descriptionplural field with the first letter converted to +upper case. +


\glsaccessshort  \glsaccessshort{label}

+

+This displays the value of the short field. +


\Glsaccessshort  \Glsaccessshort{label}

+

+This displays the value of the short field with the first letter converted to upper +case. +


\glsaccessshortpl  \glsaccessshortpl{label}

+

+This displays the value of the shortplural field. +


\Glsaccessshortpl  \Glsaccessshortpl{label}

+

+This displays the value of the shortplural field with the first letter converted to upper +case. +


\glsaccesslong  \glsaccesslong{label}

+

+This displays the value of the long field. +


\Glsaccesslong  \Glsaccesslong{label}

+

+This displays the value of the long field with the first letter converted to upper +case. +


\glsaccesslongpl  \glsaccesslongpl{label}

+ + + +

+This displays the value of the longplural field. +


\Glsaccesslongpl  \Glsaccesslongpl{label}

+

+This displays the value of the longplural field with the first letter converted to upper +case. + + + +

+

+

Top

12. Sample Files

+

The following sample files are provided with this package: +

+sample.tex
Simple sample file that uses one of the dummy files provided by + the glossaries package for testing. +
+sample-abbr-styles.tex
Demonstrates all predefined abbreviation styles. +
+sample-mixture.tex
General entries, acronyms and initialisms all treated + differently. +
+sample-name-font
Categories and attributes are used to customize the way + different entries appear. +
+sample-abbrv.tex
General abbreviations. +
+sample-acronym.tex
Acronyms aren’t initialisms and don’t expand on first + use. +
+sample-acronym-desc.tex
Acronyms that have a separate long form and + description. +
+sample-crossref.tex
Unused entries that have been cross-referenced + automatically are added at the end of the document. +
+sample-indexhook.tex
Use the index hook to track which entries have been + indexed (and therefore find out which ones haven’t been indexed). +
+sample-footnote.tex
Footnote abbreviation style that moves the footnote + marker outside of the hyperlink generated by \gls and moves it after + certain punctuation characters for neatness. +
+sample-undef.tex
Warn on undefined entries instead of generating an error. +
+sample-mixed-abbrv-styles.tex
Different abbreviation styles for different + entries. + + + +
+sample-initialisms.tex
Automatically insert dots into initialisms. +
+sample-postdot.tex
Another initialisms example. +
+sample-postlink.tex
Automatically inserting text after the link-text + produced by commands like \gls (outside of hyperlink, if present). +
+sample-header.tex
Using entries in section/chapter headings. +
+sample-autoindex.tex
Using the dualindex and indexname attributes to + automatically add glossary entries to the index (in addition to the glossary + location list). +
+sample-autoindex-hyp.tex
As previous but uses hyperref. +
+sample-nested.tex
Using \gls within the value of the name key. +
+sample-entrycount.tex
Enable entry-use counting (only index if used more + than n times, see §6.1 Entry Counting (First Use Flag)). +
+sample-unitentrycount.tex
Enable use of per-unit entry-use counting (§6.1 + Entry Counting (First Use Flag)). +
+sample-onelink.tex
Using the per-unit entry counting (§6.1 Entry Counting + (First Use Flag)) to only have one hyperlink per entry per page. +
+sample-linkcount.tex
Using link counting (§6.2 Link Counting) to only have + one hyperlink per entry. +
+sample-pages.tex
Insert “page” or “pages” before the location list. +
+sample-altmodifier.tex
Set the default options for commands like \gls and + add an alternative modifier. +
+sample-mixedsort.tex
Uses the optional argument of \makeglossaries to + allow a mixture of \printglossary and \printnoidxglossary. + + + +
+sample-external.tex
Uses the targeturl attribute to allow for entries that + should link to an external URL rather than to an internal glossary. +
+sample-fmt.tex
Provides text-block commands associated with entries in + order to use \glsxtrfmt. +
+sample-alias.tex
Uses the alias key. (See §10.4 Entry Aliases.) +
+sample-alttree.tex
Uses the glossaries-extra-stylemods package with the alttree + style (see §2.12.3 The glossaries-extra-stylemods Package). +
+sample-alttree-sym.tex
Another alttree example that measures the symbol + widths. +
+sample-alttree-marginpar.tex
Another alttree example that puts the + number list in the margin. +
+sample-onthefly.tex
Using on-the-fly commands. Terms with accents must + have the name key explicitly set. +
+sample-onthefly-xetex.tex
Using on-the-fly commands with XƎLATEX. + Terms with UTF-8 characters don’t need to have the name key explicitly + set. Terms that contain commands must have the name key explicitly set + with the commands removed from the label. +
+sample-onthefly-utf8.tex
Tries to emulate the previous sample file for use + with LATEX through the starred version of \GlsXtrEnableOnTheFly. + This is a bit iffy and may not always work. Terms that contain commands + must have the name key explicitly set with the commands removed from + the label. +
+sample-accsupp.tex
Integrate glossaries-accsupp. +
+sample-prefix.tex
Integrate glossaries-prefix. +
+sample-suppl-main.tex
Uses thevalue to reference a location in the + supplementary file sample-suppl.tex. + + + +
+sample-suppl-main-hyp.tex
A more complicated version to the above that + uses the hyperref package to reference a location in the supplementary file + sample-suppl-hyp.tex. +
+ + + +

+

Top

13. Multi-Lingual Support

+

There’s only one command provided by glossaries-extra that you’re likely to want +to change in your document and that’s \abbreviationsname (§1.2 New or +Modified Package Options) if you use the abbreviations package option to +automatically create the glossary labelled abbreviations. If this command +doesn’t already exist, it will be defined to “Abbreviations” if babel hasn’t +been loaded, otherwise it will be defined as \acronymname (provided by +glossaries). +

You can redefine it in the usual way. For example: + + + +

+
+\renewcommand*{\abbreviationsname}{List of Abbreviations} +
+

Or using babel or polyglossia captions hook: + + + +

+
+\appto\captionsenglish{% + 
 \renewcommand*{\abbreviationsname}{List of Abbreviations}% + 
} +
+

+

Alternatively you can use the title key when you print the list of abbreviations. +For example: + + + +

+
+\printabbreviations[title={List of Abbreviations}] +
+

or + + + +

+
+\printglossary[type=abbreviations,title={List of Abbreviations}] +
+

+

The other fixed text commands are the diagnostic messages, which shouldn’t +appear in the final draft of your document. +

The glossaries-extra package has the facility to load language modules (whose +filename is in the form glossariesxtr-language.ldf) if they exist, but won’t warn if +they don’t. If glossaries-extra-bib2gls is loaded via the record package option then the +check for language resource files will additionally search for an associated language +script file given by glossariesxtr-script.ldf where ⟨script⟩ is the four letter script +identifier, such as Latn, associated with the given dialect. There’s no warning +if the associated file isn’t found. The script file is loaded after the dialect +file. +

If you want to write your own language module, you just need to create a file +called glossariesxtr-lang.ldf, where ⟨lang⟩ identifies the language or dialect (see +the tracklang package). For example, glossariesxtr-french.ldf. +

The simplest code for this file is: + + + +

+
+\ProvidesGlossariesExtraLang{french}[2015/12/09 v1.0] + 
\newcommand*{\glossariesxtrcaptionsfrench}{% + 
 \def\abbreviationsname{Abr\'eviations}% + 
} + 
\glossariesxtrcaptionsfrench + 
\ifcsdef{captions\CurrentTrackedDialect} + 
{% + 
  \csappto{captions\CurrentTrackedDialect}% + 
  {% + 
    \glossariesxtrcaptionsfrench + 
  }% + 
}% + 
{% + 
  \ifcsdef{captions\CurrentTrackedLanguage} + 
  {% + 
    \csappto{captions\CurrentTrackedLanguage}% + 
    {% + 
      \glossariesxtrcaptionsfrench + 
    }% + 
  }% + 
  {}% + 
} +
+

+

You can adapt this for other languages by replacing all instances of the language +identifier french and the translated text Abr\’eviations as appropriate. You can +also use the .ldf file to provide rule blocks for a particular language for use with +bib2gls’s custom sort rule. See §9.3 The glossaries-extra-bib2gls package for further +details. +

This .ldf file then needs to be put somewhere on TEX’s path so that it can be +found by glossaries-extra. You might also want to consider uploading it to CTAN so +that it can be useful to others. (Please don’t send it to me. I already have more +packages than I am able to maintain.) +

If you additionally want to provide translations for the diagnostic messages used +when a glossary is missing, you need to redefine the following commands: +


\GlsXtrNoGlsWarningHead  \GlsXtrNoGlsWarningHead{label}{file} +

+

+This produces the following text in English: +

+

This document is incomplete. The external file associated with the + + + + glossary ‘⟨label⟩’ (which should be called ⟨file⟩) hasn’t been created.

+


\GlsXtrNoGlsWarningEmptyStart  \GlsXtrNoGlsWarningEmptyStart

+

+This produces the following text in English: +

+

This has probably happened because there are no entries defined in + this glossary.

+


\GlsXtrNoGlsWarningEmptyMain  \GlsXtrNoGlsWarningEmptyMain

+

+This produces the following text in English: +

+

If you don’t want this glossary, add nomain to your package option + list when you load glossaries-extra.sty. For example:

+


\GlsXtrNoGlsWarningEmptyNotMain  \GlsXtrNoGlsWarningEmptyNotMain{label} +

+

+This produces the following text in English: +

+

Did you forget to use type=label⟩ when you defined your entries? + If you tried to load entries into this glossary with \loadglsentries + did you remember to use [label] as the optional argument? If you + did, check that the definitions in the file you loaded all had the type + set to \glsdefaulttype.

+


\GlsXtrNoGlsWarningCheckFile  \GlsXtrNoGlsWarningCheckFile{file} +

+

+This produces the following text in English: +

+

Check the contents of the file ⟨file⟩. If it’s empty, that means you + haven’t indexed any of your entries in this glossary (using commands + like \gls or \glsadd) so this list can’t be generated. If the file isn’t + empty, the document build process hasn’t been completed.

+


\GlsXtrNoGlsWarningMisMatch  \GlsXtrNoGlsWarningMisMatch

+

+This produces the following text in English: +

+ + + +

You need + to either replace \makenoidxglossaries with \makeglossaries or + replace \printglossary (or \printglossaries) + with \printnoidxglossary (or \printnoidxglossaries) and then + rebuild this document.

+


\GlsXtrNoGlsWarningNoOut  \GlsXtrNoGlsWarningNoOut{file}

+

+This produces the following text in English: +

+

The file ⟨file⟩ doesn’t exist. This most likely means you haven’t used + \makeglossaries or you have used \nofiles. If this is just a draft + version of the document, you can suppress this message using the + nomissingglstext package option.

+


\GlsXtrNoGlsWarningTail  \GlsXtrNoGlsWarningTail

+

+This produces the following text in English: +

+

This message will be removed once the problem has been fixed.

+


\GlsXtrNoGlsWarningBuildInfo  \GlsXtrNoGlsWarningBuildInfo

+

+This is advice on how to generate the glossary files. See the documented code +(glossaries-extra-code.pdf) for further details. +


\GlsXtrNoGlsWarningAutoMake  \GlsXtrNoGlsWarningAutoMake{label} +

+

+This is the message produced when the automake option is used, but the document +needs a rerun or the shell escape setting doesn’t permit the execution of the external +application. This command also generates a warning in the transcript file. See the +documented code for further details. + + + +

+ + + +

+

+

Top

Glossary

+
+bib2gls
A command line Java application that selects entries from a .bib file + and converts them + to glossary definitions (like bibtex but also performs hierarchical sorting + and collation, thus omitting the need for xindy or makeindex). Further + details at: http://www.dickimaw-books.com/software/bib2gls/. +
+entry location
The location of the entry in the document. This defaults to + the page number on which the entry appears. An entry may have multiple + locations. +
+first use
The first time a glossary entry is used (from the start of the document + or after a reset) with one of the following commands: \gls, \Gls, \GLS, + \glspl, \Glspl, \GLSpl or \glsdisp. +
+first use flag
A conditional that determines whether or not the entry has been + used according to the rules of first use. +
+first use text
The text that is displayed on first use, which is governed by the + first and firstplural keys of \newglossaryentry. (May be overridden by + \glsdisp.) +
+link-text
The text produced by commands such as \gls. It may or may not + have a hyperlink to the glossary. +
+location list
A list of entry locations. See number list. +
+makeglossaries
A custom designed Perl script interface provided with the + glossaries package to run xindy or makeindex according to the document + settings. + + + +
+makeglossaries-lite
A custom designed Lua script interface to xindy and + makeindex provided with the glossaries package. This is a cut-down + alternative to the Perl makeglossaries script. If you have Perl installed, + use the Perl script instead. This script is distributed in the source code + on CTAN with the file name makeglossaries-lite.lua but TeX Live + on Unix-like systems creates a symbolic link called makeglossaries-lite + (without the .lua extension) to the actual makeglossaries-lite.lua + script, and TEX distributions on Windows convert the script to an + executable makeglossaries-lite.exe. +
+makeindex
An indexing application. +
+number list
A list of entry locations (also called a location list). The number + list can be suppressed using the nonumberlist package option. +
+xindy
An flexible indexing application with multilingual support written in + Perl.
+ + + +

Index

+

A +

+
abbreviation styles (deprecated):
+    footnote-em  1
+    footnote-sc  2
+    footnote-sm  3
+    long-desc-em  4
+    long-desc-sc  5
+    long-desc-sm  6
+    long-em  7
+    long-sc  8
+    long-sm  9
+    postfootnote-em  10
+    postfootnote-sc  11
+    postfootnote-sm  12
+abbreviation styles:
+    footnote  13
+    long  14
+    long-desc  15
+    long-em-noshort-em  16, 17, 18
+    long-em-noshort-em-desc  19, 20
+    long-em-noshort-em-desc-noreg  21
+    long-em-noshort-em-noreg  22, 23, 24
+    long-em-short-em  25, 26, 27, 28
+    long-em-short-em-desc  29
+    long-hyphen-long-hyphen  30
+    long-hyphen-noshort-desc-noreg  31, 32
+    long-hyphen-noshort-noreg  33, 34
+    long-hyphen-postshort-hyphen  35, 36, 37, 38, 39, 40
+    long-hyphen-postshort-hyphen-desc  41
+    long-hyphen-short-hyphen  42, 43, 44, 45, 46
+    long-hyphen-short-hyphen-desc  47, 48
+    long-noshort  49, 50, 51, 52, 53, 54, 55, 56, 57
+    long-noshort-desc  58, 59, 60, 61, 62, 63, 64, 65, 66, 67
+    long-noshort-desc-noreg  68
+ + + +    long-noshort-em  69
+    long-noshort-em-desc  70
+    long-noshort-noreg  71
+    long-noshort-sc  72, 73
+    long-noshort-sc-desc  74, 75
+    long-noshort-sm  76
+    long-noshort-sm-desc  77
+    long-only-short-only  78, 79, 80
+    long-only-short-only-desc  81
+    long-postshort-user  82, 83
+    long-postshort-user-desc  84
+    long-short  85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
+    long-short-desc  101, 102, 103, 104, 105, 106, 107, 108, 109
+    long-short-em  110, 111, 112, 113
+    long-short-em-desc  114, 115
+    long-short-sc  116, 117, 118, 119
+    long-short-sc-desc  120, 121
+    long-short-sm  122, 123, 124
+    long-short-sm-desc  125, 126
+    long-short-user  127, 128, 129, 130, 131, 132, 133, 134, 135
+    long-short-user-desc  136
+    nolong-short  137, 138
+    nolong-short-em  139
+    nolong-short-noreg  140
+    nolong-short-sc  141
+    nolong-short-sm  142
+    postfootnote  143
+    short  144
+    short-desc  145
+    short-em  146
+    short-em-desc  147
+    short-em-footnote  148, 149
+    short-em-footnote-desc  150
+    short-em-long  151, 152, 153
+    short-em-long-desc  154, 155
+    short-em-long-em  156, 157
+    short-em-long-em-desc  158
+    short-em-nolong  159, 160, 161
+    short-em-nolong-desc  162, 163
+    short-em-postfootnote  164
+    short-footnote  165, 166, 167, 168, 169, 170, 171, 172, 173, 174
+    short-footnote-desc  175
+    short-hyphen-long-hyphen  176, 177
+    short-hyphen-long-hyphen-desc  178
+    short-hyphen-postlong-hyphen  179, 180
+    short-hyphen-postlong-hyphen-desc  181
+ + + +    short-long  182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192
+    short-long-desc  193, 194, 195, 196, 197, 198, 199
+    short-long-user  200, 201, 202, 203, 204, 205, 206
+    short-long-user-desc  207
+    short-nolong  208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221
+    short-nolong-desc  222, 223, 224, 225, 226
+    short-nolong-desc-noreg  227
+    short-nolong-noreg  228
+    short-postfootnote  229, 230, 231, 232, 233, 234, 235
+    short-postlong-user  236, 237, 238
+    short-postlong-user-desc  239
+    short-sc  240
+    short-sc-desc  241
+    short-sc-footnote  242, 243, 244
+    short-sc-footnote-desc  245
+    short-sc-long  246, 247, 248, 249
+    short-sc-long-desc  250, 251
+    short-sc-nolong  252, 253, 254
+    short-sc-nolong-desc  255, 256
+    short-sc-postfootnote  257, 258
+    short-sm  259
+    short-sm-desc  260
+    short-sm-footnote  261
+    short-sm-footnote-desc  262
+    short-sm-long  263, 264, 265
+    short-sm-long-desc  266, 267
+    short-sm-nolong  268, 269, 270
+    short-sm-nolong-desc  271, 272
+    short-sm-postfootnote  273
+\abbreviationsname  274
+\abbrvpluralsuffix  275
+acronym styles (glossaries):
+    dua  276
+    dua-desc  277
+    footnote  278
+    footnote-desc  279
+    footnote-sc  280
+    footnote-sc-desc  281
+    footnote-sm  282
+    footnote-sm-desc  283
+    long-sc-short  284
+    long-sc-short-desc  285
+    long-short-desc  286
+    long-sm-short  287
+    long-sm-short-desc  288
+    long-sp-short  289, 290
+ + + +    long-sp-short-desc  291
+    sc-short-long  292
+    sc-short-long-desc  293
+    short-long  294
+    short-long-desc  295
+    sm-short-long  296
+    sm-short-long-desc  297
+amsgen package  298
+amsmath package  299
+\apptoglossarypreamble  300
+

B +babel package  301, 302, 303, 304, 305, 306, 307, 308, 309
+bib2gls  310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419
+

C +categories:
+    abbreviation  420, 421, 422, 423, 424
+    acronym  425, 426, 427, 428, 429
+    general  430, 431, 432, 433, 434, 435, 436, 437
+    index  438, 439
+    number  440
+    symbol  441, 442
+category attributes:
+    accessaposplural  443, 444, 445
+    accessinsertdots  446
+    accessnoshortplural  447
+    aposplural  448, 449, 450, 451, 452, 453, 454, 455
+    discardperiod  456, 457, 458, 459, 460
+    dualindex  461, 462, 463, 464, 465, 466, 467
+    entrycount  468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478
+    externallocation  479, 480, 481, 482
+    firstshortaccess  483
+    glossdesc  484, 485, 486
+    glossdescfont  487, 488
+    glossname  489, 490, 491
+    glossnamefont  492, 493, 494
+    headuc  495, 496, 497, 498
+    hyperoutside  499, 500
+    indexname  501, 502, 503, 504, 505
+    indexonlyfirst  506, 507, 508
+    insertdots  509, 510, 511, 512
+    linkcount  513, 514, 515
+ + + +    linkcountmaster  516, 517
+    markshortwords  518, 519
+    markwords  520, 521, 522, 523, 524, 525
+    nameshortaccess  526
+    nohyper  527, 528, 529
+    nohyperfirst  530, 531, 532, 533, 534
+    noshortplural  535, 536, 537, 538, 539, 540
+    pluraldiscardperiod  541, 542
+    recordcount  543, 544, 545, 546
+    regular  547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578
+    retainfirstuseperiod  579
+    tagging  580, 581, 582, 583
+    targetcategory  584
+    targetname  585, 586
+    targeturl  587, 588, 589, 590, 591
+    textformat  592, 593, 594, 595, 596
+    textshortaccess  597
+    unitcount  598
+    wrgloss  599, 600
+\cGLS  601
+\cGLSformat  602
+\cGLSpl  603
+\cGLSplformat  604
+convertgls2bib  605
+\csGlsXtrLetField  606
+\CustomAbbreviationFields  607
+

D +datatool-base package  608
+\dGLS  609
+\dGls  610
+\dgls  611
+\dglsdisp  612
+\dglslink  613
+\dGLSpl  614
+\dGlspl  615
+\dglspl  616
+

E +\eglssetwidest  617
+\eglsupdatewidest  618
+\eGlsXtrSetField  619
+entry location  620, 621, 622
+ + + +entrycounter package  623
+equation (counter)  624, 625, 626, 627, 628
+etoolbox package  629, 630, 631, 632, 633, 634, 635, 636, 637
+

F +fancyhdr package  638
+first use  639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691
+first use flag  692, 693, 694, 695, 696, 697, 698
+first use text  699, 700
+fontenc package  701
+

G +\gglssetwidest  702
+\gglsupdatewidest  703
+\gGlsXtrSetField  704
+glossaries package  705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724
+glossaries-accsupp package  725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741
+glossaries-extra package  742, 743, 744, 745, 746, 747
+glossaries-extra-bib2gls package  748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761
+glossaries-extra-stylemods package  762, 763, 764, 765, 766, 767, 768, 769, 770
+glossaries-prefix package  771, 772, 773
+\glossariesextrasetup  774
+glossary styles:
+    altlist  775, 776
+    alttree  777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789
+    bookindex  790, 791, 792, 793
+    index  794
+    inline  795, 796
+    list  797, 798, 799
+    listdotted  800, 801
+    long  802
+    long-desc-name  803
+    long-desc-sym-name  804
+    long-loc-desc-name  805
+    long-loc-desc-sym-name  806
+    long-loc-sym-desc-name  807
+    long-name-desc  808, 809, 810
+    long-name-desc-loc  811
+    long-name-desc-sym  812, 813
+    long-name-desc-sym-loc  814, 815
+    long-name-sym-desc  816
+    long-name-sym-desc-loc  817
+    long-sym-desc-name  818
+ + + +    long3col  819
+    longragged-booktabs  820, 821
+    mcolindexgroup  822
+    topic  823, 824
+    topicmcols  825
+    tree  826, 827, 828, 829
+    treenoname  830, 831, 832
+glossary-bookindex package  833, 834
+glossary-inline package  835
+glossary-long package  836, 837
+glossary-longextra package  838, 839
+glossary-topic package  840
+glossary-tree package  841, 842, 843, 844, 845, 846
+\glossentrynameother  847
+\glossxtrsetpopts  848
+\glsabbrvdefaultfont  849, 850
+\glsabbrvemfont  851
+\glsabbrvfont  852
+\glsabbrvhyphenfont  853
+\glsabbrvonlyfont  854
+\glsabbrvscfont  855
+\glsabbrvsmfont  856
+\glsabbrvuserfont  857, 858
+\Glsaccessdesc  859
+\glsaccessdesc  860
+\Glsaccessdescplural  861
+\glsaccessdescplural  862
+\Glsaccessfirst  863
+\glsaccessfirst  864
+\Glsaccessfirstplural  865
+\glsaccessfirstplural  866
+\Glsaccesslong  867
+\glsaccesslong  868
+\Glsaccesslongpl  869
+\glsaccesslongpl  870
+\Glsaccessname  871
+\glsaccessname  872
+\Glsaccessplural  873
+\glsaccessplural  874
+\Glsaccessshort  875
+\glsaccessshort  876
+\Glsaccessshortpl  877
+\glsaccessshortpl  878
+\Glsaccesssymbol  879
+\glsaccesssymbol  880
+\Glsaccesssymbolplural  881
+ + + +\glsaccesssymbolplural  882
+\Glsaccesstext  883
+\glsaccesstext  884
+\glsacspace  885
+\glsacspacemax  886
+\glsadd options
+    format  887
+    theHvalue  888, 889
+    thevalue  890, 891, 892, 893, 894
+\glsaddeach  895
+\glsaddpostsetkeys  896
+\glsaddpresetkeys  897
+\glscapturedgroup  898
+\glscategory  899
+\glscategorylabel  900
+\glscurrententrylabel  901
+\glscurrentfieldvalue  902
+\glsdefpostdesc  903
+\glsdefpostlink  904
+\glsdefpostname  905
+\glsentrycurrcount  906
+\glsentryprevcount  907
+\glsentryprevmaxcount  908
+\glsentryprevtotalcount  909
+\glsextrapostnamehook  910
+\glsFindWidestAnyName  911
+\glsFindWidestAnyNameLocation  912
+\glsFindWidestAnyNameSymbol  913
+\glsFindWidestAnyNameSymbolLocation  914
+\glsFindWidestLevelTwo  915
+\glsFindWidestTopLevelName  916
+\glsFindWidestUsedAnyName  917
+\glsFindWidestUsedAnyNameLocation  918
+\glsFindWidestUsedAnyNameSymbol  919
+\glsFindWidestUsedAnyNameSymbolLocation  920
+\glsFindWidestUsedLevelTwo  921
+\glsFindWidestUsedTopLevelName  922
+\glsfirstabbrvdefaultfont  923
+\glsfirstabbrvemfont  924
+\glsfirstabbrvfont  925
+\glsfirstabbrvhyphenfont  926
+\glsfirstabbrvonlyfont  927
+\glsfirstabbrvsmfont  928
+\glsfirstabbrvuserfont  929
+\glsfirstlongdefaultfont  930
+\glsfirstlongemfont  931
+ + + +\glsfirstlongfont  932
+\glsfirstlongfootnotefont  933
+\glsfirstlonghyphenfont  934
+\glsfirstlongonlyfont  935
+\glsfirstlonguserfont  936
+\Glsfmtfirst  937
+\glsfmtfirst  938
+\Glsfmtfirstpl  939
+\glsfmtfirstpl  940
+\Glsfmtfull  941
+\glsfmtfull  942
+\Glsfmtfullpl  943
+\glsfmtfullpl  944
+\Glsfmtlong  945
+\glsfmtlong  946
+\Glsfmtlongpl  947
+\glsfmtlongpl  948
+\Glsfmtname  949
+\glsfmtname  950
+\Glsfmtplural  951
+\glsfmtplural  952
+\Glsfmtshort  953
+\glsfmtshort  954
+\Glsfmtshortpl  955
+\glsfmtshortpl  956
+\Glsfmttext  957
+\glsfmttext  958
+\glsforeachwithattribute  959
+\glsgetattribute  960
+\glsgetcategoryattribute  961
+\glsgetwidestname  962
+\glsgetwidestsubname  963
+\glshasattribute  964
+\glshascategoryattribute  965
+\glshex  966
+\glsifattribute  967
+\glsifcategory  968
+\glsifcategoryattribute  969
+\glsifnotregular  970
+\glsifnotregularcategory  971
+\glsifregular  972
+\glsifregularcategory  973
+\glskeylisttok  974
+\glslabeltok  975
+\glslink options
+    counter  976, 977
+ + + +    format  978, 979, 980, 981
+    hyper  982, 983, 984
+    hyper=false  985
+    hyperoutside  986, 987
+    noindex  988, 989, 990, 991, 992, 993, 994
+    prefix  995, 996
+    textformat  997, 998
+    theHvalue  999, 1000
+    thevalue  1001, 1002
+    wrgloss  1003, 1004, 1005, 1006
+\glslinkcheckfirsthyperhook  1007
+\glslinkpresetkeys  1008
+\glslistchildpostlocation  1009
+\glslistchildprelocation  1010
+\glslistdesc  1011
+\glslistgroupskip  1012
+\glslistprelocation  1013
+\glslocalreseteach  1014
+\glslocalunseteach  1015
+\glslongdefaultfont  1016
+\glslongemfont  1017
+\glslongextraDescAlign  1018
+\glslongextraDescFmt  1019
+\glslongextraDescNameHeader  1020
+\glslongextraDescNameTabularFooter  1021
+\glslongextraDescNameTabularHeader  1022
+\glslongextraDescSymNameHeader  1023
+\glslongextraDescSymNameTabularFooter  1024
+\glslongextraDescSymNameTabularHeader  1025
+\glslongextraGroupHeading  1026
+\glslongextraHeaderFmt  1027
+\glslongextraLocationAlign  1028
+\glslongextraLocationDescNameHeader  1029
+\glslongextraLocationDescNameTabularFooter  1030
+\glslongextraLocationDescNameTabularHeader  1031
+\glslongextraLocationDescSymNameHeader  1032
+\glslongextraLocationDescSymNameTabularFooter  1033
+\glslongextraLocationDescSymNameTabularHeader  1034
+\glslongextraLocationFmt  1035, 1036
+\glslongextraLocationSymDescNameHeader  1037
+\glslongextraLocationSymDescNameTabularFooter  1038
+\glslongextraLocationSymDescNameTabularHeader  1039
+\glslongextraLocSetDescWidth  1040
+\glslongextraNameAlign  1041
+\glslongextraNameDescHeader  1042
+\glslongextraNameDescLocationHeader  1043
+ + + +\glslongextraNameDescLocationTabularFooter  1044
+\glslongextraNameDescLocationTabularHeader  1045
+\glslongextraNameDescSymHeader  1046
+\glslongextraNameDescSymLocationHeader  1047
+\glslongextraNameDescSymLocationTabularFooter  1048
+\glslongextraNameDescSymLocationTabularHeader  1049
+\glslongextraNameDescSymTabularFooter  1050
+\glslongextraNameDescSymTabularHeader  1051
+\glslongextraNameDescTabularFooter  1052
+\glslongextraNameDescTabularHeader  1053
+\glslongextraNameFmt  1054
+\glslongextraNameSymDescHeader  1055
+\glslongextraNameSymDescLocationHeader  1056
+\glslongextraNameSymDescLocationTabularFooter  1057
+\glslongextraNameSymDescLocationTabularHeader  1058
+\glslongextraNameSymDescTabularFooter  1059
+\glslongextraNameSymDescTabularHeader  1060
+\glslongextraSetDescWidth  1061
+\glslongextraSetWidest  1062
+\glslongextraSubDescFmt  1063
+\glslongextraSubNameFmt  1064
+\glslongextraSubSymbolFmt  1065
+\glslongextraSymbolAlign  1066
+\glslongextraSymbolFmt  1067
+\glslongextraSymDescNameHeader  1068
+\glslongextraSymDescNameTabularFooter  1069
+\glslongextraSymDescNameTabularHeader  1070
+\glslongextraSymLocSetDescWidth  1071
+\glslongextraSymSetDescWidth  1072
+\glslongextraTabularVAlign  1073
+\glslongextraUpdateWidest  1074
+\glslongextraUpdateWidestChild  1075
+\GlsLongExtraUseTabulartrue  1076
+\glslongfont  1077
+\glslongfootnotefont  1078
+\glslonghyphenfont  1079
+\glslongonlyfont  1080
+\glslongpltok  1081
+\glslongtok  1082
+\glslonguserfont  1083
+\glsnoidxdisplayloc  1084
+\glsps  1085
+\glspt  1086
+\glsrenewcommand  1087
+\glsseeitemformat  1088
+\glssetattribute  1089
+ + + +\glssetcategoryattribute  1090
+\glssetregularcategory  1091
+\glsshortpltok  1092
+\glsshorttok  1093
+\glstopicAssignSubIndent  1094
+\glstopicAssignWidest  1095
+\glstopicCols  1096
+\glstopicColsEnv  1097
+\glstopicDesc  1098
+\glstopicGroupHeading  1099
+\glstopicInit  1100
+\glstopicItem  1101
+\glstopicLoc  1102
+\glstopicMarker  1103
+\glstopicMidSkip  1104
+\glstopicParIndent  1105
+\glstopicPostSkip  1106
+\glstopicPreSkip  1107
+\glstopicSubIndent  1108
+\glstopicSubItem  1109
+\glstopicSubItemBox  1110
+\glstopicSubItemSep  1111
+\glstopicSubLoc  1112
+\glstopicSubNameFont  1113
+\glstopicSubPreLocSep  1114
+\glstopicTitle  1115
+\glstopicTitleFont  1116
+\glstreechilddesc  1117
+\glstreeChildDescLoc  1118
+\glstreechildprelocation  1119
+\glstreechildsymbol  1120
+\glstreedefaultnamefmt  1121
+\glstreedesc  1122
+\glstreeDescLoc  1123
+\glstreegroupskip  1124
+\glstreenonamechilddesc  1125
+\glstreenonamedesc  1126
+\glstreenonamesymbol  1127
+\glstreePreHeader  1128
+\glstreeprelocation  1129
+\glstreesymbol  1130
+\glsupdatewidest  1131
+\glsuseabbrvfont  1132
+\glsuselongfont  1133
+\glsuserdescription  1134
+\Glsxtr  1135
+ + + +\glsxtr  1136
+\glsxtrabbreviationfont  1137
+\glsxtrabbrvfootnote  1138
+\glsxtrabbrvpluralsuffix  1139, 1140
+\glsxtractivatenopost  1141
+\glsxtraddallcrossrefs  1142
+\glsxtraddlabelprefix  1143
+\glsxtralias  1144
+\glsxtrAltTreeIndent  1145
+\glsxtralttreeInit  1146
+\glsxtralttreeSubSymbolDescLocation  1147
+\glsxtralttreeSymbolDescLocation  1148
+\GlsXtrAutoAddOnFormat  1149
+\glsxtrautoindex  1150
+\glsxtrautoindexassignsort  1151
+\glsxtrautoindexentry  1152
+\glsxtrautoindexesc  1153
+\glsxtrBasicDigitrules  1154
+\GlsXtrBibTeXEntryAliases  1155
+\glsxtrbookindexatendgroup  1156
+\glsxtrbookindexbetween  1157
+\glsxtrbookindexbookmark  1158
+\glsxtrbookindexcols  1159
+\glsxtrbookindexcolspread  1160
+\glsxtrbookindexfirstmark  1161
+\glsxtrbookindexfirstmarkfmt  1162
+\glsxtrbookindexformatheader  1163
+\glsxtrbookindexlastmark  1164
+\glsxtrbookindexlastmarkfmt  1165
+\glsxtrbookindexlocation  1166
+\glsxtrbookindexmarkentry  1167
+\glsxtrbookindexmulticolsenv  1168
+\glsxtrbookindexname  1169
+\glsxtrbookindexparentchildsep  1170
+\glsxtrbookindexparentsubchildsep  1171
+\glsxtrbookindexprelocation  1172
+\glsxtrbookindexsubatendgroup  1173
+\glsxtrbookindexsubbetween  1174
+\glsxtrbookindexsublocation  1175
+\glsxtrbookindexsubname  1176
+\glsxtrbookindexsubprelocation  1177
+\glsxtrbookindexsubsubatendgroup  1178
+\glsxtrbookindexsubsubbetween  1179
+\glsxtrchecknohyperfirst  1180
+\glsxtrclearlabelprefixes  1181
+\glsxtrcombiningdiacriticIIIrules  1182
+ + + +\glsxtrcombiningdiacriticIIrules  1183
+\glsxtrcombiningdiacriticIrules  1184
+\glsxtrcombiningdiacriticIVrules  1185
+\glsxtrcombiningdiacriticrules  1186
+\glsxtrcontrolrules  1187
+\glsxtrcopytoglossary  1188
+\glsxtrcurrencyrules  1189
+\GlsXtrDefaultResourceOptions  1190
+\glsxtrdeffield  1191
+\glsxtrdetoklocation  1192
+\glsxtrdigitrules  1193
+\glsxtrdisplayendloc  1194
+\glsxtrdisplayendlochook  1195
+\glsxtrdisplaylocnameref  1196
+\glsxtrdisplaysingleloc  1197
+\glsxtrdisplaystartloc  1198
+\glsxtrdisplaysupploc  1199
+\glsxtrdoautoindexname  1200
+\glsxtrdowrglossaryhook  1201
+\glsxtredeffield  1202
+\glsxtremsuffix  1203
+\GlsXtrEnableEntryCounting  1204
+\GlsXtrEnableEntryUnitCounting  1205
+\GlsXtrEnableIndexFormatOverride  1206
+\GlsXtrEnableInitialTagging  1207
+\GlsXtrEnableLinkCounting  1208
+\GlsXtrEnableOnTheFly  1209
+\GlsXtrEnablePreLocationTag  1210
+\glsxtrenablerecordcount  1211
+\glsxtrendfor  1212
+\glsxtrentryfmt  1213
+\GlsXtrExpandedFmt  1214
+\glsxtrfielddolistloop  1215
+\glsxtrfieldforlistloop  1216
+\glsxtrfieldifinlist  1217
+\glsxtrfieldlistadd  1218
+\glsxtrfieldlisteadd  1219
+\glsxtrfieldlistgadd  1220
+\glsxtrfieldlistxadd  1221
+\glsxtrfieldtitlecasecs  1222
+\glsxtrfieldxifinlist  1223
+\glsxtrfmt  1224
+\glsxtrfmt*  1225
+\GlsXtrFmtDefaultOptions  1226
+\glsxtrfmtdisplay  1227
+\glsxtrfmtexternalnameref  1228
+ + + +\GlsXtrFmtField  1229
+\glsxtrfmtinternalnameref  1230
+\glsxtrfootnotename  1231
+\glsxtrforcsvfield  1232
+\GlsXtrForeignText  1233
+\GlsXtrForeignTextField  1234
+\GlsXtrFormatLocationList  1235
+\GlsXtrForUnsetBufferedList  1236
+\glsxtrfractionrules  1237
+\GLSxtrfull  1238
+\Glsxtrfull  1239
+\glsxtrfull  1240
+\Glsxtrfullformat  1241
+\glsxtrfullformat  1242
+\GLSxtrfullpl  1243
+\Glsxtrfullpl  1244
+\glsxtrfullpl  1245
+\Glsxtrfullplformat  1246
+\glsxtrfullplformat  1247
+\glsxtrfullsep  1248
+\glsxtrGeneralLatinIIIrules  1249
+\glsxtrGeneralLatinIIrules  1250
+\glsxtrGeneralLatinIrules  1251
+\glsxtrGeneralLatinIVrules  1252
+\glsxtrGeneralLatinVIIIrules  1253
+\glsxtrGeneralLatinVIIrules  1254
+\glsxtrGeneralLatinVIrules  1255
+\glsxtrGeneralLatinVrules  1256
+\glsxtrgeneralpuncIIrules  1257
+\glsxtrgeneralpuncIrules  1258
+\glsxtrgeneralpuncrules  1259
+\glsxtrglossentry  1260
+\glsxtrglossentryother  1261
+\glsxtrgroupfield  1262
+\GLSXTRhiername  1263
+\GLSxtrhiername  1264
+\GlsXtrhiername  1265
+\Glsxtrhiername  1266
+\glsxtrhiername  1267
+\glsxtrhiernamesep  1268
+\glsxtrhyphenrules  1269
+\glsxtrhyphensuffix  1270
+\glsxtridentifyglslike  1271
+\glsxtrifcounttrigger  1272
+\glsxtrifcustomdiscardperiod  1273
+\GlsXtrIfFieldCmpNum  1274
+ + + +\GlsXtrIfFieldEqNum  1275
+\GlsXtrIfFieldEqStr  1276
+\GlsXtrIfFieldEqXpStr  1277
+\GlsXtrIfFieldNonZero  1278
+\GlsXtrIfFieldUndef  1279
+\glsxtrifhasfield  1280
+\glsxtrifhasfield*  1281
+\GlsXtrIfHasNonZeroChildCount  1282
+\glsxtrifinlabelprefixlist  1283
+\glsxtrifkeydefined  1284
+\glsxtriflabelinlist  1285
+\GlsXtrIfLinkCounterDef  1286
+\glsxtrifrecordtrigger  1287
+\GlsXtrIfUnusedOrUndefined  1288
+\glsxtrifwasfirstuse  1289
+\GlsXtrIfXpFieldEqXpStr  1290
+\glsxtrinclinkcounter  1291
+\glsxtrindexaliased  1292
+\GlsXtrIndexCounterLink  1293
+\glsxtrindexseealso  1294
+\glsxtrinitwrgloss  1295
+\Glsxtrinlinefullformat  1296
+\glsxtrinlinefullformat  1297
+\Glsxtrinlinefullplformat  1298
+\glsxtrinlinefullplformat  1299
+\glsxtrinsertinsidetrue  1300
+\glsxtrLatinA  1301
+\glsxtrLatinAA  1302
+\glsxtrLatinAELigature  1303
+\glsxtrLatinE  1304
+\glsxtrLatinEszettSs  1305
+\glsxtrLatinEszettSz  1306
+\glsxtrLatinEth  1307
+\glsxtrLatinH  1308
+\glsxtrLatinI  1309
+\glsxtrLatinInsularG  1310
+\glsxtrLatinK  1311
+\glsxtrLatinL  1312
+\glsxtrLatinLslash  1313
+\glsxtrLatinM  1314
+\glsxtrLatinN  1315
+\glsxtrLatinO  1316
+\glsxtrLatinOELigature  1317
+\glsxtrLatinOslash  1318
+\glsxtrLatinP  1319
+\glsxtrLatinS  1320
+ + + +\glsxtrLatinSchwa  1321
+\glsxtrLatinT  1322
+\glsxtrLatinThorn  1323
+\glsxtrLatinWynn  1324
+\glsxtrLatinX  1325
+\GlsXtrLetField  1326
+\GlsXtrLetFieldToField  1327
+\GlsXtrLinkCounterName  1328
+\GlsXtrLinkCounterValue  1329
+\GlsXtrLoadResources  1330
+\glsxtrlocalsetgrouptitle  1331
+\GlsXtrLocationField  1332
+\GlsXtrLocationRecordCount  1333
+\glsxtrlocrangefmt  1334
+\Glsxtrlong  1335, 1336
+\glsxtrlong  1337
+\glsxtrlonghyphen  1338
+\glsxtrlonghyphenshort  1339
+\glsxtrlongnoshortdescname  1340
+\glsxtrlongnoshortname  1341
+\GLSxtrlongpl  1342
+\Glsxtrlongpl  1343
+\glsxtrlongpl  1344
+\glsxtrlongshortdescname  1345
+\glsxtrlongshortdescsort  1346
+\glsxtrlongshortname  1347
+\glsxtrlongshortuserdescname  1348
+\glsxtrMathGreekIIrules  1349
+\glsxtrMathGreekIrules  1350
+\glsxtrMathItalicGreekIIrules  1351
+\glsxtrMathItalicGreekIrules  1352
+\glsxtrMathItalicLowerGreekIIrules  1353
+\glsxtrMathItalicLowerGreekIrules  1354
+\glsxtrMathItalicNabla  1355
+\glsxtrMathItalicPartial  1356
+\glsxtrMathItalicUpperGreekIIrules  1357
+\glsxtrMathItalicUpperGreekIrules  1358
+\glsxtrMathUpGreekIIrules  1359
+\glsxtrMathUpGreekIrules  1360
+\glsxtrmultisupplocation  1361
+\glsxtrnameloclink  1362
+\glsxtrnamereflink  1363
+\glsxtrnewgls  1364
+\glsxtrnewGLSlike  1365
+\glsxtrnewglslike  1366
+\glsxtrnewnumber  1367
+ + + +\glsxtrnewrgls  1368
+\glsxtrnewrGLSlike  1369
+\glsxtrnewrglslike  1370
+\glsxtrnewsymbol  1371
+\GlsXtrNoGlsWarningAutoMake  1372
+\GlsXtrNoGlsWarningBuildInfo  1373
+\GlsXtrNoGlsWarningCheckFile  1374
+\GlsXtrNoGlsWarningEmptyMain  1375
+\GlsXtrNoGlsWarningEmptyNotMain  1376
+\GlsXtrNoGlsWarningEmptyStart  1377
+\GlsXtrNoGlsWarningHead  1378
+\GlsXtrNoGlsWarningMisMatch  1379
+\GlsXtrNoGlsWarningNoOut  1380
+\GlsXtrNoGlsWarningTail  1381
+\glsxtrnonprintablerules  1382
+\glsxtrnopostpunc  1383
+\glsxtronlydescname  1384
+\glsxtronlyname  1385
+\glsxtronlysuffix  1386
+\glsxtrorglong  1387
+\glsxtrorgshort  1388
+\GLSxtrp  1389
+\Glsxtrp  1390
+\glsxtrp  1391
+\glsxtrpageref  1392
+\glsxtrparen  1393
+\Glsxtrpl  1394
+\glsxtrpl  1395
+\glsxtrpostdescription  1396
+\glsxtrposthyphenlong  1397
+\glsxtrposthyphenshort  1398
+\glsxtrpostlink  1399
+\glsxtrpostlinkAddDescOnFirstUse  1400
+\glsxtrpostlinkAddSymbolDescOnFirstUse  1401
+\glsxtrpostlinkAddSymbolOnFirstUse  1402
+\glsxtrpostlinkendsentence  1403
+\glsxtrpostlinkhook  1404
+\glsxtrpostlongdescription  1405
+\glsxtrpostnamehook  1406
+\GlsXtrPostNewAbbreviation  1407
+\glsxtrprelocation  1408
+\glsxtrprependlabelprefix  1409
+\GlsXtrProvideBibTeXFields  1410
+\glsxtrprovidecommand  1411
+\glsxtrprovidestoragekey  1412
+\GlsXtrRecordCount  1413
+ + + +\GlsXtrRecordCounter  1414
+\glsxtrrecordtriggervalue  1415
+\glsxtrregularfont  1416
+\glsxtrresourcefile  1417
+\glsxtrresourceinit  1418
+\glsxtrrestorepostpunc  1419
+\glsxtrRevertMarks  1420
+\glsxtrRevertTocMarks  1421
+\glsxtrscsuffix  1422
+\glsxtrseealsolabels  1423
+\glsxtrseelist  1424
+\GlsXtrSetActualChar  1425
+\glsxtrsetaliasnoindex  1426
+\GlsXtrSetAltModifier  1427
+\glsxtrsetcategory  1428
+\glsxtrsetcategoryforall  1429
+\GlsXtrSetDefaultGlsOpts  1430
+\GlsXtrSetEncapChar  1431
+\GlsXtrSetEscChar  1432
+\GlsXtrSetField  1433
+\glsxtrsetfieldifexists  1434
+\glsxtrsetglossarylabel  1435
+\glsxtrsetgrouptitle  1436
+\GlsXtrSetLevelChar  1437
+\glsxtrsetpopts  1438
+\GlsXtrSetRecordCountAttribute  1439
+\glsxtrSetWidest  1440
+\glsxtrSetWidestFallback  1441
+\Glsxtrshort  1442, 1443
+\glsxtrshort  1444
+\glsxtrshortdescname  1445
+\glsxtrshorthyphenlong  1446
+\glsxtrshortlongdescname  1447
+\glsxtrshortlongname  1448, 1449
+\glsxtrshortlonguserdescname  1450
+\glsxtrshortnolongname  1451
+\GLSxtrshortpl  1452
+\Glsxtrshortpl  1453
+\glsxtrshortpl  1454
+\glsxtrsmsuffix  1455
+\glsxtrspacerules  1456
+\GlsXtrStandaloneEntryName  1457
+\GlsXtrStandaloneEntryOther  1458
+\GlsXtrStandaloneGlossaryType  1459
+\GlsXtrStartUnsetBuffering  1460
+\GlsXtrStopUnsetBuffering  1461
+ + + +\glsxtrSubScriptDigitrules  1462
+\Glsxtrsubsequentfmt  1463
+\glsxtrsubsequentfmt  1464
+\Glsxtrsubsequentplfmt  1465
+\glsxtrsubsequentplfmt  1466
+\glsxtrSuperScriptDigitrules  1467
+\glsxtrtagfont  1468
+\GlsXtrTheLinkCounter  1469
+\GlsXtrTotalRecordCount  1470
+\glsxtrunsrtdo  1471
+\GlsXtrUseAbbrStyleFmts  1472
+\GlsXtrUseAbbrStyleSetup  1473
+\GLSxtrusefield  1474
+\Glsxtrusefield  1475
+\glsxtrusefield  1476
+\glsxtruserfield  1477
+\glsxtruserparen  1478
+\glsxtrusersuffix  1479, 1480
+\glsxtrusesee  1481
+\glsxtruseseealso  1482
+\glsxtruseseeformat  1483, 1484
+\GlsXtrWarnDeprecatedAbbrStyle  1485
+\GlsXtrWarning  1486
+\glsxtrword  1487
+\glsxtrwordsep  1488
+\glsxtrwrglossmark  1489
+

H +hyperref package  1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514
+

I +\ifglsxtrinitwrglossbefore  1515
+inputenc package  1516
+

L +link-text  1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536
+location list  1537, 1538, 1539, 1540, 1541
+\longnewglossaryentry  1542
+

M +makeglossaries  1543, 1544, 1545, 1546, 1547
+\makeglossaries  1548
+ + + +makeglossaries-lite  1549, 1550
+makeglossaries-lite  1551, 1552
+makeindex  1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572
+makeindex  1573, 1574, 1575, 1576, 1577
+memoir class  1578
+mfirstuc package  1579, 1580, 1581
+multicols package  1582
+

N +\newabbreviation  1583
+\newabbreviationstyle  1584
+\newacronym  1585
+\newglossaryentry options
+    access  1586, 1587
+    alias  1588, 1589, 1590, 1591, 1592, 1593
+    category  1594, 1595, 1596, 1597, 1598, 1599
+    counter  1600
+    description  1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624
+    descriptionplural  1625, 1626, 1627, 1628, 1629, 1630
+    first  1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643
+    firstaccess  1644
+    firstplural  1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654
+    group  1655, 1656, 1657, 1658, 1659
+    location  1660, 1661, 1662, 1663
+    loclist  1664, 1665, 1666, 1667
+    long  1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676
+    longplural  1677, 1678, 1679, 1680, 1681, 1682
+    name  1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735
+    nameshortaccess  1736, 1737
+    parent  1738, 1739, 1740
+    plural  1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, 1751, 1752, 1753
+    prefix  1754
+    see  1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781
+    seealso  1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791
+    short  1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807
+    shortaccess  1808, 1809, 1810, 1811, 1812, 1813
+    shortplural  1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828
+    shortpluralaccess  1829, 1830, 1831, 1832
+    sort  1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852
+    symbol  1853, 1854, 1855, 1856
+ + + +    symbolplural  1857, 1858
+    text  1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872
+    textaccess  1873
+    type  1874, 1875, 1876, 1877
+    user1  1878, 1879, 1880
+number list  1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914
+

P +package options:
+    abbreviations  1915, 1916, 1917, 1918, 1919
+    accsupp  1920, 1921, 1922, 1923, 1924
+    acronym  1925, 1926
+    acronymlists  1927
+    acronyms  1928
+    automake  1929, 1930
+    autoseeindex  1931, 1932
+        false  1933, 1934
+    counter
+        chapter  1935
+        equation  1936
+        section  1937
+        wrglossary  1938
+    debug  1939
+        all  1940, 1941
+        showtargets  1942, 1943
+        showwrgloss  1944, 1945, 1946
+        true  1947
+    docdef  1948, 1949, 1950, 1951
+        restricted  1952, 1953, 1954, 1955
+        true  1956, 1957
+    docdefs  1958, 1959, 1960
+        true  1961
+    entrycounter  1962, 1963
+    equations  1964, 1965
+        true  1966
+    floats  1967
+    hyperfirst
+        false  1968
+    index  1969, 1970, 1971
+    indexcounter  1972, 1973, 1974, 1975
+    indexcrossrefs  1976, 1977, 1978, 1979
+        false  1980
+    indexonlyfirst  1981, 1982, 1983, 1984
+    makeindex  1985
+ + + +    nogroupskip  1986, 1987, 1988, 1989, 1990, 1991
+    nomain  1992
+    nomissingglstext  1993
+    nonumberlist  1994, 1995, 1996, 1997, 1998
+    nopostdot  1999, 2000, 2001, 2002
+        false  2003, 2004, 2005
+        true  2006
+    noredefwarn
+        false  2007
+        true  2008
+    notree  2009
+    numbers  2010, 2011, 2012
+    postdot  2013, 2014, 2015
+    postpunc  2016, 2017, 2018
+        comma  2019
+        dot  2020
+        none  2021
+    record  2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034
+        alsoindex  2035, 2036, 2037, 2038, 2039, 2040, 2041
+        nameref  2042, 2043
+        off  2044, 2045
+        only  2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056
+    section
+        chapter  2057
+    seeautonumberlist  2058
+    seenoindex  2059
+        ignore  2060, 2061
+        warn  2062
+    shortcuts  2063, 2064
+        abbr  2065, 2066
+        abbreviation  2067, 2068
+        abbreviations  2069, 2070
+        ac  2071, 2072, 2073, 2074, 2075, 2076
+        acro  2077, 2078
+        acronyms  2079, 2080
+        all  2081, 2082
+        false  2083
+        none  2084
+        other  2085, 2086
+        true  2087
+    sort
+        none  2088, 2089
+    stylemods  2090, 2091, 2092, 2093, 2094
+        all  2095
+        default  2096
+    subentrycounter  2097, 2098
+ + + +    symbols  2099, 2100, 2101
+    toc
+        false  2102
+        true  2103
+    translate
+        babel  2104
+        true  2105
+    undefaction  2106, 2107
+        error  2108, 2109, 2110
+        warn  2111, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119
+    xindy  2120, 2121
+page (counter)  2122, 2123, 2124, 2125, 2126, 2127
+polyglossia package  2128, 2129
+\pretoglossarypreamble  2130
+\printabbreviations  2131
+\printglossary options
+    label  2132
+    nogroupskip  2133
+    prefix  2134
+    target  2135, 2136
+    targetnameprefix  2137
+    title  2138
+\printnoidxglossary options
+    sort  2139
+\printunsrtabbreviations  2140
+\printunsrtacronyms  2141
+\printunsrtglossaries  2142
+\printunsrtglossary  2143
+\printunsrtglossary*  2144
+\printunsrtglossaryentryprocesshook  2145
+\printunsrtglossaryhandler  2146
+\printunsrtglossarypredoglossary  2147
+\printunsrtglossaryskipentry  2148
+\printunsrtglossaryunit  2149
+\printunsrtglossaryunitsetup  2150
+\printunsrtindex  2151
+\printunsrtnumbers  2152
+\printunsrtsymbols  2153
+\provideignoredglossary  2154
+

R +relsizes package  2155
+\RestoreAcronyms  2156
+\rGLS  2157
+\rGls  2158
+ + + +\rgls  2159
+\rGLSformat  2160
+\rGlsformat  2161
+\rglsformat  2162
+\rGLSpl  2163
+\rGlspl  2164
+\rglspl  2165
+\rGLSplformat  2166
+\rGlsplformat  2167
+\rglsplformat  2168
+

S +\setabbreviationstyle  2169
+slantsc package  2170
+soul package  2171, 2172
+style package  2173
+subentrycounter package  2174
+

T +texindy  2175
+textcase package  2176
+tracklang package  2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186
+translator package  2187
+

U +upgreek package  2188, 2189, 2190, 2191
+

W +wrglossary (counter)  2192, 2193, 2194, 2195, 2196
+

X +xfor package  2197, 2198, 2199
+\xglssetwidest  2200
+\xglsupdatewidest  2201
+\xGlsXtrSetField  2202
+xindy  2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219
+xindy  2220
+xkeyval package  2221
+

+ + + +

1.14.21 was originally intended as the last release of glossaries to incorporate new features, but +a few new minor features slipped in with some bug fixes in v4.21.

+

2.1The descriptionplural key is a throwback to the base package’s original acronym mechanism +before the introduction of the long and short keys, where the long form was stored in the description +field and the short form was stored in the symbol field.

+

3.1For compatibility with earlier versions, \glsabbrvscfont is defined to \glsxtrscfont, which +is defined to use \textsc. Direct use of \glsxtrscfont is now deprecated. Likewise for similar +commands.

+

9.1Version 1.11 only allowed one use of \GlsXtrLoadResources per document.

+

9.2v1.08 assumed filename.tex but that’s potentially dangerous if, for example, filename⟩ +happens to be the same as \jobname. The .glstex extension was enforced by version +1.11.

+

10.1Pre version 1.28 used \csedef.

+ + + + + + diff --git a/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.pdf b/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.pdf new file mode 100644 index 0000000000..3af0f7a83e Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.tex b/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.tex new file mode 100644 index 0000000000..674b704722 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/glossaries-extra-manual.tex @@ -0,0 +1,12125 @@ +\documentclass[report,inlinetitle,widecs]{nlctdoc} + +\makeatletter +\@ifpackageloaded{tex4ht} +{ + \DeclareUnicodeCharacter{00FE}{\HCode{&\#x00FE;}} + \DeclareUnicodeCharacter{00D0}{\HCode{&\#x00D0;}} + \DeclareUnicodeCharacter{01F7}{\HCode{&\#x01F7;}} + \DeclareUnicodeCharacter{A77D}{\HCode{&\#xA77D;}} + \DeclareUnicodeCharacter{017F}{\HCode{&\#x017F;}} + \DeclareUnicodeCharacter{018F}{\HCode{&\#x018F;}} +} +{ + \usepackage{fontspec} + \setmainfont{FreeSerif} +} +\makeatother + +\usepackage{alltt} +\usepackage{hologo} +\usepackage[colorlinks, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, + pdftitle={glossaries-extra.sty: an extension to the glossaries +package}, + pdfkeywords={LaTeX,package,glossary,abbreviations}]{hyperref} +\usepackage[nogroupskip,nonumberlist]{glossaries-extra} + +\makeglossaries + +\GlsXtrEnableEntryUnitCounting{general}{0}{page} + +\renewcommand*{\glsxtrifcounttrigger}[3]{#3} + +\renewcommand*{\glslinkcheckfirsthyperhook}{% + \ifnum\glsentrycurrcount\glslabel>0 + \setkeys{glslink}{hyper=false}% + \fi +} + +\newcommand*{\XeLaTeX}{\hologo{XeLaTeX}} +\newcommand*{\LuaLaTeX}{\hologo{LuaLaTeX}} +\newcommand*{\pdfLaTeX}{\hologo{pdfLaTeX}} + +\IndexPrologue{\chapter*{\indexname} + \addcontentsline{toc}{chapter}{\indexname}% + \markboth{\indexname}{\indexname}} + +\renewcommand*{\main}[1]{\hyperpage{#1}} +\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}} + +\glssetcategoryattribute{general}{indexname}{htextbf} +\glssetcategoryattribute{general}{dualindex}{main} + +\newglossaryentry{xindy}{ + name={\appfmt{xindy}}, + sort={xindy}, + description={An flexible indexing application with multilingual + support written in Perl.} +} + +\newglossaryentry{makeindex}{% + name={\appfmt{makeindex}},% + sort={makeindex},% + description={An indexing application.}, +} + +\newglossaryentry{makeglossaries}{% +name={\appfmt{makeglossaries}},% +sort={makeglossaries},% +description={A custom designed Perl script interface +provided with the \styfmt{glossaries} package +to run \gls{xindy} or \gls{makeindex} according to +the document settings.}} + +\newglossaryentry{makeglossaries-lite.lua}{% +name={\appfmt{makeglossaries-lite}\index{makeglossaries-lite=\appfmt{makeglossaries-lite}|htextbf}},% +sort={makeglossaries-lite},% +text={\appfmt{makeglossaries-lite}\iapp{makeglossaries-lite}},% +description={A custom designed Lua script interface +to \gls{xindy} and \gls{makeindex} provided with the +\styfmt{glossaries} +package. This is a cut-down alternative to the Perl +\appfmt{makeglossaries} script. If you have Perl installed, use the +Perl script instead. This script is distributed in the source code +on CTAN with the file name +\texttt{makeglossaries-lite.lua} but TeX Live on Unix-like systems +creates a symbolic link +called \texttt{makeglossaries-lite} (without the \texttt{.lua} +extension) to the actual \texttt{makeglossaries-lite.lua} script, and +\TeX\ distributions on Windows convert the script to an executable +\texttt{makeglossaries-lite.exe}.} +} + +\newglossaryentry{bib2gls}{% +name={\appfmt{bib2gls}},% +sort={bib2gls},% +description={A command line Java application that selects +entries from a .bib file and converts them to glossary +definitions (like \appfmt{bibtex} but also performs hierarchical +sorting and collation, thus omitting the need for \gls{xindy} or +\gls{makeindex}). Further details at: +\url{http://www.dickimaw-books.com/software/bib2gls/}.}% +} + +\newglossaryentry{numberlist}{% +name={number list},% +description={A list of \glspl{entrylocation} (also +called a location list). The number list can be suppressed using the +\pkgopt{nonumberlist} package option.} +} + +\newglossaryentry{entrylocation}{% +name={entry location},% +description={The location of the entry in the document. This +defaults to the page number on which the entry appears. An entry may +have multiple locations.} +} + +\newglossaryentry{locationlist}{% +name={location list},% +description={A list of \glspl{entrylocation}. +See \gls{numberlist}.}% +} + +\newglossaryentry{linktext}{% +name={link-text}, +description={The text produced by commands such as \ics{gls}. It may +or may not have a hyperlink to the glossary.} +} + +\let\glsd\glsuseri +\let\glsation\glsuserii + +\newglossaryentry{firstuseflag}{% +name={first use flag}, +description={A conditional that determines whether or not the entry +has been used according to the rules of \gls{firstuse}.}% +} + +\newglossaryentry{firstusetext}{% +name={first use text}, +description={The text that is displayed on \gls{firstuse}, which is +governed by the \gloskey{first} and \gloskey{firstplural} keys of +\ics{newglossaryentry}. (May be overridden by +\ics{glsdisp}.)}% +} + +\newglossaryentry{firstuse}{% + name={first use}, + user1={first used}, + see={firstuseflag,firstusetext}, + description={The first time a glossary entry is used (from the start + of the document or after a reset) with one of the + following commands: \ics{gls}, \ics{Gls}, \ics{GLS}, \ics{glspl}, + \ics{Glspl}, \ics{GLSpl} or \ics{glsdisp}.}% +} + +\setcounter{IndexColumns}{2} + +\newrobustcmd*{\eq}{\protect=}% hide from makeindex + +\newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}} +\newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}} +\newcommand*{\optfmt}[1]{\textsf{#1}} + +\newcommand*{\glostyle}[1]{\textsf{#1}\index{glossary styles:>#1={\protect\sffamily#1}|main}} + +\newcommand*{\acrstyle}[1]{\textsf{#1}\index{acronym +styles (glossaries):>#1={\protect\ttfamily#1}|main}} + +\newcommand*{\abbrstylenolink}[1]{% + \textsf{#1}\index{abbreviation styles:>#1={\protect\sffamily#1}|main}} + +\newcommand*{\abbrstyle}[1]{% + \hyperlink{abbrstyle.#1}{\textsf{#1}}% + \index{abbreviation styles:>#1={\protect\sffamily#1}|main}% +} + +\makeatletter +\newcommand{\htarget}[2]{\Hy@raisedlink{\hypertarget{#1}{}}#2} +\makeatother + +\newcommand*{\abbrstyledef}[1]{% + \htarget{abbrstyle.#1}{\textsf{#1}}% + \index{abbreviation styles:>#1={\protect\sffamily#1}|main}% +} + +\newcommand*{\depabbrstyle}[1]{\textsf{#1}\index{abbreviation styles (deprecated):>#1={\protect\sffamily#1}|main}} + +\newcommand*{\category}[1]{\textsf{#1}\index{categories:>#1={\protect\sffamily#1}|main}} + +\newcommand*{\catattrnolink}[1]{% + \textsf{#1}\index{category attributes:>#1={\protect\sffamily#1}|main}} + +\newcommand*{\catattr}[1]{% + \hyperlink{catattr.#1}{\textsf{#1}}% + \index{category attributes:>#1={\protect\sffamily#1}|main}% +} + +\newcommand*{\catattrdef}[1]{% + \htarget{catattr.#1}{\textsf{#1}}% + \index{category attributes:>#1={\protect\sffamily#1}|main}% +} + +\newcommand*{\postlinkcat}{% + \cs{glsxtrpostlink}\meta{category}% + \index{glsxtrpostlinkcategory=\cs{glsxtrpostlink}\meta{category}|hyperpage}% +} + +\renewcommand*{\pkgopt}[2][]{% + \hyperlink{styopt.#2}{\pkgoptfmt{#2}}% + \ifstrempty{#1}{}{\pkgoptfmt{=#1}}% + \ipkgopt[#1]{#2}% +} + +\newcommand*{\pkgoptdef}[1]{% + \htarget{styopt.#1}{\pkgoptfmt{#1}}% + \ipkgopt{#1}% +} + +\setlength\marginparwidth{70pt} + +\begin{document} +\DeleteShortVerb{\|} +\MakeShortVerb{"} + + \title{glossaries-extra.sty v1.41: + an extension to the glossaries package} + \author{Nicola L.C. Talbot\\[10pt] +Dickimaw Books\\ +\url{http://www.dickimaw-books.com/}} + + \date{2019-04-09} + \maketitle + +\begin{abstract} +The \styfmt{glossaries-extra} package is an extension to the +\styfmt{glossaries} package, providing additional features. +Some of the features provided by this package are only available +with \styfmt{glossaries} version 4.19 (or above). +This document assumes familiarity with the \styfmt{glossaries} package. + +The file \texttt{example-glossaries-xr.tex} contains dummy +entries with cross-references that may be used for creating +minimal working examples for testing the \styfmt{glossaries-extra} +package. (The base \styfmt{glossaries} package provides additional files, +but this one needs \styfmt{glossaries-extra}.) There are equivalent +\texttt{.bib} files for use with \gls{bib2gls}. + +\end{abstract} + +\begin{important} +Since \styfmt{glossaries-extra} internally loads the \styfmt{glossaries} +package, you also need to have \styfmt{glossaries} installed and +all the packages that \styfmt{glossaries} depends on (including, but +not limited to, \sty{tracklang}, \sty{mfirstuc}, \sty{etoolbox}, +\sty{xkeyval} (at least version dated 2006/11/18), \sty{textcase}, +\sty{xfor}, \sty{datatool-base} and \sty{amsgen}. These +packages are all available in the current \TeX\ Live and Mik\TeX\ +distributions. If any of them are missing, please update your +\TeX\ distribution using your update manager. +(For help on this see, for example, +\href{http://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my \TeX\ distribution?} +or +\href{http://tex.stackexchange.com/questions/14925/updating-tex-on-linux}{Updating +\TeX\ on Linux}.) +\end{important} + +Additional resources: +\begin{itemize} +\item The \styfmt{glossaries-extra} documented code +\href{http://mirrors.ctan.org/macros/latex/contrib/glossaries-extra/glossaries-extra-code.pdf}{glossaries-extra-code.pdf}. + +\item The +\href{http://www.dickimaw-books.com/gallery/#glossaries-extra}{\styfmt{glossaries-extra} gallery}. + +\item \styfmt{glossaries-extra} and \gls{bib2gls}: An Introductory +Guide. (\href{http://mirrors.ctan.org/support/bib2gls/bib2gls-begin.pdf}{\texttt{bib2gls-begin.pdf}}). + +\item +\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating +makeglossaries or makeglossaries-lite or bib2gls into the document +build}. + +\item The +\href{http://www.dickimaw-books.com/software/bib2gls}{\appfmt{bib2gls}} +application. + +\item The base \href{https://ctan.org/pkg/glossaries}{\styfmt{glossaries}} package. +\end{itemize} + +\tableofcontents + +\chapter{Introduction} +\label{sec:intro} + +The \styfmt{glossaries} package is a flexible package, but it's also a +heavy-weight package that uses a lot of resources. As package +developer, I'm caught between those users who complain about the +drawbacks of a heavy-weight package with a large user manual and +those users who want more features (which necessarily adds to the +package weight and manual size). + +The \styfmt{glossaries-extra} package is an attempt to provide +a~compromise for this +conflict. Version 4.22 of the \styfmt{glossaries} package is +the last version to incorporate new features.\footnote{4.21 was +originally intended as the last release of \styfmt{glossaries} to +incorporate new features, but a few new minor features slipped in with +some bug fixes in v4.21.} Future versions of +\styfmt{glossaries} will just be bug fixes. New features will +instead be added to \styfmt{glossaries-extra}. +This means that the base \styfmt{glossaries} package won't increase +in terms of package loading time and allocation of resources, but +those users who do want extra features available will have more of a +chance of getting their feature requests accepted. + +\section{Package Defaults} +\label{sec:defaults} + +I'm not happy with some of the default settings assumed by the +\styfmt{glossaries} package, and, judging from code I've seen, other +users also seem unhappy with them, as certain package options are +often used in questions posted on various sites. I can't change the default +behaviour of \styfmt{glossaries} as it would break backward +compatibility, but since \styfmt{glossaries-extra} is a separate +package, I have decided to implement some of these commonly-used +options by default. You can switch them back if they're not +appropriate. + +The new defaults are: +\begin{itemize} +\item \pkgopt[true]{toc} (add the glossaries to the table of +contents). Use \pkgopt[false]{toc} to switch this back off. + +\item \pkgopt[true]{nopostdot} (suppress the terminating full stop +after the description in the glossary). Use +\pkgopt[false]{nopostdot} or just \pkgopt{postdot} to restore the +terminating full stop (period). + +\item \pkgopt[true]{noredefwarn} (suppress the warnings that occur when +the \env{theglossary} environment and \cs{printglossary} are redefined while +\styfmt{glossaries} is loading). To restore the warnings, use +\pkgopt[false]{noredefwarn}. Note that this won't have any effect if +the \styfmt{glossaries} package has already been loaded before you use +the \styfmt{glossaries-extra} package. + +\item If \sty{babel} has been loaded, the \pkgopt[babel]{translate} +option is switched on. To revert to using the \sty{translator} +interface, use \pkgopt[true]{translate}. There is no change to the +default if \sty{babel} hasn't been loaded. + +\end{itemize} + +The examples below illustrate the difference in explicit +package options between \styfmt{glossaries} and +\styfmt{glossaries-extra}. There may be other differences +resulting from modifications to commands provided by +\styfmt{glossaries} (see \sectionref{sec:modifications}). + +\begin{enumerate} +\item +\begin{verbatim} +\documentclass{article} +\usepackage{glossaries-extra} +\end{verbatim} +This is like: +\begin{verbatim} +\documentclass{article} +\usepackage[toc,nopostdot]{glossaries} +\usepackage{glossaries-extra} +\end{verbatim} + +\item +\begin{verbatim} +\documentclass[british]{article} +\usepackage{babel} +\usepackage{glossaries-extra} +\end{verbatim} +This is like: +\begin{verbatim} +\documentclass[british]{article} +\usepackage{babel} +\usepackage[toc,nopostdot,translate=babel]{glossaries} +\usepackage{glossaries-extra} +\end{verbatim} + +\item +\begin{verbatim} +\documentclass{memoir} +\usepackage{glossaries-extra} +\end{verbatim} +This is like: +\begin{verbatim} +\documentclass{memoir} +\usepackage[toc,nopostdot,noredefwarn]{glossaries} +\usepackage{glossaries-extra} +\end{verbatim} +\emph{However} +\begin{verbatim} +\documentclass{memoir} +\usepackage{glossaries} +\usepackage{glossaries-extra} +\end{verbatim} +This is like: +\begin{verbatim} +\documentclass{memoir} +\usepackage[toc,nopostdot]{glossaries} +\usepackage{glossaries-extra} +\end{verbatim} +Since by the time \styfmt{glossaries-extra} has been loaded, +\styfmt{glossaries} has already redefined \cls{memoir}'s +glossary-related commands. +\end{enumerate} + +Another noticeable change is that by default \cs{printglossary} +will now display information text in the document if the external +glossary file doesn't exist. This is explanatory text to help new +users who can't work out what to do next to complete the document +build. Once the document is set up correctly and the external files +have been generated, this text will disappear. + +This change is mostly likely to be noticed by users +with one or more redundant empty glossaries who ignore +transcript messages, explicitly use \gls{makeindex}\slash\gls{xindy} +on just the non-empty glossary (or glossaries) and use +the iterative +\ics{printglossaries} command instead of \ics{printglossary}. For example, +consider the following: +\begin{verbatim} +\documentclass{article} + +\usepackage[acronym]{glossaries} + +\makeglossaries + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + +\begin{document} + +\gls{laser} + +\printglossaries + +\end{document} +\end{verbatim} +The above document will only display the list of +acronyms at the place where \ics{printglossaries} occurs. However it +will also attempt to input the \texttt{.gls} file associated with +the \texttt{main} glossary. + +If you use \gls{makeglossaries}, you'll get the warning message: +\begin{verbatim} +Warning: File 'test.glo' is empty. +Have you used any entries defined in glossary 'main'? +Remember to use package option 'nomain' if you +don't want to use the main glossary. +\end{verbatim} +(where the original file is called \texttt{test.tex}) +but if you simply call \gls{makeindex} directly to generate the +\texttt{.acr} file (without attempting to create the \texttt{.gls} +file) then the transcript file will always contain the message: +\begin{verbatim} +No file test.gls. +\end{verbatim} +This doesn't occur with \gls{makeglossaries} as it will create +the \texttt{.gls} file containing the single command \cs{null}. + +If you simply change from \styfmt{glossaries} to +\styfmt{glossaries-extra} in this document, you'll find a change in the +resulting PDF if you don't use \gls{makeglossaries} and you only +generate the \texttt{.acr} file with \gls{makeindex}. + +The transcript file will still contain the message +about the missing \texttt{.gls}, but now you'll also see +information in the actual PDF document. The simplest remedy is to +follow the advice inserted into the document at that point, which is +to add the \pkgopt{nomain} package option: +\begin{verbatim} +\documentclass{article} + +\usepackage[nomain,acronym,postdot]{glossaries-extra} + +\makeglossaries + +\setabbreviationstyle[acronym]{long-short} + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + +\begin{document} + +\gls{laser} + +\printglossaries + +\end{document} +\end{verbatim} +(Note the need to set the acronym style using +\cs{setabbreviationstyle} before \cs{newacronym}. +See \sectionref{sec:abbreviations} for further details.) + +\section{New or Modified Package Options} +\label{sec:pkgopts} + +If you haven't already loaded \styfmt{glossaries}, you can use any of +the package options provided by \styfmt{glossaries} when you load +\styfmt{glossaries-extra} and they will automatically be passed to +\styfmt{glossaries} (which \styfmt{glossaries-extra} will load). If +\styfmt{glossaries} has already been loaded, then those options will be +passed to \ics{setupglossaries}, but remember that not all of the +\styfmt{glossaries} package options may be used in that command. + +\begin{important} +This section only lists options that are either unrecognised by +the \styfmt{glossaries} package or are a modified version of options +of the same name provided by \styfmt{glossaries}. See the +\styfmt{glossaries} user manual for details about the unmodified +options. +\end{important} + +The new and modified options provided by \styfmt{glossaries-extra} +are described below: + +\begin{description} + +\item[{\pkgoptdef{debug}}] The \styfmt{glossaries} package +has a \pkgoptfmt{debug} option that allows the values +\pkgoptfmt{false}, \pkgoptfmt{true} and \pkgoptfmt{showtargets}. +The \pkgopt[showtargets]{debug} option was introduced to +\styfmt{glossaries} v4.32, so if you want to use this option +with \styfmt{glossaries-extra} you must make sure that +your version of \styfmt{glossaries} supports it. + +The \styfmt{glossaries-extra} package extends this option +to provide the additional values \pkgopt[showwrgloss]{debug} +and \pkgopt[all]{debug}. + +The \pkgopt[showwrgloss]{debug} option implements +\pkgopt[true]{debug} and uses +\begin{definition}[\DescribeMacro\glsxtrwrglossmark] +\cs{glsxtrwrglossmark} +\end{definition} +to show a mark \ensuremath{\cdot} just before the write operation +performed by the indexing commands. If you use +\pkgopt[alsoindex]{record} there will be a mark for the +write operation to the \texttt{.aux} file for \gls{bib2gls} +and a mark for the write operation to the associated glossary +file for \gls{makeindex} or \gls{xindy}. + +The \pkgopt[all]{debug} option implements both \pkgopt[showtargets]{debug} +and \pkgopt[showwrgloss]{debug}. + +\item[{\pkgoptdef{postdot}}] (New to version 1.12.) +This option is just a shortcut for \pkgopt[false]{nopostdot}. + +\item[{\pkgoptdef{postpunc}}] (New to version 1.21.) +This option sets the post-description punctuation to the given +value. For example: \pkgoptfmt{postpunc={;}} does +\begin{verbatim} +\renewcommand{\glspostdescription}{;} +\end{verbatim} +The value may also be one of the following keywords: +\begin{description} +\item[\texttt{comma}:] \pkgopt[comma]{postpunc} is +equivalent to +\begin{verbatim} +\renewcommand{\glspostdescription}{,} +\end{verbatim} + +\item[\texttt{dot}:] \pkgopt[dot]{postpunc} is +equivalent to +\begin{verbatim} +\renewcommand{\glspostdescription}{.\spacefactor\sfcode`\. } +\end{verbatim} + +\item[\texttt{none}:] \pkgopt[none]{postpunc} is +equivalent to +\begin{verbatim} +\renewcommand{\glspostdescription}{} +\end{verbatim} +\end{description} +The default definition is +\begin{verbatim} +\newcommand*{\glspostdescription}{% + \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi +} +\end{verbatim} +where the conditional is determined by the \pkgopt{nopostdot} +package option. The \pkgopt{postpunc} option removes the conditional +from the definition of \cs{glspostdescription}. The package options +\pkgopt{nopostdot} and \pkgopt{postdot} will restore the original definition of +\cs{glspostdescription}. + +The \sty{glossaries-extra-stylemods} package adjusts +the predefined styles that had a hard-coded \cs{space} +before the \gls{numberlist} so that they use \cs{glsxtrprelocation} +instead (which is defined to \cs{space}). You can therefore +redefine this command in combination with \pkgopt{postpunc} +to alter the separator before the \gls{numberlist}. +For example, to have a comma followed by \cs{hfil}: +\begin{verbatim} +\usepackage[postpunc=comma,stylemods]{glossaries-extra} +\renewcommand{\glsxtrprelocation}{\hfil} +\end{verbatim} +Be careful with doing this as it will look odd if the \gls{numberlist} is +missing. (With \gls{bib2gls} you can instead redefine +\cs{glsxtrprelocation} to do nothing and set the +location prefixes with \texttt{loc-prefix} which will only +apply if the entry has a \gls{numberlist}.) + +\item[{\pkgoptdef{accsupp}}] Load the \sty{glossaries-accsupp} +package (if not already loaded). + +If you want to define styles that can interface with the +accessibility support provided by \sty{glossaries-accsupp} use +the \cs{glsaccess\meta{xxx}} type of commands instead of +\cs{glsentry\meta{xxx}} (for example, \ics{glsaccesstext} instead of +\ics{glsentrytext}). If \sty{glossaries-accsupp} hasn't been loaded +those commands are equivalent (for example, \cs{glsaccesstext} +just does \cs{glsentrytext}) but if it has been loaded, then the +\cs{glsaccess\meta{xxx}} commands will add the accessibility +information. (See \sectionref{sec:accsupp} for further details.) + +Note that the \pkgopt{accsupp} option can only be used as +a~package option (and can't be set with \ics{glossariesextrasetup}) since the \sty{glossaries-accsupp} +package must be loaded before \styfmt{glossaries-extra} if it's +required. + +\item[{\pkgoptdef{stylemods}}] This is a +\meta{key}=\meta{value} option used to load the +\sty{glossaries-extra-stylemods} package. The value may be a +comma-separated list of options to pass to that package. (Remember +to group \meta{value} if it contains any commas.) The value may be +omitted if no options need to be passed. See \sectionref{sec:glosstylemods} +for further details. There are two special keyword values: +\pkgopt[default]{stylemods} (equivalent to omitting the value) +and \pkgopt[all]{stylemods}, which loads all the +predefined styles. + +\item[{\pkgoptdef{undefaction}}] This is a \meta{key}=\meta{value} +option, which has two allowed values: \pkgoptfmt{warn} and +\pkgoptfmt{error}. This indicates what to do if an undefined +glossary entry is referenced. The default behaviour is +\pkgopt[error]{undefaction}, which produces an error message (the +default for \styfmt{glossaries}). You can switch this to a warning +message (and ?? appearing in the text) with +\pkgopt[warn]{undefaction}. + +\begin{important} +Undefined entries can't be picked up by any commands that iterate +over a glossary list. This includes \ics{forglsentries} and +\ics{glsaddall}. +\end{important} + +Note that \ics{ifglsused} will display ?? in the document text with +\pkgopt[warn]{undefaction} if the entry hasn't been defined, as the +underlying boolean variable doesn't exist and so is neither true nor +false. (There will also be a warning in the transcript.) See +\sectionref{sec:glsunset} for further details. + +\item[{\pkgoptdef{indexcrossrefs}}] This is a boolean option. +If \pkgoptfmt{true}, this will automatically index any +cross-referenced entries that haven't been marked as used at +the end of the document. Note that this necessarily adds to +the overall document build time, especially if you have defined +a large number of entries, so this defaults to \pkgoptfmt{false}, +but it will be automatically switched on if you use the \gloskey{see} +or \gloskey{seealso} keys in any entries (unless +\pkgopt[false]{autoseeindex}). To force it off, even if you use the +\gloskey{see} or \gloskey{seealso} key, you +need to explicitly set \pkgopt{indexcrossrefs} to \pkgoptfmt{false}. + +Note that \gls{bib2gls} can automatically find dependent +entries when it parses the \texttt{.bib} source file. +The \pkgopt{record} option automatically implements +\pkgopt[false]{indexcrossrefs}. + +\item[{\pkgoptdef{autoseeindex}}]\label{opt:autoseeindex} (New to +v1.16.) This is a boolean option. If true (default), this makes +the \gloskey{see} and \gloskey{seealso} keys automatically index the +cross-reference when an entry is defined. If false, the value +of those keys will still be stored in their corresponding fields +(and can be accessed using commands like \cs{glsxtrusesee} and +\cs{glsxtruseseealso}) but cross-reference won't be automatically +indexed. + +Note that the \pkgopt[only]{record} option automatically implements +\pkgopt[false]{autoseeindex}. + +For example, if an entry is defined as +\begin{verbatim} +\newglossaryentry{foo}{name={foo},description={},see={bar,baz}} +\end{verbatim} +then with \texttt{autoseeindex=true}, this is equivalent to +\begin{verbatim} +\newglossaryentry{foo}{name={foo},description={}} +\glssee{foo}{bar,baz} +\glossariesextrasetup{indexcrossrefs=true} +\GlsXtrSetField{foo}{see}{bar,baz} +\end{verbatim} +but with \texttt{autoseeindex=false}, this is equivalent to +\begin{verbatim} +\newglossaryentry{foo}{name={foo},description={}} +\GlsXtrSetField{foo}{see}{bar,baz} +\end{verbatim} +Note that \pkgopt{indexcrossrefs} isn't automatically implemented +by the presence of the \gloskey{see} key when \pkgopt{autoseeindex} +is false. + +It's therefore possible to remove the cross-references from the +location lists and set their position within the glossary style. + +Another method of preventing the automatic indexing is to +define the entries before the external indexing files have been +opened with \cs{makeglossaries}. Since the appropriate file isn't +open, the information can't be written to it. This will need +the package option \pkgoptfmt{seenoindex=ignore} (provided by +\styfmt{glossaries}) to prevent an error occurring. + +\item[{\pkgoptdef{record}}]\label{opt:record}(New to v1.08.) This is +a \meta{key}=\meta{value} option provided for the benefit of +\gls{bib2gls} (see \sectionref{sec:bib2gls}). + +The option may only be set in the preamble and can't be used after +\cs{GlsXtrLoadResources}. If the value is missing +\pkgopt[only]{record} is assumed. Permitted values: +\begin{description} +\item[\pkgoptfmt{off}] This is the default setting. The indexing +is performed as normal using either \cs{makeglossaries} +or \cs{makenoidxglossaries}. This setting implements \pkgopt[error]{undefaction}. + +\item[\pkgoptfmt{only}] The indexing is performed by +\gls{bib2gls} (see \sectionref{sec:bib2gls}). Neither +\cs{makeglossaries} nor \cs{makenoidxglossaries} is permitted. +This setting implements \pkgopt[warn]{undefaction} and automatically +loads the supplementary \sty{glossaries-extra-bib2gls} package. +(There should be no need to explicitly load \sty{glossaries-extra-bib2gls}.) + +The glossaries should be displayed using \cs{printunsrtglossary} +(or \cs{printunsrtglossaries}). + +The document build process is (assuming the file is called +\texttt{myDoc.tex}): +\begin{verbatim} +pdflatex myDoc +bib2gls myDoc +pdflatex myDoc +\end{verbatim} + +Note that \pkgopt[only]{record} will prevent the \gloskey{see} from +automatically implementing \cs{glssee}. (\gls{bib2gls} deals with the +\gloskey{see} field.) You may explicitly use \cs{glssee} in the +document, but \gls{bib2gls} will ignore the cross-reference if the +\gloskey{see} field was already set for that entry. + +The \pkgopt[only]{record} option will automatically set +the \styfmt{glossaries} package's \pkgopt[none]{sort} option +if available. (That option value was only introduced to +\styfmt{glossaries} v4.30.) + +\item[\pkgoptfmt{nameref}] (New to v1.37 and requires \gls{bib2gls} +v1.8+.) This option is like \pkgopt[only]{record} but additionally +records the current label information given by \cs{@currentlabel} +and \cs{@currentHref}, and provides a more reliable way of saving +the \cs{theH}\meta{counter} for the given location. This option +requires \sty{hyperref} otherwise it will fall back on the usual +location records. Remember that \cs{@currentHref} is always globally +updated whenever \cs{refstepcounter} is used, but \cs{@currentlabel} +isn't. This can cause some undesired side-effects with some settings. Remember also that the \pkgopt{indexcounter} option +increments the associated counter every time an entry is indexed, +which affects this option. See \sectionref{sec:recordnameref} for +further details. + +This option is best used with \pkgopt[chapter]{counter} or +\pkgopt[section]{counter} if you want the title included in the +location list. If the indexing counter is the default +\ctr{page}, only the location number is shown. Similarly for +\pkgopt[equation]{counter} (or \pkgopt[true]{equations}). + +\item[\pkgoptfmt{alsoindex}] This is a hybrid setting +that uses \gls{bib2gls} to fetch entry information from +\texttt{.bib} files, but uses \gls{makeindex} or \gls{xindy} +to create the glossary files. This option should be used +with \cs{makeglossaries} but not with its optional argument. +This option should not be used with \cs{makenoidxglossaries}. +You may need to change the transcript file used by \gls{bib2gls} +to avoid a clash with the transcript file used by +\gls{makeindex} or \gls{xindy}. (This can be done with +\gls{bib2gls}['s] \verb|--log-file| or \verb|-t| option.) + +The glossaries should be displayed using \cs{printglossary} +(or \cs{printglossaries}). This option is expected to be used with +\gls{bib2gls}'s \texttt{sort=none} setting and so +\sty{glossaries-extra-bib2gls} is not automatically loaded. + +The document build process is (assuming the file is called +\texttt{myDoc.tex}): +\begin{verbatim} +pdflatex myDoc +bib2gls myDoc +pdflatex myDoc +makeglossaries myDoc +pdflatex myDoc +\end{verbatim} +\end{description} + +With the recording on (\pkgopt[only]{record} or +\pkgopt[alsoindex]{record}), any of the commands that would typically +index the entry (such as \cs{gls}, \cs{glstext} or \cs{glsadd}) +will add a \cs{glsxtr@record} entry to the \texttt{.aux} file. +\gls{bib2gls} can then read these lines to find +out which entries have been used. (Remember that commands like +\cs{glsentryname} don't index, so any use of these commands won't +add a corresponding \cs{glsxtr@record} entry to the \texttt{.aux} +file.) See \sectionref{sec:bib2gls} for further details. + +\item[{\pkgoptdef{equations}}] (New to v1.37.) This option will +cause the default location counter to automatically switch +to \ctr{equation} when inside a numbered equation environment, such +as \env{equation} or \env{align}. The counter can be explicitly +overridden with \gloskey[glslink]{counter} in the optional +arguments of commands like \cs{glslink} or \cs{gls} as usual. + +\item[{\pkgoptdef{floats}}] (New to v1.37.) This option will +cause the default location counter to automatically switch +to the corresponding counter when inside a floating environment, +such as \env{figure} or \env{table}. The counter can be explicitly +overridden with \gloskey[glslink]{counter} in the optional +arguments of commands like \cs{glslink} or \cs{gls} as usual. +Remember that within floats it's the \cs{caption} command that actually uses +\cs{refstepcounter}, so indexing before the caption will result in +the wrong reference. The commands for use in captions and sections, +such as \cs{glsfmttext} and \cs{glsfmtshort}, don't index. (See +\sectionref{sec:headtitle}). You may +want to consider using \cs{glsadd} after the caption (not before). For example: +\begin{verbatim} +\begin{figure}[htbp] + \centering + \includegraphics{example-image} + \caption{Sample \glsfmttext{foobar} figure} + \glsadd{foobar} +\end{figure} +\end{verbatim} + +\item[{\pkgoptdef{indexcounter}}] (New to v1.29.) This option (which +doesn't take a value) is primarily intended for use with +\gls{bib2gls} (v1.4+) and \sty{hyperref}. It can be used with +\gls{makeindex} or \gls{xindy} but it will interfere with the +\gls{numberlist} collation, so you won't have ranges and you'll have +duplicate page numbers present (but each page number will link to +the relevant part of the page where the indexing occurred). This +option automatically implements \pkgopt[wrglossary]{counter}. + +\begin{important} +This option works by incrementing \ctr{wrglossary} and +adding \ics{label}. This can cause a problem if the indexing +occurs in an \env{equation} environment as \sty{amsmath} +forbids multiple occurrences of \cs{label} (resulting in the +\qt{Multiple \cs{label}'s} error). It's best to change the counter +to \ctr{page} or \ctr{equation} when in maths mode with this option. +For example: +\begin{verbatim} +\renewcommand{\glslinkpresetkeys}{% + \ifmmode \setkeys{glslink}{counter=equation}\fi} +\renewcommand{\glsaddpresetkeys}{% + \ifmmode \setkeys{glossadd}{counter=equation}\fi} +\end{verbatim} +\end{important} + +By default (with \sty{hyperref}), the page numbers in +\glspl{numberlist} link back to the top of the relevant page +(provided the format uses \cs{glshypernumber}). The +\pkgopt{indexcounter} option is designed to link back to the place +within the page where the indexing occurred. It does this by +creating a new counter (called \ctr{wrglossary}) that's incremented +with \cs{refstepcounter} every time an entry is indexed (but not via +cross-referencing commands, such as \cs{glssee}). A \cs{label} is +placed immediately after the increment command allowing the +back-referenced to be obtained with \cs{pageref}. The location, as +seen by the indexing application, is the value of the +\ctr{wrglossary} counter but this value is substituted with the page +reference when \gls{numberlist} is typeset. Since the counter is +used by all entries and is incremented every time any indexing +occurs, neither \gls{makeindex} nor \gls{xindy} can correctly +collate the lists. For example, if the first term to be referenced +is indexed three times on page~5 without any intervening terms then +the actual locations obtained from \ctr{wrglossary} will be 1, 2 and +3, which \gls{xindy} and \gls{makeindex} will try to form into the +range 1--3, but they should actually all simply appear as page~5, +whereas it can actually end up with 5--5. Conversely, a range may +not be formed where it would naturally occur if just the \ctr{page} +counter was used. + +Since \gls{bib2gls} is designed specifically to work with +\styfmt{glossaries-extra}, \gls{bib2gls} (v1.4+) will check for +\ctr{wrglossary} locations. If the default +\texttt{--merge-wrglossary-records} is on, then any records for the +same page for a given entry will be merged. In the above example +with three references on page~5, only a single record for page~5 for +that entry will be added to the \gls{numberlist} and it will link +back to the first instance on that page. Whereas if you use the +\texttt{--no-merge-wrglossary-records} switch, the \gls{numberlist} +will contain three instance of page~5, with each linking to the +corresponding place on that page. In both cases, consecutive pages +can form ranges, but it may look strange in the second case. + +See the \gls{bib2gls} documentation for the +\texttt{save-index-counter} resource option for more details. + +\item[{\pkgoptdef{docdef}}] This option governs the use of +\cs{newglossaryentry}. It was originally a boolean option, +but as from version 1.06, it can now take one of the following values (if +the value is omitted, \pkgoptfmt{true} is assumed): +\begin{itemize} +\item[{\pkgopt[false]{docdef}}] \ics{newglossaryentry} is not +permitted in the \env{document} environment (default). + +\item[{\pkgopt[true]{docdef}}] \cs{newglossaryentry} behaves as it +does in the base \styfmt{glossaries} package. That is, where +its use is permitted in the \env{document} environment, it +uses the \texttt{.glsdefs} temporary file to store the entry +definitions so that on the next \LaTeX\ run the entries are +defined at the beginning of the \env{document} environment. +This allows the entry information to be referenced in the glossary, +even if the glossary occurs before \cs{newglossaryentry}. +(For example, when the glossary is displayed in the front matter.) +This method of saving the definitions for the next \LaTeX\ run +has drawbacks that are detailed in the \styfmt{glossaries} user +manual. + +Remember that if \cs{newglossaryentry} wouldn't be allowed +in the \env{document} environment with the +base \styfmt{glossaries} package, then it still won't +be allowed with \pkgopt[true]{docdefs}. +If your glossaries occur at the end of the document, consider using +\pkgopt[restricted]{docdef} instead. + +\item[{\pkgopt[restricted]{docdef}}] (new to version 1.06) +\ics{newglossaryentry} is permitted in the \env{document} +environment without using the \texttt{.glsdefs} file. This means +that all entries must be defined before the glossary is displayed, +but it avoids the complications associated with saving the +entry details in a temporary file. You will still need to take +care about any changes made to characters that are required +by the \meta{key}=\meta{value} mechanism (that is, the comma and +equal sign) and any \gls{makeindex} or \gls{xindy} character that +occurs in the \gloskey{sort} key or label. If any of those +characters are made active in the document, then it can cause +problems with the entry definition. This option will allow +\cs{newglossaryentry} to be used in the document with +\cs{makenoidxglossaries}, but note that \cs{longnewglossaryentry} +remains a preamble-only command. + +With this option, if an entry appears in the glossary before +it has been defined, an error will occur (or a warning if +the \pkgopt[warn]{undefaction} option is used.) If you edit your +document and either remove an entry or change its label, you may +need to delete the document's temporary files (such as the +\texttt{.aux} and \texttt{.gls} files). + +\item[{\pkgopt[atom]{docdef}}] (new to version 1.34) +This option behaves like \pkgopt[restricted]{docdef} but creates the +\texttt{.glsdefs} file for +\href{https://atom.io/packages/autocomplete-glossaries}{atom's +autocomplete support}. This file isn't input by +\styfmt{glossaries-extra} and so associated problems with the use of +this file are avoided, but it allows the autocomplete support to +find the labels in the file. As with \pkgopt[restricted]{docdef}, +entries may be defined in the preamble or anywhere in the document, +but they may only be referenced after they have been defined. +Entries must be defined before the associated glossary is displayed. + +\end{itemize} + +The \styfmt{glossaries} package allows +\cs{newglossaryentry} within the \env{document} environment (when +used with \gls{makeindex} or \gls{xindy}) but the user manual warns +against this usage. By default the \styfmt{glossaries-extra} package +\emph{prohibits} this, only allowing definitions within the +preamble. If you are really determined to define entries in the +\env{document} environment, despite all the associated drawbacks, +you can restore this with \pkgopt[true]{docdef}. Note that this +doesn't change the prohibitions that the \styfmt{glossaries} +package has in certain circumstances (for example, when using +\qt{option~1}). See the \styfmt{glossaries} user manual for further +details. A better option if document definitions are required +is \pkgopt[restricted]{docdef}. Only use \pkgopt[true]{docdef} +if document definitions are necessary and one or more of the +glossaries occurs in the front matter. + +\begin{sloppypar} +This option affects commands that internally use +\cs{newglossaryentry}, such as \cs{newabbreviation}, but not +the \qt{on-the-fly} commands described in \sectionref{sec:onthefly}. +\end{sloppypar} + +\item[{\pkgoptdef{nomissingglstext}}] This is a boolean option. +If true, this will suppress the warning written to the transcript +and the warning text that will appear in the +document if the external glossary files haven't been generated due +to an incomplete document build. However, it's probably simpler +just to fix whatever has caused the failure to build the external +file or files. + +\item[{\pkgoptdef{abbreviations}}] This option has no value and can't +be cancelled. If used, +it will automatically create a new glossary with the label +\texttt{abbreviations} and redefines \cs{glsxtrabbrvtype} to this +label. In addition, it defines a shortcut command +\begin{definition}[\DescribeMacro\printabbreviations] +\cs{printabbreviations}\oarg{options} +\end{definition} +which is equivalent to +\begin{alltt} +\cs{printglossary}[type=\cs{glsxtrabbrvtype},\meta{options}] +\end{alltt} +If \sty{glossaries-extra-bib2gls} is also loaded then this option +will additionally provide: +\begin{definition}[\DescribeMacro\printunsrtabbreviations] +\cs{printunsrtabbreviations}\oarg{options} +\end{definition} +which uses \ics{printunsrtglossary}. + +The title of the new glossary is given by +\begin{definition}[\DescribeMacro\abbreviationsname] +\cs{abbreviationsname} +\end{definition} +If this command is already defined, it's left unchanged. Otherwise +it's defined to \qt{Abbreviations} if \sty{babel} hasn't been loaded +or \cs{acronymname} if \sty{babel} has been loaded. However, if +you're using \sty{babel} it's likely you will need to change this. +(See \sectionref{sec:lang} for further details.) + +\begin{important} +If you don't use the \pkgopt{abbreviations} package option, +the \cs{abbreviationsname} command won't be defined (unless it's +defined by an included language file). +\end{important} + +If the \pkgopt{abbreviations} option is used and the +\pkgopt{acronym} option provided by the \styfmt{glossaries} +package hasn't been used, then \ics{acronymtype} +will be set to \ics{glsxtrabbrvtype} so that acronyms defined with +\ics{newacronym} can be added to the list of abbreviations. If you +want acronyms in the \texttt{main} glossary and other abbreviations in the +\texttt{abbreviations} glossary then you will need to redefine +\cs{acronymtype} to \texttt{main}: +\begin{verbatim} +\renewcommand*{\acronymtype}{main} +\end{verbatim} + +Note that there are no analogous options to the \styfmt{glossaries} +package's \pkgopt{acronymlists} option (or associated commands) +as the abbreviation mechanism is handled differently with +\styfmt{glossaries-extra}. + +\item[{\pkgoptdef{symbols}}] This is passed to \styfmt{glossaries} but +will additionally define +\begin{definition}[\DescribeMacro\glsxtrnewsymbol] +\cs{glsxtrnewsymbol}\oarg{options}\marg{label}\marg{symbol} +\end{definition} +which is equivalent to +\begin{alltt} +\cs{newglossaryentry}\marg{label}\{name=\marg{symbol}, + sort=\marg{label},type=symbols,category=symbol,\meta{options}\} +\end{alltt} +Note that the \gloskey{sort} key is set to the \meta{label} +not the \meta{symbol} as the symbol will likely contain commands. + +If \sty{glossaries-extra-bib2gls} is also loaded then this option +will additionally provide: +\begin{definition}[\DescribeMacro\printunsrtsymbols] +\cs{printunsrtsymbols}\oarg{options} +\end{definition} +which uses \ics{printunsrtglossary}. + +\item[{\pkgoptdef{numbers}}] This is passed to \styfmt{glossaries} but +will additionally define +\begin{definition}[\DescribeMacro\glsxtrnewnumber] +\cs{glsxtrnewnumber}\oarg{options}\marg{number} +\end{definition} +which is equivalent to +\begin{alltt} +\cs{newglossaryentry}\marg{label}\{name=\marg{number}, + sort=\marg{label},type=numbers,category=number,\meta{options}\} +\end{alltt} + +If \sty{glossaries-extra-bib2gls} is also loaded then this option +will additionally provide: +\begin{definition}[\DescribeMacro\printunsrtnumbers] +\cs{printunsrtnumbers}\oarg{options} +\end{definition} +which uses \ics{printunsrtglossary}. + +\item[{\pkgoptdef{acronyms} (or \pkgoptdef{acronym})}] This is +passed to \styfmt{glossaries} but if +\sty{glossaries-extra-bib2gls} is also loaded then this option +will additionally provide: +\begin{definition}[\DescribeMacro\printunsrtacronyms] +\cs{printunsrtacronyms}\oarg{options} +\end{definition} +which uses \ics{printunsrtglossary}. + +\begin{important} +This option defines a new glossary with the label \texttt{acronym} +not \texttt{acronyms}. You may find it easier to reference it +with the command \ics{acronymtype}. +\end{important} + +\item[{\pkgoptdef{index}}] This is +passed to \styfmt{glossaries} but if +\sty{glossaries-extra-bib2gls} is also loaded then this option +will additionally provide: +\begin{definition}[\DescribeMacro\printunsrtindex] +\cs{printunsrtindex}\oarg{options} +\end{definition} +which uses \ics{printunsrtglossary}. + +\item[{\pkgoptdef{shortcuts}}] Unlike the \styfmt{glossaries} package +option of the same name, this option isn't boolean but has multiple +values: +\begin{itemize} +\item \pkgopt[acronyms]{shortcuts} (or \pkgopt[acro]{shortcuts}): +set the shortcuts provided by the \styfmt{glossaries} package for +acronyms (such as \cs{ac}). Note that the short and long forms don't +use \cs{glsxtrshort} and \cs{glsxtrlong} but use the original +\cs{acrshort} and \cs{acrlong}, which don't recognise multiple +abbreviation styles. The better option with \styfmt{glossaries-extra} +is \pkgopt[ac]{shortcuts}. + +\item \pkgopt[ac]{shortcuts}: +set the shortcuts provided by the \styfmt{glossaries} package for +acronyms (such as \cs{ac}) but uses the \styfmt{glossaries-extra} +interface (such as \cs{glsxtrshort} rather than \cs{acrshort}). +In this case \cs{ac} is defined as \cs{cgls} rather than +\cs{gls}. + +\item \pkgopt[abbreviations]{shortcuts} (or +\pkgopt[abbr]{shortcuts}): +set the abbreviation shortcuts provided by \styfmt{glossaries-extra}. (See +\sectionref{sec:abbrshortcuts}.) These settings don't switch on the +acronym shortcuts provided by the \styfmt{glossaries} package. + +\item \pkgopt[other]{shortcuts}: set the \qt{other} +shortcut commands, but not the shortcut commands for abbreviations +or the acronym shortcuts provided by \styfmt{glossaries}. +The \qt{other} shortcuts are: +\begin{itemize} +\item \ics{newentry} equivalent to \ics{newglossaryentry} +\item \ics{newsym} equivalent to \ics{glsxtrnewsymbol} (see the +\pkgopt{symbols} option). +\item \ics{newnum} equivalent to \ics{glsxtrnewnumber} (see the +\pkgopt{numbers} option). +\end{itemize} + +\item \pkgopt[all]{shortcuts} (or \pkgopt[true]{shortcuts}): +implements \pkgopt[ac]{shortcuts}, \pkgopt[abbreviations]{shortcuts} +and \pkgopt[other]{shortcuts}. + +\item \pkgopt[none]{shortcuts} (or \pkgopt[false]{shortcuts}): +don't define any of the shortcut commands (default). +\end{itemize} + +Note that multiple invocations of the \pkgopt{shortcuts} option +\emph{within the same option list} will override each other. +\end{description} + +After the \styfmt{glossaries-extra} package has been loaded, you can +set available options using +\begin{definition}[\DescribeMacro\glossariesextrasetup] +\cs{glossariesextrasetup}\marg{options} +\end{definition} +The \pkgopt{abbreviations} and \pkgopt{docdef} options may only be +used in the preamble. Additionally, \pkgopt{docdef} can't be used +after \ics{makenoidxglossaries}. + +\chapter{Modifications to Existing Commands and Styles} +\label{sec:modifications} + +The \styfmt{glossaries} package provides \ics{nopostdesc} +which may be used in the \gloskey{description} to suppress +the post-description hook. The \styfmt{glossaries-extra} package +provides another command +\begin{definition}[\DescribeMacro\glsxtrnopostpunc] +\cs{glsxtrnopostpunc} +\end{definition} +which has a similar function but only suppresses the +post-description punctuation. It doesn't suppress the use of +\cs{glsxtrpostdescription} which allows the use of +category-dependent post-description hooks. (Note that the +punctuation, which is in the original base hook \cs{glspostdescription}, +comes after the extended post-description hook +\cs{glsxtrpostdescription} not before.) The post-description hook +can counter-act the effect of \cs{glsxtrnopostpunc} using +\begin{definition}[\DescribeMacro\glsxtrrestorepostpunc] +\cs{glsxtrrestorepostpunc} +\end{definition} +These commands have no effect outside of the glossary (except with +standalone entries that use \cs{glsxtractivatenopost} and +\cs{glspostdescription}, see \sectionref{sec:glossentry}). + +The \styfmt{glossaries} package provides +\begin{definition}[\DescribeMacro\glsseeitemformat] +\cs{glsseeitemformat}\marg{label} +\end{definition} +to format items in a cross-reference list (identified with the +\gloskey{see} key or \cs{glssee}). This was originally defined to +use \cs{glsentryname}\marg{label} since it makes more sense for the +cross-reference to match the way the term appears in the glossary. +Unfortunately this caused a problem when the \gloskey{name} field +was sanitized, which used to be the default setting, so +\styfmt{glossaries} v3.0 changed the default definition of this +command to use \cs{glsentrytext} instead. Since the \gloskey{name} +and \gloskey{text} field are quite often the same, this change +usually doesn't have a noticeable effect. However, now that the +\gloskey{name} field is no longer sanitized (following the redesign +of \styfmt{glossaries} v4.0) it makes more sense to restore this +command to its original behaviour, but to take account of +abbreviations \styfmt{glossaries-extra} redefines this as: +\begin{verbatim} +\renewcommand*{\glsseeitemformat}[1]{% + \ifglshasshort{\glslabel}{\glsaccesstext{#1}}{\glsaccessname{#1}}% +} +\end{verbatim} +If you want to restore the \styfmt{glossaries} v3.0+ definition just do: +\begin{verbatim} +\renewcommand*{\glsseeitemformat}[1]{\glsentrytext{#1}} +\end{verbatim} +The \sty{glossaries-extra} package provides \ics{glsxtrhiername} +and its case-changing variants that may be used within +the definition of \cs{glsseeitemformat} if required. These +display the hierarchy for sub-entries rather than just the name, +which may be more helpful in cross-references. See +\sectionref{sec:see} for further details. + +The commands used by \styfmt{glossaries} to automatically produce an +error if an entry is undefined (such as \ics{glsdoifexists}) are +changed to take the \pkgopt{undefaction} option into account. + +The \ics{newignoredglossary}\marg{type} command now (as from v1.11) has a starred +version that doesn't automatically switch off the hyperlinks. +This starred version may be used with the \catattr{targeturl} +attribute to create a link to an external URL. (See +\sectionref{sec:categories} for further details.) +As from v1.12 both the starred and unstarred version check +that the glossary doesn't already exist. (The \styfmt{glossaries} +package omits this check.) + +You can now provide an ignored glossary with: +\begin{definition}[\DescribeMacro\provideignoredglossary] +\cs{provideignoredglossary}\marg{type} +\end{definition} +which will only define the glossary if it doesn't already exist. +This also has a starred version that doesn't automatically switch +off hyperlinks. + +The individual glossary displaying commands \ics{printglossary}, +\ics{printnoidxglossary} and \cs{printunsrtglossary} have two extra +keys: + +\begin{itemize} +\item \gloskey[printglossary]{target}. This is a boolean key which can +be used to switch off the automatic hypertarget for each entry. +Unlike \cs{glsdisablehyper} this doesn't switch off hyperlinks, so +any cross-references within the glossary won't be affected. This is +a way of avoiding duplicate target warnings if a glossary needs to +be displayed multiple times. +\item +\gloskey[printglossary]{targetnameprefix}\texttt{=}\marg{prefix}. Another way +of avoiding duplicate target names is to set a prefix +used for the names. Unlike changing \cs{glolinkprefix} this doesn't affect +any hyperlinks (such as those created with \cs{gls}). +\item +\gloskey[printglossary]{prefix}\texttt{=}\marg{prefix}. If you do +actually want to locally change \cs{glolinkprefix}, you can use +the \gloskey{prefix} key instead. You need to use the matching +\gloskey[glslink]{prefix} key in commands like \cs{gls}. + +\item +\gloskey[printglossary]{label}\texttt{=}\marg{label}. Labels +the glossary with \texttt{\cs{label}\marg{label}} and also +defines \cs{@currentlabelname} to the glossary's TOC title +(to provide text for \cs{nameref}). You can also set the +label before the glossary using: +\begin{definition}[\DescribeMacro\glsxtrsetglossarylabel] +\cs{glsxtrsetglossarylabel}\marg{label} +\end{definition} +but take care of duplicate labels if it's not scoped. +\end{itemize} + +The \cs{newglossaryentry} command has three new keys: +\begin{itemize} +\item \gloskey{category}, which sets the category label for the given +entry. By default this is \texttt{general}. See +\sectionref{sec:categories} for further information about +categories. +\item \gloskey{alias}, which allows an entry to be alias to another +entry. See \sectionref{sec:alias} for further details. +\item \gloskey{seealso}, which performs much like \gloskey{see}, but +allows for separate \qt{see} and \qt{see also} treatment. +See \sectionref{sec:see} for further details. +\end{itemize} +The test file \texttt{example-glossaries-xr.tex} contains +dummy entries with a mixture of \gloskey{see}, \gloskey{alias} +and \gloskey{seealso} keys for use with minimal working examples. +There are also \texttt{example-glossaries-*.bib} files that +correspond to each \texttt{example-glossaries-*.tex} file +for testing \gls{bib2gls}. + +The \cs{longnewglossaryentry} command now has a starred version +(as from v1.12) that doesn't automatically insert +\begin{verbatim} +\leavevmode\unskip\nopostdesc +\end{verbatim} +at the end of the description field. +\begin{definition}[\DescribeMacro\longnewglossaryentry] +\cs{longnewglossaryentry}*\marg{label}\marg{options}\marg{description} +\end{definition} +The \gloskey{descriptionplural} key is left unset unless explicitly +set in \meta{options}. + +The unstarred version no longer hard-codes the above code (which +removes trailing space and suppresses the post-description hook) but instead +uses: +\begin{definition}[\DescribeMacro\glsxtrpostlongdescription] +\cs{glsxtrpostlongdescription} +\end{definition} +This can be redefined to allow the post-description hook to work +but retain the \cs{unskip} part if required. +For example: +\begin{verbatim} +\renewcommand*{\glsxtrpostlongdescription}{\leavevmode\unskip} +\end{verbatim} +This will discarded unwanted trailing space at the end of the description +but won't suppress the post-description hook. + +The unstarred version also alters the base \sty{glossaries} package's +treatment of the \gloskey{descriptionplural} key. Since a +plural description doesn't make much sense for multi-paragraph +descriptions, the default behaviour with +\sty{glossaries-extra}'s +\cs{longnewglossaryentry} is to simply leave the plural description +unset unless explicitly set using the \gloskey{descriptionplural} +key. The \styfmt{glossaries.sty} version of this command sets the description's +plural form to the same as the singular.\footnote{The +\gloskey{descriptionplural} key is a +throwback to the base package's original acronym mechanism before the introduction of +the \gloskey{long} and \gloskey{short} keys, where the long form was +stored in the \gloskey{description} field and the short form was stored in the +\gloskey{symbol} field.} + +Note that this modified unstarred version doesn't append +\cs{glsxtrpostlongdescription} to the description's plural form. + +The \ics{newterm} command (defined through the \pkgopt{index} package +option) is modified so that the category defaults to \category{index}. +The \ics{newacronym} command is modified to use the new abbreviation +interface provided by \styfmt{glossaries-extra}. +(See \sectionref{sec:abbreviations}.) + +The \cs{makeglossaries} command now has an optional argument. +\begin{definition}[\DescribeMacro\makeglossaries] +\cs{makeglossaries}\oarg{list} +\end{definition} +If \meta{list} is empty, \cs{makeglossaries} behaves as per +its original definition in the \styfmt{glossaries} package, +otherwise \meta{list} can be a comma-separated list of glossaries +that need processing with an external indexing application. + +This command is not permitted with the \pkgopt[only]{record} +package option. Without the optional argument, it's permitted +with \pkgopt[alsoindex]{record}. With the optional argument, +it's only permitted with the default \pkgopt[off]{record}. + +It should then be possible to use \cs{printglossary} for those +glossaries listed in \meta{list} and \cs{printnoidxglossary} +for the other glossaries. (See the accompanying file +\texttt{sample-mixedsort.tex} for an example.) + +\begin{important} +If you use the optional argument \meta{list}, you can't define +entries in the document (even with the \pkgopt{docdef} option). +\end{important} + +You will need at least version 2.20 of \gls{makeglossaries} or at +least version 1.3 of the Lua alternative \gls{makeglossaries-lite.lua} (both distributed +with \styfmt{glossaries} v4.27) to allow for this use of +\cs{makeglossaries}\oarg{list}. Alternatively, use the +\pkgopt{automake} option. + +\section{Entry Indexing} +\label{sec:wrglossary} + +As from version 1.31, there is a new command like \cs{glsadd} +where the mandatory argument is a comma-separated list +of labels: +\begin{definition}[\DescribeMacro\glsaddeach] +\cs{glsaddeach}\oarg{options}\marg{list} +\end{definition} +This simply iterates over \meta{list} and does +\cs{glsadd}\oarg{options}\marg{label} for each entry in the list. + +As from version 1.37, you can make commands like \cs{gls} or +\cs{glslink} automatically use \cs{glsadd} with specific options +when a given format is used (identified with +\texttt{format=\marg{format}} in the optional argument of the +corresponding \cs{gls}, \cs{glslink} etc). +\begin{definition}[\DescribeMacro\GlsXtrAutoAddOnFormat] +\cs{GlsXtrAutoAddOnFormat}\oarg{label}\marg{format list}\marg{glsadd options} +\end{definition} +The optional argument \meta{label} defaults to \cs{glslabel} and +indicates the label to use in \cs{glsadd} and so needs to be +expandable. The \meta{format list} is a comma-separated list +of format values that will trigger the automated adding. The +\meta{glsadd options} are the options to pass to \cs{glsadd} with +\texttt{format=\marg{format}} prepended to the list. + +For example, with: +\begin{verbatim} +\GlsXtrAutoAddOnFormat{hyperbf}{counter=chapter} +\end{verbatim} +then \verb|\gls[format=hyperbf]{sample}| will be equivalent to +\begin{verbatim} +\glsadd[format=hyperbf,counter=chapter]{sample}\gls[format=hyperbf]{sample} +\end{verbatim} +Note that the explicit range markers will prevent a match +unless you include them in \meta{format list} (in which case, be +sure to add both the start and end formats). + +Here's another example: +\begin{verbatim} +\GlsXtrAutoAddOnFormat[dual.\glslabel]{hyperbf}{} +\end{verbatim} +In this case \verb|\gls[format=hyperbf]{sample}| will now be +equivalent to: +\begin{verbatim} +\glsadd[format=hyperbf]{dual.sample}\gls[format=hyperbf]{sample} +\end{verbatim} + +\begin{important} +\cs{GlsXtrAutoAddOnFormat} is not applied to \cs{glsadd} +as it could cause an infinite loop. +\end{important} +The \styfmt{glossaries-extra} package provides extra keys for +commands like \cs{gls} and \cs{glstext}: +\begin{description} +\item[{\gloskey[glslink]{noindex}}] This is a boolean key. If true, +this suppresses the indexing. (That is, it prevents \cs{gls} or +whatever from adding a line to the external glossary file.) +This is more useful than the \pkgopt{indexonlyfirst} package option +provided by \styfmt{glossaries}, as the \gls{firstuse} might not be the most +pertinent use. (If you want to apply \pkgopt{indexonlyfirst} +to selected entries, rather than all of them, you can use +the \catattr{indexonlyfirst} attribute, see +\sectionref{sec:categories} for further details.) +Note that the \gloskey[glslink]{noindex} key isn't available +for \ics{glsadd} (and \ics{glsaddall}) since the whole purpose +of that command is to index an entry. + +\item[{\gloskey[glslink]{wrgloss}}] (New to v1.14.) +This is may only take the +values \optfmt{before} or \optfmt{after}. By default, commands +that both index and display link text (such as \cs{gls}, +\cs{glstext} and \cs{glslink}), perform the indexing before +the link text as the indexing creates a whatsit that can cause +problems if it occurs after the link text. However, it may +be that in some cases (such as long phrases) you may actually +want the indexing performed after the link text. In this +case you can use \texttt{wrgloss=after} for specific +instances. Note that this option doesn't +have an effect if the indexing has been suppressed through +other settings (such as \gloskey[glslink]{noindex}). + +The default value is set up using +\begin{definition}[\DescribeMacro\glsxtrinitwrgloss] +\cs{glsxtrinitwrgloss} +\end{definition} +which is defined as: +\begin{verbatim} +\newcommand*{\glsxtrinitwrgloss}{% + \glsifattribute{\glslabel}{wrgloss}{after}% + {% + \glsxtrinitwrglossbeforefalse + }% + {% + \glsxtrinitwrglossbeforetrue + }% +} +\end{verbatim} +This sets the conditional +\begin{definition}[\DescribeMacro\ifglsxtrinitwrglossbefore] +\cs{ifglsxtrinitwrgloss} +\end{definition} +which is used to determine where to perform the indexing. + +This means you can set the \catattr{wrgloss} +attribute to \optfmt{after} to automatically use this as +the default for entries with that category attribute. (Note that +adding \gloskey[glslink]{wrgloss} to the default options +in \ics{GlsXtrSetDefaultGlsOpts} will override +\cs{glsxtrinitwrgloss}.) + +\item[{\gloskey[glslink]{hyperoutside}}] (New to v1.21.) This is a +boolean key. The default is \texttt{hyperoutside=true}, which puts +the hyperlink outside \cs{glstextformat}, so that commands like +\cs{gls} will effectively do +\begin{alltt} +\cs{hyperlink}\marg{target}\{\cs{glstextformat}\marg{link text}\} +\end{alltt} +This is the same behaviour as with the base \styfmt{glossaries} +package. With \texttt{hyperoutside=false}, \cs{hyperlink} is placed +inside the argument of \cs{glstextformat}: +\begin{alltt} +\cs{glstextformat}\{\cs{hyperlink}\marg{target}\marg{link text}\} +\end{alltt} +You can use the \catattr{hyperoutside} category attribute to set +the default for a given category. This can be combined +with the use of the \catattr{textformat} attribute to counteract +any interference caused by \cs{hyperlink}. +For example: +\begin{verbatim} +\glssetcategoryattribute{mathrelation}{hyperoutside}{false} +\end{verbatim} +will set \texttt{hyperoutside=false} for all entries that are +assigned to the category \texttt{mathrelation} and +\begin{verbatim} +\glssetcategoryattribute{mathrelation}{textformat}{mathrel} +\end{verbatim} +will use \cs{mathrel} instead of \cs{glstextformat} resulting in: +\begin{alltt} +\cs{mathrel}\{\cs{hyperlink}\marg{target}\marg{link text}\} +\end{alltt} +for entries with the \gloskey{category} key set to +\texttt{mathrelation}. + +\item[{\gloskey[glslink]{textformat}}] This key must have a +control sequence name as its value. The command formed from +this name must exist and must take one argument. (Use +\texttt{relax} for default behaviour.) If set, this overrides +the \catattr{textformat} attribute and \cs{glstextformat}. +See the \sty{soul} example in \sectionref{sec:glsunset}. + +\item[{\gloskey[glslink]{prefix}}] Locally redefines +\ics{glolinkprefix} to the given value. It should match the prefix +for the desired glossary. + +\item[{\gloskey[glslink]{thevalue}}] Explicitly set the location to +this value (see below). + +\item[{\gloskey[glslink]{theHvalue}}] Set the corresponding +hyperlink location (see below). + +\end{description} + +There is a new hook that's used each time indexing information is +written to the external glossary files: +\begin{definition}[\DescribeMacro\glsxtrdowrglossaryhook] +\cs{glsxtrdowrglossaryhook}\marg{label} +\end{definition} +where \meta{label} is the entry's label. This does nothing by +default but may be redefined. (See, for example, the +accompanying sample file \texttt{sample-indexhook.tex}, +which uses this hook to determine which entries haven't been +indexed.) + +There's also a new hook (from v1.26) that's used immediately +before the options are set by the \cs{gls}-like and +\cs{glstext}-like commands: +\begin{definition}[\DescribeMacro\glslinkpresetkeys] +\cs{glslinkpresetkeys} +\end{definition} +(The base package provides \ics{glslinkpostsetkeys} that's +used immediately after the options are set.) + +As from version 1.30 there are also similar hooks for \cs{glsadd}: +\begin{definition}[\DescribeMacro\glsaddpresetkeys] +\cs{glsaddpresetkeys} +\end{definition} +and +\begin{definition}[\DescribeMacro\glsaddpostsetkeys] +\cs{glsaddpostsetkeys} +\end{definition} +For example, to default to using the \ctr{equation} counter in maths +mode: +\begin{verbatim} +\renewcommand{\glslinkpresetkeys}{% + \ifmmode \setkeys{glslink}{counter=equation}\fi} +\renewcommand{\glsaddpresetkeys}{% + \ifmmode \setkeys{glossadd}{counter=equation}\fi} +\end{verbatim} +In this case, the counter can be overridden with an explicit use of +\gloskey{counter} in the optional argument of \cs{gls} or +\cs{glsadd}. (As from version 1.37, a simpler method is to just use +the \pkgopt{equations} package option.) + +Alternatively, to enforce this (overriding the option +argument): +\begin{verbatim} +\renewcommand{\glslinkpostsetkeys}{% + \ifmmode \setkeys{glslink}{counter=equation}\fi} +\renewcommand{\glsaddpostsetkeys}{% + \ifmmode \setkeys{glossadd}{counter=equation}\fi} +\end{verbatim} + +As from version 1.14, there are two new keys for \cs{glsadd}: +\gloskey[glsadd]{thevalue} and \gloskey[glsadd]{theHvalue}. +These keys are designed for manually adding explicit locations +rather than obtaining the value from the associated counter. +As from version 1.19, these two keys are also available for commands +like \cs{gls} and \cs{glslink}. The \gloskey[glsadd]{thevalue} keys is +intended primarily for adding locations in supplementary material +that can't be obtained from a counter. + +The principle key \gloskey[glslink]{thevalue} is for the location value. The +other key \gloskey[glslink]{theHvalue} can be used to +extract a prefix value for the first argument of commands like +\ics{glsnoidxdisplayloc}. Its value must be in the format +\meta{prefix}\meta{location}. In general, there's little need for +this key as the prefix is typically associated with a counter that can be +used to form hypertargets. + +\begin{important} +If you use \gloskey[glsadd]{thevalue}, you must make sure that you +use an indexing application that will accept the given value. +\end{important} + +For example, \app{makeindex} will only accept locations in the form +[\meta{num}\meta{sep}]*\meta{num} where \meta{num} is an arabic +number (0, 1, \ldots), roman numeral (i, ii, \ldots\ or I, II, +\ldots) or a character from a, \ldots, z or A, \ldots, Z, and +[\meta{num}\meta{sep}]* indicates zero or more instances of a number +followed by the recognised separator character (set with +\cs{glsSetCompositor}). This means that \app{makeindex} won't +accept, for example, +\begin{verbatim} +\glsadd[thevalue={Supplementary Material}]{sample} +\end{verbatim} +This location value will be accepted by \gls{bib2gls}, since it will +allow any location and will only try forming ranges if the location +matches any of its numerical patterns. +In the case of \app{xindy}, you'll need to add a rule that can match +the value. If you're using \sty{hyperref}, you may need to use the +\gloskey[glslink]{format} key to prevent a hyperlink if one can't +naturally be formed from the prefix, counter and location value. + +For example, suppose the file \texttt{suppl.tex} contains: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries-extra} + +\newglossaryentry{sample}{name={sample},description={an example}} + +\renewcommand{\thepage}{S.\arabic{page}} + +\begin{document} +First page. +\newpage +\gls{sample}. +\end{document} +\end{verbatim} +This has an entry on page S.2. Suppose another document wants to +include this location in the glossary. Then this can be done by +setting \gloskey[glsadd]{thevalue} to \texttt{S.2}. For example: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries-extra} + +\makeglossaries + +\newglossaryentry{sample}{name={sample},description={an example}} + +\begin{document} +Some \gls{sample} text. + +\printglossaries +\glsadd[thevalue={S.2}]{sample} +\end{document} +\end{verbatim} +This location value will be accepted by \app{makeindex} as it's in +the form \meta{num}\meta{sep}\meta{num}. + +If you want hyperlinks, things are more complicated. First +you need to set the \catattr{externallocation} attribute to the location of +the PDF file. For example: +\begin{verbatim} +\glssetcategoryattribute{supplemental}{externallocation}{suppl.pdf} + +\newglossaryentry{sample}{category=supplemental, + name={sample},description={an example}} +\end{verbatim} +Next you need to add \texttt{glsxtrsupphypernumber} as the format: +\begin{verbatim} +\glsadd[thevalue={S.2},format=glsxtrsupphypernumber]{sample} +\end{verbatim} +Both documents will need to use the \sty{hyperref} package. +Remember that the counter used for the location also needs to match. +If \cs{theH}\meta{counter} is defined in the other document +and doesn't match in the referencing document, then you need +to use \gloskey[glsadd]{theHvalue} to set the appropriate value. +See the accompanying sample files \texttt{sample-suppl-hyp.tex} +and \texttt{sample-suppl-main-hyp.tex} for an example that uses +\sty{hyperref}. + +\begin{important} +The hyperlink for the supplementary location may or \emph{may not} +take you to the relevant place in the external PDF file +\emph{depending on your PDF viewer}. Some may not support external +links, and some may take you to the first page or last visited page. +\end{important} + +For example, if both \texttt{sample-suppl-hyp.pdf} +and \texttt{sample-suppl-main-hyp.pdf} are in the same directory, +then viewing \texttt{sample-suppl-main-hyp.pdf} in Evince will +take you to the correct location in the linked document (when you +click on the S.2 external link), but Okular will take you to the top +of the first page of the linked document. + +This method can only be used where there is one external source +for the designated category (identified by the +\catattr{externallocation} attribute). For multiple sources, you need to use +\gls{bib2gls} version 1.7+, which is the better method in general as it can +automatically fetch the relevant locations from the \texttt{.aux} +files of the designated external documents without the need to +explicitly use \cs{glsadd}. + +\section{Cross-References (\qt{see} and \qt{see also})} +\label{sec:see} + +The value of the \gloskey{see} key is now saved +as a field. This isn't the case with \styfmt{glossaries}, where +the \gloskey{see} value is simply used to directly +write a line to the corresponding glossary file and is then +discarded. This is why the \gloskey{see} key can't be +used before \ics{makeglossaries} (since the file hasn't been opened +yet). It's also the reason why the \gloskey{see} key doesn't have +any effect when used in entries that are defined in the +\env{document} environment. Since the value isn't saved, +it's not available when the \texttt{.glsdefs} file is created at the +end of the document and so isn't available at the start of the +\env{document} environment on the next run. + +This modification allows \styfmt{glossaries-extra} to provide +\begin{definition}[\DescribeMacro\glsxtraddallcrossrefs] +\cs{glsxtraddallcrossrefs} +\end{definition} +which is used at the end of the document to automatically add +any unused cross-references unless the package option +\pkgopt{indexcrossrefs} was set to false. + +As a by-product of this enhancement, the \gloskey{see} key will now +work for entries defined in the \env{document} environment, but it's still +best to define entries in the preamble, and the \gloskey{see} key +still can't perform any indexing before the file has been opened by +\cs{makeglossaries}. Note that \styfmt{glossaries} v4.24 introduced +the \pkgopt{seenoindex} package option, which can be used to +suppress the error when the \gloskey{see} key is used before +\cs{makeglossaries}, so \pkgopt[ignore]{seenoindex} will allow the +\gloskey{see} value to be stored even though it may not be possible +to index it at that point. + +As from version 1.06, you can display the cross-referenced +information for a given entry using +\begin{definition}[\DescribeMacro\glsxtrusesee] +\cs{glsxtrusesee}\marg{label} +\end{definition} +This internally uses +\begin{definition}[\DescribeMacro\glsxtruseseeformat] +\cs{glsxtruseseeformat}\marg{tag}\marg{xr list} +\end{definition} +where \meta{tag} and \meta{xr list} are obtained from the value of +the entry's \gloskey{see} field (if non-empty). +By default, this just does \cs{glsseeformat}\oarg{tag}\marg{xr +list}\verb|{}|, which is how the cross-reference is displayed in the +\gls{numberlist}. Note that \cs{glsxtrusesee} does nothing if the +\gloskey{see} field hasn't been set for the entry given by +\meta{label}. + +As with the base \sty{glossaries} package, \cs{glsseeformat} +is defined to do \texttt{\cs{emph}\marg{tag} \cs{glsseelist}\marg{xr +list}}. The third argument is always ignored and is present for +\app{makeindex}, which always requires a final argument to +encapsulate the associated location. The command +\begin{definition} +\ics{glsseelist}\marg{xr list} +\end{definition} +used to iterate over the list of cross-reference labels is also +unchanged from the base \sty{glossaries} package, with each item in +the list formatted according to: +\begin{definition} +\ics{glsseeitem}\marg{label} +\end{definition} +This is defined by the \sty{glossaries} package to: +\begin{alltt} +\cs{glshyperlink}[\cs{glsseeitemformat}\marg{label}]\marg{label} +\end{alltt} +So the actual formatting for each cross-referenced entry is +performed by \ics{glsseeitemformat}, which is redefined by +\sty{glossaries-extra}, as described in +\sectionref{sec:modifications}. This now displays the value +of the \gloskey{text} field for abbreviations and the value +of the \gloskey{name} field otherwise. There's no indication +of the entry hierarchy, which could confuse the reader. Therefore, +as from \sty{glossaries-extra} v1.37, there are some new commands +that include the hierarchical information. You may prefer to +redefine \cs{glsseeitemformat} to use one of this if you have +sub-entries. For example: +\begin{verbatim} +\renewcommand*{\glsseeitemformat}[1]{\glsxtrhiername{#1}} +\end{verbatim} + +The command: +\begin{definition}[\DescribeMacro\glsxtrhiername] +\cs{glsxtrhiername}\marg{label} +\end{definition} +performs a recursive action: +\begin{enumerate} +\item If the entry given by \meta{label} has a parent, then +\cs{glsxtrhiername}\marg{parent label} is done followed by +\cs{glsxtrhiernamesep} then: +\item If the entry given by \meta{label} is an abbreviation +(that is, it has the \gloskey{short} field set) then +the short form is displayed (using \cs{glsaccessshort}) +otherwise the name is displayed (using \cs{glsaccessname}). +\end{enumerate} +The first step above is skipped if the entry doesn't have a parent. +Each level is separated by: +\begin{definition}[\DescribeMacro\glsxtrhiernamesep] +\cs{glsxtrhiernamesep} +\end{definition} +which defaults to \qt{\glsxtrhiernamesep}. This can be redefined as +appropriate. + +There are some case-changing variants: +\begin{definition}[\DescribeMacro\Glsxtrhiername] +\cs{Glsxtrhiername}\marg{label} +\end{definition} +The top-level has the first letter changed to upper case +(either \cs{Glsaccessshort} or \cs{Glsaccessname}). There's +no case-change for sub-entries. + +\begin{definition}[\DescribeMacro\GlsXtrhiername] +\cs{GlsXtrhiername}\marg{label} +\end{definition} +All levels have the first letter changed to upper case +(either \cs{Glsaccessshort} or \cs{Glsaccessname}). + +\begin{definition}[\DescribeMacro\GLSxtrhiername] +\cs{GLSxtrhiername}\marg{label} +\end{definition} +The top-level is converted to upper case +(either \cs{GLSaccessshort} or \cs{GLSaccessname}). There's +no case-change for sub-entries. + +\begin{definition}[\DescribeMacro\GLSXTRhiername] +\cs{GLSXTRhiername}\marg{label} +\end{definition} +All levels are converted to upper case +(either \cs{GLSaccessshort} or \cs{GLSaccessname}). + +Suppose you want to suppress the \gls*{numberlist} +using \pkgopt{nonumberlist}. This will automatically prevent the +cross-references from being displayed. The +\pkgopt{seeautonumberlist} package option will automatically +enable the \gls*{numberlist} for entries that have the \gloskey{see} +key set, but this will also show the rest of the \gls*{numberlist}. + +Another approach in this situation is to use the post description +hook with \cs{glsxtrusesee} to append the cross-reference after +the description. For example: +\begin{verbatim} +\renewcommand*{\glsxtrpostdescgeneral}{% + \ifglshasfield{see}{\glscurrententrylabel} + {, \glsxtrusesee{\glscurrententrylabel}}% + {}% +} +\end{verbatim} +Now the cross-references can appear even though the \gls{numberlist} +has been suppressed. + +As from v1.16, there's a separate \gloskey{seealso} key. Unlike +\gloskey{see}, this doesn't have an optional part for the textual +tag. The syntax \texttt{seealso=\marg{xr-labels}} works in much the same way as using +\texttt{see=[\cs{seealsoname}]\marg{xr-labels}} but the information +is stored in a separate field. If you need a different tag, use the +\gloskey{see} key instead (or redefine \cs{seealsoname} or +\cs{glsxtruseseealsoformat}, described below). + +You can display the formatted list of +cross-references stored in the \gloskey{seealso} key using: +\begin{definition}[\DescribeMacro\glsxtruseseealso] +\cs{glsxtruseseealso}\marg{label} +\end{definition} +This works in much the same way as \cs{glsxtrusesee} +but it internally uses +\begin{definition}[\DescribeMacro\glsxtruseseeformat] +\cs{glsxtruseseealsoformat}\marg{xr list} +\end{definition} +For example: +\begin{verbatim} +\renewcommand*{\glsxtrpostdescgeneral}{% + \ifglshasfield{see}{\glscurrententrylabel} + {, \glsxtrusesee{\glscurrententrylabel}}% + {}% + \ifglshasfield{seealso}{\glscurrententrylabel} + { (\glsxtruseseealso{\glscurrententrylabel})}% + {}% +} +\end{verbatim} + +The actual unformatted comma-separated list \meta{xr-list} +stored in the \gloskey{seealso} field can be accessed with: +\begin{definition}[\DescribeMacro\glsxtrseealsolabels] +\cs{glsxtrseealsolabels}\marg{label} +\end{definition} +This will just expand to the \meta{xr-labels} provided in the value +of the \gloskey{seealso} key. There's no corresponding command to +access the \gloskey{see} field. If you really need to access it, you +can use commands like \cs{glsxtrfielduse}, but remember that it +may start with \oarg{tag}, so it can't be automatically treated +as a simple comma-separated list. + +As mentioned above, the base \styfmt{glossaries} package provides \ics{glsseelist}, +which requires a comma-separated list of labels as the argument. +The argument isn't fully expanded, so it's not suitable to use, for +example, \cs{glsxtrseealsolabels}\marg{label} as the argument. +For convenience, \styfmt{glossaries-extra} provides +\begin{definition}[\DescribeMacro\glsxtrseelist] +\cs{glsxtrseelist}\marg{xr list} +\end{definition} +which fully expands its argument and passes it to \cs{glsseelist}. + +The \gloskey{seealso} key implements the automatic indexing using +\begin{definition}[\DescribeMacro\glsxtrindexseealso] +\cs{glsxtrindexseealso}\marg{label}\marg{xr list} +\end{definition} +which just does +\begin{alltt} +\cs{glssee}[\cs{seealsoname}]\marg{label}\marg{xr list} +\end{alltt} +unless the \pkgopt{xindy} option is used with \sty{glossaries} +v4.30+, in which case a distinct \texttt{seealso} cross-reference +class is used instead. + +\section{Entry Display Style Modifications} +\label{sec:entryfmtmods} + +Recall from the \styfmt{glossaries} package that commands such as \cs{gls} +display text at that point in the document (optionally with a +hyperlink to the relevant line in the glossary). This text is +referred to as the \qt{\gls{linktext}} regardless of whether or not it +actually has a hyperlink. The actual text and the way it's displayed +depends on the command used (such as \cs{gls}) and the entry format. + +The default entry format (\ics{glsentryfmt}) used in the +\gls{linktext} by commands like \ics{gls}, \ics{glsxtrfull}, +\ics{glsxtrshort} and \ics{glsxtrlong} (but not commands like +\ics{glslink}, \ics{glsfirst} and \cs{glstext}) is changed by \styfmt{glossaries-extra} to test for +regular entries, which are determined as follows: + +\begin{itemize} +\item If an entry is assigned to a category that has the +\catattr{regular} attribute set (see \sectionref{sec:categories}), the entry is considered a~regular +entry, even if it has a~value for the \gloskey{short} key. +In this case \cs{glsentryfmt} uses \ics{glsgenentryfmt} +(provided by \styfmt{glossaries}), which uses the \gloskey{first} +(or \gloskey{firstplural}) value on \gls{firstuse} and the +\gloskey{text} (or \gloskey{plural}) value on subsequent use. + +\item An entry that doesn't have a~value for the \gloskey{short} +key is assumed to be a~regular entry, even if the +\catattr{regular} attribute isn't set to \qt{true} (since it can't +be an abbreviation without the short form). +In this case \cs{glsentryfmt} uses \ics{glsgenentryfmt}. + +\item If an entry does has a~value for the \gloskey{short} key +and hasn't been marked as a~regular entry through the +\catattr{regular} attribute, it's not considered a regular entry. +In this case \cs{glsentryfmt} uses \ics{glsxtrgenabbrvfmt} +(defined by \styfmt{glossaries-extra}) which is governed +by the abbreviation style (see \sectionref{sec:abbrstyle}). + +\end{itemize} + +This means that entries with a short +form can be treated as regular entries rather than +abbreviations if it's more appropriate for the desired style. + +As from version 1.04, \ics{glsentryfmt} now puts \ics{glsgenentry} +in the argument of the new command +\begin{definition}[\DescribeMacro\glsxtrregularfont] +\cs{glsxtrregularfont}\marg{text} +\end{definition} +This just does its argument \meta{text} by default. This means that +if you want regular entries in a different font but don't want +that font to apply to abbreviations, then you can redefine +\cs{glsxtrregularfont}. This is more precise than changing +\ics{glstextformat} which is applied to all linking commands +for all entries, unless overridden by the \catattr{textformat} +attribute. + +For example: +\begin{verbatim} +\renewcommand*{\glsxtrregularfont}[1]{\textsf{#1}} +\end{verbatim} +You can access the label through \cs{glslabel}. For example, +you can query the category: +\begin{verbatim} +\renewcommand*{\glsxtrregularfont}[1]{% + \glsifcategory{\glslabel}{general}{\textsf{#1}}{#1}} +\end{verbatim} +or query the category attribute, for example, provide a custom +attribute called \texttt{font}: +\begin{verbatim} +\glssetcategoryattribute{general}{font}{sf} + +\renewcommand*{\glsxtrregularfont}[1]{% + \glsifattribute{\glslabel}{font}{sf}{\textsf{#1}}{#1}} +\end{verbatim} +As from version 1.21, it's simpler to just do, for example: +\begin{verbatim} +\glssetcategoryattribute{general}{textformat}{textsf} +\end{verbatim} +without redefining \cs{glsxtrregularfont}. + +As from version 1.30, there is also a command for abbreviations +that encapsulates \cs{glsxtrgenabbrvfmt}: +\begin{definition}[\DescribeMacro\glsxtrabbreviationfont] +\cs{glsxtrabbreviationfont}\marg{text} +\end{definition} +This also just does its argument by default. Font changes +made by abbreviation styles are within \meta{text}. + +The \cs{glspostlinkhook} provided by the \styfmt{glossaries} package to +insert information after the \gls{linktext} produced by commands like \cs{gls} and \cs{glstext} is +redefined to +\begin{definition}[\DescribeMacro\glsxtrpostlinkhook] +\cs{glsxtrpostlinkhook} +\end{definition} +This command will discard a following full stop (period) if the +\catattr{discardperiod} attribute is set to \qt{true} for the +current entry's category. It will also do +\begin{definition}[\DescribeMacro\glsxtrpostlink] +\cs{glsxtrpostlink} +\end{definition} +if a full stop hasn't be discarded and +\begin{definition}[\DescribeMacro\glsxtrpostlinkendsentence] +\cs{glsxtrpostlinkendsentence} +\end{definition} +if a full stop has been discarded. + +It may be that you want to check some other setting (rather +than a category attribute) to determine whether or not to discard +a following full stop. In which case you can redefine: +\begin{definition}[\DescribeMacro\glsxtrifcustomdiscardperiod] +\cs{glsxtrifcustomdiscardperiod}\marg{true}\marg{false} +\end{definition} +You can access the field's label using \cs{glslabel}. +This command should do \meta{true} if the post-link hook +should check if a period follows and \meta{false} otherwise. +The default definition is simply: +\begin{verbatim} +\newcommand*{\glsxtrifcustomdiscardperiod}[2]{#2} +\end{verbatim} +which means that no additional checks are performed. +(Only the recognised category attributes will be checked.) + +\begin{important} +Avoid the use of \cs{gls}-like and \cs{glstext}-like commands +within the post-link hook as they will cause interference. +Consider using commands like \cs{glsentrytext}, \cs{glsaccesstext} +or \cs{glsxtrp} (\sectionref{sec:nested}) instead. +\end{important} + +By default \cs{glsxtrpostlink} just does \postlinkcat\ if it exists, where +\meta{category} is the category label for the current entry. +(For example, for the \category{general} category, +\cs{glsxtrpostlinkgeneral} if it has been defined.) + +You can define the post-link hook command using \cs{newcommand}, for +example: +\begin{verbatim} +\newcommand*{\glsxtrpostlinkgeneral}{% + \glsxtrpostlinkAddDescOnFirstUse +} +\end{verbatim} +or, as from v1.31, you can use +\begin{definition}[\DescribeMacro\glsdefpostlink] +\cs{glsdefpostlink}\marg{category}\marg{definition} +\end{definition} +This is simply a shortcut for: +\begin{alltt} +\cs{csdef}\{glsxtrpostlink\meta{category}\}\marg{definition} +\end{alltt} +Note that it doesn't check if the command has already been defined. + +\begin{sloppypar} +The sentence-ending hook is slightly more complicated. +If the command \postlinkcat\ is defined the hook will do that +and then insert a full stop with the space factor adjusted to match +the end of sentence. If \postlinkcat\ hasn't +been defined, the space factor is adjusted to match the end of +sentence. This means that if you have, for example, an entry that +ends with a full stop, a redundant following full stop will be +discarded and the space factor adjusted (in case the entry is in +uppercase) unless the entry is followed by additional material, in +which case the following full stop is no longer redundant and needs +to be reinserted. +\end{sloppypar} + +There are some convenient commands you might want to use +when customizing the post-\gls{linktext} category hooks: +\begin{definition}[\DescribeMacro\glsxtrpostlinkAddDescOnFirstUse] +\cs{glsxtrpostlinkAddDescOnFirstUse} +\end{definition} +This will add the description in parentheses on \gls{firstuse}. + +For example, suppose you want to append the description in +parentheses on \gls{firstuse} for entries in the \category{symbol} +category: +\begin{verbatim} +\newcommand*{\glsxtrpostlinksymbol}{% + \glsxtrpostlinkAddDescOnFirstUse +} +\end{verbatim} + +\begin{definition}[\DescribeMacro\glsxtrpostlinkAddSymbolOnFirstUse] +\cs{glsxtrpostlinkAddSymbolOnFirstUse} +\end{definition} +This will append the symbol (if defined) in parentheses on +\gls{firstuse}. (Does nothing if the symbol hasn't been set.) + +\begin{definition}[\DescribeMacro\glsxtrpostlinkAddSymbolDescOnFirstUse] +\cs{glsxtrpostlinkAddSymbolDescOnFirstUse} +\end{definition} +(New to v1.31.) On \gls{firstuse}, +this will append \cs{space}(\meta{symbol}, \meta{description}) if +the symbol is defined otherwise it just appends +\cs{space}(\meta{description}). + +If you want to provide your own custom format be aware that you +can't use \ics{ifglsused} within the post-\gls{linktext} hook as by this point +the \gls{firstuseflag} will have been unset. Instead you can use +\begin{definition}[\DescribeMacro\glsxtrifwasfirstuse] +\cs{glsxtrifwasfirstuse}\marg{true}\marg{false} +\end{definition} +This will do \meta{true} if the last used entry was the +\gls{firstuse} +for that entry, otherwise it will do \meta{false}. (Requires at +least \styfmt{glossaries} v4.19 to work properly.) This command is +locally set by commands like \cs{gls}, so don't rely on it outside +of the post-\gls{linktext} hook. + +\begin{important} +Note that commands like \ics{glsfirst} and \ics{glsxtrfull} fake +\gls{firstuse} for the benefit of the post-\gls{linktext} hooks by setting +\cs{glsxtrifwasfirstuse} to \cs{@firstoftwo}. +(Although, depending on the styles in use, they may not exactly match +the text produced by \ics{gls}-like commands on \gls{firstuse}.) +However, the \abbrstyle{short-postfootnote} style alters \cs{glsxtrfull} +so that it fakes non-\gls{firstuse} otherwise the inline full format +would include the footnote, which is inappropriate. +\end{important} + +For example, if you want to place the description in a footnote +after the \gls{linktext} on \gls{firstuse} for the \category{general} category: +\begin{verbatim} +\newcommand*{\glsxtrpostlinkgeneral}{% + \glsxtrifwasfirstuse{\footnote{\glsentrydesc{\glslabel}}}{}% +} +\end{verbatim} + +The \abbrstyle{short-postfootnote} abbreviation style uses the +post-\gls{linktext} hook to +place the footnote after trailing punctuation characters. + +You can set the default options used by \ics{glslink}, \ics{gls} +etc with: +\begin{definition}[\DescribeMacro\GlsXtrSetDefaultGlsOpts] +\cs{GlsXtrSetDefaultGlsOpts}\marg{options} +\end{definition} +For example, if you mostly don't want to index entries then +you can do: +\begin{verbatim} +\GlsXtrSetDefaultGlsOpts{noindex} +\end{verbatim} +and then use, for example, \verb|\gls[noindex=false]{sample}| +when you actually want the location added to the \gls{numberlist}. +These defaults may be overridden by other settings (such as +category attributes) in addition to any settings passed in the +option argument of commands like \cs{glslink} and \cs{gls}. + +Note that if you don't want \emph{any} indexing, just omit +\cs{makeglossaries} and \cs{printglossaries} (or analogous +commands). If you want to adjust the default for +\gloskey[glslink]{wrgloss}, it's better to do this by redefining +\ics{glsxtrinitwrgloss} instead. + +\begin{important} +\cs{GlsXtrSetDefaultGlsOpts} doesn't affect \cs{glsadd}. +\end{important} + +If you want to change the default value of \gloskey[glsadd]{format}, +you can instead use: +\begin{definition}[\GlsXtrSetDefaultNumberFormat] +\cs{GlsXtrSetDefaultNumberFormat}\marg{format} +\end{definition} +This has the advantage of also working for \cs{glsadd}. +For example, if you want all locations in the back matter to appear +in italic (unless explicitly overridden): +\begin{verbatim} +\backmatter +\GlsXtrSetDefaultNumberFormat{hyperit} +\end{verbatim} + +Commands like \ics{gls} have star (\texttt{*}) and plus +(\texttt{+}) modifiers as a short cut for \texttt{hyper=false} +and \texttt{hyper=true}. The \styfmt{glossaries-extra} package +provides a way to add a third modifier, if required, using +\begin{definition}[\DescribeMacro\GlsXtrSetAltModifier] +\cs{GlsXtrSetAltModifier}\marg{char}\marg{options} +\end{definition} +where \meta{char} is the character used as the modifier and +\meta{options} is the default set of options (which may be +overridden). Note that \meta{char} must be a single character +(not a UTF-8 character, unless you are using \XeLaTeX\ or +\LuaLaTeX). + +\begin{important} +When choosing the character \meta{char} take care of any +changes in category code. +\end{important} + +Example: +\begin{verbatim} +\GlsXtrSetAltModifier{!}{noindex} +\end{verbatim} +This means that \verb|\gls!{sample}| will be equivalent to +\verb|\gls[noindex]{sample}|. It's not possible to mix modifiers. +For example, if you want to do +\begin{verbatim} +\gls[noindex,hyper=false]{sample} +\end{verbatim} +you can use \verb|\gls*[noindex]{sample}| or +\verb|\gls![hyper=false]{sample}| but you can't combine the +\texttt{*} and \texttt{!} modifiers. + +\Glspl{locationlist} displayed with \cs{printnoidxglossary} +internally use +\begin{definition}[\DescribeMacro\glsnoidxdisplayloc] +\cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{location} +\end{definition} +This command is provided by \styfmt{glossaries}, but is modified by +\styfmt{glossaries-extra} to check for the start and end range +formation identifiers \verb|(| and \verb|)| which are discarded to +obtain the actual control sequence name that forms the location +formatting command. + +If the range identifiers aren't present, this just uses +\begin{definition}[\DescribeMacro\glsxtrdisplaysingleloc] +\cs{glsxtrdisplaysingleloc}\marg{format}\marg{location} +\end{definition} +otherwise it uses +\begin{definition}[\DescribeMacro\glsxtrdisplaystartloc] +\cs{glsxtrdisplaystartloc}\marg{format}\marg{location} +\end{definition} +for the start of a range (where the identifier has been stripped +from \meta{format}) or +\begin{definition}[\DescribeMacro\glsxtrdisplayendloc] +\cs{glsxtrdisplayendloc}\marg{format}\marg{location} +\end{definition} +for the end of a range (where the identifier has been stripped +from \meta{format}). + +By default the start range command saves the format in +\begin{definition}[\DescribeMacro\glsxtrlocrangefmt] +\cs{glsxtrlocrangefmt} +\end{definition} +and does +\begin{display} +\cs{glsxtrdisplaysingleloc}\marg{format}\marg{location} +\end{display} +(If the format is empty, it will be replaced with +\texttt{glsnumberformat}.) + +The end command checks that the format matches the start of the +range, does +\begin{definition}[\DescribeMacro\glsxtrdisplayendlochook] +\cs{glsxtrdisplayendlochook}\marg{format}\marg{location} +\end{definition} +(which does nothing by default), followed by +\begin{display} +\cs{glsxtrdisplaysingleloc}\marg{format}\marg{location} +\end{display} +and then sets \cs{glsxtrlocrangefmt} to empty. + +This means that the list +\begin{verbatim} +\glsnoidxdisplayloc{}{page}{(textbf}{1}, +\glsnoidxdisplayloc{}{page}{textbf}{1}, +\glsnoidxdisplayloc{}{page}{)textbf}{1}. +\end{verbatim} +doesn't display any differently from +\begin{verbatim} +\glsnoidxdisplayloc{}{page}{textbf}{1}, +\glsnoidxdisplayloc{}{page}{textbf}{1}, +\glsnoidxdisplayloc{}{page}{textbf}{1}. +\end{verbatim} +but it does make it easier to define your own custom list handler +that can accommodate the ranges. + + +\section{Entry Counting Modifications} +\label{sec:entrycountmods} + +If you are using \gls{bib2gls} you may find it more convenient +to use the record count commands described in +\sectionref{sec:bib2gls} instead. + +The \ics{glsenableentrycount} command is modified to allow +for the \catattr{entrycount} attribute. This means that +you not only need to enable entry counting with +\cs{glsenableentrycount}, but you also need +to set the appropriate attribute (see \sectionref{sec:categories}). + +For example, instead of just doing: +\begin{verbatim} +\glsenableentrycount +\end{verbatim} +you now need to do: +\begin{verbatim} +\glsenableentrycount +\glssetcategoryattribute{abbreviation}{entrycount}{1} +\end{verbatim} +This will enable the entry counting for entries in the +\category{abbreviation} category, but any entries assigned to +other categories will be unchanged. + +Further information about entry counting, including the +new per-unit feature, is described in \sectionref{sec:entrycount}. + +\section{First Use Flag} +\label{sec:glsunset} + +The \styfmt{glossaries} package provides +\begin{definition} +\ics{ifglsused}\marg{label}\marg{true}\marg{false} +\end{definition} +to determine whether or not an entry has been used. This requires +the entry to have been defined. If the entry is undefined, then the +underlying boolean variable doesn't exist and so is neither true +nor false. This command will produce an error with the default +\pkgopt[error]{undefaction} mode and a warning with +\pkgopt[warn]{undefaction} and, where appropriate, displays ?? in +the document text to denote an undefined reference. With both modes, +neither \meta{true} nor \meta{false} will be performed if +\meta{label} doesn't exist. + +The \pkgopt{record} option automatically implements +\pkgopt[warn]{undefaction} since no entries will be defined until +they have been selected by \gls{bib2gls}. In this case, you +may prefer to use: +\begin{definition}[\DescribeMacro\GlsXtrIfUnusedOrUndefined] +\cs{GlsXtrIfUnusedOrUndefined}\marg{label}\marg{true}\marg{false} +\end{definition} +(new to v1.34) which does \meta{true} if the entry given by +\meta{label} is undefined or if the entry is marked as unused. +Remember that neither \cs{ifglsused} nor +\cs{GlsXtrIfUnusedOrUndefined} should be used in the post-link +hook as the \gls{firstuseflag} will have already been unset +before the hook is performed. (Instead, \ics{glsxtrifwasfirstuse} +should be used, see \sectionref{sec:entryfmtmods}.) + +There are two new commands provided with version 1.31+: +\begin{definition}[\DescribeMacro\glslocalreseteach] +\cs{glslocalreseteach}\marg{list} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslocalunseteach] +\cs{glslocalunseteach}\marg{list} +\end{definition} +These behave like \cs{glslocalreset} and \cs{glslocalunset} +but the argument is a comma-separated list of labels. + +The internal command used by \cs{glsunset} is modified first to +allow for the changing in entry counting, described above, but +also to allow for buffering pending unsets when commands like +\cs{gls} are used in a context where changing a boolean variable +can cause things to go wrong. One example of this is using +\cs{gls} in one of the commands provided with the \isty{soul} +package. For example: +\begin{verbatim} +\ul{Some text about \gls{html}.} +\end{verbatim} +This causes the confusing error: +\begin{verbatim} +Glossary entry `{html}' has not been defined. +\end{verbatim} +The simplest workaround is to put \verb|\gls{html}| inside the +argument of \cs{mbox}. For example: +\begin{verbatim} +\ul{Some text about \mbox{\gls{html}}.} +\end{verbatim} +This can work provided it's not the first use of this entry. +It if is, then unsetting the first use flag causes a problem +and results in the error: +\begin{verbatim} +! Package soul Error: Reconstruction failed. +\end{verbatim} +The \styfmt{glossaries-extra} package provides a way of temporarily +switching off \cs{glsunset} so that it just makes a note of the +entry's label but doesn't actually perform the change: +\begin{definition}[\DescribeMacro\GlsXtrStartUnsetBuffering] +\cs{GlsXtrStartUnsetBuffering} +\end{definition} +The unstarred version doesn't check for duplicates, so the internal +list may end up with multiple occurrences of the same label. The +starred version only adds a label to the internal list if it's not +already in it. Note that this buffering only applies to the +global \cs{glsunset} and does not affect the local +\cs{glslocalunset}. + +Later you can restore \cs{glsunset} and unset all buffered +labels using: +\begin{definition}[\DescribeMacro\GlsXtrStopUnsetBuffering] +\cs{GlsXtrStopUnsetBuffering} +\end{definition} +The starred form \cs{GlsXtrStopUnsetBuffering*} uses +\cs{glslocalunset} instead. For example: +\begin{verbatim} +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage{soul} +\usepackage{glossaries-extra} + +\newabbreviation{html}{HTML}{hypertext markup language} + +\begin{document} +\GlsXtrStartUnsetBuffering +\ul{Some text about \mbox{\gls{html}}.} +\GlsXtrStopUnsetBuffering + +Next use: \gls{html}. +\end{document} +\end{verbatim} +Before you stop the unset buffering, you can iterate over the +current buffer using +\begin{definition}[\DescribeMacro\GlsXtrForUnsetBufferedList] +\cs{GlsXtrForUnsetBufferedList}\marg{cs} +\end{definition} +where \meta{cs} is a control sequence that takes a single argument +(which is the entry label). This is best used with the starred +version \cs{GlsXtrStartUnsetBuffering*} to avoid duplicates. + +\begin{important} +Note that since the change in the first use flag now doesn't +occur until \cs{GlsXtrStopUnsetBuffering}, multiple references +of the same term within the buffering zone will always be +treated as first use (if the term wasn't used before the +buffering started). +\end{important} + +There can still be a problem here as content within \cs{mbox} +can't break across a line so you may end up with an overfull +line or excessive white space within the paragraph. + +An alternative is to use \cs{protect}: +\begin{verbatim} +\GlsXtrStartUnsetBuffering +\ul{Some text about \protect\gls{html}.} +\GlsXtrStopUnsetBuffering +\end{verbatim} +but the formatting (underlining in this example) won't be applied. +Another possibility is: +\begin{verbatim} +\usepackage[T1]{fontenc} +\usepackage{soul} +\usepackage{glossaries-extra} + +\newabbreviation{html}{HTML}{hypertext markup language} + +\newrobustcmd{\gul}[1]{% + {% + \def\glsxtrabbreviationfont##1{\GlsXtrExpandedFmt{\ul}{##1}}% + \def\glsxtrregularfont##1{\GlsXtrExpandedFmt{\ul}{##1}}% + #1% + }% +} + +\begin{document} +\ul{Some text about }\gls[textformat=gul]{html}. + +Next use: \gls{html}. +\end{document} +\end{verbatim} +This moves \cs{gls} outside of \cs{ul} and uses +\gloskey[glslink]{textformat} to locally change the formatting +command used by \cs{gls} (which is normally given by +\cs{glstextformat} or the \catattr{textformat} attribute) +to a custom command \cs{gul}, which locally changes the regular font +and the default abbreviation font to use \cs{ul}. It then uses +\begin{definition}[\DescribeMacro\GlsXtrExpandedFmt] +\cs{GlsXtrExpandedFmt}\marg{cs}\marg{text} +\end{definition} +which (protected) fully expands \meta{text} before applying +\meta{cs}, which must be a control sequence that takes a single +argument. This allows \cs{ul} to move much further inside +and increases its chances of working. It can still break if +\meta{text} expands to something that \cs{ul} can't deal with. +For example, if an abbreviation style is used that contains +complex formatting or if the field value contains problematic +content. + +\section{Plurals} + +Some languages, such as English, have a general rule that plurals +are formed from the singular with a suffix appended. This isn't +an absolute rule. There are plenty of exceptions (for example, +geese, children, churches, elves, fairies, sheep). The +\sty{glossaries} package allows the \gloskey{plural} key to be +optional when defining entries. In some cases a plural may not make +any sense (for example, the term is a symbol) and in some cases +the plural may be identical to the singular. + +To make life easier for languages where the majority of plurals can +simply be formed by appending a suffix to the singular, the +\sty{glossaries} package lets the \gloskey{plural} field default +to the value of the \gloskey{text} field with \ics{glspluralsuffix} +appended. This command is defined to be just the letter \qt{s}. +This means that the majority of terms don't need to have the +\gloskey{plural} supplied as well, and you only need to use it for the +exceptions. + +For languages that don't have this general rule, the \gloskey{plural} +field will always need to be supplied, where needed. + +There are other plural fields, such as \gloskey{firstplural}, +\gloskey{longplural} and \gloskey{shortplural}. Again, if you are using +a language that doesn't have a simple suffix rule, you'll have to +supply the plural forms if you need them (and if a plural makes +sense in the context). + +If these fields are omitted, the \sty{glossaries} package follows +these rules: +\begin{itemize} +\item If \gloskey{firstplural} is missing, then \cs{glspluralsuffix} +is appended to the \gloskey{first} field, if that field has been +supplied. If the \gloskey{first} field hasn't been supplied but the +\gloskey{plural} field has been supplied, then the \gloskey{firstplural} +field defaults to the \gloskey{plural} field. If the \gloskey{plural} +field hasn't been supplied, then both the \gloskey{plural} and +\gloskey{firstplural} fields default to the \gloskey{text} field (or +\gloskey{name}, if no \gloskey{text} field) with \cs{glspluralsuffix} +appended. + +\item If the \gloskey{longplural} field is missing, then +\cs{glspluralsuffix} is appended to the \gloskey{long} field, if the +\gloskey{long} field has been supplied. + +\item If the \gloskey{shortplural} field is missing then, \emph{with +the base \sty{glossaries} acronym mechanism}, \ics{acrpluralsuffix} +is appended to the \gloskey{short} field. + +\end{itemize} + +This \emph{last case is changed} with \styfmt{glossaries-extra}. +With this extension package, the \gloskey{shortplural} field +defaults to the \gloskey{short} field with \ics{abbrvpluralsuffix} +appended unless overridden by category attributes. This +suffix command is set by the abbreviation styles. This means that +every time an abbreviation style is implemented, +\cs{abbrvpluralsuffix} is redefined. In most cases its redefined to +use +\begin{definition}[\DescribeMacro\glsxtrabbrvpluralsuffix] +\cs{glsxtrabbrvpluralsuffix} +\end{definition} +which defaults to just \cs{glspluralsuffix}. Some of the +abbreviation styles have their own command for the plural suffix, +such as \cs{glsxtrscsuffix}, +so if you want to completely strip all the plural suffixes used for +abbreviations then you need to redefine \cs{glsxtrabbrvpluralsuffix} +\emph{not} \cs{abbrvpluralsuffix}, which changes with the style. Redefining +\cs{acrpluralsuffix} will have no affect, since it's not used by the +new abbreviation mechanism. + +If you require a mixture (for example, in a multilingual document), +there are two attributes that affect the short plural suffix +formation. The first is \catattr{aposplural} which uses the suffix +\begin{verbatim} +'\abbrvpluralsuffix +\end{verbatim} +That is, an apostrophe followed by \cs{abbrvpluralsuffix} is +appended. The second attribute is \catattr{noshortplural} which +suppresses the suffix and simply sets \gloskey{shortplural} to the +same as \gloskey{short}. + +\section{Nested Links} +\label{sec:nested} + +Complications arise when you use \ics{gls} in the +value of the \gloskey{name} field (or \gloskey{text} +or \gloskey{first} fields, if set). This tends to occur with +abbreviations that extend other abbreviations. For example, +SHTML is an abbreviation for SSI enabled HTML, where SSI +is an abbreviation for Server Side Includes and HTML +is an abbreviation for Hypertext Markup Language. + +Things can go wrong if we try the following with the +\styfmt{glossaries} package: +\begin{verbatim} +\newacronym{ssi}{SSI}{Server Side Includes} +\newacronym{html}{HTML}{Hypertext Markup Language} +\newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}} +\end{verbatim} + +The main problems are: +\begin{enumerate} +\item\label{itm:nestedfirstucprob} The first letter upper casing commands, such as \ics{Gls}, +won't work for the \texttt{shtml} entry on \gls{firstuse} if the +long form is displayed before the short form (which is the +default abbreviation style). This will attempt to do +\begin{verbatim} +\gls{\uppercase ssi} enabled \gls{html} +\end{verbatim} +which just doesn't work. Grouping the \verb|\gls{ssi}| doesn't +work either as this will effectively try to do +\begin{verbatim} +\uppercase{\gls{ssi}} enabled \gls{html} +\end{verbatim} +This will upper case the label \texttt{ssi} so the entry won't be +recognised. This problem will also occur if you use the all capitals +version, such as \ics{GLS}. + +\item\label{itm:nonexpandprob} The long and abbreviated forms accessed through +\ics{glsentrylong} and \ics{glsentryshort} are no longer expandable +and so can't be used be used in contexts that require this, +such as PDF bookmarks. + +\item\label{itm:nestedsortprob} The nested commands may end up in the \gloskey{sort} key, +which will confuse the indexing. + +\item\label{itm:inconsistentfirstuseprob} The \texttt{shtml} entry produces inconsistent results +depending on whether the \texttt{ssi} or \texttt{html} entries have +been used. Suppose both \texttt{ssi} and \texttt{html} are used +before \texttt{shtml}. For example: +\begin{verbatim} +This section discusses \gls{ssi}, \gls{html} and \gls{shtml}. +\end{verbatim} +This produces: +\begin{quote} +This section discusses server side includes (SSI), hypertext markup +language (HTML) and SSI enabled HTML (SHTML). +\end{quote} +So the \gls{firstuse} of the \texttt{shtml} entry produces +\qt{SSI enabled HTML (SHTML)}. + +Now let's suppose the \texttt{html} entry is used before the +\texttt{shtml} but the \texttt{ssi} entry is used after the +\texttt{shtml} entry, for example: +\begin{verbatim} +The sample files are either \gls{html} or \gls{shtml}, but let's +first discuss \gls{ssi}. +\end{verbatim} +This produces: +\begin{quote} +The sample files are either hypertext markup language (HTML) or +server +side includes (SSI) enabled HTML (SHTML), but let's first discuss +SSI. +\end{quote} +So the \gls{firstuse} of the \texttt{shtml} entry now produces +\qt{server side includes (SSI) enabled HTML (SHTML)}, which looks +a bit strange. + +Now let's suppose the \texttt{shtml} entry is used before (or +without) the other two entries: +\begin{verbatim} +This article is an introduction to \gls{shtml}. +\end{verbatim} +This produces: +\begin{quote} +This article is an introduction to server side includes (SSI) +enabled hypertext markup language (HTML) (SHTML). +\end{quote} +So the \gls{firstuse} of the \texttt{shtml} entry now produces +\qt{server side includes (SSI) enabled hypertext markup language (HTML) +(SHTML)}, which is even more strange. + +This is all aggravated by setting the style using the +\styfmt{glossaries} package's +\cs{setacronymstyle}. For example: +\begin{verbatim} +\setacronymstyle{long-short} +\end{verbatim} +as this references the label through the use of \cs{glslabel} +when displaying the long and short forms, but this value +changes with each use of \cs{gls}, so instead of displaying +\qt{(SHTML)} at the end of the \gls{firstuse}, it now displays +\qt{(HTML)}, since \cs{glslabel} has been changed to \texttt{html} +by \verb|\gls{html}|. + +Another oddity occurs if you reset the \texttt{html} entry between +uses of the \texttt{shtml} entry. For example: +\begin{verbatim} +\gls{shtml} ... \glsreset{html}\gls{shtml} +\end{verbatim} +The next use of \texttt{shtml} produces \qt{Shypertext markup +language (HTML)}, which is downright weird. + +Even without this, the short form has nested formatting commands, +which amount to \verb|\acronymfont{S\acronymfont{HTML}}|. This +may not be a problem for some styles, but if you use one of the +\qt{sm} styles (that use \ics{textsmaller}), this will produce +an odd result. + +\item\label{itm:indexingprob} Each time the \texttt{shtml} entry is used, the +\texttt{html} entry will also be indexed and marked as used, +and on \gls{firstuse} this will happen to both the \texttt{ssi} +and \texttt{html} entries. This kind of duplication in the location +list isn't usually particularly helpful to the reader. + +\item\label{itm:nestedhyplinkprob} If \sty{hyperref} is in use, you'll get nested hyperlinks +and there's no consistent way of dealing with this across the +available PDF viewers. If on the \gls{firstuse} case, the user +clicks on the \qt{HTML} part of the \qt{SSI enabled HTML (SHTML)} +link, they may be directed to the HTML entry in the glossary or +they may be directed to the SHTML entry in the glossary. + +\end{enumerate} + +For these reasons it's better to use the simple expandable commands like +\ics{glsentrytext} or \ics{glsentryshort} in the definition +of other entries (although that doesn't fix the first problem). +Alternatively use something like: +\begin{verbatim} +\newacronym + [description={\acrshort{ssi} enabled \acrshort{html}}] + {shtml}{SHTML}{SSI enabled HTML} +\end{verbatim} +with \styfmt{glossaries} or: +\begin{verbatim} +\newabbreviation + [description={\glsxtrshort{ssi} enabled \glsxtrshort{html}}] + {shtml}{SHTML}{SSI enabled HTML} +\end{verbatim} +with \styfmt{glossaries-extra}. This fixes all the above +listed problems (as long as you don't use \ics{glsdesc}). +Note that replacing \cs{gls} with \cs{acrshort} in the original +example may fix the \gls{firstuse} issue, but it doesn't +fix any of the other problems listed above. + +If it's simply that you want to use the abbreviation font, you can +use \cs{glsabbrvfont}: +\begin{verbatim} +\setabbreviationstyle{long-short-sc} + +\newabbreviation{ssi}{ssi}{server-side includes} +\newabbreviation{html}{html}{hypertext markup language} +\newabbreviation{shtml}{shtml}{\glsabbrvfont{ssi} enabled +\glsabbrvfont{html}} +\end{verbatim} +This will pick up the font style setting of the outer entry (shtml, +in the above case). This isn't a problem in the above example as all +the abbreviations use the same style. + +However if you're really determined to use +\ics{gls} in a field that may be included within +some \gls{linktext}, \styfmt{glossaries-extra} patches internals +used by the linking commands so that if \cs{gls} (or plural or +case changing variants) occurs in the \gls{linktext} it will +behave as though you used +\texttt{\ics{glstext}[hyper=false,noindex]} +instead. Grouping is also added so that, for example, when +\verb|\gls{shtml}| is used for the first time the long form +\begin{verbatim} +\gls{ssi} enabled \gls{html} +\end{verbatim} +is treated as +\begin{verbatim} +{\glstext[hyper=false,noindex]{ssi}} enabled +{\glstext[hyper=false,noindex]{html}} +\end{verbatim} +This overcomes problems~\ref{itm:inconsistentfirstuseprob}, +\ref{itm:indexingprob} and \ref{itm:nestedhyplinkprob} listed +above, but still doesn't fix problems~\ref{itm:nestedfirstucprob} +and \ref{itm:nonexpandprob}. +Problem~\ref{itm:nestedsortprob} usually won't be an issue as most abbreviation +styles set the \gloskey{sort} key to the short form, so using these +commands in the long form but not the short form will only affect +entries with a style that sorts according to the long form (such as +\abbrstyle{long-noshort-desc}). + +Additionally, any instance of the long form commands, such +as \ics{glsxtrlong} or \ics{acrlong} will be temporarily +redefined to just use +\begin{alltt} +\{\ics{glsentrylong}\marg{label}\meta{insert}\} +\end{alltt} +(or case-changing versions). Similarly the short form commands, +such as \ics{glsxtrshort} or \ics{acrshort} will use +\ics{glsentryshort} in the argument of either \cs{glsabbrvfont} +(for \cs{glsxtrshort}) or \cs{acronymfont} (for \cs{acrshort}). +So if the \texttt{shtml} entry had instead been defined as: +\begin{verbatim} +\newacronym{shtml}{SHTML}{\acrshort{ssi} enabled \acrshort{html}} +\end{verbatim} +then (using the \abbrstyle{long-short} style) the \gls{firstuse} +will be like +\begin{verbatim} +{\acronymfont{\glsentryshort{ssi}}} enabled +{\acronymfont{\glsentryshort{html}}} (SHTML) +\end{verbatim} +whereas if the entry is defined as: +\begin{verbatim} +\newabbreviation{shtml}{SHTML}{\glsxtrshort{ssi} enabled +\glsxtrshort{html}} +\end{verbatim} +then the \gls{firstuse} will be like: +\begin{verbatim} +{\glsabbrvfont{\glsentryshort{ssi}}} enabled +{\glsabbrvfont{\glsentryshort{html}}} (SHTML) +\end{verbatim} +Note that the first optional argument of +\cs{acrshort} or \cs{glsxtrshort} is ignored in this context. +(The final optional argument will be inserted, if present.) +The abbreviation style that governs \ics{glsabbrvfont} will be +set for \ics{glsxtrshort}. Note that \cs{acrshort} doesn't +set the abbreviation style. + +Alternatively you can use: +\begin{definition}[\DescribeMacro\glsxtrp] +\cs{glsxtrp}\marg{field}\marg{label} +\end{definition} +where \meta{field} is the field label and corresponds to a +command in the form \cs{gls}\meta{field} (e.g.\ \cs{glstext}) or +in the form \cs{glsxtr}\meta{field} (e.g.\ \cs{glsxtrshort}). + +There's a shortcut command for the most common fields: +\begin{definition}[\DescribeMacro\glsps] +\cs{glsps}\marg{label} +\end{definition} +which is equivalent to \verb|\glsxtrp{short}|\marg{label}, and +\begin{definition}[\DescribeMacro\glspt] +\cs{glspt}\marg{label} +\end{definition} +which is equivalent to \verb|\glsxtrp{text}|\marg{label}. + +The \cs{glsxtrp} command behaves much like the +\cs{glsfmt}\meta{field} commands described in +\sectionref{sec:headtitle} but the post-link hook is also +suppressed and extra grouping is added. It automatically sets +\gloskey[glslink]{hyper} to \texttt{false} and +\gloskey[glslink]{noindex} to \texttt{true}. If you want to change +this, you can use +\begin{definition}[\DescribeMacro\glsxtrsetpopts] +\cs{glsxtrsetpopts}\marg{options} +\end{definition} +For example: +\begin{verbatim} +\glsxtrsetpopts{hyper=false} +\end{verbatim} +will just switch off the hyperlinks but not the indexing. +Be careful using this command or you can end up back to the +original problem of nested links. + +The hyper link is re-enabled within glossaries. This is +done through the command: +\begin{definition}[\DescribeMacro\glossxtrsetpopts] +\cs{glossxtrsetpopts} +\end{definition} +which by default just does +\begin{verbatim} +\glsxtrsetpopts{noindex} +\end{verbatim} +You can redefine this if you want to adjust the setting when +\cs{glsxtrp} is used in the glossary. For example: +\begin{verbatim} +\renewcommand{\glossxtrsetpopts}{\glsxtrsetpopts{noindex=false}} +\end{verbatim} + +For example, +\begin{verbatim} +\glsxtrp{short}{ssi} +\end{verbatim} +is equivalent to +\begin{verbatim} +{\let\glspostlinkhook\relax + \glsxtrshort[hyper=false,noindex]{ssi}[]% +} +\end{verbatim} +in the main body of the document or +\begin{verbatim} +{\let\glspostlinkhook\relax + \glsxtrshort[noindex]{ssi}[]% +} +\end{verbatim} +inside the glossary. (Note the post-link hook is locally disabled.) + +If \verb|\glsxtrp{short}{ssi}| occurs in a sectioning mark, +it's equivalent to +\begin{verbatim} +{\glsxtrheadshort{ssi}} +\end{verbatim} +(which recognises the \catattr{headuc} attribute.) + +If \sty{hyperref} has been loaded, then the bookmark will +use \cs{glsentry}\meta{field} +(\verb|\glsentryshort{ssi}| in the above example). + +There are similar commands +\begin{definition}[\DescribeMacro\Glsxtrp] +\cs{Glsxtrp}\marg{field}\marg{label} +\end{definition} +for first letter upper case and +\begin{definition}[\DescribeMacro\GLSxtrp] +\cs{GLSxtrp}\marg{field}\marg{label} +\end{definition} +for all upper case. + +\begin{important} +If you use any of the case-changing commands, such as \ics{Gls} +or \ics{Glstext}, (either all caps or first letter upper casing) +don't use any of the linking commands, such as \ics{gls} or +\ics{glstext}, in the definition of entries for any of the +fields that may be used by those case-changing commands. +\end{important} + +You can, with care, protect against issue~\ref{itm:nestedfirstucprob} by +inserting an empty group at the start if the long form starts with a +command that breaks the first letter uppercasing commands like +\cs{Gls}, but you still won't be able to use the all caps commands, +such as \cs{GLS}. + +If you \emph{really need} nested commands, the safest method is +\begin{verbatim} +\newabbreviation{shtml}{shtml}{{}\glsxtrp{short}{ssi} enabled +\glsxtrp{short}{html}} +\end{verbatim} +but be aware that it may have some unexpected results occasionally. + +Example document: +\begin{verbatim} +\documentclass{report} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{slantsc} +\usepackage[colorlinks]{hyperref} +\usepackage[nopostdot=false]{glossaries-extra} + +\makeglossaries + +\setabbreviationstyle{long-short-sc} + +\newabbreviation{ssi}{ssi}{server-side includes} +\newabbreviation{html}{html}{hypertext markup language} +\newabbreviation{shtml}{shtml}{{}\glsps{ssi} enabled {}\glsps{html}} + +\pagestyle{headings} + +\glssetcategoryattribute{abbreviation}{headuc}{true} +\glssetcategoryattribute{abbreviation}{glossdesc}{title} + +\begin{document} + +\tableofcontents + +\chapter{\glsfmtfull{shtml}} + +First use: \gls{shtml}, \gls{ssi} and \gls{html}. + +Next use: \gls{shtml}, \gls{ssi} and \gls{html}. + +\newpage +Next page. + +\printglossaries +\end{document} +\end{verbatim} + +\section{Acronym Style Modifications} +\label{sec:acronymmods} + +The \styfmt{glossaries-extra} package provides a new way of dealing +with abbreviations and redefines \ics{newacronym} to +use \cs{newabbreviation} (see \sectionref{sec:abbreviations}). +The simplest way to update a document that uses +\cs{newacronym} from \styfmt{glossaries} to +\styfmt{glossaries-extra} is do just add +\begin{verbatim} +\setabbreviationstyle[acronym]{long-short} +\end{verbatim} +before you define any entries. +For example, the following document using just \styfmt{glossaries} +\begin{verbatim} +\documentclass{article} +\usepackage[acronym,nopostdot,toc]{glossaries} +\makeglossaries +\setacronymstyle{long-short} +\newacronym{html}{HTML}{hypertext markup language} +\begin{document} +\gls{html} +\printglossaries +\end{document} +\end{verbatim} +can be easily adapted to use \styfmt{glossaries-extra}: +\begin{verbatim} +\documentclass{article} +\usepackage[acronym]{glossaries-extra} +\makeglossaries +\setabbreviationstyle[acronym]{long-short} +\newacronym{html}{HTML}{hypertext markup language} +\begin{document} +\gls{html} +\printglossaries +\end{document} +\end{verbatim} +Table~\ref{tab:acrabbrvstyles} lists the nearest equivalent +\styfmt{glossaries-extra} abbreviation styles for +the predefined acronym styles provided by \styfmt{glossaries}, but +note that the new styles use different formatting commands. See +\sectionref{sec:predefabbrvstyles} for further details. + +\begin{table}[htbp] +\caption[Old Acronym Styles Verses New Abbreviation Styles]{Old Acronym Styles +\cs{setacronymstyle}\marg{old-style-name} Verses New Abbreviation +Styles \cs{setabbreviationstyle}\oarg{category}\marg{new-style-name}} +\label{tab:acrabbrvstyles} +\centering +\begin{tabular}{@{}p{\dimexpr0.3\textwidth-2\tabcolsep}p{0.7\textwidth}@{}} +\bfseries Old Style Name & +\bfseries New Style Name\\ +\acrstyle{long-sc-short} & \abbrstyle{long-short-sc}\\ +\acrstyle{long-sm-short} & \abbrstyle{long-short-sm}\\ +\acrstyle{long-sp-short} & \abbrstyle{long-short} \newline with +\ttfamily\cs{renewcommand}\{\cs{glsxtrfullsep}\}[1]\{\cs{glsacspace}\{\#1\}\}\\ +\acrstyle{short-long} & \abbrstyle{short-long}\\ +\acrstyle{sc-short-long} & \abbrstyle{short-sc-long}\\ +\acrstyle{sm-short-long} & \abbrstyle{short-sm-long}\\ +\acrstyle{long-short-desc} & \abbrstyle{long-short-desc}\\ +\acrstyle{long-sc-short-desc} & \abbrstyle{long-short-sc-desc}\\ +\acrstyle{long-sm-short-desc} & \abbrstyle{long-short-sm-desc}\\ +\acrstyle{long-sp-short-desc} & \abbrstyle{long-short-desc} \newline with +\ttfamily\cs{renewcommand}\{\cs{glsxtrfullsep}\}[1]\{\cs{glsacspace}\{\#1\}\}\\ +\acrstyle{short-long-desc} & \abbrstyle{short-long-desc}\\ +\acrstyle{sc-short-long-desc} & \abbrstyle{short-sc-long-desc}\\ +\acrstyle{sm-short-long-desc} & \abbrstyle{short-sm-long-desc}\\ +\acrstyle{dua} & \abbrstyle{long-noshort}\\ +\acrstyle{dua-desc} & \abbrstyle{long-noshort-desc}\\ +\acrstyle{footnote} & \abbrstyle{short-footnote}\\ +\acrstyle{footnote-sc} & \abbrstyle{short-sc-footnote}\\ +\acrstyle{footnote-sm} & \abbrstyle{short-sm-footnote}\\ +\acrstyle{footnote-desc} & \abbrstyle{short-footnote-desc}\\ +\acrstyle{footnote-sc-desc} & \abbrstyle{short-sc-footnote-desc}\\ +\acrstyle{footnote-sm-desc} & \abbrstyle{short-sm-footnote-desc} +\end{tabular} +\end{table} + +The reason for introducing the new style of abbreviation commands +provided by \styfmt{glossaries-extra} is because the original +acronym commands provided by \styfmt{glossaries} are too restrictive +to work with the internal modifications made by +\styfmt{glossaries-extra}. However, if you really want to restore +the generic acronym function provided +by \styfmt{glossaries} you can use +\begin{definition}[\DescribeMacro\RestoreAcronyms] +\cs{RestoreAcronyms} +\end{definition} +(before any use of \cs{newacronym}). + +\cs{RestoreAcronyms} should not be used in combination with the newer +\styfmt{glossaries-extra} abbreviations. Don't combine old and +new style entries with the same \gloskey{type}. The +original \styfmt{glossaries} acronym mechanism doesn't work well +with the newer \styfmt{glossaries-extra} commands. + +\begin{important} +If you use \cs{RestoreAcronyms}, don't use any of the commands +provided by \styfmt{glossaries-extra} intended for abbreviations +(such as \ics{glsxtrshort} or \ics{glsfmtshort}) with entries +defined via \ics{newacronym} as it will cause unexpected +results. +\end{important} + +In general, there's rarely any need for \cs{RestoreAcronyms}. If you +have a document that uses \ics{newacronymstyle}, then it's best to +either stick with just \styfmt{glossaries} for that document or +define an equivalent abbreviation style with +\ics{newabbreviationstyle}. (See \sectionref{sec:newabbrvstyle} for +further details.) + +\begin{definition}[\DescribeMacro\glsacspace] +\cs{glsacspace}\marg{label} +\end{definition} +The space command \cs{glsacspace} used by the +\acrstyle{long-sp-short} acronym style provided by \styfmt{glossaries} +is modified so that it uses +\begin{definition}[\DescribeMacro\glsacspacemax] +\cs{glsacspacemax} +\end{definition} +instead of the hard-coded 3em. This is a command not a length +and so can be changed using \cs{renewcommand}. + +Any of the new abbreviation styles that use \ics{glsxtrfullsep} +(such as \abbrstyle{long-short}) can easily be changed to use +\cs{glsacspace} with +\begin{verbatim} +\renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}} +\end{verbatim} + +The \gls{firstuse} acronym font command +\begin{definition}[\firstacronymfont] +\cs{firstacronymfont}\marg{text} +\end{definition} +is redefined to use the \gls{firstuse} abbreviation font command +\ics{glsfirstabbrvfont}. This will be reset if you use +\cs{RestoreAcronyms}. + +The subsequent use acronym font command +\begin{definition}[\acronymfont] +\cs{acronymfont}\marg{text} +\end{definition} +is redefined to use the subsequent use abbreviation font command +\ics{glsabbrvfont}. This will be reset if you use +\cs{RestoreAcronyms}. + +\section{\styfmt{glossary-bookindex} package} +\label{sec:bookindex} + +As from v1.21, \styfmt{glossaries-extra} has a new supplementary +package \sty{glossary-bookindex} which provides the glossary style +\glostyle{bookindex}. This is very similar to the +\glostyle{mcolindexgroup} style but is designed for indexes, so by +default only the name and location list are displayed. You can +either load this package explicitly and then set the style: +\begin{verbatim} +\usepackage{glossaries-extra} +\usepackage{glossary-bookindex} +\setglossarystyle{bookindex} +\end{verbatim} +or use both the \pkgopt{stylemods} and \sty{style} options: +\begin{verbatim} +\usepackage[stylemods=bookindex,style=bookindex]{glossaries-extra} +\end{verbatim} +The \glostyle{bookindex} style only supports a maximum +hierarchical level of 2 (top-level, level~1 and level~2). It's +primarily designed for use with \gls{bib2gls}. It may be used with +other indexing options, but some features may not be present and +UTF-8 characters may cause a problem with non-Unicode engines in +letter group headings or PDF bookmarks. (\gls{bib2gls} uses numeric +identifies by default to avoid these problems. If numbers show up in +the group headings instead of the appropriate characters, check that +you have used the \pkgopt{record} package option.) + +The number of columns is given by +\begin{definition}[\DescribeMacro\glsxtrbookindexcols] +\cs{glsxtrbookindexcols} +\end{definition} +which defaults to 2. + +This style uses the \env{multicols} environment. If +the command +\begin{definition}[\DescribeMacro\glsxtrbookindexcolspread] +\cs{glsxtrbookindexcolspread} +\end{definition} +isn't empty then it's supplied as the optional argument +following \verb|\begin{multicols}|\marg{n}. You can switch from +\env{multicols} to \env{multicols*} by redefining +\begin{definition}[\DescribeMacro\glsxtrbookindexmulticolsenv] +\cs{glsxtrbookindexmulticolsenv} +\end{definition} +For example +\begin{verbatim} +\renewcommand{\glsxtrbookindexmulticolsenv}{multicols*} +\end{verbatim} + +Each top-level entry is displayed using +\begin{definition}[\DescribeMacro\glsxtrbookindexname] +\cs{glsxtrbookindexname}\marg{label} +\end{definition} +where the entry is identified by \meta{label}. This just +does \cs{glossentryname}\marg{label} by default. +For example, if you want the symbol to be included: +\begin{verbatim} +\renewcommand*{\glsxtrbookindexname}[1]{% + \glossentryname{#1}% + \ifglshassymbol{#1}{\space (\glossentrysymbol{#1})}{}% +} +\end{verbatim} +or if you want the description (if set): +\begin{verbatim} +\renewcommand*{\glsxtrbookindexname}[1]{% + \glossentryname{#1}% + \ifglshasdesc{#1}{\space \glossentrydesc{#1}\glspostdescription}{}% +} +\end{verbatim} +(which picks up the post-description hook). + +Alternatively you can use the \cs{glsxtrpostname\meta{category}} +hook to append information after the name according to the entry's +category. + +Sub-entries are displayed using +\begin{definition}[\DescribeMacro\glsxtrbookindexsubname] +\cs{glsxtrbookindexsubname}\marg{label} +\end{definition} +which just defaults to \cs{glsxtrbookindexname}\marg{label}. + +The separator used before the location list for top-level +entries is given by +\begin{definition}[\DescribeMacro\glsxtrbookindexprelocation] +\cs{glsxtrbookindexprelocation}\marg{label} +\end{definition} +where \meta{label} is the entry's label. This checks if +the \texttt{location} field has been set. If it has, it +does +\begin{verbatim} +,\glsxtrprelocation +\end{verbatim} +otherwise it just does \cs{glsxtrprelocation} (which defaults +to \cs{space}). If you're not using +\gls{bib2gls}, the \gloskey{location} field won't be set. + +The separator used before the +location list for sub-entries is given by +\begin{definition}[\DescribeMacro\glsxtrbookindexsubprelocation] +\cs{glsxtrbookindexsubprelocation}\marg{label} +\end{definition} +which defaults to \cs{glsxtrbookindexprelocation}\marg{label}. + +The actual location list is encapsulated with: +\begin{definition}[\DescribeMacro\glsxtrbookindexlocation] +\cs{glsxtrbookindexlocation}\marg{label}\marg{location list} +\end{definition} +for top-level entries and +\begin{definition}[\DescribeMacro\glsxtrbookindexsublocation] +\cs{glsxtrbookindexsublocation}\marg{label}\marg{location list} +\end{definition} +for sub-entries. These both just do \meta{location list} by default. + +The separator used between a top-level parent and child entry is +given by +\begin{definition}[\DescribeMacro\glsxtrbookindexparentchildsep] +\cs{glsxtrbookindexparentchildsep} +\end{definition} +This defaults to \cs{nopagebreak}. + +The separator used between a sub-level parent and child entry is +given by +\begin{definition}[\DescribeMacro\glsxtrbookindexparentsubchildsep] +\cs{glsxtrbookindexparentsubchildsep} +\end{definition} +This defaults to \cs{glsxtrbookindexparentchildsep}. + +The separator between top-level entries is given by +\begin{definition}[\DescribeMacro\glsxtrbookindexbetween] +\cs{glsxtrbookindexbetween}\marg{label1}\marg{label2} +\end{definition} +This comes after the entry given by \meta{label1}, if the entry +has no children, or after the last descendent otherwise, +so it always comes immediately before the entry given +by \meta{label2} unless the entry occurs at the start of +a group. This does nothing by default. + +The separator between two level~1 entries is given by +\begin{definition}[\DescribeMacro\glsxtrbookindexsubbetween] +\cs{glsxtrbookindexsubbetween}\marg{label1}\marg{label2} +\end{definition} + +The separator between two level~2 entries is given by +\begin{definition}[\DescribeMacro\glsxtrbookindexsubsubbetween] +\cs{glsxtrbookindexsubsubbetween}\marg{label1}\marg{label2} +\end{definition} +At the end of each letter group, the following hooks +are done in order: +\begin{definition}[\DescribeMacro\glsxtrbookindexsubsubatendgroup] +\cs{glsxtrbookindexsubsubatendgroup}\marg{sub-sub-label} +\end{definition} +\begin{definition}[\DescribeMacro\glsxtrbookindexsubatendgroup] +\cs{glsxtrbookindexsubatendgroup}\marg{sub-label} +\end{definition} +\begin{definition}[\DescribeMacro\glsxtrbookindexatendgroup] +\cs{glsxtrbookindexatendgroup}\marg{label} +\end{definition} +where \meta{sub-sub-label} is the label of the last +level~2 entry, \meta{sub-label} is the label of the last +level~1 entry and \meta{label} is the label of the last +level~0 entry. + +For example, the resource option \texttt{seealso=omit} +instructs \gls{bib2gls} to omit the \texttt{seealso} cross-reference +from the location list. (The \texttt{see} cross-reference +will still be added unless you also have \texttt{see=omit}.) +The \texttt{seealso} cross-reference can instead be appended after +the child entries using: +\begin{verbatim} +\renewcommand{\glsxtrbookindexatendgroup}[1]{% + \glsxtrifhasfield{seealso}{#1}{\glstreesubitem\glsxtruseseealso{#1}}{}% +} +\renewcommand{\glsxtrbookindexbetween}[2]{% + \glsxtrbookindexatendgroup{#1}% +}% + +\renewcommand{\glsxtrbookindexsubatendgroup}[1]{% + \glsxtrifhasfield{seealso}{#1}{\glstreesubsubitem\glsxtruseseealso{#1}}{}% +} + +\renewcommand{\glsxtrbookindexsubbetween}[2]{% + \glsxtrbookindexsubatendgroup{#1}% +} + +\renewcommand{\glsxtrbookindexsubsubatendgroup}[1]{% + \glsxtrifhasfield{seealso}{#1}% + {\glstreeitem\hspace*{40pt}\glsxtruseseealso{#1}}{}% +} + +\renewcommand{\glsxtrbookindexsubsubbetween}[2]{% + \glsxtrbookindexsubsubatendgroup{#1}% +} +\end{verbatim} +This uses \cs{glstreesubitem} and \cs{glstreesubsubitem} +to indent the cross-reference according to the next level down, +so the cross-reference for a top-level entry is aligned with +the sub-entries, and a level~1 entry has its cross-reference +aligned with sub-sub-entries. In the event that a level~2 +entry has a cross-reference, this is indented a bit further +(but it won't be aligned with any deeper level as the +\glostyle{bookindex} style only supports a maximum of two +sub-levels). + +The \glostyle{bookindex} style uses group headings. (If you +use \gls{bib2gls} remember to invoke it with the \verb|--group| +or \verb|-g| switch.) The heading will use +\begin{definition}[\DescribeMacro\glsxtrbookindexbookmark] +\cs{glsxtrbookindexbookmark}\marg{group title}\marg{name} +\end{definition} +If \cs{pdfbookmark} has been defined, this will +use that command to bookmark the group title. If +\pkgopt[chapter]{section} is set (default if chapters are defined) +then this uses level~1 otherwise it uses level~2. You can +redefine this command if this isn't appropriate. +If \cs{pdfbookmark} hasn't been defined, this command does nothin. + +The group heading is formatted according to +\begin{definition}[\DescribeMacro\glsxtrbookindexformatheader] +\cs{glsxtrbookindexformatheader}\marg{group title} +\end{definition} +which is defined as +\begin{verbatim} +\newcommand*{\glsxtrbookindexformatheader}[1]{% + \par{\centering\glstreegroupheaderfmt{#1}\par}% +} +\end{verbatim} +where \cs{glstreegroupheaderfmt} is provided by the +\sty{glossary-tree} package, which is automatically loaded. +Note that the entry names aren't encapsulated with +\cs{glstreenamefmt}. + +The \sty{glossary-bookindex} package provides some supplementary +commands that aren't used by default, but may be used when +adjusting the style. These commands should only be +used within one of the \cs{print\ldots glossary} commands. +(That is, they should only be used in glossary styles.) +\begin{definition}[\DescribeMacro\glsxtrbookindexmarkentry] +\cs{glsxtrbookindexmarkentry}\marg{label} +\end{definition} +This writes information to the \texttt{.aux} file that +can be read on the next run to obtain the first and last entry on +each page of the glossary. + +You can display the first entry +associated with the current page using: +\begin{definition}[\DescribeMacro\glsxtrbookindexfirstmark] +\cs{glsxtrbookindexfirstmark} +\end{definition} +and the last entry associated with the current page +using: +\begin{definition}[\DescribeMacro\glsxtrbookindexlastmark] +\cs{glsxtrbookindexlastmark} +\end{definition} +These do nothing if there are no entries marked on the current page +(or if the document build isn't up to date). + +The entry is formatted using: +\begin{definition}[\DescribeMacro\glsxtrbookindexfirstmarkfmt] +\cs{glsxtrbookindexfirstmarkfmt}\marg{label} +\end{definition} +for the first instance and +\begin{definition}[\DescribeMacro\glsxtrbookindexlastmarkfmt] +\cs{glsxtrbookindexlastmarkfmt}\marg{label} +\end{definition} +for the last. + +These commands are designed for use in page headers or footers +where the page number is stable. For example, \cs{glsxtrbookindexname} +can be redefined to mark the current entry: +\begin{verbatim} +\renewcommand{\glsxtrbookindexname}[1]{% + \glsxtrbookindexmarkentry{#1}% + \glossentryname{#1}% +} +\end{verbatim} +If you only want to mark the top-level entries, remember +to redefine \cs{glsxtrbookindexsubname} as it defaults +to \cs{glsxtrbookindexname}: +\begin{verbatim} +\renewcommand{\glsxtrbookindexsubname}[1]{% + \glossentryname{#1}% +} +\end{verbatim} + +Then if you're using \sty{fancyhdr} you can set the page style +to show the first and last entry for the current page with: +\begin{verbatim} + \pagestyle{fancy}% + \lhead{\thepage}% + \lfoot{\glsxtrbookindexfirstmark}% + \cfoot{}% + \rfoot{\glsxtrbookindexlastmark}% +\end{verbatim} + +\section{\styfmt{glossary-longextra} package} +\label{sec:longextra} + +As from version 1.37, the \styfmt{glossaries-extra} package comes +with the supplementary package \sty{glossary-longextra} that +provides additional styles, listed below, that use the +\env{longtable} environment. If you know that your glossary won't +span more than a page and you need to use it in a context that's +incompatible with \env{longtable}, you can instead setup these styles +to use \env{tabular} instead. In order to do this you must use +\begin{definition}[\DescribeMacro\GlsLongExtraUseTabulartrue] +\cs{GlsLongExtraUseTabulartrue} +\end{definition} +\emph{before the style is set}. For example: +\begin{verbatim} +\GlsLongExtraUseTabulartrue +\setglossarystyle{long-name-desc} +\end{verbatim} +or +\begin{verbatim} +\GlsLongExtraUseTabulartrue +\printunsrtglossary[style={long-name-desc}] +\end{verbatim} +If you use this setting, you can change the default vertical +alignment with: +\begin{definition}[\DescribeMacro\glslongextraTabularVAlign] +\cs{glslongextraTabularVAlign} +\end{definition} +The default definition is \texttt{c}. + +The column titles are formatted according to: +\begin{definition}[\DescribeMacro\glslongextraHeaderFmt] +\cs{glslongextraHeaderFmt}\marg{text} +\end{definition} +which simply does \cs{textbf}\marg{text} by default. + +The name column has the title given by \ics{entryname} and +the column alignment is given by: +\begin{definition}[\DescribeMacro\glslongextraNameAlign] +\cs{glslongextraNameAlign} +\end{definition} +which expands to \texttt{l} (left) by default. + +The symbol column (where applicable) has the title given by +\ics{symbolname} and the column alignment is given by: +\begin{definition}[\DescribeMacro\glslongextraSymbolAlign] +\cs{glslongextraSymbolAlign} +\end{definition} +which expands to \texttt{c} (centred) by default. + +The location list column (where applicable) has the title given by +\ics{pagelistname} and the column alignment is given by: +\begin{definition}[\DescribeMacro\glslongextraLocationAlign] +\cs{glslongextraLocationAlign} +\end{definition} +which expands to +\begin{verbatim} +>{\raggedright}p{\glspagelistwidth} +\end{verbatim} +by default. (Ragged-right paragraph, \ics{glspagelistwidth} is +defined in \sty{glossary-long}, which is automatically loaded.) + +The description column has the title given by \ics{descriptionname} +and the column alignment is given by: +\begin{definition}[\DescribeMacro\glslongextraDescAlign] +\cs{glslongextraDescAlign} +\end{definition} +which expands to +\begin{verbatim} +>{\raggedright}p{\glsdescwidth} +\end{verbatim} +by default. (Ragged-right paragraph, \ics{glsdescwidth} is +defined in \sty{glossary-long}, which is automatically loaded.) + +Unlike the long styles provided by the base \styfmt{glossaries} +package, these new styles try to determine the value of +\cs{glsdescwidth} at the start of the glossary according to the +number of columns provided by the style. The calculations are +performed by the following commands: +\begin{definition}[\DescribeMacro\glslongextraSetDescWidth] +\cs{glslongextraSetDescWidth} +\end{definition} +This is used by the styles that have a name and description +column. The value of \cs{glsdescwidth} is computed as: +\[ + \cs{glsdescwidth} = \cs{linewidth} - 4\cs{tabcolsep} - W +\] +where $W$ is a guess at the width of the name column. This is first +set to the width of the name column header: +\begin{alltt} +\cs{settowidth}\marg{width}\{\cs{glslongextraHeaderFmt}\cs{entryname}\} +\end{alltt} +If any names in that column are larger than this, then you need +to specify the widest name using: +\begin{definition}[\DescribeMacro\glslongextraSetWidest] +\cs{glslongextraSetWidest}\marg{widest name} +\end{definition} +or +\begin{definition}[\DescribeMacro\glslongextraUpdateWidest] +\cs{glslongextraUpdateWidest}\marg{text} +\end{definition} +These work like the analogous commands \cs{glssetwidest} and +\cs{glsupdatewidest} provided with the \glostyle{alttree} style, but +in this case there's no hierarchy. The default widest name +is obtained from the \glostyle{alttree} top-level name if set, +otherwise it's empty, so you can use \gls{bib2gls}['s] +\texttt{set-widest} option. If you have the entry counter enabled, +you will need to include this with the name for the extra material to +be taken into account. + +The name isn't shown for child entries by default, but if +you change this and you want to use \gls{bib2gls}['s] +\texttt{set-widest} option (for \gls{bib2gls} v1.8+) then you need to +redefine: +\begin{definition}[\DescribeMacro\glslongextraUpdateWidestChild] +\cs{glslongextraUpdateWidestChild}\marg{level}\marg{text} +\end{definition} +This does nothing by default, but if you are including the child +names then you need to redefine this command: +\begin{verbatim} +\renewcommand{\glslongextraUpdateWidestChild}[2]{% + \glslongextraUpdateWidest{#2}% +} +\end{verbatim} + +If you prefer to set an explicit width for the description +column then you need to redefine \cs{glslongextraSetDescWidth}. For +example: +\begin{verbatim} +\renewcommand{\glslongextraSetDescWidth}{% + \setlength{\glsdescwidth}{0.6\linewidth}% +} +\end{verbatim} + +The styles that have a name, symbol and description, +\cs{glsdescwidth} is set with: +\begin{definition}[\DescribeMacro\glslongextraSymSetDescWidth] +\cs{glslongextraSymSetDescWidth} +\end{definition} +This first uses \cs{glslongextraSetDescWidth} and then subtracts +2\cs{tabcolsep} and the width of the symbol column header from +\cs{glsdescwidth}. This assumes that the symbol column header +is larger than any of the symbols. If this isn't appropriate +then you can redefine this command. For example: +\begin{verbatim} +\renewcommand{\glslongextraSymSetDescWidth}{% + \glslongextraSetDescWidth + \addtolength{\glsdescwidth}{-3cm}% +} +\end{verbatim} +or +\begin{verbatim} +\renewcommand{\glslongextraSymSetDescWidth}{% + \setlength{\glsdescwidth}{.5\linewidth}% +} +\end{verbatim} + +For the styles that have a name, description and location column, +\cs{glsdescwidth} is set using: +\begin{definition}[\DescribeMacro\glslongextraLocSetDescWidth] +\cs{glslongextraLocSetDescWidth} +\end{definition} +This uses \cs{glslongextraSetDescWidth} and then subtracts +2\cs{tabcolsep} and \cs{glspagelistwidth} from \cs{glsdescwidth}. +You can redefine this command to set both \cs{glsdescwidth} and +\cs{glspagelistwidth} if appropriate. + +For the styles that have a name, description, symbol and location +column, \cs{glsdescwidth} is set using: +\begin{definition}[\DescribeMacro\glslongextraSymLocSetDescWidth] +\cs{glslongextraSymLocSetDescWidth} +\end{definition} +This uses \cs{glslongextraSymSetDescWidth} and then subtracts +2\cs{tabcolsep} and \cs{glspagelistwidth} from +\cs{glsdescwidth}. Again, you can redefine this command +to explicitly set both lengths. + +In all cases, the top-level name is formatted according to: +\begin{definition}[\DescribeMacro\glslongextraNameFmt] +\cs{glslongextraNameFmt}\marg{label} +\end{definition} +This does +\begin{alltt} +\cs{glsentryitem}\marg{label}\cs{glstarget}\marg{label}\{\cs{glossentryname}\marg{label}\} +\end{alltt} +which includes the entry counter (if enabled), the target and the post-name link. + +The top-level description is formatted according to: +\begin{definition}[\DescribeMacro\glslongextraDescFmt] +\cs{glslongextraDescFmt}\marg{label} +\end{definition} +This does \cs{glossentrydesc}\marg{label} followed by the +post-description hook. + +The styles that have a symbol column format the symbol using: +\begin{definition}[\DescribeMacro\glslongextraSymbolFmt] +\cs{glslongextraSymbolFmt}\marg{label} +\end{definition} +This just does \cs{glossentrysymbol}\marg{label}. + +The styles that have a location list column format the list using: +\begin{definition}[\DescribeMacro\glslongextraLocationFmt] +\cs{glslongextraLocationFmt}\marg{label}\marg{locations} +\end{definition} +This just does \meta{locations} and ignores the label. + +The child entries have their name formatted according to: +\begin{definition}[\DescribeMacro\glslongextraSubNameFmt] +\cs{glslongextraSubNameFmt}\marg{level}\marg{label} +\end{definition} +where \meta{level} is the hierarchical level. This defaults to: +\begin{alltt} +\cs{glssubentryitem}\marg{label}\cs{glstarget}\marg{label}\{\cs{strut}\} +\end{alltt} +This includes the sub-entry counter (if enabled) and the target +but doesn't show the name. The child description is formatted according to: +\begin{definition}[\DescribeMacro\glslongextraSubDescFmt] +\cs{glslongextraSubDescFmt}\marg{level}\marg{label} +\end{definition} +which defaults to just \cs{glslongextraDescFmt}\marg{label} + +The child symbol is formatted (where appropriate) according to: +\begin{definition}[\DescribeMacro\glslongextraSubSymbolFmt] +\cs{glslongextraSubSymbolFmt}\marg{level}\marg{label} +\end{definition} +This just does \cs{glslongextraSymbolFmt}\marg{label} by default. + +The styles that have a location list column format the list for +child entries using: +\begin{definition}[\DescribeMacro\glslongextraLocationFmt] +\cs{glslongextraSubLocationFmt}\meta{level}\marg{label}\marg{locations} +\end{definition} +This just does \meta{locations} and ignores the level and label. + +The letter group headings are formatted according to: +\begin{definition}[\DescribeMacro\glslongextraGroupHeading] +\cs{glslongextraGroupHeading}\marg{n}\marg{label} +\end{definition} +which does nothing by default. The first argument \meta{n} is the +number of columns in the table. The second argument \meta{label} +is the group label (not the title, although they may happen +to be the same). + +This can be redefined to show the group heading. For example: +\begin{verbatim} +\renewcommand*{\glslongextraGroupHeading}[2]{% + \glsxtrgetgrouptitle{#2}{\thisgrptitle}% + \glslongextraHeaderFmt{\thisgrptitle}% + \tabularnewline + \noalign{\vskip\normalbaselineskip}% +} +\end{verbatim} +This ignores the first argument and just puts the group +title in the first column formatted according to +\cs{glslongextraHeaderFmt} (to match the column header). + +Remember that you can also adjust the styles through category +attributes. The name column's title is given by +\cs{entryname}, the description column's title is given by +\cs{descriptionname} and (where present) the symbol column's +title is given by \cs{symbolname}, as for the other long styles +that have headers. + +\begin{description} +\item{\glostyle{long-name-desc}} This is like the +\glostyle{longragged-booktabs} style but doesn't show the location +list (regardless of the \pkgopt{nonumberlist} option). The name is +shown in the first column and the description in the second. + +The symbol is not displayed. The header +row is produced with: +\begin{definition}[\DescribeMacro\glslongextraNameDescHeader] +\cs{glslongextraNameDescHeader} +\end{definition} +This essentially uses the same code as for \glostyle{longragged-booktabs} +but makes it easier to adjust the header without having to define a +new style. This is defined as: +\begin{verbatim} +\glslongextraNameDescTabularHeader\endhead +\glslongextraNameDescTabularFooter\endfoot +\end{verbatim} +where: +\begin{definition}[\DescribeMacro\glslongextraNameDescTabularHeader] +\cs{glslongextraNameDescTabularHeader} +\end{definition} +sets up the header and +\begin{definition}[\DescribeMacro\glslongextraNameDescTabularFooter] +\cs{glslongextraNameDescTabularFooter} +\end{definition} +sets up the footer. If you have setup the \env{tabular} version +of this style then the above two commands are used at the +start and end of the \env{tabular} environment (and +\cs{glslongextraNameDescHeader} isn't used). + +For example, to simply remove the header and footer (for the default +\env{longtable} version of the style): +\begin{verbatim} +\renewcommand{\glslongextraNameDescHeader}{} +\end{verbatim} +Or to change the name alignment to centred: +\begin{verbatim} +\renewcommand{\glslongextraNameAlign}{c} +\end{verbatim} + +\item{\glostyle{long-name-desc-loc}} This is like the +\glostyle{long-name-desc} style but has a third column for the +location list. The \env{longtable} header is given by: +\begin{definition}[\DescribeMacro\glslongextraNameDescLocationHeader] +\cs{glslongextraNameDescLocationHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraNameDescLocationTabularHeader] +\cs{glslongextraNameDescLocationTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraNameDescLocationTabularFooter] +\cs{glslongextraNameDescLocationTabularFooter} +\end{definition} + +\item{\glostyle{long-desc-name}} This is like the +\glostyle{long-name-desc} style but swaps the columns. Note that +if the entry counter is displayed it will appear at the start +of the second column by default. The \env{longtable} header is formatted according +to: +\begin{definition}[\DescribeMacro\glslongextraDescNameHeader] +\cs{glslongextraDescNameHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraDescNameTabularHeader] +\cs{glslongextraDescNameTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraDescNameTabularFooter] +\cs{glslongextraDescNameTabularFooter} +\end{definition} + +\item{\glostyle{long-loc-desc-name}} This has three columns +containing the location list, description and name. The +\env{longtable} header +is formatted according to: +\begin{definition}[\DescribeMacro\glslongextraLocationDescNameHeader] +\cs{glslongextraLocationDescNameHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraLocationDescNameTabularHeader] +\cs{glslongextraLocationDescNameTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraLocationDescNameTabularFooter] +\cs{glslongextraLocationDescNameTabularFooter} +\end{definition} + +\item{\glostyle{long-name-desc-sym}} This is has three columns, with +the name in the first, the description in the second and the symbol +in the third. + +The \env{longtable} header row is produced with: +\begin{definition}[\DescribeMacro\glslongextraNameDescSymHeader] +\cs{glslongextraNameDescSymHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraNameDescSymTabularHeader] +\cs{glslongextraNameDescSymTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraNameDescSymTabularFooter] +\cs{glslongextraNameDescSymTabularFooter} +\end{definition} + +\item{\glostyle{long-name-desc-sym-loc}} This is has four columns, with +the name in the first, the description in the second, the symbol +in the third and the location list in the fourth. + +The \env{longtable} header row is produced with: +\begin{definition}[\DescribeMacro\glslongextraNameDescSymLocationHeader] +\cs{glslongextraNameDescSymLocationHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraNameDescSymLocationTabularHeader] +\cs{glslongextraNameDescSymLocationTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraNameDescSymLocationTabularFooter] +\cs{glslongextraNameDescSymLocationTabularFooter} +\end{definition} + +\item{\glostyle{long-name-sym-desc}} This is like the +\glostyle{long-name-desc-sym} but the second and third column are +swapped. The \env{longtable} header row is given by: +\begin{definition}[\DescribeMacro\glslongextraNameSymDescHeader] +\cs{glslongextraNameSymDescHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraNameSymDescTabularHeader] +\cs{glslongextraNameSymDescTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraNameSymDescTabularFooter] +\cs{glslongextraNameSymDescTabularFooter} +\end{definition} + +\item{\glostyle{long-name-sym-desc-loc}} This is like the +\glostyle{long-name-desc-sym-loc} but the second and third column are +swapped. The \env{longtable} header row is given by: +\begin{definition}[\DescribeMacro\glslongextraNameSymDescLocationHeader] +\cs{glslongextraNameSymDescLocationHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraNameSymDescLocationTabularHeader] +\cs{glslongextraNameSymDescLocationTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraNameSymDescLocationTabularFooter] +\cs{glslongextraNameSymDescLocationTabularFooter} +\end{definition} + +\item{\glostyle{long-sym-desc-name}} This has the symbol in the +first column, the description in the second and the name in the +third. The \env{longtable} header row is given by: +\begin{definition}[\DescribeMacro\glslongextraSymDescNameHeader] +\cs{glslongextraSymDescNameHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraSymDescNameTabularHeader] +\cs{glslongextraSymDescNameTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraSymDescNameTabularFooter] +\cs{glslongextraSymDescNameTabularFooter} +\end{definition} + +\item{\glostyle{long-loc-sym-desc-name}} This has the location list +in the first column, symbol in the +second column, the description in the third and the name in the +fourth. The \env{longtable} header row is given by: +\begin{definition}[\DescribeMacro\glslongextraLocationSymDescNameHeader] +\cs{glslongextraLocationSymDescNameHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraLocationSymDescNameTabularHeader] +\cs{glslongextraLocationSymDescNameTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraLocationSymDescNameTabularFooter] +\cs{glslongextraLocationSymDescNameTabularFooter} +\end{definition} + +\item{\glostyle{long-desc-sym-name}} This has the description in the +first column, the symbol in the second and the name in the +third. The \env{longtable} header row is given by: +\begin{definition}[\DescribeMacro\glslongextraDescSymNameHeader] +\cs{glslongextraDescSymNameHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraDescSymNameTabularHeader] +\cs{glslongextraDescSymNameTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraDescSymNameTabularFooter] +\cs{glslongextraDescSymNameTabularFooter} +\end{definition} + +\item{\glostyle{long-loc-desc-sym-name}} This has the location list +in the first column, the description in the +second column, the symbol in the third and the name in the +fourth. The \env{longtable} header row is given by: +\begin{definition}[\DescribeMacro\glslongextraLocationDescSymNameHeader] +\cs{glslongextraLocationDescSymNameHeader} +\end{definition} +which similarly defined in terms of the commands used for the +\env{tabular} version: +\begin{definition}[\DescribeMacro\glslongextraLocationDescSymNameTabularHeader] +\cs{glslongextraLocationDescSymNameTabularHeader} +\end{definition} +and +\begin{definition}[\DescribeMacro\glslongextraLocationDescSymNameTabularFooter] +\cs{glslongextraLocationDescSymNameTabularFooter} +\end{definition} + +\end{description} + +\section{\styfmt{glossary-topic} package} +\label{sec:topic} + +As from version 1.40, the \styfmt{glossaries-extra} package comes +with the supplementary package \sty{glossary-topic} that +provides glossary styles designed for hierarchical glossaries +where the top-level entries are topic titles. This package +automatically loads the \sty{multicols} package. If the +\sty{glossary-tree} package is also loaded then commands like +\cs{glssetwidest} can be used on these styles in much the same way +as for the \glostyle{alttree} style. If a widest value isn't set +then these styles behave more like the \glostyle{tree} style. +\begin{description} +\item[\glostyle{topic}] This style is similar to the \glostyle{tree} +style but the indentation doesn't start until the second +sub-item level. The top-level entries have the name displayed +in a larger font with the description following in a new paragraph. +This style doesn't support the \pkgopt{nogroupskip} setting. + +\item[\glostyle{topicmcols}] This style is like the \glostyle{topic} +style but the sub-entries are placed inside a \env{multicols} +environment. The environment name is supplied in the value of +the command: +\begin{definition}[\DescribeMacro\glstopicColsEnv] +\cs{glstopicColsEnv} +\end{definition} +You can change this to the starred form. For example: +\begin{verbatim} +\renewcommand{\glstopicColsEnv}{multicols*} +\end{verbatim} +The number of columns is given by the command: +\begin{definition}[\DescribeMacro\glstopicCols] +\cs{glstopicCols} +\end{definition} +The default value is 2. +\end{description} +Both styles use the following commands. +\begin{definition}[\DescribeMacro\glstopicParIndent] +\cs{glstopicParIndent} +\end{definition} +This command is a length that's used for the paragraph indentation +in any multi-paragraph description for top-level entries, but not +for the first paragraph (at the start of the description) which +isn't indented. + +\begin{definition}[\DescribeMacro\glstopicSubIndent] +\cs{glstopicSubIndent} +\end{definition} +This command is a length that's used to calculate the hanging +indentation for sub-entries. The level~1 sub-entries don't indent +the name. Level~$n$ sub-entries have the name indented by +$(n-1)\times$\cs{glstopicSubIndent}. The hanging indent depends +on whether or not a widest name has been set for the level. + +\begin{definition}[\DescribeMacro\glstopicInit] +\cs{glstopicInit} +\end{definition} +Hook used at the start of the glossary. Does nothing by default. + +Although the styles don't support letter groups by default, if you +have many topics (top-level entries) and you feel that it would help +the reader to divide them up into headed letter groups, you can +redefine: +\begin{definition}[\DescribeMacro\glstopicGroupHeading] +\cs{glstopicGroupHeading}\marg{group label} +\end{definition} +This does nothing by default. If you want to redefine it, you can +fetch the title corresponding to the group label with +\cs{glsxtrgetgrouptitle}. For example: +\begin{verbatim} +\renewcommand*{\glstopicGroupHeading}[1]{% + \glsxtrgetgrouptitle{#1}{\thisgrptitle}% + \section*{\thisgrptitle}% +} +\end{verbatim} +Remember that if you use \gls{bib2gls}, you will need the +\verb|--group| (or \verb|-g|) switch to support this. + +\begin{definition}[\DescribeMacro\glstopicItem] +\cs{glstopicItem}\marg{label}\marg{location list} +\end{definition} +Used to format the name, symbol, description and location list +for the top-level entries. This starts with a paragraph break +followed by: +\begin{definition}[\DescribeMacro\glstopicPreSkip] +\cs{glstopicPreSkip} +\end{definition} +which defaults to \cs{medskip}. There is then a hook: +\begin{definition}[\DescribeMacro\glstopicMarker] +\cs{glstopicMarker}\marg{label} +\end{definition} +which does nothing by default, but may be redefined. For example, +to add a line to the table of contents. +The name and symbol are set in the +form of a title using: +\begin{definition}[\DescribeMacro\glstopicTitle] +\cs{glstopicTitle}\marg{label} +\end{definition} +This uses \cs{Glossentryname} which converts the first letter to +upper case. If there's a symbol, this is added in parentheses. +Both name and symbol (if present) are encapsulated by +\begin{definition}[\DescribeMacro\glstopicTitleFont] +\cs{glstopicTitleFont}\marg{text} +\end{definition} +This uses a bold, large font by default. + +If the entry has the description key set (tested with +\cs{ifglshasdesc}) then a paragraph break is inserted followed by: +\begin{definition}[\DescribeMacro\glstopicMidSkip] +\cs{glstopicMidSkip} +\end{definition} +which defaults to \cs{smallskip}. This is followed by the +description which is formatted according to: +\begin{definition}[\DescribeMacro\glstopicDesc] +\cs{glstopicDesc}\marg{label} +\end{definition} +This just does \cs{Glossentrydesc}\marg{label} followed +by the post-description hook. + +A paragraph break followed by: +\begin{definition}[\DescribeMacro\glstopicPostSkip] +\cs{glstopicPostSkip} +\end{definition} +comes next regardless of whether or not the description was +displayed. This defaults to \cs{smallskip}. This is then followed +by: +\begin{definition}[\DescribeMacro\glstopicLoc] +\cs{glstopicLoc}\marg{label}\marg{location list} +\end{definition} +which may be used to display the location list, but does nothing by +default. + +The sub-entries first set up the paragraph and hanging indentations +using: +\begin{definition}[\DescribeMacro\glstopicAssignSubIndent] +\cs{glstopicAssignSubIndent}\marg{level} +\end{definition} +This uses: +\begin{definition}[\DescribeMacro\glstopicAssignWidest] +\cs{glstopicAssignWidest}\marg{level} +\end{definition} +to determine if a widest name has been set for the given level. + +The sub-entry has its information displayed using: +\begin{definition}[\DescribeMacro\glstopicSubItem] +\cs{glstopicSubItem}\marg{level}\marg{label}\marg{location} +\end{definition} +This encapsulates the name with: +\begin{definition}[\DescribeMacro\glstopicSubNameFont] +\cs{glstopicSubNameFont}\marg{text} +\end{definition} +By default this just uses \cs{textbf}. This is followed by: +\begin{definition}[\DescribeMacro\glstopicSubItemSep] +\cs{glstopicSubItemSep} +\end{definition} +which defaults to \cs{quad}. The name and separator are +passed in the \meta{text} argument of: +\begin{definition}[\DescribeMacro\glstopicSubItemBox] +\cs{glstopicSubItemBox}\marg{level}\marg{text} +\end{definition} +If a widest name was set for the given level, this will +put \meta{text} inside a box of that width otherwise it just does +\meta{text}. + +This is followed by the symbol in parentheses if set. Then, if the +description is set, the description and post-description hook are +displayed followed by: +\begin{definition}[\DescribeMacro\glstopicSubPreLocSep] +\cs{glstopicSubPreLocSep} +\end{definition} +(This command isn't used if the description isn't set.) + +Finally the location list is displayed using: +\begin{definition}[\DescribeMacro\glstopicSubLoc] +\cs{glstopicSubLoc}\marg{label}\marg{location} +\end{definition} +which just does \meta{location} by default. + +\section{Glossary Style Modifications} +\label{sec:glosstylemods} + +The \sty{glossaries-extra-stylemods} package (more conveniently +loaded through the \styfmt{glossaries-extra} +\pkgopt{stylemods} option) modifies some of the predefined +styles that are provided with the \styfmt{glossaries} package. +These modifications are described in more detail in +\sectionref{sec:stylemods}. + +The \sty{glossaries} package tries to determine the group +title from its label by first checking if +\cs{}\meta{label}\texttt{groupname} exists. If it doesn't exist, +then the title is assumed to be the same as the label. +For example, when typesetting the \qt{A} letter group, +\sty{glossaries} first checks if \cs{Agroupname} exists. +This could potentially cause conflict with another package +that may have some other meaning for \cs{Agroupname}, so +\sty{glossaries-extra} first checks for the existence +of the internal command \cs{glsxtr@grouptitle@}\meta{label} +which shouldn't clash with another package. You can set the +group title using +\begin{definition}[\DescribeMacro\glsxtrsetgrouptitle] +\cs{glsxtrsetgrouptitle}\marg{label}\marg{title} +\end{definition} +For example: +\begin{verbatim} +\glsxtrsetgrouptitle{A}{A (a)} +\end{verbatim} +This uses a global assignment. If you need to scope the change +you can use +\begin{definition}[\DescribeMacro\glsxtrlocalsetgrouptitle] +\cs{glsxtrlocalsetgrouptitle}\marg{label}\marg{title} +\end{definition} + +\subsection{Style Hooks} +\label{sec:stylehooks} + +The commands \ics{glossentryname} and \ics{glossentrydesc} are +modified to take into account the \catattr{glossname}, +\catattr{glossdesc} and \catattr{glossdescfont} attributes (see \sectionref{sec:categories}). +This means you can make simple case-changing modifications to +the name and description without defining a new glossary style. + +If you want to adapt a style to use another field instead +of \gloskey{name}, you can use +\begin{definition}[\DescribeMacro\glossentrynameother] +\cs{glossentrynameother}\marg{label}\marg{field} +\end{definition} +This behaves just like \cs{glossentryname} (that is, it obeys +\catattr{glossname}, \catattr{glossnamefont} or \cs{glsnamefont} and uses the post-name +hook) but it uses the given \meta{field} instead of \gloskey{name}. +The \meta{field} argument must be the internal field name +(for example \texttt{desc} rather than \texttt{description}). +See the key to field mappings table in the \styfmt{glossaries} +user manual. + +There is a hook after \ics{glossentryname} and +\ics{Glossentryname}: +\begin{definition}[\DescribeMacro\glsxtrpostnamehook] +\cs{glsxtrpostnamehook}\marg{label} +\end{definition} +By default this checks the \catattr{indexname} attribute. +If the attribute exists for the category to which the label belongs, +then the name is automatically indexed using +\begin{definition} +\ics{glsxtrdoautoindexname}\marg{label}\texttt{\{indexname\}} +\end{definition} +See \sectionref{sec:autoindex} for further details. + +\begin{sloppypar} +As from version 1.04, the post-name hook \cs{glsxtrpostnamehook} +will also use \cs{glsxtrpostname}\meta{category} if it exists. +You can use \ics{glscurrententrylabel} to obtain the entry label +with the definition of this command. For example, suppose you are +using a glossary style the doesn't display the symbol, you can +insert the symbol after the name for a particular category, say, +the \qt{symbol} category: +\end{sloppypar} +\begin{verbatim} +\newcommand*{\glsxtrpostnamesymbol}{\space + (\glsentrysymbol{\glscurrententrylabel})} +\end{verbatim} +For convenience, as from v1.31, you can use +\begin{definition}[\DescribeMacro\glsdefpostname] +\cs{glsdefpostname}\marg{category}\marg{definition} +\end{definition} +This is simply a shortcut for: +\begin{alltt} +\cs{csdef}\{glsxtrpostname\meta{category}\}\marg{definition} +\end{alltt} +Note that it doesn't check if the command has already been defined. + +As from version 1.25, the post-name hook also does +\begin{definition}[\DescribeMacro\glsextrapostnamehook] +\cs{glsextrapostnamehook}\marg{label} +\end{definition} +(before \cs{glsxtrpostname}\meta{category}) +to allow for additional non-category related code. This does nothing +by default. + +The post-description code used within the glossary is modified so +that it also does +\begin{definition}[\DescribeMacro\glsxtrpostdescription] +\cs{glsxtrpostdescription} +\end{definition} +This occurs before the original \cs{glspostdescription}, so if the +\pkgopt[false]{nopostdot} option is used, it will be inserted before +the terminating full stop. + +This new command will do \cs{glsxtrpostdesc\meta{category}} +if it exists, where \meta{category} is the category label associated +with the current entry. For example \cs{glsxtrpostdescgeneral} +for entries with the category set to \category{general} +or \cs{glsxtrpostdescacronym} for entries with the category set to +\category{acronym}. +For convenience, as from v1.31, you can use +\begin{definition}[\DescribeMacro\glsdefpostdesc] +\cs{glsdefpostdesc}\marg{category}\marg{definition} +\end{definition} +This is simply a shortcut for: +\begin{alltt} +\cs{csdef}\{glsxtrpostdesc\meta{category}\}\marg{definition} +\end{alltt} +Note that it doesn't check if the command has already been defined. + +Since both \cs{glossentry} and \cs{subglossentry} set +\begin{definition}[\DescribeMacro\glscurrententrylabel] +\cs{glscurrententrylabel} +\end{definition} +to the label for the current entry, you can use this within the +definition of these post-description hooks if you need to reference +the label. + +For example, suppose you want to insert the plural form in brackets +after the description in the glossary, but only for entries in the +\category{general} category, then you could do: +\begin{verbatim} +\renewcommand{\glsxtrpostdescgeneral}{\space + (plural: \glsentryplural{\glscurrententrylabel})} +\end{verbatim} +This means you don't have to define a custom glossary style, which +you may find more complicated. (It also allows more flexibility if +you decide to change the underlying glossary style.) + +\begin{important} +This feature can't be used for glossary styles that ignore +\cs{glspostdescription} or if you redefine +\cs{glspostdescription} without including \cs{glsxtrpostdescription}. +(For example, if you redefine \cs{glspostdescription} to do +nothing instead of using the \pkgopt{nopostdot} option to suppress +the terminating full stop.) See \sectionref{sec:stylemods} to patch +the predefined styles provided by \styfmt{glossaries} that are missing +\cs{glspostdescription}. +\end{important} + +\subsection{Number List} +\label{sec:glosstylenumlist} + +The \gls{numberlist} is now placed inside the argument of +\begin{definition}[\DescribeMacro\GlsXtrFormatLocationList] +\cs{GlsXtrFormatLocationList}\marg{number list} +\end{definition} +This is internally used by \cs{glossaryentrynumbers}. The +\pkgopt{nonumberlist} option redefines \cs{glossaryentrynumbers} so that it +doesn't display the \gls{numberlist}, but it still saves the +\gls{numberlist} in case it's required. + +\begin{important} +If you want to suppress the \gls{numberlist} always use the +\pkgopt{nonumberlist} option instead of redefining +\cs{glossaryentrynumbers} to do nothing. +\end{important} + +If you want to, for example, change the font for the entire +\gls{numberlist} then redefine \cs{GlsXtrFormatLocationList} as +appropriate. Don't modify \cs{glossaryentrynumbers}. + +Sometimes users like to insert \qt{page} or \qt{pages} in front of +the \gls{numberlist}. This is quite fiddly to do with the base +\styfmt{glossaries} package, but \styfmt{glossaries-extra} +provides a way of doing this. First you need to enable this +option and specify the text to display using: +\begin{definition}[\DescribeMacro\GlsXtrEnablePreLocationTag] +\cs{GlsXtrEnablePreLocationTag}\marg{page}\marg{pages} +\end{definition} +where \meta{page} is the text to display if the \gls{numberlist} only +contains a single location and \meta{pages} is the text to display +otherwise. For example: +\begin{verbatim} +\GlsXtrEnablePreLocationTag{Page: }{Pages: } +\end{verbatim} +An extra run is required when using this command. + +\begin{important} +Use \texttt{glsignore} not \texttt{@gobble} as the format if you +want to suppress the page number (and only index the entry once). +\end{important} + +See the accompanying sample file \texttt{sample-pages.tex}. + +Note that \gls{bib2gls} can be instructed to insert +a prefix at the start of non-empty location lists, which +can be used as an alternative to \cs{GlsXtrEnablePreLocationTag}. + +\subsection{The \styfmt{glossaries-extra-stylemods} Package} +\label{sec:stylemods} + +As from v1.02, \styfmt{glossaries-extra} now includes the package +\sty{glossaries-extra-stylemods} that will redefine the predefined +styles to include the post-description hook (for those that are +missing it). You will need to make sure the styles have already +been defined before loading \styfmt{glossaries-extra}. For example: +\begin{verbatim} +\usepackage{glossaries-extra} +\usepackage{glossary-longragged} +\usepackage{glossaries-extra-stylemods} +\end{verbatim} +Alternatively you can load +\texttt{glossary-}\meta{name}\texttt{.sty} at the same time by +passing \meta{name} as a package option to +\sty{glossaries-extra-stylemods}. For example: +\begin{verbatim} +\usepackage{glossaries-extra} +\usepackage[longragged]{glossaries-extra-stylemods} +\end{verbatim} +Another option is to use the \pkgopt{stylemods} key when you +load \styfmt{glossaries-extra}. You can omit a value if you only want to use +the predefined styles that are automatically loaded by +\styfmt{glossaries} (for example, the \glostyle{long3col} style): +\begin{verbatim} +\usepackage[style=long3col,stylemods]{glossaries-extra} +\end{verbatim} +Or the value of \pkgopt{stylemods} may be a comma-separated list +of the style package identifiers. For example: +\begin{verbatim} +\usepackage[style=mcoltree,stylemods=mcols]{glossaries-extra} +\end{verbatim} +Remember to group the value if it contains any commas: +\begin{verbatim} +\usepackage[stylemods={mcols,longbooktabs}]{glossaries-extra} +\end{verbatim} + +Note that the \glostyle{inline} style is dealt with slightly +differently. The original definition provided by the +\sty{glossary-inline} package uses \cs{glspostdescription} at the +end of the glossary (not after each entry description) within the +definition of \cs{glspostinline}. The style modification changes +this so that \cs{glspostinline} just does a full stop followed by +space factor adjustment, and the description +\cs{glsinlinedescformat} and sub-entry description formats +\cs{glsinlinesubdescformat} are redefined to include +\cs{glsxtrpostdescription} (not \cs{glspostdescription}). This means +that the modified \glostyle{inline} style isn't affected by the +\pkgopt{nopostdot} option, but the post-description category hook +can still be used. + +The \env{tabular}-like styles, such as \glostyle{long} are +adjusted so that the \ics{ifglsnogroupskip} conditional (set with +\pkgopt{nogroupskip}) is moved outside of the definition of +\cs{glsgroupskip} to avoid problems that cause an \qt{Incomplete +\cs{iftrue}} error with \cs{printunsrtglossary} and +\cs{printnoidxglossary}. This means that if you want to change this +conditional using \cs{setupglossaries} or using the +\gloskey[printglossary]{nogroupskip} option in \cs{printglossary}, +\cs{printnoidxglossary} or \cs{printunsrtglossary}, you must also +reset the glossary style. + +As from version 1.21, the hard-coded \cs{space} before the +\gls{numberlist} in many of the predefined styles is replaced +with +\begin{definition}[\DescribeMacro\glsxtrprelocation] +\cs{glsxtrprelocation} +\end{definition} +This just defaults to \cs{space} but may be redefined as required. +For example: +\begin{verbatim} +\renewcommand{\glsxtrprelocation}{\dotfill} +\end{verbatim} + +The \glostyle{list} styles use +\begin{definition}[\DescribeMacro\glslistprelocation] +\cs{glslistprelocation} +\end{definition} +(which defaults to \cs{glsxtrprelocation}) for top-level items and +\begin{definition}[\DescribeMacro\glslistchildprelocation] +\cs{glslistchildprelocation} +\end{definition} +(which defaults to \cs{glslistprelocation}) for child items. + +As from v1.31, the description (including the post-description hook) +is governed by: +\begin{definition}[\DescribeMacro\glslistdesc] +\cs{glslistdesc}\marg{label} +\end{definition} +for the \glostyle{list} and \glostyle{altlist} styles (but not the +\glostyle{listdotted} variations). + +For just the \glostyle{list} style and its letter group variations +(not the \glostyle{altlist} or \glostyle{listdotted} variations) the +\gls{numberlist} for child entries is followed by +\begin{definition}[\DescribeMacro\glslistchildpostlocation] +\cs{glslistchildpostlocation} +\end{definition} +which defaults to a full stop. + +The default value of \ics{glslistdottedwidth} is changed so that +it's set at the start of the document (if it hasn't been changed in +the preamble). This should take into account situations where +\cs{hsize} isn't set until the start of the document. + +The separator between groups (if not \pkgopt{nogroupskip}) is now +given by: +\begin{definition}[\DescribeMacro\glslistgroupskip] +\cs{glslistgroupskip} +\end{definition} +This defaults to \cs{indexspace} with penalties to deter page +breaks. +This command isn't used if \pkgopt{nogroupskip} is set. + +The \sty{glossary-tree} package introduced two new commands in +\sty{glossaries} version 4.22, \ics{glstreegroupheaderfmt} +and \ics{glstreenavigationfmt}, which are used to format +the letter group headings and the navigation elements for the +appropriate styles. These two new commands are defined in terms of +\ics{glstreenamefmt} since that was the command originally used +for the group headings and navigation. This now allows these +different elements to be defined independently, but the most common +redefinition is for \cs{glstreenamefmt} to remove the bold in the +name. If the bold is still required for the group heading and navigation +elements, then both other commands also need redefining. To simplify +matters, if \cs{glstreenamefmt} has been defined, as from v1.31 +\sty{glossaries-extra-stylemods} defines: +\begin{definition}[\DescribeMacro\glstreedefaultnamefmt] +\cs{glstreedefaultnamefmt}\marg{text} +\end{definition} +which simply does \cs{textbf}\marg{text} and redefines +\cs{glstreenamefmt}, \cs{glstreegroupheaderfmt} and +\cs{glstreenavigationfmt} all in terms of +\cs{glstreedefaultnamefmt}. This means that if you want to change +all three to use a particular style you only need to redefine +\cs{glstreedefaultnamefmt}, but if you only want to redefine +\cs{glstreenamefmt} without affecting the other two commands, then +you now can. + +The separator between groups (if not \pkgopt{nogroupskip}) is now +given by: +\begin{definition}[\DescribeMacro\glstreegroupskip] +\cs{glstreegroupskip} +\end{definition} +This defaults to \cs{indexspace} with penalties to deter page +breaks. +This command isn't used if \pkgopt{nogroupskip} is set (except for +the styles that display the group titles). + +The styles that display the group titles now use: +\begin{definition}[\DescribeMacro\glstreePreHeader] +\cs{glstreePreHeader}\marg{label}\marg{title} +\end{definition} +where \meta{label} is the group label and \meta{title} is the group +title. This does nothing by default +and is inserted before the group title. You can redefine it to add +the group title to the PDF bookmarks. For example, if the +glossary title uses \cs{chapter} then: +\begin{verbatim} +\renewcommand{\glstreePreHeader}[2]{% + \pdfbookmark[1]{#2}{\currentglossary.#1}% +} +\end{verbatim} +will insert section-level bookmarks. The use of \cs{currentglossary} +helps to provide unique bookmark labels in the event of multiple +glossaries. + +The \glostyle{index}-like and \glostyle{tree}-like styles +insert the pre-\gls{numberlist} space with +\begin{definition}[\DescribeMacro\glstreeprelocation] +\cs{glstreeprelocation} +\end{definition} +(which defaults to \cs{glsxtrprelocation}) for top-level items and +\begin{definition}[\DescribeMacro\glstreechildprelocation] +\cs{glstreechildprelocation} +\end{definition} +(which defaults to \cs{glstreeprelocation}) for child items. + +As from version 1.31, the \styfmt{glossaries-extra-stylemods} +package also provides: +\begin{definition}[\DescribeMacro\glstreenonamedesc] +\cs{glstreenonamedesc}\marg{label} +\end{definition} +which is used by the \glostyle{treenoname} styles to display the +pre-description separator, the description and the post-description +hook. Similarly for the symbol: +\begin{definition}[\DescribeMacro\glstreenonamesymbol] +\cs{glstreenonamesymbol}\marg{label} +\end{definition} +The above are just used for top-level entries. Child entries don't +have the name or symbol displayed for the \glostyle{treenoname} +styles, so there's only a command for the child description: +\begin{definition}[\DescribeMacro\glstreenonamechilddesc] +\cs{glstreenonamechilddesc}\marg{label} +\end{definition} + +For the \glostyle{tree} styles (but not the \glostyle{treenoname} or +\glostyle{alttree} styles), the description is displayed using: +\begin{definition}[\DescribeMacro\glstreedesc] +\cs{glstreedesc}\marg{label} +\end{definition} +and the symbol with: +\begin{definition}[\DescribeMacro\glstreesymbol] +\cs{glstreesymbol}\marg{label} +\end{definition} +Again the above two commands are just for top-level entries. The +child entries use: +\begin{definition}[\DescribeMacro\glstreechilddesc] +\cs{glstreechilddesc}\marg{label} +\end{definition} +for the description and +\begin{definition}[\DescribeMacro\glstreechildsymbol] +\cs{glstreechildsymbol}\marg{label} +\end{definition} +for the symbol. + +As from version 1.41, there are now wrapper commands for +\cs{glstreedesc} and \cs{glstreechilddesc} that check for +the description and symbol to determine whether or not to insert a +space (\cs{glstreeprelocation} or \cs{glstreechildprelocation}) +before the page list. These are: +\begin{definition}[\DescribeMacro\glstreeDescLoc] +\cs{glstreeDescLoc}\marg{label}\marg{location} +\end{definition} +for top-level entries and +\begin{definition}[\DescribeMacro\glstreeChildDescLoc] +\cs{glstreeChildDescLoc}\marg{label}\marg{location} +\end{definition} +for sub-entries. This prevents a spurious space for terms that don't +have a symbol or description but do have a location list (for +example, aliases). + +As from version 1.05, the \styfmt{glossaries-extra-stylemods} +package provides some additional commands for use with the +\glostyle{alttree} style to make it easier to modify. +These commands are only defined if the +\sty{glossary-tree} package has already been loaded, which is +typically the case unless the \pkgopt{notree} option has been used +when loading \styfmt{glossaries}. + +\begin{definition}[\DescribeMacro\gglssetwidest] +\cs{gglssetwidest}\oarg{level}\marg{name} +\end{definition} +(New to version 1.21.) +This is like \cs{glssetwidest} (provided by \sty{glossary-tree}) +but performs a global assignment. + +\begin{definition}[\DescribeMacro\eglssetwidest] +\cs{eglssetwidest}\oarg{level}\marg{name} +\end{definition} +This is like \cs{glssetwidest} +but performs a protected expansion on \meta{name}. This has +a localised effect. For a global setting, use +\begin{definition}[\DescribeMacro\xglssetwidest] +\cs{xglssetwidest}\oarg{level}\marg{name} +\end{definition} +The following only set the value if \meta{name} is wider than the +current value (new to version 1.23). Local update: +\begin{definition}[\DescribeMacro\glsupdatewidest] +\cs{glsupdatewidest}\oarg{level}\marg{name} +\end{definition} +Global update: +\begin{definition}[\DescribeMacro\gglsupdatewidest] +\cs{gglsupdatewidest}\oarg{level}\marg{name} +\end{definition} +Locale update (expands \meta{name}): +\begin{definition}[\DescribeMacro\eglsupdatewidest] +\cs{eglsupdatewidest}\oarg{level}\marg{name} +\end{definition} +Global update (expands \meta{name}): +\begin{definition}[\DescribeMacro\xglsupdatewidest] +\cs{xglsupdatewidest}\oarg{level}\marg{name} +\end{definition} + + +The widest entry value can later be retrieved using +\begin{definition}[\DescribeMacro\glsgetwidestname] +\cs{glsgetwidestname} +\end{definition} +for the top-level entries and +\begin{definition}[\DescribeMacro\glsgetwidestsubname] +\cs{glsgetwidestsubname}\marg{level} +\end{definition} +for sub-entries, where \meta{level} is the level number. + +Note that if you are using \gls{bib2gls}, you can use the +resource option \texttt{set-widest} which will try to determine the +widest name of all the selected entries. This isn't guaranteed +to work as it may depend on fonts or commands that \gls{bib2gls} +can't replicate, but it should be suitable for names that just +consist of text, and can be more efficient than iterating over all +the defined entries using \TeX. + +The command \cs{glsfindwidesttoplevelname} provided by +\sty{glossary-tree} has a CamelCase synonym: +\begin{definition}[\DescribeMacro\glsFindWidestTopLevelName] +\cs{glsFindWidestTopLevelName}\oarg{glossary list} +\end{definition} +Similar commands are also provided: +\begin{definition}[\DescribeMacro\glsFindWidestUsedTopLevelName] +\cs{glsFindWidestUsedTopLevelName}\oarg{glossary list} +\end{definition} +This has an additional check that the entry has been used. +Naturally this is only useful if the glossaries that use +the \glostyle{alttree} style occur at the end of the document. +This command should be placed just before the start of the glossary. +(Alternatively, place it at the end of the document and save +the value in the auxiliary file for the next run.) + +\begin{definition}[\DescribeMacro\glsFindWidestUsedAnyName] +\cs{glsFindWidestUsedAnyName}\oarg{glossary list} +\end{definition} +This is like the previous command but if doesn't check the +\gloskey{parent} key. This is useful if all levels should have the +same width for the name. + +\begin{definition}[\DescribeMacro\glsFindWidestAnyName] +\cs{glsFindWidestAnyName}\oarg{glossary list} +\end{definition} +This is like the previous command but doesn't check if the entry +has been used. + +\begin{definition}[\DescribeMacro\glsFindWidestUsedLevelTwo] +\cs{glsFindWidestUsedLevelTwo}\oarg{glossary list} +\end{definition} +This is like \cs{glsFindWidestUsedTopLevelName} but also sets +the first two sub-levels as well. Any entry that has a +great-grandparent is ignored. + +\begin{definition}[\DescribeMacro\glsFindWidestLevelTwo] +\cs{glsFindWidestLevelTwo}\oarg{glossary list} +\end{definition} +This is like the previous command but doesn't check if the entry has +been used. + +\begin{definition}[\DescribeMacro\glsFindWidestUsedAnyNameSymbol] +\cs{glsFindWidestUsedAnyNameSymbol}\oarg{glossary +list}\marg{register} +\end{definition} +This is like \cs{glsFindWidestUsedAnyName} but also measures the +symbol. The length of the widest symbol is stored in +\meta{register}. + +\begin{definition}[\DescribeMacro\glsFindWidestAnyNameSymbol] +\cs{glsFindWidestAnyNameSymbol}\oarg{glossary list}\marg{register} +\end{definition} +This is like the previous command but it doesn't check if the entry +has been used. + +\begin{definition}[\DescribeMacro\glsFindWidestUsedAnyNameSymbolLocation] +\cs{glsFindWidestUsedAnyNameSymbolLocation}\oarg{glossary +list}\marg{symbol register}\marg{location register} +\end{definition} +This is like \cs{glsFindWidestUsedAnyNameSymbol} but also +measures the \gls{numberlist}. This requires +\ics{glsentrynumberlist} (see the \styfmt{glossaries} user manual). +The length of the widest symbol is stored in \meta{symbol register} +and the length of the widest \gls*{numberlist} is stored in +\meta{location register}. + +\begin{definition}[\DescribeMacro\glsFindWidestAnyNameSymbolLocation] +\cs{glsFindWidestAnyNameSymbolLocation}\oarg{glossary +list}\marg{symbol register}\marg{location register} +\end{definition} +This is like the previous command but it doesn't check if the entry +has been used. + +\begin{definition}[\DescribeMacro\glsFindWidestUsedAnyNameLocation] +\cs{glsFindWidestUsedAnyNameLocation}\oarg{glossary +list}\marg{register} +\end{definition} +This is like \cs{glsFindWidestUsedAnyNameSymbolLocation} but doesn't +measure the symbol. The length of the widest \gls{numberlist} +is stored in \meta{register}. + +\begin{definition}[\DescribeMacro\glsFindWidestAnyNameLocation] +\cs{glsFindWidestAnyNameLocation}\oarg{glossary +list}\marg{register} +\end{definition} +This is like the previous command but doesn't check if the entry has +been used. + +The layout of the symbol, description and \gls{numberlist} +is governed by +\begin{definition}[\DescribeMacro\glsxtralttreeSymbolDescLocation] +\cs{glsxtralttreeSymbolDescLocation}\marg{label}\marg{number list} +\end{definition} +for top-level entries and +\begin{definition}[\DescribeMacro\glsxtralttreeSubSymbolDescLocation] +\cs{glsxtralttreeSubSymbolDescLocation}\marg{label}\marg{number list} +\end{definition} +for sub-entries. + +There is now a user level command that performs the initialisation +for the \glostyle{alttree} style: +\begin{definition}[\DescribeMacro\glsxtralttreeInit] +\cs{glsxtralttreeInit} +\end{definition} + +The paragraph indent for subsequent paragraphs in multi-paragraph +descriptions is provided by the length +\begin{definition}[\DescribeMacro\glsxtrAltTreeIndent] +\cs{glsxtrAltTreeIndent} +\end{definition} + +For additional commands that are available with the +\glostyle{alttree} style, see the documented code +(\texttt{glossaries-extra-code.pdf}). For examples, see +the accompanying sample files \texttt{sample-alttree.tex}, +\texttt{sample-alttree-sym.tex} and +\texttt{sample-alttree-marginpar.tex}. + +\chapter{Abbreviations} +\label{sec:abbreviations} + +The new abbreviation system provided by \styfmt{glossaries-extra} +is more flexible than the acronym handling provided by the +base \styfmt{glossaries} package. The \styfmt{glossaries-extra} +package modifies the underlying formatting used by +\cs{gls} (and its variants) so that terms that are recognised as +abbreviations can have their formatting dealt with by the style. You +therefore need to select an abbreviation style that ensures that +\cs{gls} (and its variants) displays the desired output. + +\begin{important} +Don't use commands like \cs{glstext} or \cs{glsfirst} with +abbreviations as they aren't flexible enough to handle some +abbreviation styles and unexpected results may occur. Use commands +like \cs{glsfmtshort} or \cs{glsfmtlong} in section headings or +captions instead of \cs{gls}. If you don't want the full form to +show on first use of \cs{gls} use one of the \qt{nolong} or +\qt{noshort} styles. +\end{important} + +Abbreviations include acronyms (words formed from initial letters, +such as \qt{laser}), +initialisms (initial letters of a phrase, such as \qt{html}, that +aren't pronounced as words) and contractions (where +parts of words are omitted, often replaced by an apostrophe, such as +\qt{don't}). +The \qt{acronym} code provided by the \styfmt{glossaries} package is +misnamed as it's more often than not used for initialisms instead. +Acronyms tend not to be \emph{expanded} on \gls{firstuse} (although they may +need to be \emph{described} for readers unfamiliar with the term). They are therefore more like a regular term, +which may or may not require a description in the glossary. + +The \styfmt{glossaries-extra} package corrects this misnomer, and +provides better abbreviation handling, with +\begin{definition}[\DescribeMacro\newabbreviation] +\cs{newabbreviation}\oarg{options}\marg{label}\marg{short}\marg{long} +\end{definition} + +This sets the \gloskey{category} key to \texttt{abbreviation} by +default, but that value may be overridden in \meta{options}. +The category may have attributes that modify the way abbreviations +are defined. For example, the \catattr{insertdots} attribute will +automatically insert full stops (periods) into \meta{short} or the +\catattr{noshortplural} attribute will set the default value +of the \gloskey{shortplural} key to just \meta{short} (without +appending the plural suffix). See \sectionref{sec:categories} for +further details. + +See \sectionref{sec:nested} regarding the pitfalls of using +commands like \ics{gls} or \ics{glsxtrshort} within +\meta{short} or \meta{long}. + +\begin{important} +Make sure that you set the category attributes before defining new +abbreviations or they may not be correctly applied. +\end{important} + +The \ics{newacronym} command provided by the \styfmt{glossaries} +package is redefined by \styfmt{glossaries-extra} to use +\cs{newabbreviation} with the \gloskey{category} set to +\texttt{acronym} (see also \sectionref{sec:acronymmods}) so +\begin{definition}[\DescribeMacro\newacronym] +\cs{newacronym}\oarg{options}\marg{label}\marg{short}\marg{long} +\end{definition} +is now equivalent to +\begin{display}\raggedright\ttfamily +\cs{newabbreviation}[type=\cs{acronymtype},category=acronym,\meta{options}]\marg{label}\marg{short}\marg{long} +\end{display} + +\begin{sloppypar} +The \cs{newabbreviation} command is superficially similar to the +\styfmt{glossaries} package's \cs{newacronym} but you can apply +different styles to different categories. The default style is +\abbrstyle{short-nolong} for entries in the \category{acronym} category and +\abbrstyle{short-long} for entries in the \category{abbreviation} +category. (These aren't the same as the acronym styles provided by +the \styfmt{glossaries} package, although they may produce similar +results.) +\end{sloppypar} + +The way the abbreviations are displayed by commands like \cs{gls} +varies according to the abbreviation style. The styles are set +according to the entry's category so, unlike the base +\styfmt{glossaries} package, you can have different abbreviation +styles within the same glossary. + +There are two types of full forms. The display full form, which is +used on \gls{firstuse} by commands like \ics{gls} and the inline full +form, which is used by commands like \ics{glsxtrfull}. +For some of the abbreviation styles, such as \abbrstyle{long-short}, the display and inline forms +are the same. In the case of styles such as \abbrstyle{short-nolong} or +\abbrstyle{short-footnote}, the display and inline full forms are different. + +These formatting commands aren't stored in the \gloskey{short}, +\gloskey{shortplural}, \gloskey{long} or \gloskey{longplural} +fields, which means they won't be used within commands like +\cs{glsentryshort} (but they are used within commands like +\cs{glsxtrshort} and \cs{glsfmtshort}). +Note that \ics{glsxtrlong} and the case-changing variants don't use +\cs{glsfirstlongfont}. + +You can apply the formatting command used for the short form +to some arbitrary text using +\begin{definition}[\DescribeMacro\glsuseabbrvfont] +\cs{glsuseabbrvfont}\marg{text}\marg{category} +\end{definition} +where \meta{category} is the category label that identifies +the abbreviation style. Similarly for the formatting command +use by the long form: +\begin{definition}[\DescribeMacro\glsuselongfont] +\cs{glsuselongfont}\marg{text}\marg{category} +\end{definition} + +\section{Tagging Initials} +\label{sec:tagging} + +If you would like to tag the initial letters in the long form +such that those letters are underlined in the glossary but +not in the main part of the document, you can use +\begin{definition}[\DescribeMacro\GlsXtrEnableInitialTagging] +\cs{GlsXtrEnableInitialTagging}\marg{categories}\marg{cs} +\end{definition} +before you define your abbreviations. + +This command (robustly) defines \meta{cs} (a control sequence) +to accept a single argument, which is the letter (or letters) +that needs to be tagged. The normal behaviour of this command +within the document is to simply do its argument, but in the +glossary it's activated for those categories that have +the \catattr{tagging} attribute set to \qt{true}. For those +cases it will use +\begin{definition}[\DescribeMacro\glsxtrtagfont] +\cs{glsxtrtagfont}\marg{text} +\end{definition} +This command defaults to \ics{underline}\marg{text} +but may be redefined as required. + +The control sequence \meta{cs} can't already be defined when +used with the unstarred version of +\cs{GlsXtrEnableInitialTagging} for safety reasons. +The starred version will overwrite any previous definition +of \meta{cs}. As with redefining any commands, ensure that +you don't redefine something important. In fact, just forget +the existence of the starred version and let's pretend I didn't +mention it. + +The first argument of \cs{GlsXtrEnableInitialTagging} is a +comma-separated list of category names. The \catattr{tagging} +attribute will automatically be set for those categories. +You can later set this attribute for other categories (see +\sectionref{sec:categories}) but this must be done before the +glossary is displayed. + +The accompanying sample file \texttt{sample-mixtures.tex} +uses initial tagging for both the \category{acronym} and +\category{abbreviation} categories: +\begin{verbatim} +\GlsXtrEnableInitialTagging{acronym,abbreviation}{\itag} +\end{verbatim} +This defines the command \cs{itag} which can be used in the +definitions. For example: +\begin{verbatim} +\newacronym + [description={a system for detecting the location and + speed of ships, aircraft, etc, through the use of radio + waves}% description of this term + ] + {radar}% identifying label + {radar}% short form (i.e. the word) + {\itag{ra}dio \itag{d}etection \itag{a}nd \itag{r}anging} + +\newabbreviation{xml}{XML} + {e\itag{x}tensible \itag{m}arkup \itag{l}anguage} +\end{verbatim} +The underlining of the tagged letters only occurs in the +glossary and then only for entries with the \catattr{tagging} +attribute set. + +\section{Abbreviation Styles} +\label{sec:abbrstyle} + +The abbreviation style must be set before abbreviations are defined +using: +\begin{definition}[\DescribeMacro\setabbreviationstyle] +\cs{setabbreviationstyle}\oarg{category}\marg{style-name} +\end{definition} +where \meta{style-name} is the name of the style and \meta{category} +is the category label (\texttt{abbreviation} by default). New +abbreviations will pick up the current style according to their +given category. If there is no style set for the category, the +fallback is the style for the \texttt{abbreviation} category. +Some styles may automatically modify one or more of the attributes +associated with the given category. For example, the +\abbrstyle{long-noshort} and \abbrstyle{short-nolong} styles set the +\catattr{regular} attribute to \texttt{true}. + +\begin{important} +If you want to apply different styles to groups of abbreviations, +assign a different category to each group and set the style for the +given category. +\end{important} + +Note that \ics{setacronymstyle} is disabled by +\styfmt{glossaries-extra}. Use +\begin{alltt} +\cs{setabbreviationstyle}[acronym]\marg{style-name} +\end{alltt} +instead. The original acronym interface can be restored with +\ics{RestoreAcronyms} (see \sectionref{sec:acronymmods}). However the +original acronym interface is incompatible with all the commands +described here. + +Abbreviations can be used with the standard \styfmt{glossaries} +commands, such as \ics{gls}, but don't use the acronym commands +like \ics{acrshort} (which use \ics{acronymfont}). The short form can be +produced with: +\begin{definition}[\DescribeMacro\glsxtrshort] +\cs{glsxtrshort}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +(Use this instead of \ics{acrshort}.) + +The long form can be produced with +\begin{definition}[\DescribeMacro\glsxtrlong] +\cs{glsxtrlong}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +(Use this instead of \ics{acrlong}.) + +The \emph{inline} full form can be produced with +\begin{definition}[\DescribeMacro\glsxtrfull] +\cs{glsxtrfull}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +(This this instead of \ics{acrfull}.) + +\begin{important} +In general, it's best not to use commands like \ics{glsfirst} +for abbreviations, especially if you use the \meta{insert} +optional argument. Use either \cs{gls} (possibly with a reset) +or \cs{glsxtrfull}. +\end{important} + +As mentioned earlier, the inline full form may not necessarily match the format used on +\gls{firstuse} with \cs{gls}. For example, the +\abbrstyle{short-nolong} style +only displays the short form on \gls{firstuse}, but the full +form will display the long form followed by the short form in +parentheses. + +\begin{important} +If you want to use an abbreviation in a chapter or section +title, use the commands described in \sectionref{sec:headtitle} +instead. +\end{important} + +The arguments \meta{options}, \meta{label} and \meta{insert} are the +same as for commands such as \cs{glstext}. There are also analogous +case-changing commands: + +First letter upper case short form: +\begin{definition}[\DescribeMacro\Glsxtrshort] +\cs{Glsxtrshort}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +First letter upper case long form: +\begin{definition}[\DescribeMacro\Glsxtrlong] +\cs{Glsxtrlong}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +First letter upper case inline full form: +\begin{definition}[\DescribeMacro\Glsxtrfull] +\cs{Glsxtrfull}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +All upper case short form: +\begin{definition}[\DescribeMacro\Glsxtrshort] +\cs{GLSxtrshort}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +All upper case long form: +\begin{definition}[\DescribeMacro\Glsxtrlong] +\cs{GLSxtrlong}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +All upper case inline full form: +\begin{definition}[\DescribeMacro\GLSxtrfull] +\cs{GLSxtrfull}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +Plural forms are also available. + +Short form plurals: +\begin{definition}[\DescribeMacro\glsxtrshortpl] +\cs{glsxtrshortpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\Glsxtrshortpl] +\cs{Glsxtrshortpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\GLSxtrshortpl] +\cs{GLSxtrshortpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +Long form plurals: +\begin{definition}[\DescribeMacro\glsxtrlongpl] +\cs{glsxtrlongpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\Glsxtrlongpl] +\cs{Glsxtrlongpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\GLSxtrlongpl] +\cs{GLSxtrlongpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +Full form plurals: +\begin{definition}[\DescribeMacro\glsxtrfullpl] +\cs{glsxtrfullpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\Glsxtrfullpl] +\cs{Glsxtrfullpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\GLSxtrfullpl] +\cs{GLSxtrfullpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +\begin{important} +Be careful about using \cs{glsentryfull}, \cs{Glsentryfull}, +\cs{glsentryfullpl} and \cs{Glsentryfullpl}. These commands will use +the currently applied style rather than the style in use when the +entry was defined. If you have mixed styles, you'll need to use +\ics{glsxtrfull} instead. Similarly for \cs{glsentryshort} etc. +\end{important} + +\section{Shortcut Commands} +\label{sec:abbrshortcuts} + +The abbreviation shortcut commands can be enabled using +the package option \pkgopt[abbreviation]{shortcuts} +(or \pkgopt[abbr]{shortcuts}) or \pkgopt[ac]{shortcuts}. +(You can use both settings at the same time.) +The provided shortcut commands listed in +\tableref{tab:abbrshortcuts}. + +\begin{table}[htbp] +\caption{Abbreviation Shortcut Commands} +\label{tab:abbrshortcuts} +\centering +\begin{tabular}{lll} +\bfseries Shortcut & +\bfseries Shortcut & +\bfseries Equivalent Command\\ +\bfseries (\pkgopt[abbreviation]{shortcuts}) & +\bfseries (\pkgopt[ac]{shortcuts})\\ +\ics{ab} & \ics{ac} & \ics{cgls}\\ +\ics{abp} & \ics{acp} & \ics{cglspl}\\ +\ics{as} & \ics{acs} & \ics{glsxtrshort}\\ +\ics{asp} & \ics{acsp} & \ics{glsxtrshortpl}\\ +\ics{al} & \ics{acl} & \ics{glsxtrlong}\\ +\ics{alp} & \ics{aclp} & \ics{glsxtrlongpl}\\ +\ics{af} & \ics{acf} & \ics{glsxtrfull}\\ +\ics{afp} & \ics{acfp} & \ics{glsxtrfullpl}\\ +\ics{Ab} & \ics{Ac} & \ics{cgls}\\ +\ics{Abp} & \ics{Acp} & \ics{cglspl}\\ +\ics{As} & \ics{Acs} & \ics{Glsxtrshort}\\ +\ics{Asp} & \ics{Acsp} & \ics{Glsxtrshortpl}\\ +\ics{Al} & \ics{Acl} & \ics{Glsxtrlong}\\ +\ics{Alp} & \ics{Aclp} & \ics{Glsxtrlongpl}\\ +\ics{Af} & \ics{Acf} & \ics{Glsxtrfull}\\ +\ics{Afp} & \ics{Acfp} & \ics{Glsxtrfullpl}\\ +\ics{AB} & \ics{AC} & \ics{cGLS}\\ +\ics{ABP} & \ics{ACP} & \ics{cGLSpl}\\ +\ics{AS} & \ics{ACS} & \ics{GLSxtrshort}\\ +\ics{ASP} & \ics{ACSP} & \ics{GLSxtrshortpl}\\ +\ics{AL} & \ics{ACL} & \ics{GLSxtrlong}\\ +\ics{ALP} & \ics{ACLP} & \ics{GLSxtrlongpl}\\ +\ics{AF} & \ics{ACF} & \ics{GLSxtrfull}\\ +\ics{AFP} & \ics{ACFP} & \ics{GLSxtrfullpl}\\ +\ics{newabbr} & \ics{newabbr} & \ics{newabbreviation} +\end{tabular} +\end{table} + +\section{Predefined Abbreviation Styles} +\label{sec:predefabbrvstyles} + +There are two types of abbreviation styles: those that treat the +abbreviation as a regular entry (so that \ics{gls} uses +\ics{glsgenentryfmt}) and those that don't treat the abbreviation as +a regular entry (so that \ics{gls} uses \ics{glsxtrgenabbrvfmt}). + +The regular entry abbreviation styles set the \catattr{regular} +attribute to \qt{true} for the category assigned to each +abbreviation with that style. This means that on \gls{firstuse}, +\ics{gls} uses the value of the \gloskey{first} field and on +subsequent use \ics{gls} uses the value of the \gloskey{text} field +(and analogously for the plural and case-changing versions). The +\gloskey{short} and \gloskey{long} fields are set as appropriate +and may be accessed through commands like \ics{glsxtrshort}. + +The other abbreviation styles don't modify the \catattr{regular} +attribute. The \gloskey{first} and \gloskey{text} fields (and their +plural forms) are set and can be accessed through commands like +\cs{glsfirst}, but they aren't used by commands like \ics{gls}, +which instead use the short form (stored in the \gloskey{short} key) +and the display full format (through commands like +\ics{glsxtrfullformat} that are defined by the style). + +In both cases, the \gls{firstuse} of \ics{gls} may not match the +text produced by \ics{glsfirst} (and likewise for the plural +and case-changing versions). + +The sample file \texttt{sample-abbr-styles.tex} demonstrates all +predefined styles described here. + +\begin{important} +For the \qt{sc} styles that use \ics{textsc}, be careful about your choice +of fonts as some only have limited support. For +example, you may not be able to combine bold and small-caps. I +recommend that you at least use the \sty{fontenc} package with the +\pkgoptfmt{T1} option or something similar. +\end{important} + +The parenthetical styles, such as \abbrstyle{long-short}, +use +\begin{definition}[\DescribeMacro\glsxtrparen] +\cs{glsxtrparen}\marg{text} +\end{definition} +to set the parenthetical material. This just puts parentheses around +the text: (\meta{text}). + +The basic abbreviation styles, such as \abbrstyle{long-short} +and \abbrstyle{short-long} use +\begin{definition}[\DescribeMacro\glsabbrvdefaultfont] +\cs{glsabbrvdefaultfont}\marg{text} +\end{definition} +for the short form. This just does \meta{text} by default. +(That is, no font change is applied.) On first use, +\begin{definition}[\DescribeMacro\glsfirstabbrvdefaultfont] +\cs{glsfirstabbrvdefaultfont}\marg{text} +\end{definition} +is used instead. By default, this just does +\cs{glsabbrvdefaultfont}. The long form is formatted according to +\begin{definition}[\DescribeMacro\glslongdefaultfont] +\cs{glslongdefaultfont}\marg{text} +\end{definition} +which again just does \meta{text} (no font change). On first use, +\begin{definition}[\DescribeMacro\glsfirstlongdefaultfont] +\cs{glsfirstlongdefaultfont}\marg{text} +\end{definition} +is used instead. This just does \cs{glslongdefaultfont}. +The plural suffix used for the short form is given by +\begin{definition}[\DescribeMacro\glsxtrabbrvpluralsuffix] +\cs{glsxtrabbrvpluralsuffix} +\end{definition} +which defaults to \ics{glspluralsuffix}. + +The small-cap styles, such as \abbrstyle{long-short-sc} +and \abbrstyle{short-sc-long}, use +\begin{definition}[\DescribeMacro\glsabbrvscfont] +\cs{glsabbrvscfont}\marg{text} +\end{definition} +which uses \cs{textsc}.\footnote{For compatibility with earlier +versions, \cs{glsabbrvscfont} is defined to \cs{glsxtrscfont}, +which is defined to use \cs{textsc}. Direct use of +\cs{glsxtrscfont} is now deprecated. Likewise for similar commands.} +On first use +\begin{definition}[\DescribeMacro\glsabbrvdefaultfont] +\cs{glsfirstabbrvscfont}\marg{text} +\end{definition} +is used instead. This uses \cs{glsabbrvscfont} by default. +So redefine, \cs{glsabbrvscfont} to change first and subsequent uses or +\cs{glsfirstabbrvscfont} to change just the first use. + +The long form for the small-cap styles uses \cs{glslongdefaultfont} +or \cs{glsfirstlongdefaultfont}, as with the basic style. +The suffix is given by +\begin{definition}[\DescribeMacro\glsxtrscsuffix] +\cs{glsxtrscsuffix} +\end{definition} +This is defined as +\begin{verbatim} +\newcommand*{\glsxtrscsuffix}{\glstextup{\glsxtrabbrvpluralsuffix}} +\end{verbatim} +The \ics{glstextup} command is provided by \styfmt{glossaries} +and is used to switch off the small caps font for the suffix. +If you override the default short plural using the +\gloskey{shortplural} key when you define the abbreviation +you will need to make the appropriate adjustment if necessary. +(Remember that the default plural suffix behaviour can be modified +through the use of the \catattr{aposplural} and +\catattr{noshortplural} attributes. See +\sectionref{sec:categories} for further details.) + +The small styles, such as \abbrstyle{long-short-sm} +and \abbrstyle{short-sm-long}, use +\begin{definition}[\DescribeMacro\glsabbrvsmfont] +\cs{glsabbrvsmfont}\marg{text} +\end{definition} +which uses \cs{textsmaller}. (This requires the \sty{relsizes} +package, which isn't loaded by \styfmt{glossaries-extra}, so must be +loaded explicitly.) +On first use +\begin{definition}[\DescribeMacro\glsfirstabbrvsmfont] +\cs{glsfirstabbrvsmfont}\marg{text} +\end{definition} +is used instead. This uses \cs{glsabbrvsmfont} by default. + +The long form for the smaller styles uses \cs{glslongdefaultfont} +or \cs{glsfirstlongdefaultfont}, as with the basic style. +The suffix is given by +\begin{definition}[\DescribeMacro\glsxtrsmsuffix] +\cs{glsxtrsmsuffix} +\end{definition} +which defaults to just \cs{glsxtrabbrvpluralsuffix}. + +The \qt{short-em} (emphasize short) styles, such as +\abbrstyle{long-short-em} or \abbrstyle{short-em-long}, use +\begin{definition}[\DescribeMacro\glsabbrvemfont] +\cs{glsabbrvemfont}\marg{text} +\end{definition} +On first use +\begin{definition}[\DescribeMacro\glsfirstabbrvemfont] +\cs{glsfirstabbrvemfont}\marg{text} +\end{definition} +is used instead. This uses \cs{glsabbrvemfont} by default. +The suffix is given by +\begin{definition}[\DescribeMacro\glsxtremsuffix] +\cs{glsxtremsuffix} +\end{definition} +which defaults to just \cs{glsxtrabbrvpluralsuffix}. +The long form is as for the basic style unless the style +is a \qt{long-em} style. + +The \qt{long-em} (emphasize long) styles, such as +\abbrstyle{long-em-short-em} or \abbrstyle{short-em-long-em}, use +\begin{definition}[\DescribeMacro\glsfirstlongemfont] +\cs{glsfirstlongemfont}\marg{long-form} +\end{definition} +instead of \cs{glsfirstlongdefaultfont}\marg{long-form} and +\begin{definition}[\DescribeMacro\glslongemfont] +\cs{glslongemfont}\marg{long-form} +\end{definition} +instead of \cs{glslongdefaultfont}\marg{long-form}. The first form +\cs{glsfirstlongemfont} is initialised to use \cs{glslongemfont}. + +The user styles have similar commands: +\begin{definition}[\DescribeMacro\glsabbrvuserfont] +\cs{glsabbrvuserfont}\marg{text} +\end{definition} +for the short form, +\begin{definition}[\DescribeMacro\glsfirstabbrvuserfont] +\cs{glsfirstabbrvuserfont}\marg{text} +\end{definition} +for the first use short form, +\begin{definition}[\DescribeMacro\glslonguserfont] +\cs{glslonguserfont}\marg{text} +\end{definition} +for the long form, +\begin{definition}[\DescribeMacro\glsfirstlonguserfont] +\cs{glsfirstlonguserfont}\marg{text} +\end{definition} +for the first use long form, and +\begin{definition}[\DescribeMacro\glsxtrusersuffix] +\cs{glsxtrusersuffix} +\end{definition} +for the short plural suffix. + +Similarly for the hyphen styles: +\begin{definition}[\DescribeMacro\glsabbrvhyphenfont] +\cs{glsabbrvhyphenfont}\marg{text} +\end{definition} +for the short form, +\begin{definition}[\DescribeMacro\glsfirstabbrvhyphenfont] +\cs{glsfirstabbrvhyphenfont}\marg{text} +\end{definition} +for the first use short form, +\begin{definition}[\DescribeMacro\glslonghyphenfont] +\cs{glslonghyphenfont}\marg{text} +\end{definition} +for the long form, +\begin{definition}[\DescribeMacro\glsfirstlonghyphenfont] +\cs{glsfirstlonghyphenfont}\marg{text} +\end{definition} +for the first use long form, and +\begin{definition}[\DescribeMacro\glsxtrhyphensuffix] +\cs{glsxtrhyphensuffix} +\end{definition} +for the short plural suffix. + +Similarly for the \qt{only} styles, such as +\abbrstyle{long-only-short-only}: +\begin{definition}[\DescribeMacro\glsabbrvonlyfont] +\cs{glsabbrvonlyfont}\marg{text} +\end{definition} +for the short form, +\begin{definition}[\DescribeMacro\glsfirstabbrvonlyfont] +\cs{glsfirstabbrvonlyfont}\marg{text} +\end{definition} +for the first use short form, +\begin{definition}[\DescribeMacro\glslongonlyfont] +\cs{glslongonlyfont}\marg{text} +\end{definition} +for the long form, +\begin{definition}[\DescribeMacro\glsfirstlongonlyfont] +\cs{glsfirstlongonlyfont}\marg{text} +\end{definition} +for the first use long form, and +\begin{definition}[\DescribeMacro\glsxtronlysuffix] +\cs{glsxtronlysuffix} +\end{definition} +for the short plural suffix. + +Note that by default inserted material (provided in the final +optional argument of commands like \cs{gls}), is placed outside the +font command in the predefined styles. To move it inside, use: +\begin{definition}[\DescribeMacro\glsxtrinsertinsidetrue] +\cs{glsxtrinsertinsidetrue} +\end{definition} +This applies to all the predefined styles. For example: +\begin{verbatim} +\setabbreviationstyle{long-short} +\renewcommand*{\glsfirstlongdefaultfont}[1]{\emph{#1}} +\glsxtrinsertinsidetrue +\end{verbatim} +This will make the long form and the inserted text emphasized, +whereas the default (without \cs{glsxtrinsertinsidetrue}) would +place the inserted text outside of the emphasized font. + +Note that for some styles, such as the \abbrstyle{short-long}, the +inserted text would be placed inside the font command for the short +form (rather than the long form in the above example). + +Remember that \cs{textsc} renders \emph{lowercase} letters as small +capitals. Uppercase letters are rendered as normal uppercase +letters, so if you specify the short form in uppercase, you won't +get small capitals unless you redefine \cs{glsabbrvscfont} to +convert its argument to lowercase. For example: +\begin{verbatim} +\renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeLowercase{#1}}} +\end{verbatim} + +If you want to +easily switch between the \qt{sc} and \qt{sm} styles, you may find +it easier to redefine this command to convert case: +\begin{verbatim} +\renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeTextLowercase{#1}}} +\renewcommand*{\glsabbrvsmfont}[1]{\textsmaller{\MakeTextUppercase{#1}}} +\end{verbatim} + +Some of the styles use +\begin{definition}[\DescribeMacro\glsxtrfullsep] +\cs{glsxtrfullsep}\marg{label} +\end{definition} +as a separator between the long and short forms. This is defined as +a space by default, but may be changed as required. For example: +\begin{verbatim} +\renewcommand*{\glsxtrfullsep}[1]{~} +\end{verbatim} +or +\begin{verbatim} +\renewcommand*{\glsxtrfullsep}[1]{\glsacspace{#1}} +\end{verbatim} + +The new naming scheme for abbreviation styles is as follows: +\begin{itemize} +\item +\meta{field1}[\texttt{-}\meta{modifier1}]\texttt{-}[post]\meta{field2}[\texttt{-}\meta{modifier2}][\texttt{-user}] + +This is for the parenthetical styles. The \texttt{-}\meta{modifier} parts may +be omitted. These styles display \meta{field1} followed by +\meta{field2} in parentheses. If \meta{field1} or \meta{field2} starts +with \qt{no} then that element is omitted from the display style (no +parenthetical part) but is included in the inline style. + +If the \texttt{-}\meta{modifier} part is present, then the field has +a font changing command applied to it. The special modifier +\texttt{-only} indicates that field is only present according to +whether or not the entry has been used. + +If \texttt{post} is present then \meta{field2} is +placed after the \gls{linktext} using the post-link hook. + +If the \texttt{-user} part is present, then the \gloskey{user1} +value, if provided, is inserted into the parenthetical material . +(The field used for the inserted material may be changed.) + +Examples: + \begin{itemize} + \item\abbrstyle{long-noshort-sc}: \meta{field1} is the long +form, the short form is set in smallcaps but omitted in the display +style. + \item\abbrstyle{long-em-short-em}: both the long form and the +short form are emphasized. The short form is in parentheses. + \item\abbrstyle{long-short-em}: the +short form is emphasized but not the long form. The short form is in parentheses. + \item\abbrstyle{long-short-user}: if the \gloskey{user1} key has +been set, this produces the style \meta{long} (\meta{short}, +\meta{user1}) otherwise it just produces \meta{long} (\meta{short}). + + \item\abbrstyle{long-hyphen-postshort-hyphen}: the short +form and the inserted material (provided by the final optional +argument of commands like \cs{gls}) is moved to the post-link hook. +The long form is formatted according to \cs{glslonghyphenfont} +(or \cs{glsfirstlonghyphenfont} on first use). +The short form is formatted according to \cs{glsabbrvhyphenfont} +(or \cs{glsfirstabbrvhyphenfont} on first use). + \end{itemize} + +\item \meta{style}\texttt{-noreg} + +Some styles set the \catattr{regular} attribute. In some cases, +there's a version of the style that doesn't set this attribute. +For example, \abbrstyle{long-em-noshort-em} sets the +\catattr{regular} attribute. The +\abbrstyle{long-em-noshort-em-noreg} style is a minor variation +that style that doesn't set the attribute. + +There are a few \qt{noshort} styles, such as +\abbrstyle{long-hyphen-noshort-noreg}, that have +\qt{-noreg} version without a regular version. This is because the +style won't work properly with the \catattr{regular} set, but the +naming scheme is maintained for consistency with the other +\qt{noshort} styles. + +\item +\meta{field1}[\texttt{-}\meta{modifier1}]\texttt{-}[\texttt{post}]\texttt{footnote} + +The display style uses \meta{field1} followed by a footnote with the +other field in it. If \texttt{post} is present then the footnote is +placed after the \gls{linktext} using the post-link hook. +The inline style does \meta{field1} followed by the other field in +parentheses. + +If \texttt{-}\meta{modifier1} is present, \meta{field1} has a +font-changing command applied to it. + +Examples: +\begin{itemize} +\item \abbrstyle{short-footnote}: short form in the text with the +long form in the footnote. +\item \abbrstyle{short-sc-postfootnote}: short form in smallcaps +with the long form in the footnote outside of the \gls{linktext}. +\end{itemize} + +\begin{important} +Take care with the footnote styles. Remember that there are some +situations where \ics{footnote} doesn't work. +\end{important} + +\item \meta{style}\texttt{-desc} + +Like \meta{style} but the \gloskey{description} key must be provided +when defining abbreviations with this style. + +Examples: +\begin{itemize} + +\item \abbrstyle{short-long-desc}: like \abbrstyle{short-long} but +requires a description. +\item \abbrstyle{short-em-footnote-desc}: like +\abbrstyle{short-em-footnote} but requires a description. +\end{itemize} +\end{itemize} + +Not all combinations that fit the above syntax are provided. +Pre-version 1.04 styles that didn't fit this naming scheme are either +provided with a synonym (where the former name wasn't ambiguous) or +provided with a deprecated synonym (where the former name was +confusing). +The deprecated style names generate a warning using: +\begin{definition}[\DescribeMacro\GlsXtrWarnDeprecatedAbbrStyle] +\cs{GlsXtrWarnDeprecatedAbbrStyle}\marg{old-name}\marg{new-name} +\end{definition} +where \meta{old-name} is the deprecated name and \meta{new-name} is +the preferred name. You can suppress these warnings by redefining +this command to do nothing. + +\subsection{Predefined Abbreviation Styles that Set the Regular +Attribute} +\label{sec:predefregabbrvstyles} + +The following abbreviation styles set the \catattr{regular} +attribute to \qt{true} for all categories that have abbreviations +defined with any of these styles. + +\begin{description} +\item[\abbrstyledef{short-nolong}] +This only displays the short form on \gls{firstuse}. The \gloskey{name} +is set to the short form through the command +\begin{definition}[\DescribeMacro\glsxtrshortnolongname] +\cs{glsxtrshortnolongname} +\end{definition} +(Similarly for the other +\texttt{short}\meta{modifier}\texttt{-nolong}\meta{modifier} styles, +unless indicated otherwise.) +This command is expanded as the entry is defined, so any +redefinition must be done before \cs{newabbreviation} (or +\cs{newacronym}) for it to take effect. Make sure to \cs{protect} +any formatting commands (or anything else that shouldn't be expanded). + +The \gloskey{description} is set to the +long form. The inline full form displays +\meta{short} (\meta{long}). The long form on its own can be +displayed through commands like \ics{glsxtrlong}. + +\item[\abbrstyledef{short}] A synonym for \abbrstyle{short-nolong}. + +\item[\abbrstyledef{nolong-short}] Like \abbrstyle{short-nolong} +but the inline full form displays +\meta{long} (\meta{short}). + +\item[\abbrstyledef{short-sc-nolong}] +Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont} (which defaults to \cs{textsc}). + +\item[\abbrstyledef{short-sc}] A synonym for \abbrstyle{short-sc-nolong} + +\item[\abbrstyledef{nolong-short-sc}] Like \abbrstyle{short-sc-nolong} +but the inline full form displays +\meta{long} (\meta{short}). The name is still obtained from +\cs{glsxtrshortnolongname} (similarly for the other styles in the +form \texttt{nolong}\meta{modifier}\texttt{-short}\meta{modifier} +unless indicated otherwise). + +\item[\abbrstyledef{short-sm-nolong}] +Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont} (which defaults to \cs{textsmaller}). + +\item[\abbrstyledef{short-sm}] A synonym for \abbrstyle{short-sm-nolong}. + +\item[\abbrstyledef{nolong-short-sm}] Like \abbrstyle{short-sm-nolong} +but the inline full form displays +\meta{long} (\meta{short}). + +\item[\abbrstyledef{short-em-nolong}] +Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. + +\item[\abbrstyledef{short-em}] A synonym for \abbrstyle{short-em-nolong} + +\item[\abbrstyledef{nolong-short-em}] Like \abbrstyle{short-em-nolong} +but the inline full form displays +\meta{long} (\meta{short}). + +\item[\abbrstyledef{short-nolong-desc}] +Like the \abbrstyle{short-nolong} style, but the \gloskey{name} is set to +the full form obtained by expanding +\begin{definition}[\DescribeMacro\glsxtrshortdescname] +\cs{glsxtrshortdescname} +\end{definition} +(Similarly for the other +\texttt{short}\meta{modifier}\texttt{-nolong}\meta{modifier}\texttt{-desc} +styles, unless indicated otherwise.) This command is expanded when the entry is defined, so +\cs{protect} fragile and formatting commands and only redefine this +command before \cs{newabbreviation} (or \cs{newacronym}). + +The \gloskey{description} must be supplied by the +user. You may prefer to use the \abbrstyle{short-nolong} style with the +post-description hook set to display the long form and override +the \gloskey{description} key. (See the sample file +\texttt{sample-acronym-desc.tex}.) + +\item[\abbrstyledef{short-desc}] A synonym for +\abbrstyle{short-nolong-desc}. + +\item[\abbrstyledef{short-sc-nolong-desc}] +Like \abbrstyle{short-nolong} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont} (which defaults to \cs{textsc}). + +\item[\abbrstyledef{short-sc-desc}] A synonym for +\abbrstyle{short-sc-nolong-desc}. + +\item[\abbrstyledef{short-sm-nolong-desc}] +Like \abbrstyle{short-nolong-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont} (which defaults to \cs{textsmaller}). + +\item[\abbrstyledef{short-sm-desc}] A synonym for +\abbrstyle{short-sm-nolong-desc}. + +\item[\abbrstyledef{short-em-nolong-desc}] +Like \abbrstyle{short-nolong-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. + +\item[\abbrstyledef{short-em-desc}] A synonym for +\abbrstyle{short-em-nolong-desc}. + +\item[\abbrstyledef{long-noshort-desc}] +This style only displays the long form, regardless of first or +subsequent use of commands \ics{gls}. The short form may be +accessed through commands like \ics{glsxtrshort}. The inline full +form displays \meta{long} (\meta{short}). + +The \gloskey{sort} key are set to the long form. +The \gloskey{name} key is also set to the long form, but this is +done by expanding +\begin{definition}[\DescribeMacro\glsxtrlongnoshortdescname] +\cs{glsxtrlongnoshortdescname} +\end{definition} +(Similarly for the other +\texttt{long}\meta{modifier}\texttt{-noshort}\meta{modifier}\texttt{-desc} +styles, unless indicated otherwise.) This command should only be redefined before abbreviations +are defined, and any fragile or formatting commands within it need protecting. + +The \gloskey{description} must be provided by the user. The predefined +glossary styles won't display the short form. You can use the +post-description hook to automatically append the short form to the +description. The inline full form will display \meta{long} +(\meta{short}). + +\item[\abbrstyledef{long-desc}] A synonym for +\abbrstyle{long-noshort-desc}. + +\item[\abbrstyledef{long-noshort-sc-desc}] +Like the \abbrstyle{long-noshort-desc} style but the short form (accessed +through commands like \ics{glsxtrshort}) use \ics{glsabbrvscfont}. +(This style was originally called \depabbrstyle{long-desc-sc}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{long-noshort-sm-desc}] +Like \abbrstyle{long-noshort-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. +(This style was originally called \depabbrstyle{long-desc-sm}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{long-noshort-em-desc}] +Like \abbrstyle{long-noshort-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. The long form isn't emphasized. +(This style was originally called \depabbrstyle{long-desc-em}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{long-em-noshort-em-desc}] +New to version 1.04, like \abbrstyle{long-noshort-desc} but redefines +\cs{glsabbrvfont} to use \ics{glsabbrvemfont}. The long form uses +\ics{glsfirstlongemfont} and \ics{glslongemfont}. + +\item[\abbrstyledef{long-noshort}] +This style doesn't really make sense if you don't use the short +form anywhere in the document, but is provided for completeness. +This is like the \abbrstyle{long-noshort-desc} style, but +the \gloskey{sort} key is set to the short form. The \gloskey{name} +key is also set to the short form, but this is done by expanding +\begin{definition}[\DescribeMacro\glsxtrlongnoshortname] +\cs{glsxtrlongnoshortname} +\end{definition} +(Similarly for other +\texttt{long}\meta{modifier}\texttt{-noshort}\meta{modifier} styles, +unless indicated otherwise.) +This command should only be redefined before abbreviations are +defined, and fragile or formatting commands should be protected. + +The \gloskey{description} is set to the long form. + +\item[\abbrstyledef{long}] A synonym for \abbrstyle{long-noshort} + +\item[\abbrstyledef{long-noshort-sc}] +Like the \abbrstyle{long-noshort} style but the short form (accessed +through commands like \ics{glsxtrshort}) use \ics{glsabbrvscfont}. +(This style was originally called \depabbrstyle{long-sc}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{long-noshort-sm}] +Like \abbrstyle{long-noshort} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. +(This style was originally called \depabbrstyle{long-sm}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{long-noshort-em}] +This style is like \abbrstyle{long-noshort} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. The long form isn't emphasized. +(This style was originally called \depabbrstyle{long-em}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{long-em-noshort-em}] +New to version 1.04, this style is like \abbrstyle{long-noshort} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}, \cs{glsfirstlongfont} to use +\cs{glsfirstlongemfont} and \cs{glslongfont} to use +\cs{glslongemfont}. The short form isn't used by commands like +\ics{gls}, but can be obtained using \ics{glsxtrshort}. +The related style \abbrstyledef{long-em-noshort-em-noreg} +doesn't set the \catattr{regular} attribute. + +\end{description} + +\subsection{Predefined Abbreviation Styles that Don't Set the Regular +Attribute} +\label{sec:predefnonregabbrvstyles} + +The following abbreviation styles will set the +\catattr{regular} attribute to \qt{false} if it has previously +been set. If it hasn't already been set, it's left unset. +Other attributes may also be set, depending on the style. + +\begin{description} +\item[\abbrstyledef{long-short}] +On \gls{firstuse}, this style uses the format \meta{long} (\meta{short}). +The inline and display full forms are the same. The + \gloskey{sort} key is set to the short form. The \gloskey{name} is +also set to the short form through +\begin{definition}[\DescribeMacro\glsxtrlongshortname] +\cs{glsxtrlongshortname} +\end{definition} +(Similarly for other +\texttt{long}\meta{modifier}\texttt{-short}\meta{modifier} styles, +unless indicated otherwise.) +Any redefinition of this command must come before the abbreviations +are defined as it expands on definition. Make sure you protect +any commands that shouldn't be expanded. The long form can be +referenced with \cs{the}\cs{glslongtok} and the short form +can be referenced with \cs{the}\cs{glsshorttok}. + +The \gloskey{description} is set to the long form. The long and short +forms are separated by \cs{glsxtrfullsep}. If you want to insert +material within the parentheses (such as a~translation), try the +\abbrstyle{long-short-user} style. + +\item[\abbrstyledef{long-short-sc}] +Like \abbrstyle{long-short} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont}. + +\item[\abbrstyledef{long-short-sm}] +Like \abbrstyle{long-short} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. + +\item[\abbrstyledef{long-short-em}] +Like \abbrstyle{long-short} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. + +\item[\abbrstyledef{long-em-short-em}] +New to version 1.04, this style is like \abbrstyle{long-short-em} but redefines \cs{glsfirstlongfont} to +use \ics{glsfirstlongemfont}. + +\item[\abbrstyledef{long-only-short-only}] +New to version 1.17, this style only shows the long form +on first use and only shows the short form on subsequent use. +The inline full form \cs{glsxtrfull} shows the long form +followed by the short form in parentheses. The \gloskey{name} +field is obtained from +\begin{definition}[\DescribeMacro\glsxtronlyname] +\cs{glsxtronlyname} +\end{definition} +Any redefinition of this command must come before the abbreviations +are defined as it expands on definition. Make sure you protect +any commands that shouldn't be expanded. The long form can be +referenced with \cs{the}\cs{glslongtok} and the short form +can be referenced with \cs{the}\cs{glsshorttok}. + +\item[\abbrstyledef{long-only-short-only-desc}] +New to version 1.17, this style is like +\abbrstyle{long-only-short-only} but the user must supply the +description. The \gloskey{name} +field is obtained from +\begin{definition}[\DescribeMacro\glsxtronlydescname] +\cs{glsxtronlydescname} +\end{definition} +Any redefinition of this command must come before the abbreviations +are defined as it expands on definition. Make sure you protect +any commands that shouldn't be expanded. The long form can be +referenced with \cs{the}\cs{glslongtok} and the short form +can be referenced with \cs{the}\cs{glsshorttok}. + +\item[\abbrstyledef{long-em-noshort-em-noreg}] +New to version 1.17, this style is like +\abbrstyle{long-em-noshort-em} but +doesn't set the \catattr{regular} attribute. + +\item[\abbrstyledef{long-short-user}] +This style was introduced in version 1.04. It's like the +\abbrstyle{long-short} style but additional information can be +inserted into the parenthetical material. This checks the value +of the field given by +\begin{definition}[\DescribeMacro\glsxtruserfield] +\cs{glsxtruserfield} +\end{definition} +(which defaults to \texttt{useri}) using \ics{ifglshasfield} +(provided by \styfmt{glossaries}). If the field hasn't been set, +the style behaves like the \abbrstyle{long-short} style and +produces \meta{long} (\meta{short}) but if the field has been set, +the contents of that field are inserted within the parentheses in +the form \meta{long} (\meta{short}, \meta{field-value}). +The format is governed by +\begin{definition}[\DescribeMacro\glsxtruserparen] +\cs{glsxtruserparen}\marg{text}\marg{label} +\end{definition} +where \meta{text} is the short form (for the +\abbrstyle{long-short-user} style) or the long form (for the +\abbrstyle{short-long-user} style). This command first inserts +a space using \cs{glsxtrfullsep} and then the parenthetical content +(using \ics{glsxtrparen}). +The \gloskey{description} is set to +\begin{definition}[\DescribeMacro\glsuserdescription] +\cs{glsuserdescription}\marg{long}\marg{label} +\end{definition} +The default definition ignores the \meta{label} and encapsulates +\meta{long} with \cs{glslonguserfont}. + +The \gloskey{name} is obtained by expanding +\cs{glsxtrlongshortname} (see above). +The \meta{text} argument includes the font formatting command, +\cs{glsfirstabbrvfont}\marg{short} in the case of the +\abbrstyle{long-short-user} style and +\cs{glsfirstlongfont}\marg{long} in the +case of the \abbrstyle{short-long-user} style. + +For example: +\begin{verbatim} +\setabbreviationstyle[acronym]{long-short-user} + +\newacronym{tug}{TUG}{\TeX\ User Group} + +\newacronym + [user1={German Speaking \TeX\ User Group}] + {dante}{DANTE}{Deutschsprachige Anwendervereinigung \TeX\ e.V} + +\end{verbatim} +On first use, \verb|\gls{tug}| will appear as: +\begin{quote} +\TeX\ User Group (TUG) +\end{quote} +whereas \verb|\gls{dante}| will appear as: +\begin{quote} +Deutschsprachige Anwendervereinigung \TeX\ e.V (DANTE, German Speaking \TeX\ User Group) +\end{quote} + +The short form is formatted according to +\begin{definition}[\DescribeMacro\glsabbrvuserfont] +\cs{glsabbrvuserfont}\marg{text} +\end{definition} +and the plural suffix is given by +\begin{definition}[\DescribeMacro\glsxtrusersuffix] +\cs{glsxtrusersuffix} +\end{definition} + +These may be redefined as appropriate. For example, +if you want a~smallcaps style, you can just set these commands +to those used by the \abbrstyle{long-short-sc} style: +\begin{verbatim} +\renewcommand{\glsabbruserfont}[1]{\glsabbrvscfont{#1}} +\renewcommand{\glsxtrusersuffix}{\glsxtrscsuffix} +\end{verbatim} + +\item[\abbrstyledef{long-noshort-noreg}] +This style is like \abbrstyle{long-noshort} but it doesn't +set the \catattr{regular} attribute. + +\item[\abbrstyledef{long-noshort-desc-noreg}] +This style is like \abbrstyle{long-noshort-desc} but it doesn't +set the \catattr{regular} attribute. + +\item[\abbrstyledef{long-short-desc}] +On \gls{firstuse}, this style uses the format \meta{long} (\meta{short}). +The inline and display full forms are the same. The \gloskey{name} +is set to the full form. The \gloskey{sort} key is set to +\meta{long} (\meta{short}). Before version 1.04, this was +incorrectly set to the short form. If you want to revert back to +this you can redefine +\begin{definition}[\DescribeMacro\glsxtrlongshortdescsort] +\cs{glsxtrlongshortdescsort} +\end{definition} +For example: +\begin{verbatim} +\renewcommand*{\glsxtrlongshortdescsort}{\the\glsshorttok} +\end{verbatim} +The \gloskey{description} must be supplied by the user. +The long and short forms are separated by \cs{glsxtrfullsep}. The \gloskey{name} +field is obtained from +\begin{definition}[\DescribeMacro\glsxtrlongshortdescname] +\cs{glsxtrlongshortdescname} +\end{definition} +(Similarly for other +\texttt{long}\meta{modifier}\texttt{-short}\meta{modifier}\texttt{-desc} +styles, unless indicated otherwise.) +Any redefinition of this command must come before the abbreviations +are defined as it expands on definition. Make sure you protect +any commands that shouldn't be expanded. The long form can be +referenced with \cs{the}\cs{glslongtok} and the short form +can be referenced with \cs{the}\cs{glsshorttok}. + +\item[\abbrstyledef{long-short-sc-desc}] +Like \abbrstyle{long-short-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont}. + +\item[\abbrstyledef{long-short-sm-desc}] +Like \abbrstyle{long-short-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. + +\item[\abbrstyledef{long-short-em-desc}] +Like \abbrstyle{long-short-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. + +\item[\abbrstyledef{long-em-short-em-desc}] +New to version 1.04, this style is like \abbrstyle{long-short-em-desc} but redefines \cs{glsfirstlongfont} to +use \ics{glsfirstlongemfont}. + +\item[\abbrstyledef{long-em-noshort-em-desc-noreg}] +New to version 1.17, this style is like +\abbrstyle{long-em-noshort-em-desc} but +doesn't set the \catattr{regular} attribute. + + +\item[\abbrstyledef{long-short-user-desc}] +New to version 1.04, this style is like a~cross between the +\abbrstyle{long-short-desc} style and the +\abbrstyle{long-short-user} style. The display and inline forms are +as for \abbrstyle{long-short-user} and the \gloskey{name} key is +obtained from +\begin{definition}[\DescribeMacro\glsxtrlongshortuserdescname] +\cs{glsxtrlongshortuserdescname} +\end{definition} +Again, this should only be redefined before \cs{newabbreviation} (or +\cs{newacronym}), and fragile and formatting commands need protecting. + +The \gloskey{description} key must be +supplied in the optional argument of \cs{newabbreviation} +(or \cs{newacronym}). The \gloskey{sort} key is set to \meta{long} +(\meta{short}) as per the \abbrstyle{long-short-desc} style. + +\item[\abbrstyledef{short-nolong-noreg}] +This is like \abbrstyle{short-nolong} but doesn't set the +\catattr{regular} attribute. + +\item[\abbrstyledef{nolong-short-noreg}] +This is like \abbrstyle{nolong-short} but doesn't set the +\catattr{regular} attribute. + +\item[\abbrstyledef{short-long}] +On \gls{firstuse}, this style uses the format \meta{short} (\meta{long}). +The inline and display full forms are the same. The \gloskey{name} +and \gloskey{sort} keys are set to the short form. The +\gloskey{description} is set to the long form. +The short and long forms are separated by \cs{glsxtrfullsep}. +If you want to insert +material within the parentheses (such as a~translation), try the +\abbrstyle{short-long-user} style. + +The \gloskey{name} field is obtained from +\begin{definition}[\DescribeMacro\glsxtrshortlongname] +\cs{glsxtrshortlongname} +\end{definition} +(Similarly for other +\texttt{short}\meta{modifier}\texttt{-long}\meta{modifier} styles, +unless indicated otherwise.) +Any redefinition of this command must come before the abbreviations +are defined as it expands on definition. Make sure you protect +any commands that shouldn't be expanded. The long form can be +referenced with \cs{the}\cs{glslongtok} and the short form +can be referenced with \cs{the}\cs{glsshorttok}. + + +\item[\abbrstyledef{short-sc-long}] +Like \abbrstyle{short-long} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont}. + +\item[\abbrstyledef{short-sm-long}] +Like \abbrstyle{short-long} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. + +\item[\abbrstyledef{short-em-long}] +Like \abbrstyle{short-long} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. + +\item[\abbrstyledef{short-em-long-em}] +New to version 1.04, this style is like \abbrstyle{short-em-long} but redefines \cs{glsfirstlongfont} to +use \ics{glsfirstlongemfont}. + +\item[\abbrstyledef{short-long-user}] +New to version 1.04. This style is like the +\abbrstyle{long-short-user} style but with the long and short forms +switched. The parenthetical material is governed by the same command +\ics{glsxtruserparen}, but the first argument supplied to it is +the long form instead of the short form. The \gloskey{name} field is +obtained by expanding +\begin{definition}[\DescribeMacro\glsxtrshortlongname] +\cs{glsxtrshortlongname} +\end{definition} +Again, this should only be redefined before \cs{newabbreviation} (or +\cs{newacronym}) and commands that should be expanded need to be +protected. The \gloskey{description} is set to +\cs{glsuserdescription}\marg{long}\marg{label}. + +\item[\abbrstyledef{short-nolong-desc-noreg}] +This style is like \abbrstyle{short-nolong-desc} but it doesn't +set the \catattr{regular} attribute. + +\item[\abbrstyledef{short-long-desc}] +On \gls{firstuse}, this style uses the format \meta{short} (\meta{long}). +The inline and display full forms are the same. The \gloskey{name} +is set to the full form. The +\gloskey{description} must be supplied by the user. +The short and long forms are separated by \cs{glsxtrfullsep}. The \gloskey{name} +field is obtained from +\begin{definition}[\DescribeMacro\glsxtrshortlongdescname] +\cs{glsxtrshortlongdescname} +\end{definition} +(Similarly for other +\texttt{short}\meta{modifier}\texttt{-long}\meta{modifier}\texttt{-desc} +styles, unless indicated otherwise.) +Any redefinition of this command must come before the abbreviations +are defined as it expands on definition. Make sure you protect +any commands that shouldn't be expanded. The long form can be +referenced with \cs{the}\cs{glslongtok} and the short form +can be referenced with \cs{the}\cs{glsshorttok}. + +\item[\abbrstyledef{short-sc-long-desc}] +Like \abbrstyle{short-long-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont}. + +\item[\abbrstyledef{short-sm-long-desc}] +Like \abbrstyle{short-long-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. + +\item[\abbrstyledef{short-em-long-desc}] +Like \abbrstyle{short-long-desc} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. + +\item[\abbrstyledef{short-em-long-em-desc}] +New to version 1.04, this style is like \abbrstyle{short-em-long-desc} but redefines \cs{glsfirstlongfont} to +use \ics{glsfirstlongemfont}. + +\item[\abbrstyledef{short-long-user-desc}] +New to version 1.04, this style is like a~cross between the +\abbrstyle{short-long-desc} style and the +\abbrstyle{short-long-user} style. The display and inline forms are +as for \abbrstyle{short-long-user}, but the \gloskey{name} key is +obtained from +\begin{definition}[\DescribeMacro\glsxtrshortlonguserdescname] +\cs{glsxtrshortlonguserdescname} +\end{definition} +Again, this should only be redefined before \cs{newabbreviation} (or +\cs{newacronym}), and fragile and formatting commands need protecting. + +The \gloskey{description} key must be +supplied in the optional argument of \cs{newabbreviation} +(or \cs{newacronym}). + +\item[\abbrstyledef{short-footnote}] +On \gls{firstuse}, this style displays the short form with the long form +as a footnote. This style automatically sets the +\catattr{nohyperfirst} attribute to \qt{true} for the supplied +category, so the \gls{firstuse} won't be hyperlinked (but the footnote +marker may be, if the \sty{hyperref} package is used). + +The inline full form uses the \meta{short} +(\meta{long}) style. The \gloskey{name} is set to the short form. +The \gloskey{description} is set to the long form. The +\gloskey{name} key is obtained by expanding +\begin{definition}[\DescribeMacro\glsxtrfootnotename] +\cs{glsxtrfootnotename} +\end{definition} +(Similarly for other +\texttt{short\meta{modifier}-\meta{modifier}footnote} styles, unless +indicated otherwise.) Again, this command should only be redefined +before \cs{newabbreviation} (or \cs{newacronym}), and fragile or +formatting commands should be protected from expansion. + +As from version 1.05, all the footnote styles use: +\begin{definition}[\DescribeMacro\glsfirstlongfootnotefont] +\cs{glsfirstlongfootnotefont}\marg{text} +\end{definition} +to format the long form on \gls{firstuse} or for the full form and +\begin{definition}[\DescribeMacro\glslongfootnotefont] +\cs{glslongfootnotefont}\marg{text} +\end{definition} +to format the long form elsewhere (for example, when used with +\cs{glsxtrlong}). + +As from version 1.07, all the footnote styles use: +\begin{definition}[\DescribeMacro\glsxtrabbrvfootnote] +\cs{glsxtrabbrvfootnote}\marg{label}\marg{long} +\end{definition} +By default, this just does \ics{footnote}\marg{long} (the first +argument is ignored). For example, to make the footnote text +link to the relevant place in the glossary: +\begin{verbatim} +\renewcommand{\glsxtrabbrvfootnote}[2]{% + \footnote{\glshyperlink[#2]{#1}}% +} +\end{verbatim} +or to include the short form with a hyperlink: +\begin{verbatim} +\renewcommand{\glsxtrabbrvfootnote}[2]{% + \footnote{\glshyperlink[\glsfmtshort{#1}]{#1}: #2}% +} +\end{verbatim} +Note that I haven't used commands like \cs{glsxtrshort} to +avoid interference (see \sectionref{sec:entryfmtmods} +and \sectionref{sec:nested}). + +\item[\abbrstyledef{footnote}] A synonym for +\abbrstyle{short-footnote}. + +\item[\abbrstyledef{short-sc-footnote}] +Like \abbrstyle{short-footnote} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont}. +(This style was originally called \depabbrstyle{footnote-sc}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{short-sc-footnote}] +Like \abbrstyle{short-footnote} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. +(This style was originally called \depabbrstyle{footnote-sm}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{short-em-footnote}] +Like \abbrstyle{short-footnote} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. +(This style was originally called \depabbrstyle{footnote-em}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{short-postfootnote}] +This is similar to the \abbrstyle{short-footnote} style but doesn't modify +the category attribute. Instead it changes \postlinkcat\ to +insert the footnote after the +\gls{linktext} on \gls{firstuse}. This will also defer the footnote until after any +following punctuation character that's recognised by +\ics{glsxtrifnextpunc}. + +The inline full form uses the \meta{short} +(\meta{long}) style. The \gloskey{name} is set to the short form. +The \gloskey{description} is set to the long form. +Note that this style will change \cs{glsxtrfull} (and its variants) +so that it fakes non-\gls{firstuse}. (Otherwise the footnote would +appear after the inline form.) + +\item[\abbrstyledef{postfootnote}] A synonym for +\abbrstyle{short-postfootnote}. + +\item[\abbrstyledef{short-sc-postfootnote}] +Like \abbrstyle{short-postfootnote} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvscfont}. +(This style was originally called \depabbrstyle{postfootnote-sc}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{short-sm-postfootnote}] +Like \abbrstyle{short-postfootnote} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvsmfont}. +(This style was originally called \depabbrstyle{postfootnote-sm}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{short-em-postfootnote}] +Like \abbrstyle{short-postfootnote} but redefines \cs{glsabbrvfont} to +use \ics{glsabbrvemfont}. +(This style was originally called \depabbrstyle{postfootnote-em}. Renamed in version +1.04, but original name retained as a deprecated synonym for +backward-compatibility.) + +\item[\abbrstyledef{short-postlong-user}] +This style was introduced in version 1.12. It's like the +\abbrstyle{short-long-user} style but defers the parenthetical +material to after the link-text. This means that you don't have such +a long hyperlink (which can cause problems for the DVI \LaTeX\ format) +and it also means that the user supplied material can include a +hyperlink to another location. The \gloskey{name} key is obtained +from \cs{glsxtrshortlongname}. + +\item[\abbrstyledef{short-postlong-user-desc}] +This style was introduced in version 1.12. It's like the above +\abbrstyle{short-postlong-user} style but the \gloskey{description} +must be specified. The \gloskey{name} is obtained from +\cs{glsxtrshortlonguserdescname}. + +\item[\abbrstyledef{long-postshort-user}] +This style was introduced in version 1.12. It's like the above +\abbrstyle{short-postlong-user} style but the long form is shown +first and the short form is in the parenthetical material (as for +\abbrstyle{long-short-user}) style. + +\item[\abbrstyledef{long-postshort-user-desc}] +This style was introduced in version 1.12. It's like the above +\abbrstyle{long-postshort-user} style but the \gloskey{description} +must be specified. The \gloskey{name} is obtained from +\cs{glsxtrlongshortuserdescname}. + +\item[\abbrstyledef{long-hyphen-short-hyphen}] +This style (new to v1.17) is designed to work with the \catattr{markwords} +category attribute. The full form is formatted using +\begin{definition}[\DescribeMacro\glsxtrlonghyphenshort] +\cs{glsxtrlonghyphenshort}\marg{label}\marg{long}\marg{short}\marg{insert} +\end{definition} +where \meta{insert} is the inserted material +provided in the final optional argument of commands like +\cs{insert}. If \meta{insert} start with a hyphen, then this +locally redefines \ics{glsxtrwordsep} to a hyphen, which means that +if the \catattr{markwords} attribute is set then the long form +will become hyphenated. (If this attribute isn't set, there's +no alteration to the way the long form is displayed.) +The \gloskey{name} key is obtained from \cs{glsxtrlongshortname}. + +Unlike the other \meta{long} (\meta{short}) type of styles, +such as \abbrstyle{long-short}, this style +also repeats the insertion in the parenthetical part, so that the +first use form is: +\begin{quote} +\cs{glsfirstlonghyphenfont}\marg{long}\meta{insert} +(\cs{glsfirstabbrvhyphenfont}\marg{short}\meta{insert}) +\end{quote} +The space before the parenthetical material is actually given by +\cs{glsxtrfullsep}\marg{label} which defaults to a space. +The \meta{insert} may be moved into the formatting commands +according to the conditional \cs{ifglsxtrinsertinside}. + +For example, if \texttt{ip} is defined using: +\begin{verbatim} +\glssetcategoryattribute{english}{markwords}{true} +\setabbreviationstyle[english]{long-hyphen-short-hyphen} +\newabbreviation[category=english]{ip}{IP}{Internet Protocol} +\end{verbatim} +then +\begin{verbatim} +\gls{ip}[-Adressen] +\end{verbatim} +will do +\begin{quote} +Internet-Protocol-Adressen (IP-Adressen) +\end{quote} +on first use, whereas +\begin{verbatim} +\gls{ip}[ Address] +\end{verbatim} +will do +\begin{quote} +Internet Protocol Address (IP Address) +\end{quote} +on first use. + +\begin{important} +Note that the hyphenation isn't applied when using commands like +\cs{glsxtrlong}. This means that +\begin{verbatim} +\glsxtrlong{ip}[-Adressen] +\end{verbatim} +will do +\begin{quote} +Internet Protocol-Adressen +\end{quote} +\end{important} + +If the \catattr{markwords} attribute hadn't been set, then the +first use of +\begin{verbatim} +\gls{ip}[-Adressen] +\end{verbatim} +would do +\begin{quote} +Internet Protocol-Adressen (IP-Adressen) +\end{quote} +instead. + +\begin{important} +If the inserted material \meta{insert} is likely to contain commands like +\cs{gls}, then use \abbrstyle{long-hyphen-postshort-hyphen} +instead to avoid nested links. +\end{important} + +If you want the short version in small-caps, you can +just redefine \cs{glsabbrvhyphenfont} and \cs{glsxtrhyphensuffix} +to use the small-caps versions. For example: +\begin{verbatim} +\renewcommand{\glsabbrvhyphenfont}{\glsabbrvscfont} +\renewcommand{\glsxtrhyphensuffix}{\glsxtrscsuffix} +\end{verbatim} +Similarly for other font-changing variations. + +\item[\abbrstyledef{long-hyphen-noshort-desc-noreg}] +New to version 1.17, this style is like +\abbrstyle{long-hyphen-short-hyphen-desc} except that the +parenthetical part is omitted and the long form is displayed +on subsequent use. The short form can be accessed +with \cs{glsxtrshort} but just uses the default abbreviation font. +There's no regular version of this style as the regular form +doesn't have the flexibility to deal with the hyphen switch. +The \gloskey{name} is obtained from \cs{glsxtrlongnoshortdescname}. + +\item[\abbrstyledef{long-hyphen-noshort-noreg}] +New to version 1.17, this style is like +\abbrstyle{long-hyphen-noshort-desc-noreg} but the +name is set to the short form and the description is set to the long +form. + +\item[\abbrstyledef{long-hyphen-short-hyphen-desc}] + +New to version 1.17. +This is similar to \abbrstyle{long-hyphen-short-hyphen} but the user +supplies the description. The \gloskey{name} is obtained from +\cs{glsxtrlongshortdescname}. + +\item[\abbrstyledef{long-hyphen-postshort-hyphen}] + +New to version 1.17. +This is similar to \abbrstyle{long-hyphen-short-hyphen} but the +inserted and parenthetical material are moved to the post-link hook. +On first use, \cs{gls}\marg{label}\oarg{insert} will do +\begin{display} +\cs{glsxtrlonghyphen}\marg{long}\marg{label}\marg{insert}\cs{glsxtrposthyphenshort}\marg{label}\meta{insert} +\end{display} +where +\begin{definition}[\DescribeMacro\glsxtrposthyphenshort] +\cs{glsxtrposthyphenshort}\marg{label}\meta{insert} +\end{definition} +is in the post-link hook. This uses the format: +\begin{display} +\meta{insert} (\cs{glsfirstabbrvhyphenfont}\marg{short}\meta{isnert}) +\end{display} + +\begin{important} +The singular short form is always used here, even with \cs{glspl}. +(Unlike \abbrstyle{long-hyphen-long-hyphen}.) +\end{important} + +The part in the link-text on first use: +\begin{definition}[\DescribeMacro\glsxtrlonghyphen] +\cs{glsxtrlonghyphen}\marg{long}\marg{label}\marg{insert} +\end{definition} +checks if \meta{insert} starts with a hyphen. If it does, then +\cs{glsxtrwordsep} is locally redefined to a hyphen. This command +only uses \meta{insert} to test if it starts with a hyphen. +The actual insertion code isn't typeset until the post-link +hook and it's also localised, which means that you can use +commands like \cs{gls} in \meta{insert} for this style without +causing nested hyperlinks, but only for commands like \cs{gls}. + +\begin{important} +Don't use \cs{gls} in the \meta{insert} part for commands +like \cs{glsxtrfull}, \cs{glsxtrshort} or \cs{glsxtrlong}. +\end{important} + +The inline full display format used by commands like \cs{glsxtrfull} +behaves differently to the first use of \cs{gls} with this style. +It's better to use \cs{glsreset}\marg{label}\cs{gls}\marg{label} +if you want to ensure the full format. + +\item[\abbrstyledef{long-hyphen-postshort-hyphen-desc}] + +New to version 1.17. +This is similar to \abbrstyle{long-hyphen-postshort-hyphen} but the +user supplies the description. The \gloskey{name} is obtained from +\cs{glsxtrlongshortdescname}. + + +\item[\abbrstyledef{short-hyphen-long-hyphen}] +This style (new to v1.17) is like +\abbrstyle{long-hyphen-short-hyphen}, except that the short form +is displayed first followed by the long form in parentheses. The full form is formatted using +\begin{definition}[\DescribeMacro\glsxtrshorthyphenlong] +\cs{glsxtrshorthyphenlong}\marg{label}\marg{short}\marg{long}\marg{insert} +\end{definition} +which behaves in an analogous way to \cs{glsxtrlonghyphenshort}. +The \gloskey{name} is obtained from \cs{glsxtrshortlongname}. + +\item[\abbrstyledef{short-hyphen-long-hyphen-desc}] + +New to version 1.17. +This is similar to \abbrstyle{short-hyphen-long-hyphen} but the +user supplies the description. +The \gloskey{name} is obtained from \cs{glsxtrshortlongdescname}. + +\item[\abbrstyledef{short-hyphen-postlong-hyphen}] +This style (new to v1.17) is like +\abbrstyle{long-hyphen-postshort-hyphen}, but the +short form is displayed first followed by the long form in +parentheses. +On first use, \cs{gls}\marg{label}\oarg{insert} will do +\begin{display} +\cs{glsxtrshorthyphen}\marg{short}\marg{label}\marg{insert}\cs{glsxtrposthyphenlong}\marg{label}\meta{insert} +\end{display} +where +\begin{definition}[\DescribeMacro\glsxtrposthyphenlong] +\cs{glsxtrposthyphenlong}\marg{label}\meta{insert} +\end{definition} +is in the post-link hook. These commands behave in an analogous +manner to those used with \abbrstyle{long-hyphen-postshort-hyphen}. +The \gloskey{name} is obtained from \cs{glsxtrshortlongname}. + +\begin{important} +Don't use \cs{gls} in the \meta{insert} part for commands +like \cs{glsxtrfull}, \cs{glsxtrshort} or \cs{glsxtrlong}. +\end{important} + +The inline full display format used by commands like \cs{glsxtrfull} +behaves differently to the first use of \cs{gls} with this style. +It's better to use \cs{glsreset}\marg{label}\cs{gls}\marg{label} +if you want to ensure the full format. + +\item[\abbrstyledef{short-hyphen-postlong-hyphen-desc}] + +New to version 1.17. +This is similar to \abbrstyle{short-hyphen-postlong-hyphen} but the +user supplies the description. The \gloskey{name} is obtained from +\cs{glsxtrshortlongdescname}. + +\end{description} + +\section{Defining New Abbreviation Styles} +\label{sec:newabbrvstyle} + +New abbreviation styles may be defined using: +\begin{definition}[\DescribeMacro\newabbreviationstyle] +\cs{newabbreviationstyle}\marg{name}\marg{setup}\marg{fmts} +\end{definition} +\begin{sloppypar}\noindent +where \meta{name} is the name of the new style (as used in the +mandatory argument of \ics{setabbreviationstyle}). This is similar +but not identical to the \styfmt{glossaries} package's +\ics{newacronymstyle} command. +\end{sloppypar} + +\begin{important} +You can't use styles defined by +\cs{newacronymstyle} with \styfmt{glossaries-extra} unless you have +reverted \ics{newacronym} back to its generic definition from \styfmt{glossaries} +(using \ics{RestoreAcronyms}). The acronym styles from the +\styfmt{glossaries} package can't be used with abbreviations defined +with \cs{newabbreviation}. +\end{important} + +The \meta{setup} argument deals with the way the entry is defined +and may set attributes for the given abbreviation +category. This argument should redefine +\begin{definition}[\DescribeMacro\CustomAbbreviationFields] +\cs{CustomAbbreviationFields} +\end{definition} +to set the entry fields including the \gloskey{name} (defaults to +the short form if omitted), +\gloskey{sort}, \gloskey{first}, \gloskey{firstplural}. Other fields +may also be set, such as \gloskey{text}, \gloskey{plural} and +\gloskey{description}. + +\begin{important} +\cs{CustomAbbreviationFields} is expanded by \cs{newabbreviation} +so take care to protect commands that shouldn't be expanded. +\end{important} + +For example, the \abbrstyle{long-short} style has the following in +\meta{setup}: +\begin{verbatim} + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsabbrvfont{\the\glsshorttok}}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshortpltok}}},% + plural={\protect\glsabbrvfont{\the\glsshortpltok}},% + description={\the\glslongtok}}% +\end{verbatim} +Note that the \gloskey{first} and \gloskey{firstplural} are +set even though they're not used by \cs{gls}. + +The basic styles, such as \abbrstyle{long-short}, use commands like +\cs{glsabbrvfont} (which are redefined whenever the style formatting +is set) within \cs{CustomAbbreviationFields}. Other styles, such as +\abbrstyle{long-em-short-em} directly use their own custom commands, +such as \cs{glsabbrvemfont}. With these styles, commands like +\cs{glsabbrvfont} still need to be defined as appropriate in the +\meta{fmts} argument even if they're not used within +\cs{CustomAbbreviationFields}. + +The \meta{setup} argument may also redefine +\begin{definition}[\DescribeMacro\GlsXtrPostNewAbbreviation] +\cs{GlsXtrPostNewAbbreviation} +\end{definition} +which can be used to assign attributes. (This will automatically +be initialised to do nothing.) + +For example, the \abbrstyle{short-footnote} includes the following in +\meta{setup}: +\begin{verbatim} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +\end{verbatim} +This sets the \catattr{nohyperfirst} attribute to \qt{true}. +It also unsets the \catattr{regular} attribute if it has +previously been set. Note that the \catattr{nohyperfirst} +attribute doesn't get unset by other styles, so take care +not to switch styles for the same category. + +You can access the short, long, short plural and long plural +values through the following token registers. + +Short value (defined by \styfmt{glossaries}): +\begin{definition}[\DescribeMacro\glsshorttok] +\cs{glsshorttok} +\end{definition} + +Short plural value (defined by \styfmt{glossaries-extra}): +\begin{definition}[\DescribeMacro\glsshortpltok] +\cs{glsshortpltok} +\end{definition} +(This may be the default value or, if provided, the value provided by the user +through the \gloskey{shortplural} key in the optional argument +of \ics{newabbreviation}.) + +Long value (defined by \styfmt{glossaries}): +\begin{definition}[\DescribeMacro\glslongtok] +\cs{glslongtok} +\end{definition} + +Long plural value (defined by \styfmt{glossaries-extra}): +\begin{definition}[\DescribeMacro\glslongpltok] +\cs{glslongpltok} +\end{definition} +(This may be the default value or, if provided, the value provided by the user +through the \gloskey{longplural} key in the optional argument +of \ics{newabbreviation}.) + +The short or long values may be modified by attributes (such as +\catattr{markwords}). The above registers reflect the modification. +If you want to access the original (unmodified) short or long form +(as provided in the final two arguments of \cs{newabbreviation}), +then use the commands: +\begin{definition}[\DescribeMacro\glsxtrorgshort] +\cs{glsxtrorgshort} +\end{definition} +for the short form and +\begin{definition}[\DescribeMacro\glsxtrorglong] +\cs{glsxtrorglong} +\end{definition} +for the long form. (These may be useful for the \gloskey{sort} key +to avoid any formatting that may be added by the attribute setting.) + +There are two other registers available that are defined by +\styfmt{glossaries}: + +\begin{definition}[\DescribeMacro\glslabeltok] +\cs{glslabeltok} +\end{definition} +which contains the entry's label and +\begin{definition}[\DescribeMacro\glskeylisttok] +\cs{glskeylisttok} +\end{definition} +which contains the values provided in the optional argument +of \ics{newabbreviation}. + +Remember put \cs{the} in front of the register command as in the +examples above. The category label can be access through +the command (not a register): +\begin{definition}[\DescribeMacro\glscategorylabel] +\cs{glscategorylabel} +\end{definition} +This may be used inside the definition of +\cs{GlsXtrPostNewAbbreviation}. + +If you want to base a style on an existing style, you can use +\begin{definition}[\DescribeMacro\GlsXtrUseAbbrStyleSetup] +\cs{GlsXtrUseAbbrStyleSetup}\marg{name} +\end{definition} +where \meta{name} is the name of the existing style. +For example, the \abbrstyle{long-noshort-sc-desc} style simply does +\begin{verbatim} +\GlsXtrUseAbbrStyleSetup{long-noshort-desc} +\end{verbatim} +within \meta{setup}. + +The \meta{fmts} argument deals with the way the entry is displayed +in the document. This argument should redefine the following +commands. + +The default suffix for the plural short form (if not overridden by +the \gloskey{shortplural} key): +\begin{definition}[\DescribeMacro\abbrvpluralsuffix] +\cs{abbrvpluralsuffix} +\end{definition} +(Note that this isn't used for the plural long form, which +just uses the regular \cs{glspluralsuffix}.) + +The font used for the short form on \gls{firstuse} or in the full forms: +\begin{definition}[\DescribeMacro\glsfirstabbrvfont] +\cs{glsfirstabbrvfont}\marg{text} +\end{definition} + +The font used for the short form on subsequent use or through +commands like \ics{glsxtrshort}: +\begin{definition}[\DescribeMacro\glsabbrvfont] +\cs{glsabbrvfont}\marg{text} +\end{definition} + +The font used for the long form on \gls{firstuse} or in the full forms: +\begin{definition}[\DescribeMacro\glsfirstlongfont] +\cs{glsfirstlongfont}\marg{text} +\end{definition} + +The font used for the long form in commands like \cs{glsxtrlong} +use: +\begin{definition}[\DescribeMacro\glslongfont] +\cs{glslongfont}\marg{text} +\end{definition} + +Display full form singular no case-change (used by \ics{gls} on +\gls{firstuse} for abbreviations without the \catattr{regular} attribute +set): +\begin{definition}[\DescribeMacro\glsxtrfullformat] +\cs{glsxtrfullformat}\marg{label}\marg{insert} +\end{definition} + +Display full form singular first letter converted to upper case +(used by \ics{Gls} on \gls{firstuse} for abbreviations without the +\catattr{regular} attribute set): +\begin{definition}[\DescribeMacro\Glsxtrfullformat] +\cs{Glsxtrfullformat}\marg{label}\marg{insert} +\end{definition} + +Display full form plural no case-change +(used by \ics{glspl} on \gls{firstuse} for abbreviations without the +\catattr{regular} attribute set): +\begin{definition}[\DescribeMacro\glsxtrfullplformat] +\cs{glsxtrfullplformat}\marg{label}\marg{insert} +\end{definition} + +Display full form plural first letter converted to upper case +(used by \ics{Glspl} on \gls{firstuse} for abbreviations without the +\catattr{regular} attribute set): +\begin{definition}[\DescribeMacro\Glsxtrfullplformat] +\cs{Glsxtrfullplformat}\marg{label}\marg{insert} +\end{definition} + +In addition \meta{fmts} may also redefine the following commands that +govern the inline full formats. If the style doesn't redefine them, +they will default to the same as the display full forms. + +Inline singular no case-change (used by +\ics{glsentryfull}, \ics{glsxtrfull} and \ics{GLSxtrfull}): +\begin{definition}[\DescribeMacro\glsxtrinlinefullformat] +\cs{glsxtrinlinefullformat}\marg{label}\marg{insert} +\end{definition} + +Inline singular first letter converted to upper case (used by +\ics{Glsentryfull} and \ics{Glsxtrfull}): +\begin{definition}[\DescribeMacro\Glsxtrinlinefullformat] +\cs{Glsxtrinlinefullformat}\marg{label}\marg{insert} +\end{definition} + +Inline plural no case-change (used by +\ics{glsentryfullpl}, \ics{glsxtrfullpl} and \ics{GLSxtrfullpl}): +\begin{definition}[\DescribeMacro\glsxtrinlinefullplformat] +\cs{glsxtrinlinefullplformat}\marg{label}\marg{insert} +\end{definition} + +Inline plural first letter converted to upper case (used by +\ics{Glsentryfullpl} and \ics{Glsxtrfullpl}): +\begin{definition}[\DescribeMacro\Glsxtrinlinefullplformat] +\cs{Glsxtrinlinefullplformat}\marg{label}\marg{insert} +\end{definition} + +(New to version 1.17.) +You can also modify the way the subsequent use is formatted by +redefining the following four commands, but these won't be used for +abbreviations with the \catattr{regular} attribute set. If the style +doesn't redefine these commands, the default values are used. + +Singular with no case-change: +\begin{definition}[\DescribeMacro\glsxtrsubsequentfmt] +\cs{glsxtrsubsequentfmt}\marg{label}\marg{insert} +\end{definition} + +Singular with first letter upper case: +\begin{definition}[\DescribeMacro\Glsxtrsubsequentfmt] +\cs{Glsxtrsubsequentfmt}\marg{label}\marg{insert} +\end{definition} + +Plural with no case-change: +\begin{definition}[\DescribeMacro\glsxtrsubsequentplfmt] +\cs{glsxtrsubsequentplfmt}\marg{label}\marg{insert} +\end{definition} + +Plural with first letter upper case: +\begin{definition}[\DescribeMacro\Glsxtrsubsequentplfmt] +\cs{Glsxtrsubsequentplfmt}\marg{label}\marg{insert} +\end{definition} + +If you want to provide support for \sty{glossaries-accsupp} +use the following \cs{glsaccess\meta{xxx}} commands +(\sectionref{sec:accsupp}) within the definitions of +\cs{glsxtrfullformat} etc instead of the analogous +\cs{glsentry}\meta{xxx} commands. (If you don't use +\sty{glossaries-accsupp}, they will just do the corresponding +\cs{glsentry}\meta{xxx} command.) + +For example, the \abbrstyle{short-long} style has the following in +\meta{fmts}: +\begin{verbatim} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% +\end{verbatim} +Since the inline full commands aren't redefined, they default +to the same as the display versions. + +If you want to base a style on an existing style, you can use +\begin{definition}[\DescribeMacro\GlsXtrUseAbbrStyleFmts] +\cs{GlsXtrUseAbbrStyleFmts}\marg{name} +\end{definition} +within \meta{fmts}, where \meta{name} is the name of the existing +style. For example, the \abbrstyle{long-short-desc} style has the +following in \meta{fmts}: +\begin{verbatim} + \GlsXtrUseAbbrStyleFmts{long-short}% +\end{verbatim} + +Here's an example of an abbreviation style that's based on +\abbrstyle{long-short} that displays the short form within +\cs{textsf}: +\begin{verbatim} +\newabbreviationstyle +{custom-sf}% label +{% setup + \GlsXtrUseAbbrStyleSetup{short-long}% +}% +{% fmts + \GlsXtrUseAbbrStyleFmts{short-long}% + \renewcommand*{\glsabbrvfont}[1]{\textsf{##1}}% +} +\end{verbatim} +Note that this wouldn't work if it was instead based on one of the +modified versions such as \abbrstyle{short-sc-long} as they +explicitly use their own formatting commands, such as +\cs{glsabbrvemfont}. The base styles, such as \abbrstyle{short-long}, +use the more generic \cs{glsabbrvfont} etc which makes them easier +to adapt than the modified styles. + +For further details, see the \qt{Abbreviations} section in the documented code +(\texttt{glossaries-extra-code.pdf}). + +\chapter{Entries in Sectioning Titles, Headers, Captions and Contents} +\label{sec:headtitle} + +The \styfmt{glossaries} user manual cautions against using commands +like \cs{gls} in chapter or section titles. The principle problems +are: +\begin{itemize} +\item if you have a table of contents, the \gls{firstuseflag} +will be unset in the contents rather than later in the document; +\item if you have the location lists displayed in the glossary, +unwanted locations will be added to it corresponding to the table of +contents (if present) and every page that contains the entry in the +page header (if the page style in use adds the chapter or section +title to the header); +\item if the page style in use adds the chapter or section title to +the header and attempts to convert it to upper case, the entry label +(in the argument of \cs{gls} etc) will be converted to upper case +and the entry won't be recognised; +\item if you use \sty{hyperref}, commands like \cs{gls} can't be +expanded to a simple string and only the label will appear in the +PDF bookmark (with a warning from \sty{hyperref}); +\item if you use \sty{hyperref}, you will end up with nested hyperlinks +in the table of contents. +\end{itemize} +Similar problems can also occur with captions (except for the page +header and bookmark issues). + +To get around all these problems, the \styfmt{glossaries} user manual +recommends using the expandable non-hyperlink commands, such as +\ics{glsentrytext} (for regular entries) or \ics{glsentryshort} +(for abbreviations). This is the simplest solution, but doesn't +allow for special formatting that's applied to the entry through +commands like \cs{glstext} or \cs{glsxtrshort}. This means that if, +for example, you are using one of the abbreviation styles that uses +\ics{textsc} then the short form displayed with \cs{glsentryshort} won't use small +caps. If you only have one abbreviation style in use, you can +explicitly enclose \cs{glsentryshort}\marg{label} in the argument of +\cs{glsabbrvfont}, like this: +\begin{verbatim} +\chapter{A Chapter about \glsabbrvfont{\glsentryshort{html}}} +\end{verbatim} +Or, if you are using \sty{hyperref}: +\begin{verbatim} +\chapter{A Chapter about +\texorpdfstring{\glsabbrvfont{\glsentryshort{html}}}{\glsentryshort{html}}} +\end{verbatim} + +Since this is a bit cumbersome, you might want to define a new +command to do this for you. However, if you have mixed styles this +won't work as commands like \cs{gls} and \cs{glsxtrshort} redefine +\cs{glsabbrvfont} to match the entry's style before displaying it. +In this case, the above example doesn't take into account the +shifting definitions of \cs{glsabbrvfont} and will use whatever +happens to be the last abbreviation style in use. More complicated +solutions interfere with the upper casing used by the standard +page styles that display the chapter or section title in the page +header using \ics{MakeUppercase}. + +The \styfmt{glossaries-extra} package tries to resolve this by +modifying \ics{markright} and \ics{markboth} and \cs{@starttoc}. If you don't like this +change, you can restore their former definitions using +\begin{definition}[\DescribeMacro\glsxtrRevertMarks] +\cs{glsxtrRevertMarks} +\end{definition} +If you only want to restore \cs{@starttoc} you can use: +\begin{definition}[\DescribeMacro\glsxtrRevertTocMarks] +\cs{glsxtrRevertTocMarks} +\end{definition} +If you restore the header or table of contents commands, you'll have to use the \styfmt{glossaries} manual's +recommendations of either simply using \cs{glsentryshort} (as above) +or use the sectioning command's option argument to provide an +alternative for the table of contents and page header. For example: +\begin{verbatim} +\chapter[A Chapter about \glsentryshort{html}]{A Chapter about \gls{html}} +\end{verbatim} +Alternatively, you need to find a way to insert \cs{glsxtrmarkhook} and +\cs{@glsxtrinmark} at the start of the header or table of contents +either scoped or afterwards cancelled with \cs{@glsxtrnotinmark} and +\cs{glsxtrrestoremarkhook}. + +If you don't revert the mark commands back with +\cs{glsxtrRevertMarks}, you can use the commands described below in +the argument of sectioning commands. You can still use them even +if the mark commands have been reverted, but only where they don't +conflict with the page style. + +The commands listed below all use \ics{texorpdfstring} if +\sty{hyperref} has been loaded so that the expandable non-formatted +version is added to the PDF bookmarks. Note that since the commands +that convert the first letter to upper case aren't expandable, the +non-case-changing version is used for the bookmarks. + +These commands essentially behave as though you have used +\cs{glsxtrshort} (or equivalent) with the options +\gloskey[glslink]{noindex} and \gloskey[glslink]{hyper\eq false}. +The text produced won't be converted to upper case in the page +headings by default. If you want the text converted to upper case +you need to set the \catattr{headuc} attribute to \qt{true} +for the appropriate category. + +\begin{important} +If you use one of the \ics{textsc} styles, be aware that the default +fonts don't provide bold small-caps or italic small-caps. This +means that if the chapter or section title style uses bold, this +may override the small-caps setting, in which case the abbreviation +will just appear as lower case bold. If the heading style uses +italic, the abbreviation may appear in upright small-caps, +\emph{even if you have set the \catattr{headuc} attribute} since +the all-capitals form still uses \cs{glsabbrvfont}. +You may want to consider using the \sty{slantsc} package in this +case. +\end{important} + +Display the short form: +\begin{definition}[\DescribeMacro\glsfmtshort] +\cs{glsfmtshort}\marg{label} +\end{definition} + +Display the plural short form: +\begin{definition}[\DescribeMacro\glsfmtshortpl] +\cs{glsfmtshortpl}\marg{label} +\end{definition} + +First letter upper case singular short form: +\begin{definition}[\DescribeMacro\Glsfmtshort] +\cs{Glsfmtshort}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +First letter upper case plural short form: +\begin{definition}[\DescribeMacro\Glsfmtshortpl] +\cs{Glsfmtshortpl}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +Display the long form: +\begin{definition}[\DescribeMacro\glsfmtlong] +\cs{glsfmtlong}\marg{label} +\end{definition} + +Display the plural long form: +\begin{definition}[\DescribeMacro\glsfmtlongpl] +\cs{glsfmtlongpl}\marg{label} +\end{definition} + +First letter upper case singular long form: +\begin{definition}[\DescribeMacro\Glsfmtlong] +\cs{Glsfmtlong}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +First letter upper case plural long form: +\begin{definition}[\DescribeMacro\Glsfmtlongpl] +\cs{Glsfmtlongpl}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +There are similar commands for the full form, but note that these +use the \emph{inline} full form, which may be different from the +full form used by \cs{gls}. + +Display the full form: +\begin{definition}[\DescribeMacro\glsfmtfull] +\cs{glsfmtfull}\marg{label} +\end{definition} + +Display the plural full form: +\begin{definition}[\DescribeMacro\glsfmtfullpl] +\cs{glsfmtfullpl}\marg{label} +\end{definition} + +First letter upper case singular full form: +\begin{definition}[\DescribeMacro\Glsfmtfull] +\cs{Glsfmtfull}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +First letter upper case plural full form: +\begin{definition}[\DescribeMacro\Glsfmtfullpl] +\cs{Glsfmtfullpl}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +There are also equivalent commands for the value of the +\gloskey{text} field: +\begin{definition}[\DescribeMacro\glsfmttext] +\cs{glsfmttext}\marg{label} +\end{definition} + +First letter converted to upper case: +\begin{definition}[\DescribeMacro\Glsfmttext] +\cs{Glsfmttext}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +The plural equivalents: +\begin{definition}[\DescribeMacro\glsfmtplural] +\cs{glsfmtplural}\marg{label} +\end{definition} +and +\begin{definition}[\DescribeMacro\Glsfmtplural] +\cs{Glsfmtplural}\marg{label} +\end{definition} + +Likewise for the value of the +\gloskey{name} field: +\begin{definition}[\DescribeMacro\glsfmtname] +\cs{glsfmtname}\marg{label} +\end{definition} + +First letter converted to upper case: +\begin{definition}[\DescribeMacro\Glsfmtname] +\cs{Glsfmtname}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +Similarly for the value of the +\gloskey{first} field: +\begin{definition}[\DescribeMacro\glsfmtfirst] +\cs{glsfmtfirst}\marg{label} +\end{definition} + +First letter converted to upper case: +\begin{definition}[\DescribeMacro\Glsfmtfirst] +\cs{Glsfmtfirst}\marg{label} +\end{definition} +(No case-change applied to PDF bookmarks.) + +The plural equivalents: +\begin{definition}[\DescribeMacro\glsfmtfirstpl] +\cs{glsfmtfirstpl}\marg{label} +\end{definition} +and +\begin{definition}[\DescribeMacro\Glsfmtfirstpl] +\cs{Glsfmtfirstpl}\marg{label} +\end{definition} + +\chapter{Categories} +\label{sec:categories} + +Each entry defined by \ics{newglossaryentry} (or commands that +internally use it such as \ics{newabbreviation}) +is assigned a category +through the \gloskey{category} key. You may add any category that +you like, but since the category is a label used in the creation +of some control sequences, avoid problematic characters within the +category label. (So take care if you have \sty{babel} shorthands on +that make some characters active.) + +The use of categories can give you more control over the way entries +are displayed in the text or glossary. Note that an entry's category +is independent of the glossary type. Be careful not to confuse +\gloskey{category} with \gloskey{type}. + +The default category assumed by +\cs{newglossaryentry} is labelled \category{general}. Abbreviations +defined with \cs{newabbreviation} have the category set to +\category{abbreviation} by default. Abbreviations defined with +\cs{newacronym} have the category set to \category{acronym} by +default. + +Additionally, if you have enabled \ics{newterm} with the +\pkgopt{index} package option that command +will set the category to \category{index} by default. If you have +enabled \ics{glsxtrnewsymbol} with the \pkgopt{symbols} package +option, that command will set the category to \category{symbol}. If you have +enabled \ics{glsxtrnewnumber} with the \pkgopt{numbers} package +option, that command will set the category to \category{number}. + +You can obtain the category label for a given entry using +\begin{definition}[\DescribeMacro\glscategory] +\cs{glscategory}\marg{label} +\end{definition} +This is equivalent to commands like \cs{glsentryname} and so may be +used in an expandable context. No error is generated if the entry +doesn't exist. + +You can test the category for a given entry using +\begin{definition}[\DescribeMacro\glsifcategory] +\cs{glsifcategory}\marg{entry-label}\marg{category-label}\marg{true +part}\marg{false part} +\end{definition} +This is equivalent to +\begin{alltt} +\ics{ifglsfieldeq}\marg{entry-label}\{category\}\marg{category-label}\marg{true +part}\marg{false part} +\end{alltt} +so any restrictions that apply to \cs{ifglsfieldeq} also apply to +\cs{glsifcategory}. + +Each category may have a set of attributes. For example, the +\category{general} and \category{acronym} categories have the +attribute \catattr{regular} set to \qt{true} to indicate that all +entries with either of those categories are regular entries (as +opposed to abbreviations). This attribute is accessed by +\cs{glsentryfmt} to determine whether to use \cs{glsgenentryfmt} or +\cs{glsxtrgenabbrvfmt}. + +Other attributes recognised by \styfmt{glossaries-extra} are: + +\begin{description} + +\item[\catattrdef{nohyperfirst}] When using commands like \ics{gls} +this will automatically suppress the hyperlink on \gls{firstuse} for entries with a +category that has this attribute set to \qt{true}. +(This settings can be overridden by explicitly setting +the \gloskey[glslink]{hyper} key on or off in the optional argument of +commands like \cs{gls}.) As from version 1.07, \cs{glsfirst}, +\cs{Glsfirst}, \cs{GLSfirst} and their plural versions (which should ideally +behave in a similar way to the \gls{firstuse} of \cs{gls} or +\cs{glspl}) now honour +this attribute (but not the package-wide \pkgopt[false]{hyperfirst} +option, which matches the behaviour of \sty{glossaries}). If you +want commands like \cs{glsfirst} to ignore the +\catattr{nohyperfirst} attribute then just redefine +\begin{definition}[\DescribeMacro\glsxtrchecknohyperfirst] +\cs{glsxtrchecknohyperfirst}\marg{label} +\end{definition} +to do nothing. + +\item[\catattrdef{nohyper}] When using commands like \ics{gls} +this will automatically suppress the hyperlink for entries with a +category that has this attribute set to \qt{true}. +(This settings can be overridden by explicitly setting +the \gloskey[glslink]{hyper} key on or off in the optional argument of +commands like \cs{gls}.) + +\item[\catattrdef{indexonlyfirst}] This is similar to the +\pkgopt{indexonlyfirst} package option but only for entries +that have a category with this attribute set to \qt{true}. + +\item[\catattrdef{wrgloss}] When using commands like \ics{gls}, +if this attribute is set to \qt{after}, it will automatically +implement \gloskey[glslink]{wrgloss}\optfmt{=after}. (New to v1.14.) + +\item[\catattrdef{discardperiod}] If set to \qt{true}, the +post-\gls{linktext} hook will +discard a~full stop (period) that follows \emph{non-plural} commands like \cs{gls} or +\cs{glstext}. (Provided for entries such as abbreviations that end +with a full stop.) This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) This attribute +doesn't apply to the accessibility fields. + +Note that this can cause a problem if you access a field that +doesn't end with a full stop. For example: +\begin{verbatim} +\newabbreviation + [user1={German Speaking \TeX\ User Group}] + {dante}{DANTE e.V.}{Deutschsprachige Anwendervereinigung \TeX\ +e.V.} +\end{verbatim} +Here the \gloskey{short} and \gloskey{long} fields end with a full stop, but the +\gloskey{user1} field doesn't. The simplest solution in this +situation is to put the sentence terminator in the final optional +argument. For example: +\begin{verbatim} +\glsuseri{dante}[.] +\end{verbatim} +This will bring the punctuation character inside the \gls{linktext} +and it won't be discarded. + +\item[\catattrdef{pluraldiscardperiod}] If this attribute is set to +\qt{true} \emph{and} the \catattr{discardperiod} attribute is set to +\qt{true}, this will behave as above for the plural commands like +\cs{glspl} or \cs{glsplural}. This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\item[\catattrdef{retainfirstuseperiod}] If this attribute is set +to \qt{true} then the full stop won't be discarded for +\gls{firstuse} instances, even if \catattr{discardperiod} or +\catattr{pluraldiscardperiod} are set. This is useful for +\meta{short} (\meta{long}) abbreviation styles where only the short +form has a trailing full stop. This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) This attribute doesn't apply to the +accessibility fields. + +\item[\catattrdef{markwords}] If this attribute is set to \qt{true} +any entry defined using \ics{newabbreviation} will automatically +have spaces in the long form replaced with +\begin{definition}[\DescribeMacro\glsxtrwordsep] +\cs{glsxtrwordsep} +\end{definition} +and each word is encapsulated with +\begin{definition}[\DescribeMacro\glsxtrword] +\cs{glsxtrword}\marg{word} +\end{definition} +For example: +\begin{verbatim} +\glssetcategoryattribute{abbreviation}{markwords}{true} +\newabbreviation{ip}{IP}{Internet Protocol} +\end{verbatim} +is essentially the same as +\begin{verbatim} +\newabbreviation{ip}{IP} +{\glsxtrword{Internet}\glsxtrwordsep\glsxtrword{Protocol}} +\end{verbatim} +The \qt{hyphen} styles, such as +\abbrstyle{long-hyphen-short-hyphen}, take advantage of this +markup. If the inserted material (provided in the final argument +of commands like \ics{gls}) starts with a hyphen then +\cs{glsxtrwordsep} is locally redefined to a hyphen. (The default +value is a space). Note that this only applies to commands +like \cs{gls} and not like \cs{glsxtrlong}. You can provide your own +localised switch, if required. For example: +\begin{verbatim} +\newcommand{\hyplong}[2][]{% + {\def\glsxtrwordsep{-}\glsxtrlong[#1]{#2}}} +\end{verbatim} + +This setting will also adjust the long plural. This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\begin{important} +This setting may result in the +\cs{glsxtrword} and \cs{glsxtrwordsep} markup ending up in the +\gloskey{sort} field, depending on the style in use. +\end{important} + +\item[\catattrdef{markshortwords}] This is similar to +\catattr{markwords} but applies to the short form. (Only useful for +abbreviations that contain spaces.) This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +This setting will only adjust the short plural if the +\gloskey{shortplural} key isn't used. This setting will +take precedence over \catattr{insertdots}. + +\begin{important} +This setting may result in the +\cs{glsxtrword} and \cs{glsxtrwordsep} markup ending up in the +\gloskey{sort} field, depending on the style in use. +\end{important} + +\item[\catattrdef{insertdots}] If this attribute is set to \qt{true} +any entry defined using \ics{newabbreviation} will automatically +have full stops (periods) inserted after each letter. The entry will +be defined with those dots present as though they had been present +in the \meta{short} argument of \cs{newabbreviation} (rather than +inserting them every time the entry is used). The short plural +form defaults to the new dotted version of the original \meta{short} +form with the plural suffix appended. \emph{This setting is incompatible +with \catattr{markshortwords}.} This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\begin{important} +If you explicitly override +the short plural using the \gloskey{shortplural} key, you must +explicitly insert the dots yourself (since there's no way for the +code to determine if the plural has a suffix that shouldn't be +followed by a dot). +\end{important} + +This attribute is best used with the \catattr{discardperiod} +attribute set to \qt{true}. + +\item[\catattrdef{aposplural}] If this attribute is set to \qt{true}, +\ics{newabbreviation} will insert an apostrophe (') before +the plural suffix for the \emph{short} plural form (unless explicitly +overridden with the \gloskey{shortplural} key). The long plural form +is unaffected by this setting. This setting overrides +\catattr{noshortplural}. This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) Check with your supervisor, publisher or +editor if you want to use this attribute as this +usage is controversial. + + +\item[\catattrdef{noshortplural}] If this attribute is set to +\qt{true}, \ics{newabbreviation} won't append the plural suffix for +the short plural form. This means the \gloskey{short} and +\gloskey{shortplural} values will be the same unless explicitly +overridden. \emph{This setting is incompatible with \catattr{aposplural}.} This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\item[\catattrdef{accessinsertdots}] If this attribute is set to +\qt{true} and the \sty{glossaries-accsupp} package has been loaded +(with the \pkgopt{accsupp} option), then this behaves like +\catattr{insertdots} but for the \gloskey{shortaccess} field instead +of the \gloskey{short} field. This can be used to assist the +screen reader for initialisms that should be read out letter by +letter rather than as a word. For example: +\begin{verbatim} +\glssetcategoryattribute{initialism}{accessinsertdots}{true} + +\newabbreviation[category=initialism]{pi}{PI}{Private Investigator} +\end{verbatim} +This setting will be overridden by an explicit use of +the \gloskey{shortaccess} key in the optional argument +of \cs{newabbreviation} (or \cs{newacronym}). This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\item[\catattrdef{nameshortaccess}] If this attribute is set to +\qt{true}, the \gloskey{access} field (used for the \gloskey{name} +field's accessibility support) is set to the \gloskey{shortaccess} +value. This attribute has no effect if there's no accessibility +support or if the \gloskey{shortaccess} field hasn't been assigned +or if the \gloskey{access} field is used explicitly. This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\item[\catattrdef{textshortaccess}] Like \gloskey{nameshortaccess} +but applies to the \gloskey{textaccess} field (for use with +regular abbreviations). + +\item[\catattrdef{firstshortaccess}] Like \gloskey{nameshortaccess} +but applies to the \gloskey{firstaccess} field (for use with +regular abbreviations). + +\item[\catattrdef{accessaposplural}] This boolean attribute overrides +\catattr{aposplural} for the \gloskey{shortpluralaccess} key. +Has no effect if there's no accessibility support or if +the \gloskey{shortaccess} key hasn't been set or if the +\gloskey{shortpluralaccess} key is explicitly set. If +the \catattr{aposplural} is set and this attribute isn't set +and the \gloskey{shortaccess} key is set, then the +\catattr{aposplural} setting governs the default +\gloskey{shortpluralaccess} setting. If you want +\catattr{aposplural} but don't want it applied to the accessibility +support, set the \catattr{accessaposplural} attribute to \qt{false}. This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\item[\catattrdef{accessnoshortplural}] This boolean attribute overrides +\catattr{noshortplural} for the \gloskey{shortpluralaccess} key. +The same conditions apply as for \catattr{accessaposplural}. This attribute is only applicable to entries +defined using \cs{newabbreviation} (or \cs{newacronym} if it's using +\cs{newabbreviation}.) + +\item[\catattrdef{headuc}] If this attribute is set to \qt{true}, +commands like \ics{glsfmtshort} will use the upper case version +in the page headers. + +\item[\catattrdef{tagging}] If this attribute is set to \qt{true}, +the tagging command defined by \ics{GlsXtrEnableInitialTagging} +will be activated to use \ics{glsxtrtagfont} in the glossary +(see \sectionref{sec:tagging}). + +\item[\catattrdef{entrycount}] Unlike the above attributes, +this attribute isn't boolean but instead must be an integer +value and is used in combination with \ics{glsenableentrycount} +(see \sectionref{sec:entrycountmods}). Leave blank or undefined +for categories that shouldn't have this facility enabled. The +value of this attribute is used by \ics{glsxtrifcounttrigger} +to determine how commands such as \ics{cgls} should behave. + +With \styfmt{glossaries}, commands like \cs{cgls} use \cs{cglsformat} +only if the previous usage count for that entry was equal to~1. +With \styfmt{glossaries-extra} the test is now for entries that +have the \catattr{entrycount} attribute set and +where the previous usage count for that entry is less than or +equal to the value of that attribute. + +\item[\catattrdef{linkcount}] This attribute is set to +\texttt{true} by \ics{GlsXtrEnableLinkCounting} (see +\sectionref{sec:linkcount}). + +\item[\catattrdef{linkcountmaster}] This attribute is set to +the name of the master counter by \ics{GlsXtrEnableLinkCounting} +if the optional argument is provided (see +\sectionref{sec:linkcount}). + +\item[\catattrdef{glossdesc}] The \ics{glossentrydesc} command +(used in the predefined glossary styles) is modified by +\styfmt{glossaries-extra} to check for this attribute. +The attribute may have one of the following values: +\begin{itemize} +\item \texttt{firstuc}: the first letter of the description will be +converted to upper case (using \ics{Glsentrydesc}). + +\item \texttt{title}: the description will be used in the argument of the +title casing command \ics{capitalisewords} (provided by +\sty{mfirstuc}). If you want to use a different command +you can redefine: +\begin{definition}[\DescribeMacro\glsxtrfieldtitlecasecs] +\cs{glsxtrfieldtitlecasecs}\marg{phrase cs} +\end{definition} +For example: +\begin{verbatim} +\newcommand*{\glsxtrfieldtitlecasecs}[1]{\xcapitalisefmtwords*{#1}} +\end{verbatim} +(Note that the argument to \cs{glsxtrfieldtitlecasecs} +will be a control sequence whose replacement text is the +entry's description, which is why \cs{xcapitalisefmtwords} +is needed instead of \cs{capitalisefmtwords}.) + +\end{itemize} +Any other values of this attribute are ignored. Remember +that there are design limitations for both the first letter +uppercasing and the title casing commands. See the \sty{mfirstuc} +user manual for further details. + +\item[\catattrdef{glossdescfont}] (New to version 1.04) +In addition to the above, the modified \ics{glossentrydesc} +command also checks this attribute. If set, it should be the name of +a control sequence (without the leading backslash) that takes one +argument. This control sequence will be applied to the description +text. For example: +\begin{verbatim} +\glssetcategoryattribute{general}{glossdescfont}{emph} +\end{verbatim} + + +\item[\catattrdef{glossname}] As \catattr{glossdesc} but applies +to \ics{glossentryname}. Additionally, if this attribute is +set to \qt{uc} the name is converted to all capitals. + +\item[\catattrdef{indexname}] If set, the \cs{glsxtrpostnamehook} hook +used at the end of \ics{glossentryname} +will index the entry using \ics{index}. See +\sectionref{sec:autoindex} for further details. + +\item[\catattrdef{glossnamefont}] (New to version 1.04) +In addition to the above, the modified \ics{glossentryname} +command also checks this attribute. If set, it should be the name of +a control sequence (without the leading backslash) that takes one +argument. This control sequence will be applied to the name +text. For example: +\begin{verbatim} +\glssetcategoryattribute{general}{glossnamefont}{emph} +\end{verbatim} +Note that this overrides \cs{glsnamefont} which will only +be used if this attribute hasn't been set. + +Remember that glossary styles may additionally apply a font change, +such as the list styles which put the name in the optional argument +of \cs{item}. + +\item[\catattrdef{textformat}] (New to version 1.21.) +Commands like \cs{gls} and \cs{glstext} have the link text +encapsulated in the argument of \cs{glstextformat} by default. If +this attribute is set, the control sequence given by the attribute +value will be used instead. As with the above, the attribute value +should be the name (without the leading backslash) of a command that +takes a single argument (the link text). Remember that the +abbreviation styles may apply an additional font change. + +\item[\catattrdef{hyperoutside}] (New to v1.21.) The attribute value +may be \texttt{false}, \texttt{true} or unset. If unset, +\texttt{true} is assumed. This indicates the default setting +of the \gloskey[glslink]{hyperoutside} key, described in +\sectionref{sec:wrglossary}. + +\item[\catattrdef{dualindex}] If set, whenever a glossary entry +has information written to the external glossary file +through commands like \ics{gls} and \ics{glsadd}, a~corresponding +line will be written to the indexing file using \ics{index}. See +\sectionref{sec:autoindex} for further details. + +\item[\catattrdef{targeturl}] If set, the hyperlink generated by +commands like \cs{gls} will be set to the URL provided by this +attributes value. For example: +\begin{verbatim} +\glssetcategoryattribute{general}{targeturl}{master-doc.pdf} +\end{verbatim} +(See also the accompanying sample file +\texttt{sample-external.tex}.) If the URL contains awkward +characters (such as \verb|%| or \verb|~|) remember that the base +\styfmt{glossaries} package provides commands like +\ics{glspercentchar} and \cs{glstildechar} that expand to literal +characters. + +If you want to a named anchor within the target URL (notionally +adding \texttt{\#}\meta{name} to the URL), then you also +need to set \catattr{targetname} to the anchor \meta{name}. You may +use \cs{glslabel} within \meta{name} which is set by commands +like \cs{gls} to the entry's label. + +All the predefined glossary styles start each entry +listing with \cs{glstarget} which sets the anchor to +\verb|\glolinkprefix\glslabel|, so if you want entries to link +to glossaries in the URL given by \catattr{targeturl}, you +can just do: +\begin{verbatim} +\glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel} +\end{verbatim} +(If the target document changed \cs{glolinkprefix} then you will +need to adjust the above as appropriate.) + +If the anchor is in the form \meta{name1}\texttt{.}\meta{name2} +then use \catattr{targetname} for the \meta{name2} part and +\catattr{targetcategory} for the \meta{name1} part. + +For example: +\begin{verbatim} +\glssetcategoryattribute{general}{targeturl}{master-doc.pdf} +\glssetcategoryattribute{general}{targetcategory}{page} +\glssetcategoryattribute{general}{targetname}{7} +\end{verbatim} +will cause all link text for \texttt{general} entries to +link to \texttt{master-doc.pdf\#page.7} (page 7 of that PDF). + +If you want a mixture in your document of entries that link to +an internal glossary and entries that link to an external URL +then you can use the starred form of \ics{newignoredglossary} +for the external list. For example: +\begin{verbatim} +\newignoredglossary*{external} + +\glssetcategoryattribute{external}{targeturl}{master-doc.pdf} +\glssetcategoryattribute{general}{targetname}{\glolinkprefix\glslabel} + +\newglossaryentry{sample}{name={sample},description={local example}} + +\newglossaryentry{sample2}{name={sample2}, + type=external, + category=external, + description={external example}} +\end{verbatim} + +\item[\catattrdef{externallocation}] The value should be the +file name of the target document when manually indexing an +external location (see \sectionref{sec:wrglossary}). In general, +it's better to use \gls{bib2gls} v1.7+ which can handle multiple +external sources and doesn't require this attribute. + +\end{description} + +An attribute can be set using: +\begin{definition}[\DescribeMacro\glssetcategoryattribute] +\cs{glssetcategoryattribute}\marg{category-label}\marg{attribute-label}\marg{value} +\end{definition} +where \meta{category-label} is the category label, +\meta{attribute-label} is the attribute label and \meta{value} is +the new value for the attribute. + +There is a shortcut version to set the \catattr{regular} attribute +to \qt{true}: +\begin{definition}[\DescribeMacro\glssetregularcategory] +\cs{glssetregularcategory}\marg{category-label} +\end{definition} + +If you need to lookup the category label for a particular entry, you +can use the shortcut command: +\begin{definition}[\DescribeMacro\glssetattribute] +\cs{glssetattribute}\marg{entry-label}\marg{attribute-label}\marg{value} +\end{definition} +This uses \cs{glssetcategoryattribute} with \cs{glscategory} to set +the attribute. Note that this will affect all other entries that +share this entry's category. + +You can fetch the value of an attribute for a particular category +using: +\begin{definition}[\DescribeMacro\glsgetcategoryattribute] +\cs{glsgetcategoryattribute}\marg{category-label}\marg{attribute-label} +\end{definition} +Again there is a shortcut if you need to lookup the category label +for a given entry: +\begin{definition}[\DescribeMacro\glsgetattribute] +\cs{glsgetattribute}\marg{entry-label}\marg{attribute-label} +\end{definition} + +You can test if an attribute has been assigned to a given +category using: +\begin{definition}[\DescribeMacro\glshascategoryattribute] +\cs{glshascategoryattribute}\marg{category-label}\marg{attribute-label}\marg{true +code}\marg{false code} +\end{definition} +This uses \sty{etoolbox}'s +\cs{ifcsvoid} and does \meta{true code} if the attribute has been +set and isn't blank and isn't \cs{relax}. The shortcut if you need +to lookup the category label from an entry is: +\begin{definition}[\DescribeMacro\glshasattribute] +\cs{glshasattribute}\marg{entry-label}\marg{attribute-label}\marg{true +code}\marg{false code} +\end{definition} + +You can test the value of an attribute for a particular category +using: +\begin{definition}[\DescribeMacro\glsifcategoryattribute] +\cs{glsifcategoryattribute}\marg{category-label}\marg{attribute-label}\marg{value} \marg{true-part}\marg{false-part} +\end{definition} +This tests if the attribute (given by \meta{attribute-label}) for +the category (given by \meta{category-label}) is set and equal to +\meta{value}. If true, \meta{true-part} is done. If the attribute +isn't set or is set but isn't equal to \meta{value}, \meta{false +part} is done. + +For example: +\begin{verbatim} +\glsifcategoryattribute{general}{nohyper}{true}{NO HYPER}{HYPER} +\end{verbatim} +This does \qt{NO HYPER} if the \category{general} category has the +\catattr{nohyper} attribute set to \texttt{true} otherwise if +does \qt{HYPER}. + +With boolean-style attributes like \catattr{nohyper}, make sure you +always test for \texttt{true} not \texttt{false} in case the attribute hasn't been set. + +Again there's a shortcut if you need to lookup the category label +from a particular entry: +\begin{definition}[\DescribeMacro\glsifattribute] +\cs{glsifattribute}\marg{entry-label}\marg{attribute-label}\marg{value}\marg{true-part} \marg{false-part} +\end{definition} + +There's also a shortcut to determine if a particular category has +the \catattr{regular} attribute set to \qt{true}: +\begin{definition}[\DescribeMacro\glsifregularcategory] +\cs{glsifregularcategory}\marg{category-label}\marg{true-part}\marg{false-part} +\end{definition} +Alternatively, if you need to lookup the category for a particular +entry: +\begin{definition}[\DescribeMacro\glsifregular] +\cs{glsifregular}\marg{entry-label}\marg{true-part}\marg{false-part} +\end{definition} +Note that if the \catattr{regular} attribute hasn't be set, the +above do \meta{false-part}. There are also reverse commands that +test if the \catattr{regular} attribute has been set to \qt{false}: +\begin{definition}[\DescribeMacro\glsifnotregularcategory] +\cs{glsifnotregularcategory}\marg{category-label}\marg{true-part}\marg{false-part} +\end{definition} +or for a particular entry: +\begin{definition}[\DescribeMacro\glsifnotregular] +\cs{glsifnotregular}\marg{entry-label}\marg{true-part}\marg{false-part} +\end{definition} +Again, if the \catattr{regular} attribute hasn't been set, the above +do \meta{false-part}, so these reverse commands aren't logically +opposite in the strict sense. + +You can iterate through all entries with a given category using: +\begin{definition} +\cs{glsforeachincategory}\oarg{glossary-labels}\marg{category-label} \marg{glossary-cs}\marg{label-cs}\marg{body} +\end{definition} +This iterates through all entries in the glossaries identified by +the comma-separated list \meta{glossary-labels} that have the +category given by \meta{category-label} and performs \meta{body} for +each match. Within \meta{body}, you can use \meta{glossary-cs} and +\meta{label-cs} +(which much be control sequences) to access the current glossary and +entry label. If \meta{glossary-labels} is omitted, all glossaries +are assumed. + +Similarly, you can iterate through all entries that have a category +with a given attribute using: +\begin{definition}[\DescribeMacro\glsforeachwithattribute] +\cs{glsforeachwithattribute}\oarg{glossary-labels}\marg{attribute-label} \marg{attribute-value}\marg{glossary-cs}\marg{label-cs}\marg{body} +\end{definition} +This will do \meta{body} for each entry that has a category with the +attribute \meta{attribute-label} set to \meta{attribute-value}. +The remaining arguments are as the previous command. + +You can change the category for a particular entry using the +standard glossary field changing commands, such as +\ics{glsfielddef}. Alternatively, you can use +\begin{definition}[\DescribeMacro\glsxtrsetcategory] +\cs{glsxtrsetcategory}\marg{entry-labels}\marg{category-label} +\end{definition} +This will change the category to \meta{category-label} for each +entry listed in the comma-separated list \meta{entry-labels}. This +command uses \ics{glsfieldxdef} so it will expand +\meta{category-label} and make the change global. + +You can also change the category for all entries with a glossary or +glossaries using: +\begin{definition}[\DescribeMacro\glsxtrsetcategoryforall] +\cs{glsxtrsetcategoryforall}\marg{glossary-labels}\marg{category-label} +\end{definition} +where \meta{glossary-labels} is a comma-separated list of glossary +labels. + +\chapter{Counting References} +\label{sec:countref} + +There are three basic ways of counting entry references: +\begin{enumerate} +\item Counting the total number of times \cs{glsunset} is used +(\cs{glsreset} resets the count and is best avoided). +This is provided by the base \styfmt{glossaries} package and is +intended for documents where the term should be displayed +differently if it's only been used a certain number of times. +The information has to be written to the \texttt{.aux} file +so that it's available on the next \LaTeX\ run. + +This method is extended by \styfmt{glossaries-extra} and is +described in \sectionref{sec:entrycount}. + +\item Counting the total number of records. This method is +only available with \gls{bib2gls} and is intended +for documents where the term should be displayed differently +if it's only been recorded (indexed) a certain number of times. +See \sectionref{sec:recordcount} for further details. + +\item Counting the number of times the \cs{gls}-like or +\cs{glstext}-like commands are used. (That is, those commands +that internally use \cs{@gls@link}.) Unlike the other two methods, +this just provides a running total rather than the total from the +previous \LaTeX\ run. This method is intended to make it more +convenient to work with hooks like \cs{glslinkcheckfirsthyperhook}, +\cs{glslinkpostsetkeys} or \cs{glslinkpresetkeys}. +See \sectionref{sec:linkcount} for further details. +\end{enumerate} + +\section{Entry Counting (First Use Flag)} +\label{sec:entrycount} + +As mentioned in \sectionref{sec:entrycountmods}, +\styfmt{glossaries-extra} modifies the \ics{glsenableentrycount} command to allow +for the \catattr{entrycount} attribute. This means that +you not only need to enable entry counting with +\ics{glsenableentrycount}, but you also need +to set the appropriate attribute (see \sectionref{sec:categories}). + +\begin{important} +Remember that entry counting only counts the number of times an +entry is used by commands that change the \gls{firstuseflag}. (That +is, all those commands that mark the entry as having been used.) +There are many commands that don't modify this flag and they won't +contribute to the entry use count. +\end{important} + +With \styfmt{glossaries-extra}, you may use \ics{cgls} instead of +\ics{gls} even if you haven't enabled entry counting. You will only +get a warning if you use \cs{glsenableentrycount} without setting +the \catattr{entrycount} attribute. (With \styfmt{glossaries}, +commands like \ics{cgls} will generate a warning if +\cs{glsenableentrycount} hasn't been used.) The abbreviation +shortcut \ics{ab} uses \cs{cgls} (see +\sectionref{sec:abbrshortcuts}). The acronym shortcut +\ics{ac} uses \cs{cgls} if it's been defined with +\pkgopt[ac]{shortcuts} (or \pkgopt[all]{shortcuts}) +but uses \cs{gls} if it's been defined with +\pkgopt[acronyms]{shortcuts} (or \pkgopt[acro]{shortcuts}). + +All upper case versions (not provided by \styfmt{glossaries}) are +also available: +\begin{definition}[\DescribeMacro\cGLS] +\cs{cGLS}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +and +\begin{definition}[\DescribeMacro\cGLSpl] +\cs{cGLSpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +These are analogous to \cs{cgls} and \cs{cglspl} but they +use +\begin{definition}[\DescribeMacro\cGLSformat] +\cs{cGLSformat}\marg{label}\marg{insert} +\end{definition} +and +\begin{definition}[\DescribeMacro\cGLSplformat] +\cs{cGLSplformat}\marg{label}\marg{insert} +\end{definition} +which convert the analogous \cs{cglsformat} and +\cs{cglsplformat} to upper case. + +Just using \styfmt{glossaries}: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsenableentrycount + +\newacronym{html}{HTML}{hypertext markup language} +\newacronym{xml}{XML}{extensible markup language} + +\begin{document} + +Used once: \cgls{html}. + +Used twice: \cgls{xml} and \cgls{xml}. + +\printglossaries + +\end{document} +\end{verbatim} + +If you switch to \styfmt{glossaries-extra} you must set the +\catattr{entrycount} attribute: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries-extra} + +\makeglossaries + +\glsenableentrycount + +\glssetcategoryattribute{abbreviation}{entrycount}{1} + +\newabbreviation{html}{HTML}{hypertext markup language} +\newabbreviation{xml}{XML}{extensible markup language} + +\begin{document} + +Used once: \cgls{html}. + +Used twice: \cgls{xml} and \cgls{xml}. + +\printglossaries + +\end{document} +\end{verbatim} + +When activated with \cs{glsenableentrycount}, commands such as +\ics{cgls} now use +\begin{definition}[\DescribeMacro\glsxtrifcounttrigger] +\cs{glsxtrifcounttrigger}\marg{label}\marg{trigger code}\marg{normal +code} +\end{definition} +to determine if the entry trips the entry count trigger. +The \meta{trigger code} uses commands like \cs{cglsformat} and +unsets the \gls{firstuseflag}. The \meta{normal code} is the code that +would ordinarily be performed by whatever the equivalent +command is (for example, \cs{cgls} will use \cs{cglsformat} in +\meta{trigger code} but the usual \cs{gls} behaviour in \meta{normal +code}). + +The default definition is: +\begin{verbatim} +\newcommand*{\glsxtrifcounttrigger}[3]{% + \glshasattribute{#1}{entrycount}% + {% + \ifnum\glsentryprevcount{#1}>\glsgetattribute{#1}{entrycount}\relax + #3% + \else + #2% + \fi + }% + {#3}% +} +\end{verbatim} +This means that if an entry is assigned to a category that has +the \catattr{entrycount} attribute then the \meta{trigger code} +will be used if the previous count value +(the number of times the entry was used on the last run) is greater +than the value of the attribute. + +For example, to trigger normal use if the previous count value +is greater than four: +\begin{verbatim} +\glssetcategoryattribute{abbreviation}{entrycount}{4} +\end{verbatim} + +There is a convenient command provided to enable entry counting, +set the \catattr{entrycount} attribute and redefine \ics{gls}, +etc to use \ics{cgls} etc: +\begin{definition}[\DescribeMacro\GlsXtrEnableEntryCounting] +\cs{GlsXtrEnableEntryCounting}\marg{categories}\marg{value} +\end{definition} +The first argument \meta{categories} is a comma-separated list +of categories. For each category, the \catattr{entrycount} +attribute is set to \meta{value}. In addition, this does: +\begin{verbatim} +\renewcommand*{\gls}{\cgls}% +\renewcommand*{\Gls}{\cGls}% +\renewcommand*{\glspl}{\cglspl}% +\renewcommand*{\Glspl}{\cGlspl}% +\renewcommand*{\GLS}{\cGLS}% +\renewcommand*{\GLSpl}{\cGLSpl}% +\end{verbatim} +This makes it easier to enable entry-counting on existing +documents. + +If you use \cs{GlsXtrEnableEntryCounting} more than once, subsequent uses will +just set the \catattr{entrycount} attribute for each listed +category. + +The above example document can then become: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries-extra} + +\makeglossaries + +\GlsXtrEnableEntryCounting{abbreviation}{1} + +\newabbreviation{html}{HTML}{hypertext markup language} +\newabbreviation{xml}{XML}{extensible markup language} + +\begin{document} + +Used once: \gls{html}. + +Used twice: \gls{xml} and \gls{xml}. + +\printglossaries + +\end{document} +\end{verbatim} + +The standard entry-counting function describe above counts +the number of times an entry has been marked as used throughout +the document. (The reset commands will reset the total back to +zero.) If you prefer to count per sectional-unit, you can +use +\begin{definition}[\DescribeMacro\GlsXtrEnableEntryUnitCounting] +\cs{GlsXtrEnableEntryUnitCounting}\marg{categories}\marg{value}\marg{counter-name} +\end{definition} +where \meta{categories} is a comma-separated list of categories +to which this feature should be applied, \meta{value} is the +trigger value and \meta{counter-name} is the name of the counter +used by the sectional unit. + +\begin{important} +Due to the asynchronous nature of \TeX's output routine, +discrepancies will occur in page spanning paragraphs if you +use the \ctr{page} counter. +\end{important} + +Note that you can't use both the document-wide counting and +the per-unit counting in the same document. + +The counter value is used as part of a label, which means +that \cs{the}\meta{counter-name} needs to be expandable. +Since \sty{hyperref} also has a similar requirement and provides +\cs{theH}\meta{counter-name} as an expandable alternative, +\styfmt{glossaries-extra} will use \cs{theH}\meta{counter-name} +if it exists otherwise it will use \cs{the}\meta{counter-name}. + +The per-unit counting function uses two attributes: \catattr{entrycount} +(as before) and \catattr{unitcount} (the name of the counter). + +Both the original document-wide counting mechanism and the +per-unit counting mechanism provide a command that can be +used to access the current count value for this run: +\begin{definition}[\DescribeMacro\glsentrycurrcount] +\cs{glsentrycurrcount}\marg{label} +\end{definition} +and the final value from the previous run: +\begin{definition}[\DescribeMacro\glsentryprevcount] +\cs{glsentryprevcount}\marg{label} +\end{definition} +In the case of the per-unit counting, this is the final value +\emph{for the current unit}. In both commands \meta{label} +is the entry's label. + +The per-unit counting mechanism additionally provides: +\begin{definition}[\DescribeMacro\glsentryprevtotalcount] +\cs{glsentryprevtotalcount}\marg{label} +\end{definition} +which gives the sum of all the per-unit totals from the previous run +for the entry given by \meta{label}, and +\begin{definition}[\DescribeMacro\glsentryprevmaxcount] +\cs{glsentryprevmaxcount}\marg{label} +\end{definition} +which gives the maximum per-unit total from the previous run. + +The above two commands are unavailable for the document-wide counting. + +Example of per-unit counting, where the unit is the chapter: +\begin{verbatim} +\documentclass{report} +\usepackage{glossaries-extra} + +\GlsXtrEnableEntryUnitCounting{abbreviation}{2}{chapter} + +\makeglossaries + +\newabbreviation{html}{HTML}{hypertext markup language} +\newabbreviation{css}{CSS}{cascading style sheet} + +\newglossaryentry{sample}{name={sample},description={sample}} + +\begin{document} +\chapter{Sample} + +Used once: \gls{html}. + +Used three times: \gls{css} and \gls{css} and \gls{css}. + +Used once: \gls{sample}. + +\chapter{Another Sample} + +Used once: \gls{css}. + +Used twice: \gls{html} and \gls{html}. + +\printglossaries +\end{document} +\end{verbatim} +In this document, the \texttt{css} entry is used three times in the +first chapter. This is more than the trigger value of 2, so +\verb|\gls{css}| is expanded on \gls{firstuse} with the short +form used on subsequent use, and the \texttt{css} entries in +that chapter are added to the glossary. In the second chapter, +the \texttt{css} entry is only used once, which trips the +suppression trigger, so in that chapter, the long form +is used and \verb|\gls{css}| doesn't get a line added to +the glossary file. + +The \texttt{html} is used a total of three times, but the +expansion and indexing suppression trigger is tripped +in both chapters because the per-unit total (1 for the first +chapter and 2 for the second chapter) is less than or equal +to the trigger value. + +The \texttt{sample} entry has only been used once, but it doesn't +trip the indexing suppression because it's in the \category{general} +category, which hasn't been listed in +\cs{GlsXtrEnableEntryUnitCounting}. + +The per-unit entry counting can be used for other purposes. +In the following example document the trigger value is set +to zero, which means the index suppression won't be triggered, +but the unit entry count is used to automatically suppress the +hyperlink for commands like \ics{gls} by modifying the +hook +\begin{definition}[\DescribeMacro\glslinkcheckfirsthyperhook] +\cs{glslinkcheckfirsthyperhook} +\end{definition} +which is used at the end of the macro the determines whether +or not to suppress the hyperlink. + +\begin{verbatim} +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\GlsXtrEnableEntryUnitCounting{general}{0}{page} + +\newglossaryentry{sample}{name={sample},description={an example}} + +\renewcommand*{\glslinkcheckfirsthyperhook}{% + \ifnum\glsentrycurrcount\glslabel>0 + \setkeys{glslink}{hyper=false}% + \fi +} + +\begin{document} + +A \gls{sample} entry. +Next use: \gls{sample}. + +\newpage + +Next page: \gls{sample}. +Again: \gls{sample}. + +\printglossaries + +\end{document} +\end{verbatim} +This only produces a hyperlink for the first instance of +\verb|\gls{sample}| on each page. + +The earlier warning about using the \ctr{page} counter still +applies. If the first instance of \cs{gls} occurs at the top of the +page within a paragraph that started on the previous page, then +the count will continue from the previous page. + +\section{Link Counting} +\label{sec:linkcount} + +As from version 1.26, an alternative method of entry counting +is to count the number of times the \cs{gls}-like or +\cs{glstext}-like commands are used. (The \qt{link} in this method's +name refers to the use of the internal command \cs{@gls@link} +not to \cs{hyperlink} although \cs{@gls@link} may use +\cs{hyperlink} when displaying the \gls{linktext}.) + +To enable link counting use the preamble-only command: +\begin{definition}[\DescribeMacro\GlsXtrEnableLinkCounting] +\cs{GlsXtrEnableLinkCounting}\oarg{master counter}\marg{categories} +\end{definition} +where \meta{categories} is a list of category labels. The optional +argument \meta{master counter} may be used to identify a master +counter (which must be defined). If present, the associated +link counter will be reset when the master counter is incremented. +This command automatically sets the \catattr{linkcount} attribute +for the given categories. If the optional argument is +present, it also sets the \catattr{linkcountmaster} attribute. + +When enabled, commands like \cs{gls} and \cs{glstext} +increment the associated counter using +\begin{definition}[\DescribeMacro\glsxtrinclinkcounter] +\cs{glsxtrinclinkcounter}\marg{counter name} +\end{definition} +This just does +\texttt{\cs{stepcounter}\marg{counter name}} by default but if you +need \cs{refstepcounter} instead, just redefine this command: +\begin{verbatim} +\renewcommand*{\glsxtrinclinkcounter}[1]{\refstepcounter{#1}} +\end{verbatim} + +You can access the internal count register using +\begin{definition}[\DescribeMacro\GlsXtrLinkCounterValue] +\cs{GlsXtrLinkCounterValue}\marg{label} +\end{definition} +where \meta{label} is the entry's label. This will expand +to 0 if the counter hasn't been defined. + +It's also possible to access the display value +(\cs{the}\meta{counter}) using +\begin{definition}[\DescribeMacro\GlsXtrTheLinkCounter] +\cs{GlsXtrTheLinkCounter}\marg{counter} +\end{definition} +(This will expand to 0 if the counter hasn't been defined.) + +\begin{important} +In order to conserve resources, the counter is only defined +when it first needs to be incremented so terms that have +been defined but haven't been used in the document +won't have the associated count register allocated. +\end{important} + +You can test if the counter has been defined using: +\begin{definition}[\DescribeMacro\GlsXtrIfLinkCounterDef] +\cs{GlsXtrIfLinkCounterDef}\marg{label}\marg{true}\marg{false} +\end{definition} +where \meta{label} is the entry's label. + +The counter name can be obtained using +\begin{definition}[\DescribeMacro\GlsXtrLinkCounterName] +\cs{GlsXtrLinkCounterName}\marg{label} +\end{definition} +This simply expands to the counter name associated with the +entry given by \meta{label} without any check for +existence. For example, to change the display command +(\cs{the}\meta{counter}) using \sty{etoolbox}: +\begin{verbatim} +\csdef{the\GlsXtrLinkCounterName{duck}}{\Roman{\GlsXtrLinkCounterName{duck}}} +\end{verbatim} +This is useful if you just want to change the display for +specific entries but isn't convenient if you want to change the +display for all entries. Instead, it's simpler to redefine +\cs{GlsXtrTheLinkCounter}. For example: +\begin{verbatim} +\renewcommand*{\GlsXtrTheLinkCounter}[1]{% + \GlsXtrIfLinkCounterDef{#1}% + {\Roman{\GlsXtrLinkCounterName{#1}}}% + {0}% +} +\end{verbatim} +In both cases, the redefinition should be implemented +after \cs{GlsXtrEnableLinkCounting}. + +Here's an example document that uses link counting to disable +the hyperlink after the first reference. This redefines +\ics{glslinkpresetkeys} (which is used by both \cs{gls} +and \cs{glstext}) instead of +\cs{glslinkcheckfirsthyperhook} (which is used by \cs{gls} +but not by \cs{glstext}). + +\begin{verbatim} +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\renewcommand*{\glslinkpresetkeys}{% + \ifnum\GlsXtrLinkCounterValue{\glslabel}>1 + \setkeys{glslink}{hyper=false}% + \fi +} + +\GlsXtrEnableLinkCounting{general} + +\newglossaryentry{sample1}{name={sample1},description={an example}} +\newglossaryentry{sample2}{name={sample2},description={another example}} + +\newabbreviation{ex}{ex}{example} + +\begin{document} + +\section{Sample Section} + +\Gls{sample1}, \gls{sample2} and \gls{ex}. +\Glstext{sample1} and \gls{ex} again. + +\section{Another Sample Section} + +\Gls{sample1}, \gls{sample2} and \gls{ex}. + +\printglossaries + +\end{document} +\end{verbatim} +The use of \ics{glslinkpresetkeys} +means that the options can override this. For example +\begin{verbatim} +\gls[hyper=true]{sample1} +\end{verbatim} +will override the \texttt{hyper=false} setting in +\ics{glslinkpresetkeys}. If \ics{glslinkpostsetkeys} is used +instead, the \texttt{hyper=false} setting will override +the setting provided in the optional argument. + +The \category{abbreviation} category doesn't have the +\catattr{linkcount} attribute set (since it's not +listed in the argument of \cs{GlsXtrEnableLinkCounting}). This means that +\cs{GlsXtrLinkCounterValue} +always expands to 0 for the abbreviation (\texttt{ex}), so the +inequality test +\begin{verbatim} +\ifnum\GlsXtrLinkCounterValue{\glslabel}>1 +\end{verbatim} +will always be false. This means that the abbreviation won't +have \texttt{hyper=false} applied. If the test is changed to +\begin{verbatim} +\ifnum\GlsXtrLinkCounterValue{\glslabel}=1 +\else + \setkeys{glslink}{hyper=false}% +\fi +\end{verbatim} +Then the abbreviation will always have \texttt{hyper=false} +applied. + +To reset the counter every section use the optional argument to set +the master counter: +\begin{verbatim} +\GlsXtrEnableLinkCounting[section]{general} +\end{verbatim} + +\chapter{Auto-Indexing} +\label{sec:autoindex} + +It's possible that you may also want a normal index as well as +the glossary, and you may want entries to automatically be +added to the index (as in this document). +There are two attributes that govern this: \catattr{indexname} +and \catattr{dualindex}. + +\begin{important} +The auto-indexing is designed for \gls{makeindex} syntax. If you've +used the \pkgopt{xindy} package option, the automatic escaping of +\gls{xindy} special characters in the \gloskey{sort} field may +result in an incorrect sort value for the \cs{index} command used by +the auto-indexing. Note also that \app{texindy} has a fixed set of +special characters (corresponding to \gls{makeindex}['s] defaults) +that can't be customized. You may want to consider using \gls{bib2gls} and +its dual entries as an alternative approach. +\end{important} + +\begin{sloppypar} +The \ics{glsxtrpostnamehook} macro, used +at the end of \ics{glossentryname} and \ics{Glossentryname}, +checks the \catattr{indexname} attribute for the category +associated with that entry. +Since \cs{glossentryname} is used in the default glossary +styles, this makes a convenient way of automatically indexing +each entry name at its location in the glossary without +fiddling around with the value of the \gloskey{name} key. +\end{sloppypar} + +The internal macro used by the \styfmt{glossaries} package to +write the information to the external glossary file is +modified to check for the \catattr{dualindex} attribute. + +In both cases, the indexing is done through +\begin{definition}[\DescribeMacro\glsxtrdoautoindexname] +\cs{glsxtrdoautoindexname}\marg{label}\marg{attribute-label} +\end{definition} +This uses the standard \ics{index} command with the sort value +taken from the entry's \gloskey{sort} key and the actual value +set to \cs{glsentryname}\marg{label}. As from v1.16, there are +user-level commands available to change the sort and actual +value used by the automated index. + +The actual value is given by +\begin{definition}[\DescribeMacro\glsxtrautoindexentry] +\cs{glsxtrautoindexentry}\marg{label} +\end{definition} +where \meta{label} is the entry's label. The default definition +is: +\begin{verbatim} +\newcommand*{\glsxtrautoindexentry}[1]{\string\glsentryname{#1}} +\end{verbatim} +Note the use of \cs{string} to prevent \cs{glsentryname} from +being expanded as it's written to the index file. + +The sort value is assigned using: +\begin{definition}[\DescribeMacro\glsxtrautoindexassignsort] +\cs{glsxtrautoindexassignsort}\marg{cs}\marg{label} +\end{definition} +where \meta{label} is the entry label and \meta{cs} is the command +which needs to be set to the sort value. The default definition is: +\begin{verbatim} +\newcommand*{\glsxtrautoindexassignsort}[2]{% + \glsletentryfield{#1}{#2}{sort}% +} +\end{verbatim} +After this macro is called, \meta{cs} is then processed to escape +any of \app{makeindex}'s special characters. Note that this +escaping is only performed on the sort not on the actual value. +The escaping of the sort value is performed by +\begin{definition}[\DescribeMacro\glsxtrautoindexesc] +\cs{glsxtrautoindexesc} +\end{definition} +You can redefine this to do nothing if you want to omit the +escaping. You may want to consider providing another field to obtain +the appropriate sort value if the one provided in the \gloskey{sort} +field isn't suitable (because it may already have had special +characters escaped or it may be a numeric value in the case of +sort by use or definition). + +The command used to perform the actual indexing is: +\begin{definition}[\DescribeMacro\glsxtrautoindex] +\cs{glsxtrautoindex}\marg{text} +\end{definition} +This just does \cs{index}\marg{text} by default. + +\begin{important} +The entry's \gloskey{parent} field isn't referenced in this +automated indexing. +\end{important} + +For example, to index the value of the \gloskey{first} key, +instead of the \gloskey{name} key: +\begin{verbatim} +\renewcommand*{\glsxtrautoindexentry}[1]{\string\glsentryfirst{#1}} +\end{verbatim} +and if the sort value also needs to be set to the \gloskey{long} +field, if present, otherwise the \gloskey{sort} field: +\begin{verbatim} +\renewcommand*{\glsxtrautoindexassignsort}[2]{% + \ifglshaslong{#2}% + {\glsletentryfield{#1}{#2}{long}}% + {\glsletentryfield{#1}{#2}{sort}}% +} +\end{verbatim} + +If the value of the attribute given by \meta{attribute-label} +is \qt{true}, no encap +will be added, otherwise the encap will be the +attribute value. For example: +\begin{verbatim} +\glssetcategoryattribute{general}{indexname}{textbf} +\end{verbatim} +will set the encap to \texttt{textbf} which will display the +relevant page number in bold whereas +\begin{verbatim} +\glssetcategoryattribute{general}{dualindex}{true} +\end{verbatim} +won't apply any formatting to the page number in the index. + +\begin{important} +The location used in the index will always be the page number +not the counter used in the glossary. (Unless some other loaded +package has modified the definition of \cs{index} to use +some thing else.) +\end{important} + +By default the \gloskey[glslink]{format} key won't be used with +the \catattr{dualindex} attribute. You can allow the +\gloskey[glslink]{format} key to override the attribute value +by using the preamble-only command: +\begin{definition}[\DescribeMacro\GlsXtrEnableIndexFormatOverride] +\cs{GlsXtrEnableIndexFormatOverride} +\end{definition} +If you use this command and \sty{hyperref} has been loaded, +then the \env{theindex} environment will be modified to redefine +\ics{glshypernumber} to allow formats that use that command. + +\begin{important} +The \catattr{dualindex} attribute will still be used on +subsequent use even if the \catattr{indexonlyfirst} attribute +(or \pkgopt{indexonlyfirst} package option) is set. However, +the \catattr{dualindex} attribute will honour the +\gloskey[glslink]{noindex} key. +\end{important} + +The \cs{glsxtrdoautoindexname} command will attempt to escape any of +\ics{makeindex}'s special characters, but there may be special cases +where it fails, so take care. This assumes the default \gls{makeindex} actual, +level, quote and encap values (unless any of the commands +\ics{actualchar}, \ics{levelchar}, \ics{quotechar} or +\ics{encapchar} have been defined before \styfmt{glossaries-extra} +is loaded). + +If this isn't the case, you can use the following preamble-only +commands to set the correct characters. +\begin{important} +Be very careful of possible shifting category codes! +\end{important} + +\begin{definition}[\DescribeMacro\GlsXtrSetActualChar] +\cs{GlsXtrSetActualChar}\marg{char} +\end{definition} +Set the actual character to \meta{char}. + +\begin{definition}[\DescribeMacro\GlsXtrSetLevelChar] +\cs{GlsXtrSetLevelChar}\marg{char} +\end{definition} +Set the level character to \meta{char}. + +\begin{definition}[\DescribeMacro\GlsXtrSetEscChar] +\cs{GlsXtrSetEscChar}\marg{char} +\end{definition} +Set the escape (quote) character to \meta{char}. + +\begin{definition}[\DescribeMacro\GlsXtrSetEncapChar] +\cs{GlsXtrSetEncapChar}\marg{char} +\end{definition} +Set the encap character to \meta{char}. + +\chapter{On-the-Fly Document Definitions} +\label{sec:onthefly} + +\begin{important} +The commands described here may superficially look like +\meta{word}\cs{index}\marg{word}, but they behave rather +differently. If you want to use \cs{index} then just use +\cs{index}. +\end{important} + +The \styfmt{glossaries} package advises against defining entries +in the \env{document} environment. As mentioned in +\sectionref{sec:pkgopts} above, this ability is disabled by +default with \styfmt{glossaries-extra} but can be enabled using +the \pkgopt{docdefs} package options. + +Although this can be problematic, the \styfmt{glossaries-extra} +package provides a way of defining and using entries within +the \env{document} environment without the tricks used with the +\pkgopt{docdefs} option. \emph{There are limitations with this +approach, so take care with it.} This function is disabled by +default, but can be enabled using the preamble-only command: +\begin{definition}[\DescribeMacro\GlsXtrEnableOnTheFly] +\cs{GlsXtrEnableOnTheFly} +\end{definition} +When used, this defines the commands described below. + +\begin{important} +The commands \cs{glsxtr}, \cs{glsxtrpl}, \cs{Glsxtr} +and \cs{Glsxtrpl} can't be used after the glossaries have been +displayed (through \ics{printglossary} etc). It's best not to mix +these commands with the standard glossary commands, such +as \cs{gls} or there may be unexpected results. +\end{important} + +\begin{definition}[\DescribeMacro\glsxtr] +\cs{glsxtr}\oarg{gls-options}\oarg{dfn-options}\marg{label} +\end{definition} +If an entry with the label \meta{label} has already been defined, +this just does \cs{gls}\oarg{gls-options}\marg{label}. If +\meta{label} hasn't been defined, this will define the entry +using: +\begin{alltt} +\cs{newglossaryentry}\marg{label}\{name=\marg{label}, + category=\cs{glsxtrcat}, + description=\{\cs{nopostdesc}\}, + \meta{dfn-options}\} +\end{alltt} + +\begin{important} +The \meta{label} must contain any non-expandable commands, such as +formatting commands or problematic characters. +If the term requires any of these, they must be omitted from the +\meta{label} and placed in the \gloskey{name} key must be provided +in the optional argument \meta{dfn-options}. +\end{important} + +The second optional argument \meta{dfn-options} should be empty +if the entry has already been defined, since it's too late for +them. If it's not empty, a~warning will be generated with +\begin{definition}[\DescribeMacro\GlsXtrWarning] +\cs{GlsXtrWarning}\marg{dfn-options}\marg{label} +\end{definition} + +For example, this warning will be generated on the second instance +of \cs{glsxtr} below: +\begin{verbatim} +\glsxtr[][plural=geese]{goose} +% ... later +\glsxtr[][plural=geese]{goose} +\end{verbatim} + +If you are considering doing something like: +\begin{verbatim} +\newcommand*{\goose}{\glsxtr[][plural=geese]{goose}} +\renewcommand*{\GlsXtrWarning}[2]{} +% ... later +\goose\ some more text here +\end{verbatim} +then don't bother. It's simpler and less problematic to just +define the entries in the preamble with \ics{newglossaryentry} +and then use \cs{gls} in the document. + +There are plural and case-changing alternatives to \cs{glsxtr}: +\begin{definition}[\DescribeMacro\glsxtrpl] +\cs{glsxtrpl}\oarg{gls-options}\oarg{dfn-options}\marg{label} +\end{definition} +This is like \cs{glsxtr} but uses \cs{glspl} instead of \cs{gls}. + +\begin{definition}[\DescribeMacro\Glsxtr] +\cs{Glsxtr}\oarg{gls-options}\oarg{dfn-options}\marg{label} +\end{definition} +This is like \cs{glsxtr} but uses \cs{Gls} instead of \cs{gls}. + +\begin{definition}[\DescribeMacro\Glsxtrpl] +\cs{Glsxtrpl}\oarg{gls-options}\oarg{dfn-options}\marg{label} +\end{definition} +This is like \cs{glsxtr} but uses \cs{Glspl} instead of \cs{gls}. + +If you use UTF-8 and don't want the inconvenient of needing +to use an ASCII-only label, then it's better to use +\XeLaTeX\ or \LuaLaTeX\ instead of \LaTeX\ (or \pdfLaTeX). +If you really desperately want to use UTF-8 entry labels without +switching to \XeLaTeX\ or \LuaLaTeX\ then there is a starred +version of \cs{GlsXtrEnableOnTheFly} that allows you to +use UTF-8 characters in \meta{label}, but it's experimental and +may not work in some cases. + +\begin{important} +If you use the starred version of \cs{GlsXtrEnableOnTheFly} +don't use any commands in the \meta{label}, even if they expand +to just text. +\end{important} + +\chapter{\appfmt{bib2gls}: Managing Reference Databases} +\label{sec:bib2gls} + +There is a new command line application called +\gls{bib2gls}, which works in much the same way as +a combination of \appfmt{bibtex} and +\appfmt{makeindex}\slash\appfmt{xindy}. +Instead of storing all your entry definitions in a \texttt{.tex} and +loading them using \cs{input} or \cs{loadglsentries}, the entries +can instead be stored in a \texttt{.bib} file and \gls{bib2gls} can +selectively write the appropriate commands to a \texttt{.glstex} +file which is loaded using \cs{glsxtrresourcefile} (or +\cs{GlsXtrLoadResources}). + +This means that you can use a reference managing system, such as +JabRef, to maintain the database and it reduces the \TeX\ overhead +by only defining the entries that are actually required in the +document. If you currently have a \texttt{.tex} file that contains +hundreds of definitions, but you only use a dozen or so in your +document, then the build time is needlessly slowed by the unrequired +definitions that occur when the file is input. (You can convert an +existing \texttt{.tex} file containing glossary definitions to a +\texttt{.bib} file using \app{convertgls2bib}, supplied with +\gls{bib2gls}.) + +There are some new commands and options added to +\styfmt{glossaries-extra} to help assist the integration of +\gls{bib2gls} into the document build process. + +This chapter just provides a general overview of \gls{bib2gls}. +The full details and some sample documents are provided +in the \gls{bib2gls} \href{http://mirrors.ctan.org/support/bib2gls/bib2gls.pdf}{manual}. + +An example of the contents of \texttt{.bib} file that stores +glossary entries that can be extracted with \gls{bib2gls}: +\begin{verbatim} +@entry{bird, + name={bird}, + description = {feathered animal}, + see={[see also]{duck,goose}} +} + +@entry{duck, + name={duck}, + description = {a waterbird with short legs} +} + +@entry{goose, + name="goose", + plural="geese", + description={a waterbird with a long neck} +} +\end{verbatim} + +The follow provides some abbreviations: +\begin{verbatim} +@string{ssi={server-side includes}} +@string{html={hypertext markup language}} + +@abbreviation{shtml, + short="shtml", + long= ssi # " enabled " # html, + description={a combination of \gls{html} and \gls{ssi}} +} + +@abbreviation{html, + short ="html", + long = html, + description={a markup language for creating web pages} +} + +@abbreviation{ssi, + short="ssi", + long = ssi, + description={a simple interpreted server-side scripting language} +} +\end{verbatim} + +Here are some symbols: +\begin{verbatim} +preamble{"\providecommand{\mtx}[1]{\boldsymbol{#1}}"} + +@symbol{M, + name={$\mtx{M}$}, + text={\mtx{M}}, + description={a matrix} +} + +@symbol{v, + name={$\vec{v}$}, + text={\vec{v}}, + description={a vector} +} + +@symbol{S, + name={$\mathcal{S}$}, + text={\mathcal{S}}, + description={a set} +} +\end{verbatim} + +To ensure that \gls{bib2gls} can find out which entries have been +used in the document, you need the \pkgopt{record} package option: +\begin{verbatim} +\usepackage[record]{glossaries-extra} +\end{verbatim} +If this option's value is omitted (as above), the normal indexing +will be switched off, since \gls{bib2gls} can also sort the entries and +collate the locations. + +If you still want to use an indexing application (for example, you +need a custom \gls{xindy} rule), then just use +\pkgopt[alsoindex]{record} and continue to use \cs{makeglossaries} +and \cs{printglossary} (or \cs{printglossaries}), but you also need +to instruct \gls{bib2gls} to omit sorting to save time and +to prevent the \gloskey{sort} key from being set. + +The \texttt{.glstex} file created by \gls{bib2gls} is loaded using: +\begin{definition}[\DescribeMacro\glsxtrresourcefile] +\cs{glsxtrresourcefile}\oarg{options}\marg{filename} +\end{definition} +(Don't include the file extension in \meta{filename}.) +There's a shortcut version (recommended over the above) that sets \meta{filename} to use \cs{jobname}: +\begin{definition}[\DescribeMacro\GlsXtrLoadResources] +\cs{GlsXtrLoadResources}\oarg{options} +\end{definition} +On the first use, this command is a shortcut for +\begin{alltt} +\cs{glsxtrresourcefile}\oarg{options}\{\cs{jobname}\} +\end{alltt} +On subsequent use,\footnote{Version 1.11 only allowed one use +of \cs{GlsXtrLoadResources} per document.}\ this command is a shortcut for +\begin{alltt} +\cs{glsxtrresourcefile}\oarg{options}\{\cs{jobname}-\meta{n}\} +\end{alltt} +where \meta{n} is the current value of +\begin{definition} +\cs{glsxtrresourcecount} +\end{definition} +which is incremented at the end of \cs{GlsXtrLoadResources}. +Any advisory notes regarding \cs{glsxtrresourcefile} also +apply to \cs{GlsXtrLoadResources}. + +The \cs{glsxtrresourcefile} command writes the line +\begin{alltt} +\cs{glsxtr@resource}\marg{options}\marg{filename} +\end{alltt} +to the \texttt{.aux} file and will input +\meta{filename}\texttt{.glstex} if it exists.\footnote{v1.08 assumed +\meta{filename}\texttt{.tex} but that's potentially dangerous if, +for example, \meta{filename} happens to be the same as \cs{jobname}. +The \texttt{.glstex} extension was enforced by version 1.11.} + +Since the \texttt{.glstex} file won't exist on the first \LaTeX\ run, the +\pkgopt{record} package option additionally switches on +\pkgopt[warn]{undefaction}. Any use of commands like \cs{gls} or +\cs{glstext} will produce ?? in the document, since the entries are +undefined at this point. Once \gls{bib2gls} has created the +\texttt{.glstex} file the references should be resolved. +This may cause a shift in the locations if the actual text produced +once the entry is defined is significantly larger than the +placeholder ?? (as this can alter the page breaking). + +Note that as from v1.12, \cs{glsxtrresourcefile} temporarily +switches the category code of \texttt{@} to 11 (letter) while it +reads the file to allow for any internal commands stored in the +location field. + +\section{Selection} + +The default behaviour is for \gls{bib2gls} to select all entries +that have a record in the \texttt{.aux} file, and any dependent +entries (including parent and cross-references). The +\texttt{glsignore} format (for example, +\verb|\gls[format=glsignore]{duck}|) is recognised by \gls{bib2gls} +as a special ignored record. This means that it will match +the selection criteria but the record won't be added to +the location list. This means that you won't get spurious +commas in the location list (as can happen with the other indexing +methods), so you can do, for example, +\begin{verbatim} +\GlsXtrSetDefaultNumberFormat{glsignore} +\end{verbatim} +at the start of the front matter and +\begin{verbatim} +\GlsXtrSetDefaultNumberFormat{glsnumberformat} +\end{verbatim} +at the start of the main matter to prevent any records in the +front matter from occurring in the location lists. + +\begin{important} +Note that commands like \cs{glsaddall} and \cs{glsaddallunused} don't work with \gls{bib2gls} as the command +has to iterate over the internal lists of defined entry labels, which will be empty on the first +run and on subsequent runs will only contain those entries that have +been selected by \gls{bib2gls}. +\end{important} + +If you want to add all +entries to the glossary, you need to tell \gls{bib2gls} this in the +options list. For example: +\begin{verbatim} +\GlsXtrLoadResources[src={terms},selection={all}] +\end{verbatim} +This will add all entries, regardless of whether or not they +have any records in the \texttt{.aux} file. Those that don't +have any records will have an empty location list. +See the \gls{bib2gls} user manual for more details of this option. + +\section{Sorting and Displaying the Glossary} + +There are many sorting options provided by \gls{bib2gls}. +The default is to sort according to the system locale. +If the document has a language setting, you can use +\texttt{sort=doc} to instruct \gls{bib2gls} to sort according to +that. (The language tag obtained from \sty{tracklang}'s +interface is written to the \texttt{.aux} file.) For a multilingual +document you need to explicitly set the locale using a well-formed +language tag. For example: +\begin{verbatim} +\GlsXtrLoadResources[ + src=terms, % data in terms.bib + sort=de-DE-1996 % sort according to this locale +] +\end{verbatim} +The locale-sensitive sort methods usually ignore most +punctuation so for lists of symbols you may find it more +appropriate to use one of the letter-base sort methods +that sort according to the Unicode value of each character. +Alternatively you can provide a custom rule. +See the \gls{bib2gls} manual for full details of all the available +sort methods. + +Since the \texttt{.glstex} file only defines those references +required +within the document (selected according to the \texttt{selection} +option) and the definitions have been written in the +order corresponding to \gls{bib2gls}['s] sorted list, the glossaries can +simply be displayed using \cs{printunsrtglossary} (or +\cs{printunsrtglossaries}), described in \sectionref{sec:printunsrt}. + +Suppose the \texttt{.bib} examples shown above have been stored in +the files \texttt{terms.bib}, \texttt{abbrvs.bib} and +\texttt{symbols.bib} which may either be in the current directory or +on \TeX's path. Then the document might look like: +\begin{verbatim} +\documentclass{article} + +\usepackage[record]{glossaries-extra} + +\setabbreviationstyle{long-short-desc} + +\GlsXtrLoadResources[src={terms,abbrvs,symbols}] + +\begin{document} +\gls{bird} + +\gls{shtml} + +\gls{M} + +\printunsrtglossaries +\end{document} +\end{verbatim} +The document build process (assuming the document is called +\texttt{mydoc}) is: +\begin{verbatim} +pdflatex mydoc +bib2gls mydoc +pdflatex mydoc +\end{verbatim} +This creates a single glossary containing the entries: +\texttt{bird}, \texttt{duck}, \texttt{goose}, +\texttt{html}, \texttt{M}, \texttt{shtml} and \texttt{ssi} (in that +order). The \texttt{bird}, \texttt{shtml} and \texttt{M} entries +were added because \gls{bib2gls} detected (from the \texttt{.aux} +file) that they had been used in the document. The other entries +were added because \gls{bib2gls} detected (from the \texttt{.bib} +files) that they are referenced by the used entries. In the case of +\texttt{duck} and \texttt{goose}, they are in the \gloskey{see} +field for \texttt{bird}. In the case of \texttt{ssi} and +\texttt{html}, they are referenced in the \gloskey{description} +field of \texttt{shtml}. These cross-referenced entries won't have a +location list when the glossary is first displayed, but depending on +how they are referenced, they may pick up a location list on the +next document build. + +The entries can be separated into different glossaries with +different sort methods: +\begin{verbatim} +\documentclass{article} + +\usepackage[record,abbreviations,symbols]{glossaries-extra} + +\setabbreviationstyle{long-short-desc} + +\GlsXtrLoadResources[src={terms},sort={en-GB},type=main] + +\GlsXtrLoadResources + [src={abbrvs},sort={letter-nocase},type=abbreviations] + +\GlsXtrLoadResources + [src={symbols},sort={use},type={symbols}] + +\begin{document} +\gls{bird} + +\gls{shtml} + +\gls{M} + +\printunsrtglossaries +\end{document} +\end{verbatim} + +Or you can have multiple instance of \cs{GlsXtrLoadResources} +with the same \texttt{type}, which will produce a glossary +with ordered sub-blocks. For example: +\begin{verbatim} +\documentclass{article} + +\usepackage[record,style=indexgroup]{glossaries-extra} + +\setabbreviationstyle{long-short-desc} + +\GlsXtrLoadResources + [src={abbrvs},sort={letter-nocase},type=main, + group={Abbreviations}] + +\GlsXtrLoadResources + [src={symbols},sort={use},type=main, + group={Symbols}] + +\GlsXtrLoadResources[src={terms},sort={en-GB},type=main] + +\begin{document} +\gls{bird} + +\gls{shtml} + +\gls{M} + +\printunsrtglossaries +\end{document} +\end{verbatim} +This will result in a glossary where the first group has +the title \qt{Abbreviations}, the second group has the +title \qt{Symbols} and then follow the usual letter groups. +Note that for this example to work, you must run \gls{bib2gls} +with the \verb|--group| (or \verb|-g|) switch. For example, +if the document is called \texttt{myDoc.tex}: +\begin{verbatim} +pdflatex myDoc +bib2gls -g myDoc +pdflatex myDoc +\end{verbatim} +The value of the \gloskey{group} field must always be a label. You +can set the corresponding title with \cs{glsxtrsetgrouptitle} +(see \sectionref{sec:glosstylemods}). If no title is set then the +label is used as the group title. + +You can provide your own custom sort rule. For example, +if you are using \XeLaTeX\ or \LuaLaTeX: +\begin{alltt} +\cs{GlsXtrLoadResources}[ + src=terms, % entries in terms.bib + sort=custom, % custom sort rule + sort-rule=\{% required with sort=custom + < \ae;\AE\ < a;\'a;\aa;\"a,\"A;\'A;\AA;\"A < b,B + < c;\'c,C;\'C < d,D < e;\'e,E;\'E < f,F < g,G + < h,H < i;\'i,I;\'I < j,J < l;\l,L;\L < m,M < n,N + < o;\"o;\o,O;\"O;\O\ < p,P < q,Q < r,R < s;\'s,S;\'S + < t,T < u;\'u,U;\'U < v,V < w,W < x,X < y,Y < + z;\.z,Z;\.Z + \} +] +\end{alltt} +Remember that if you are using \sty{inputenc} then extended +characters, such as \'e or \o, are active and will expand when +written to the \texttt{.aux} file. So with PDF\LaTeX\ the +above would have to be changed to protect against expansion. +Some of the options, including \texttt{sort-rule}, +allow Unicode characters to be indicated in the format +\cs{u}\meta{hex} (or \cs{u}~\meta{hex}) \textbf{in the \texttt{.aux} file}. \gls{bib2gls} +will recognise this as the character +given by the hexadecimal value \meta{hex}. The \cs{u} also needs +protection from expansion, so with a non-Unicode aware +engine, the character \ae\ needs to be written as +\texttt{\cs{string}\cs{u}E6} and so on. This is quite cumbersome, +but you can use the shortcut \texttt{\ics{glshex} E6} instead, so +the above needs to be written as: +\begin{alltt} +\cs{GlsXtrLoadResources}[ + src=terms, % entries in terms.bib + sort=custom, % custom sort rule + sort-rule=\{% required with sort=custom + < \cs{glshex} E6;\cs{glshex} C6 + < a;\cs{glshex} E1;\cs{glshex} E5,\cs{glshex} E4,A;\cs{glshex} C1;\cs{glshex} C5;\cs{glshex} C4 + < b,B < c;\cs{glshex} 0107,C;\cs{glshex} 0106 < d,D + < e;\cs{glshex} E9,E;\cs{glshex} C9 < f,F < g,G + < h,H < i;\cs{glshex} ED,I;\cs{glshex} CD < j,J + < l;\cs{glshex} 0142,L;\cs{glshex} 0141 < m,M < n,N + < o;\cs{glshex} F6;\cs{glshex} F8,O;\cs{glshex} D6;\cs{glshex} D8 + < p,P < q,Q < r,R < s;\cs{glshex} 013F,S;\cs{glshex} 015A + < t,T < u;\cs{glshex} FA,U;\cs{glshex} DA < v,V < w,W < x,X < y,Y + < z;\cs{glshex} 017C,Z;\cs{glshex} 017B + \}] +\end{alltt} + +\section{The \styfmt{glossaries-extra-bib2gls} package} +\label{sec:bib2glssty} + +The package option \pkgopt[only]{record} (or simply \pkgopt{record}) +automatically loads the supplementary package +\sty{glossaries-extra-bib2gls}, which provides some commands +that are specific to \gls{bib2gls}. The package isn't +loaded by \pkgopt[alsoindex]{record} as that option is intended +for sorting with \gls{makeindex} or \gls{xindy} and it is expected +that the sorting will be switched off (with the resource option +\texttt{sort=none}). + +If \sty{glossaries-extra-bib2gls} is loaded via the +\pkgopt{record} package option then the check for associated +language resource files (see \sectionref{sec:lang}) will also +search for the existence of +\texttt{glossariesxtr-}\meta{script}\texttt{.ldf} for each +document dialect (where \meta{script} is the four letter +script identifier, such as \texttt{Latn}). + +This package provides some shortcut commands that use +\ics{printunsrtglossary} if the relevant package option has defined +the associated glossary: \ics{printunsrtabbreviations}, +\ics{printunsrtacronyms}, \ics{printunsrtsymbols}, +\ics{printunsrtnumbers} and \ics{printunsrtindex}. + +\begin{definition}[\DescribeMacro\glsxtrprovidecommand] +\cs{glsxtrprovidecommand}\marg{cs}\oarg{n}\oarg{default}\marg{definition} +\end{definition} +This command is intended for use in \texttt{@preamble}. +It's simply defined to \cs{providecommand} in +\sty{glossaries-extra-bib2gls} but \gls{bib2gls}['s] interpreter +treats it as \cs{renewcommand}. This means that you can +override \gls{bib2gls}['s] internal definition of a command +without overriding the command definition in the document +(if it's already defined before the resource file is input). +For example +\begin{verbatim} +@preamble{"\glsxtrprovidecommand{\int}{integral}"} +\end{verbatim} +This will force \gls{bib2gls} to treat \cs{int} as the word +\qt{integral} to assist sorting but if this preamble code is written +to the \texttt{.glstex} file (as it is by default) then it won't +override the current definition (provided by the kernel or redefined +by a package). + +The helper commands in the resource files are defined using +\cs{providecommand}. For many of them, if you want to provide an +alternative definition then you need to define the command before +the resource file is loaded. There are a few that may be redefined +afterwards but if you use \cs{renewcommand} then you will get an +error on the first \LaTeX\ run when the \texttt{.glstex} file +doesn't exist. In this case, you may prefer to use: +\begin{definition}[\DescribeMacro\glsrenewcommand] +\cs{glsrenewcommand}\marg{cs}\oarg{n}\oarg{default}\marg{definition} +\end{definition} +This behaves like \cs{renewcommand} but only generates a warning +rather than an error if the command isn't already defined so it +won't interrupt the document build. + +\begin{definition}[\DescribeMacro\GlsXtrIndexCounterLink] +\cs{GlsXtrIndexCounterLink}\marg{text}\marg{label} +\end{definition} +If the \ics{hyperref} command has been defined (that is, +\sty{hyperref} has been loaded before \styfmt{glossaries-extra}) +then this command checks for the existence of the +\texttt{indexcounter} field. If this field is set for the entry +given by \meta{label}, this command does +\cs{hyperref}\texttt{[wrglossary.\meta{value}]\marg{text}}, where +\meta{value} is the value of the \texttt{indexcounter} field. If the +field isn't set or if \cs{hyperref} hasn't been defined, this just +does \meta{text}. This command is provided for use with the +\pkgopt{indexcounter} package option combined with \gls{bib2gls}['s] +\texttt{save-index-counter} resource option. See the \gls{bib2gls} +manual for further details (at least version 1.4). + +If you use the \texttt{set-widest} resource option, \gls{bib2gls} +v1.8+ will now use: +\begin{definition}[\DescribeMacro\glsxtrSetWidest] +\cs{glsxtrSetWidest}\marg{type}\marg{level}\marg{text} +\end{definition} +(if it has been defined) to set the widest name for the given +glossary type and level. This allows for both the \glostyle{alttree} +style and the styles provided by \sty{glossary-longextra}, which +need to know the widest name. + +If \gls{bib2gls} can't determine the widest name (typically because +the name field consists of commands that aren't recognised by the +interpreter) then \gls{bib2gls} v1.8+ will now use: +\begin{definition}[\DescribeMacro\glsxtrSetWidestFallback] +\cs{glsxtrSetWidestFallback}\marg{max depth}\marg{list} +\end{definition} +(if defined). Currently the maximum hierarchical depth \meta{max +depth} may only be 0 or 2. This command requires commands provided +by the \sty{glossaries-extra-stylemods} package with the +\glostyle{alttree} style enabled. In this case, it may be simpler +to just use \ics{glssetwidest}. + +\subsection{Supplemental Locations} +\label{sec:supplocations} + +\begin{definition}[\DescribeMacro\glsxtrdisplaysupploc] +\cs{glsxtrdisplaysupploc}\marg{prefix}\marg{counter}\marg{format}\marg{src}\marg{location} +\end{definition} +This is used by \gls{bib2gls} version 1.7+ for supplemental +locations, instead of using \cs{glsxtrsupphypernumber} with the +\catattr{externallocation} attribute. This command sets up the +location counter and prefix (used in the formation of hyperlinks) +and then uses +\begin{definition}[\DescribeMacro\glsxtrmultisupplocation] +\cs{glsxtrmultisupplocation}\marg{location}\marg{src}\marg{format} +\end{definition} +to format the actual location (with an external hyperlink, if +supported). + +\subsection{Nameref Record} +\label{sec:recordnameref} + +Normally locations are recorded in the \texttt{.aux} file +in the form: +\begin{definition} +\cs{glsxtr@record}\marg{label}\marg{prefix}\marg{counter}\marg{format}\marg{location} +\end{definition} +The \pkgopt[nameref]{record} option, which requires at least +\gls{bib2gls} v1.8, instead uses: +\begin{definition} +\cs{glsxtr@record@nameref}\marg{label}\marg{prefix}\marg{counter}\marg{format}\marg{location}\marg{title}\marg{href}\marg{hcounter} +\end{definition} +where \meta{title} is obtained from \cs{@currentlabelname} +and \meta{href} is obtained from \cs{@currentHref}. These +commands require \sty{hyperref}. If they are undefined, +\meta{title} and \meta{href} will be left empty and \gls{bib2gls} +will treat it as a regular record. + +\begin{important} +Be careful with this option as \meta{href} will globally change on every +instance of \cs{refstepcounter} but \meta{title} won't necessarily +change. It can therefore cause unexpected behaviour. +\end{important} + +The final argument \meta{hcounter} is obtained from +\cs{theH}\meta{counter} which provides the partial target name associated +with the indexing counter. With the original +\gls{makeindex}\slash \gls{xindy} approach, it's not possible to +include this information in the location, so the base +\sty{glossaries} package attempts to derive a prefix from which the +\meta{hcounter} value can be reconstituted by appending the prefix. +Unfortunately, not all definitions of \cs{theH}\meta{counter} are in +the form \meta{prefix}\cs{the}\meta{counter} (most notably the +\ctr{equation} counter with chapters) so this can fail. + +Since \gls{bib2gls} is customized specifically for use with +\styfmt{glossaries-extra}, it's now possible to save +\meta{hcounter}, so the \pkgopt[nameref]{record} option does this. +By providing both \meta{href} and \meta{hcounter}, you can determine +which target you would rather use. The default is to use +\meta{hcounter}, which will take you to the place where the +corresponding counter was incremented with \cs{refstepcounter}. +However, you may choose to switch to using the \meta{href} target, +which will take you to the nearest target before the indexing took +place. + +With \gls{bib2gls} v1.8+, normal locations are displayed using: +\begin{definition} +\cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{location} +\end{definition} +This is provided by the base \sty{glossaries} package and is simply +defined to do: +\begin{definition} +\cs{setentrycounter}\oarg{prefix}\marg{counter}\cs{csuse}\marg{format}\marg{location} +\end{definition} +Earlier versions of \gls{bib2gls} only used this in the +\gloskey{loclist} field and explicitly used \cs{setentrycounter} in +the \gloskey{location} field followed by +\cs{}\meta{format}\marg{location}, which follows the code that's created +with the default \pkgopt{makeindex} setting. +The \cs{setentrycounter} command sets up the prefix needed for +\cs{glshypernumber} to reform the target name from the given +location. + +The locations identified by \cs{glsxtr@record@nameref} are written +by \gls{bib2gls} to the location list using: +\begin{definition}[\DescribeMacro\glsxtrdisplaylocnameref] +\cs{glsxtrdisplaylocnameref}\marg{prefix}\marg{counter}\marg{format}\marg{location}\marg{title}\marg{href}\marg{hcounter}\marg{file} +\end{definition} +With normal internal locations, \meta{file} will always be empty. +With supplemental locations, \meta{file} will be the external file +reference. + +The default definition is: +\begin{verbatim} +\newcommand*{\glsxtrdisplaylocnameref}[8]{% + \ifstrequal{#2}{equation}% + {\glsxtrnamereflink{#3}{(#4)}{#2.#7}{#8}}% + {% + \ifstrempty{#5}% + {% + \glsxtrnamereflink{#3}{#4}{#2.#7}{#8}% + }% + {% + \ifstrequal{#2}{page}% + {\glsxtrnamereflink{#3}{#4}{#2.#7}{#8}}% + {\glsxtrnamereflink{#3}{#5}{#2.#7}{#8}}% + }% + }% +} +\end{verbatim} +which uses: +\begin{definition}[\DescribeMacro\glsxtrnamereflink] +\cs{glsxtrnamereflink}\marg{format}\marg{title}\marg{target}\marg{file} +\end{definition} +This ignores the \meta{prefix}, \meta{counter} and \marg{location} +arguments and instead creates a hyperlink with the target name obtained from \meta{target} (and \meta{file}, if not empty). + +Since pages and equations typically don't have titles, the default +definition of \cs{glsxtrdisplaylocnameref} checks the counter was +used as the location. If it's \ctr{page} or if \meta{title} is empty, then just the location is +used as the hyperlink text. If the counter \ctr{equation}, then the +text is the location in parentheses. Otherwise the text is obtained +from \meta{title}. + +If \meta{file} is empty an internal link is created with: +\begin{definition}[\DescribeMacro\glsxtrfmtinternalnameref] +\cs{glsxtrfmtinternalnameref}\marg{target}\marg{format}\marg{title} +\end{definition} +otherwise an external link is created with: +\begin{definition}[\DescribeMacro\glsxtrfmtexternalnameref] +\cs{glsxtrfmtexternalnameref}\marg{target}\marg{format}\marg{title}\marg{file} +\end{definition} +The \meta{file} argument is set by \gls{bib2gls} for supplemental +locations. + +Here's alternative definition that uses the \meta{prefix} and +\meta{counter} to reform the target name (as +\cs{glsnoidxdisplayloc}) but uses the \meta{title} as the hyperlink text: +\begin{verbatim} +\renewcommand*{\glsxtrdisplaylocnameref}[7]{% + \glsxtrnamereflink{#3}{#5}{#6}{#7}% +} +\end{verbatim} +which uses: +\begin{definition}[\DescribeMacro\glsxtrnameloclink] +\cs{glsxtrnameloclink}\marg{prefix}\marg{counter}\marg{format}\marg{location}\marg{title}\marg{file} +\end{definition} +This uses the same commands as \cs{glsxtrnamereflink} +to produce the hyperlinks. + +In both cases, the link is encapsulated with the text-block command +whose name is given by \meta{format}, but \cs{glshypernumber} is +first locally redefined to \cs{@firstofone} to prevent a conflict with the +usual location hyperlink formation. This means that if the +\meta{format} is \texttt{hyperbf} then it will simply behave like +\texttt{textbf}. + +For compactness, \gls{bib2gls} merges normal records if the +\meta{prefix}, \meta{counter} and \meta{location} all match. (An +order of precedence can be provided for format conflicts.) With +nameref records, you can use the \verb|--merge-nameref-on| switch +provided by \gls{bib2gls} v1.8+ to determine how to merge nameref +records. This switch must be followed by one of the following +keywords: \texttt{hcounter} (merge on \meta{hcounter}, default) +\texttt{href} (merge on \meta{href}), \texttt{title} (merge +on \meta{title}) and \texttt{location} (merge on \meta{location}, as +regular records). In all cases, the \meta{counter} must also match. + +\subsection{Helper Commands for Resource Options} +\label{sec:resourcecommands} + +\begin{definition}[\DescribeMacro\glshex] +\cs{glshex} +\end{definition} +This is just defined as \verb|\string\u|, which is required +when you need to indicate a Unicode character in the form +\cs{u}\meta{hex} in some of +the resource options (as illustrated above). + +\begin{definition}[\DescribeMacro\glscapturedgroup] +\cs{glscapturedgroup} +\end{definition} +This is just defined as \verb|\string\$| and is used for +the captured group reference in a replacement part of a regular +expression substitution (requires at least \gls{bib2gls} version 1.5). For example: +\begin{verbatim} +sort-replace={{([a-zA-Z])\string\.}{\glscapturedgroup1}} +\end{verbatim} +This only removes a full stop that follows any of the characters +a,\ldots,z or A,\ldots,Z. + +If you use the \texttt{save-child-count} resource option, +you can test if the \texttt{childcount} field is non-zero using: +\begin{definition}[\DescribeMacro{\GlsXtrIfHasNonZeroChildCount}] +\cs{GlsXtrIfHasNonZeroChildCount}\marg{label}\marg{true}\marg{false} +\end{definition} +This internally uses \cs{GlsXtrIfFieldNonZero} and will do +\meta{false} if the field isn't set. Within \meta{true} and +\meta{false} you can use \cs{glscurrentfieldvalue} to access the +value. (It will be 0 in \meta{false} if the field isn't set.) + + +A convenient shortcut for use in the \texttt{entry-type-aliases} +setting: +\begin{definition}[\DescribeMacro\GlsXtrBibTeXEntryAliases] +\cs{GlsXtrBibTeXEntryAliases} +\end{definition} +This provides aliases for Bib\TeX's standard entry types to +\gls{bib2gls}['s] \texttt{@bibtexentry} entry type (requires at +least \gls{bib2gls} version 1.4). + +You may also want to provide storage keys for Bib\TeX's standard +fields rather than having to alias them all. This can be done with: +\begin{definition}[\DescribeMacro\GlsXtrProvideBibTeXFields] +\cs{GlsXtrProvideBibTeXFields} +\end{definition} +Note that Bib\TeX's \texttt{type} field clashes with the \sty{glossaries} +package's \gloskey{type} key, so this command provides the key +\texttt{bibtextype} instead. You can alias it with +\texttt{field-aliases={type=bibtextype}} in the resource options. +Each storage key is provided with a convenient command to access the +value in the form \cs{glsxtrbib}\meta{field}. For example, +\cs{glsxtrbibaddress}. The \texttt{bibtextype} field can be accessed +with \cs{glsxtrbibtype}. Each of these commands takes the entry +label as the sole argument. + +The \sty{glossaries-extra-bib2gls} package also provides definitions +of the missing mathematical Greek commands: \ics{Alpha}, +\ics{Beta}, \ics{Epsilon}, \ics{Zeta}, \ics{Eta}, \ics{Iota}, +\ics{Kappa}, \ics{Mu}, \ics{Nu}, \ics{Omicron}, \ics{Rho}, +\ics{Tau}, \ics{Chi}, \ics{Digamma}, \ics{omicron}. +These are all defined with \cs{providecommand}, so they won't override +any definitions provided by any package loaded before +\sty{glossaries-extra}. Since \gls{bib2gls}['s] interpreter +recognises these commands, using them instead of explicitly using +the Latin characters with the same shape helps to keep the Greek +symbols together when sorting. +Similarly, if \sty{upgreek} has been loaded, the missing upright +Greek commands are also provided. + +The remaining commands provide common rule blocks for use in +the \texttt{sort-rule} resource option. If you want a rule for +a specific locale, you can provide similar commands in a file called +\texttt{glossariesxtr-}\meta{tag}\texttt{.ldf}, where \meta{tag} +identifies the dialect, locale, region or root language. See the +description of \cs{IfTrackedLanguageFileExists} in the +\sty{tracklang} documentation for further details. If this file is +on \TeX's path and the \sty{tracklang} package (automatically loaded +by \styfmt{glossaries}) detects that the document has requested that +language or locale, then the file will automatically be loaded. +For example, if you want to provide a rule block for Welsh, then +create a file called \texttt{glossariesxtr-welsh.ldf} that contains: +\begin{verbatim} +\ProvidesGlossariesExtraLang{welsh}[2018/02/23 v1.0] + +\@ifpackageloaded{glossaries-extra-bib2gls} +{ + \newcommand{\glsxtrWelshRules}{% + \glsxtrLatinA + \string}. + +The \styfmt{glossaries} package provides \ics{glsfieldfetch} which +can be used to fetch the value of the given field and store it in a +control sequence. The \styfmt{glossaries-extra} package provides +another way of accessing the field value: +\begin{definition}[\DescribeMacro\glsxtrusefield] +\cs{glsxtrusefield}\marg{entry-label}\marg{field-label} +\end{definition} +This works in the same way as commands like \cs{glsentrytext} but +the field label is specified in the first argument. Note that the +\meta{field-label} corresponds to the internal field tag, which +isn't always the same as the key name. See Table~4.1 of the +\sty{glossaries} manual. No error occurs if the entry or field +haven't been defined. This command is not robust. + +There is also a version that converts the first letter to uppercase +(analogous to \cs{Glsentrytext}): +\begin{definition}[\DescribeMacro\Glsxtrusefield] +\cs{Glsxtrusefield}\marg{entry-label}\marg{field-label} +\end{definition} +and, as from v1.37, a command that converts the entire value to upper case: +\begin{definition}[\DescribeMacro\GLSxtrusefield] +\cs{GLSxtrusefield}\marg{entry-label}\marg{field-label} +\end{definition} + +If you want to use a field to store a list that can be used +as an \sty{etoolbox} internal list, you can use the following +command that adds an item to the field using \sty{etoolbox}'s +\cs{listcsadd}: +\begin{definition}[\DescribeMacro\glsxtrfieldlistadd] +\cs{glsxtrfieldlistadd}\marg{label}\marg{field}\marg{item} +\end{definition} +where \meta{label} is the entry's label, \meta{field} is +the entry's field and \meta{item} is the item to add. There +are analogous commands that use \cs{listgadd}, \cs{listeadd} +and \cs{listxadd}: +\begin{definition}[\DescribeMacro\glsxtrfieldlistgadd] +\cs{glsxtrfieldlistgadd}\marg{label}\marg{field}\marg{item} +\end{definition} +\begin{definition}[\DescribeMacro\glsxtrfieldlisteadd] +\cs{glsxtrfieldlisteadd}\marg{label}\marg{field}\marg{item} +\end{definition} +\begin{definition}[\DescribeMacro\glsxtrfieldlistxadd] +\cs{glsxtrfieldlistxadd}\marg{label}\marg{field}\marg{item} +\end{definition} +You can then iterate over the list using: +\begin{definition}[\DescribeMacro\glsxtrfielddolistloop] +\cs{glsxtrfielddolistloop}\marg{label}\marg{field} +\end{definition} +or +\begin{definition}[\DescribeMacro\glsxtrfieldforlistloop] +\cs{glsxtrfieldforlistloop}\marg{label}\marg{field}\marg{handler} +\end{definition} +that internally use \cs{dolistcsloop} and \cs{forlistloop}, +respectively. + +There are also commands that use \cs{ifinlistcs}: +\begin{definition}[\DescribeMacro\glsxtrfieldifinlist] +\cs{glsxtrfieldifinlist}\marg{label}\marg{field}\marg{item}\marg{true}\marg{false} +\end{definition} +and \cs{xifinlistcs} +\begin{definition}[\DescribeMacro\glsxtrfieldxifinlist] +\cs{glsxtrfieldxifinlist}\marg{label}\marg{field}\marg{item}\marg{true}\marg{false} +\end{definition} + +See the \sty{etoolbox}'s user manual for further +details of these commands, in particular the limitations +of \cs{ifinlist}. + +If the field has a comma-separated list value instead, you +can iterate over it using: +\begin{definition}[\DescribeMacro\glsxtrforcsvfield] +\cs{glsxtrforcsvfield}\marg{label}\marg{field}\marg{handler} +\end{definition} +where again \meta{handler} is a control sequence that takes +a single argument. Unlike the \sty{etoolbox} loops, this +doesn't ignore empty elements nor does it discard leading / trailing +spaces. Internally it uses \cs{@for} (modified by \sty{xfor} +which is automatically loaded by \sty{glossaries}). The +\sty{xfor} package modifies the behaviour of \cs{@for} to allow +the loop to be broken prematurely using \cs{@endfortrue}. +The \cs{glsxtrforcsvfield} command locally defines +a user level command: +\begin{definition}[\DescribeMacro\glsxtrendfor] +\cs{glsxtrendfor} +\end{definition} +which is just a synonym for \cs{@endfortrue}. + +The loop is performed within the true part of \cs{glsxtrifhasfield} +so scoping is automatically applied. + +As from version 1.32, if the field given by +\begin{definition}[\DescribeMacro\GlsXtrForeignTextField] +\cs{GlsXtrForeignTextField} +\end{definition} +(which defaults to \texttt{userii}) contains a locale tag, then +\begin{definition}[\DescribeMacro\GlsXtrForeignText] +\cs{GlsXtrForeignText}\marg{entry label}\marg{text} +\end{definition} +can be used to encapsulate \meta{text} in +\cs{foreignlanguage}\marg{dialect}\marg{text} where \meta{dialect} +is obtained from the locale tag through \sty{tracklang}'s +\ics{GetTrackedDialectFromLanguageTag} command. You need at least +\sty{tracklang} v1.3.6 for this to work properly. The \meta{dialect} +must be one that's tracked (which typically means that \sty{babel} +or \sty{polyglossia} has been loaded with the appropriate setting +for that language). If \cs{foreignlanguage} hasn't been defined, +this just does \meta{text}. +For example: +\begin{verbatim} +\documentclass{article} + +\usepackage[main=british,brazilian,ngerman]{babel} +\usepackage{glossaries-extra} + +\setabbreviationstyle{long-short-user} +\newabbreviation + [user1={Associa\c{c}\~ao Brasileria de Normas T\'ecnicas}, + user2= {pt-BR} + ] + {abnt}{ABNT}{Brazilian National Standards Organization} + +\newabbreviation + [user1={Deutsches Institut f\"ur Normung e.V.}, + user2={de-DE-1996}] + {din}{DIN}{German Institute for Standardization} + +\renewcommand*{\glsxtruserparen}[2]{% + \glsxtrfullsep{#2}% + \glsxtrparen + {#1% + \ifglshasfield{\glsxtruserfield}{#2}% + {, \emph{\GlsXtrForeignText{#2}{\glscurrentfieldvalue}}}% + {}% + }% +} + +\begin{document} +\gls{abnt}, \gls{din}. +\end{document} +\end{verbatim} + + +When using the \pkgopt{record} option, in addition to recording the +usual location, you can also record the current value +of another counter at the same time using the preamble-only command: +\begin{definition}[\DescribeMacro\GlsXtrRecordCounter] +\cs{GlsXtrRecordCounter}\marg{counter name} +\end{definition} +For example: +\begin{verbatim} +\usepackage[record]{glossaries-extra} +\GlsXtrRecordCounter{section} +\end{verbatim} +Each time an entry is referenced with commands like \cs{gls} +or \cs{glstext}, the \texttt{.aux} file will not only contain +the \cs{glsxtr@record} command but also +\begin{alltt} +\cs{glsxtr@counterrecord}\marg{label}\{section\}\marg{n} +\end{alltt} +where \meta{n} is the current expansion of \cs{thesection} +and \meta{label} is the entry's label. On the next run, when the +\texttt{.aux} file is run, this command will do +\begin{alltt} +\cs{glsxtrfieldlistgadd}\marg{label}\{record.\meta{counter}\}\marg{n} +\end{alltt} +In the above example, if \verb|\gls{bird}| is used in section~1.2 +this would be +\begin{verbatim} +\glsxtrfieldlistgadd{bird}{record.section}{1.2} +\end{verbatim} +Note that there's no key corresponding to this new +\texttt{record.section} field, but its value can be +accessed with \cs{glsxtrfielduse} or the list can be +iterated over with \cs{glsxtrfielddolistloop} etc. + +\section{Display All Entries Without Sorting or Indexing} +\label{sec:printunsrt} + +\begin{definition}[\DescribeMacro\printunsrtglossary] +\cs{printunsrtglossary}\oarg{options} +\end{definition} +This behaves like \cs{printnoidxglossary} but never sorts the +entries and always lists all the defined entries for the given +glossary (and doesn't require \cs{makenoidxglossaries}). +If you want to use one of the \env{tabular}-like +styles with \cs{printunsrtglossary}, make sure you load +\sty{glossaries-extra-stylemods} which modifies +the definition of \cs{glsgroupskip} to avoid the +\qt{Incomplete \cs{iftrue}} error that may otherwise occur. + +There's also a starred form +\begin{definition}[\DescribeMacro{\printunsrtglossary*}] +\cs{printunsrtglossary}*\oarg{options}\marg{code} +\end{definition} +which is equivalent to +\begin{alltt} +\cs{begingroup} + \meta{code}\cs{printunsrtglossary}\oarg{options}\% +\cs{endgroup} +\end{alltt} +Note that unlike \cs{glossarypreamble}, the supplied \meta{code} is +done before the glossary header. + +This means you now have the option to simply list all entries on the +first \LaTeX\ run without the need for a post-processor, however +there will be no \gls{numberlist} in this case, as that has to be +set by a post-processor such as \gls{bib2gls} (see +\sectionref{sec:bib2gls}). + +\begin{important} +No attempt is made to gather hierarchical elements. +If child entries aren't defined immediately after their parent +entry, they won't be together in the glossary when using +\cs{printunsrtglossary}. +\end{important} + +There's a difference in behaviour depending on whether or not the +\gloskey{group} key is defined. If not defined (default), the +group label will be formed from the first letter of the +\gloskey{name} field. The corresponding group title will be obtained +as discussed in \sectionref{sec:glosstylemods}. This can lead to an +odd effect if you are using a style that separates letter groups +when the ordering isn't alphabetical. + +If the \gloskey{group} key is defined (which it is with the +\pkgopt{record} option) then the group label will be obtained from +the value of that field. If the field is empty, \emph{no grouping is +performed}, even if the style supports it. (That is, there won't be +a header or a vertical separation.) If the \gloskey{group} field is +non-empty, then the corresponding title is obtained as described +earlier. + +If you want to use a different field, you can redefine +\begin{definition}[\DescribeMacro\glsxtrgroupfield] +\cs{glsxtrgroupfield} +\end{definition} +to the relevant internal field label, but the \gloskey{group} +\emph{key} must still be defined (through the \pkgopt{record} option +or with commands like \cs{glsaddstoragekey}) to ensure that +\cs{printunsrtglossary} uses \cs{glsxtrgroupfield}. (This method is +used by \gls{bib2gls} for secondary entries, which have the group +label stored in the \texttt{secondarygroup} internal field.) + +If you have any entries with the \gloskey{see} key set, you will +need the \sty{glossaries} package option \pkgopt[ignore]{seenoindex} +or \pkgopt[warn]{seenoindex} to prevent an error occurring from the +automated \cs{glssee} normally triggered by this key. The +\pkgopt[only]{record} package option will automatically deal with +this. + +For example: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries-extra} + +\newglossaryentry{zebra}{name={zebra},description={stripy animal}} +\newglossaryentry{ant}{name={ant},description={an insect}} + +\begin{document} +\gls{ant} and \gls{zebra} + +\printunsrtglossaries +\end{document} +\end{verbatim} +In the above, zebra will be listed before ant as it was defined +first. + +If you allow document definitions with the \pkgopt{docdefs} option, +the document will require a second \LaTeX\ run if the entries are +defined after \cs{printunsrtglossary}. + +The optional argument is as for \cs{printnoidxglossary} (except for +the \gloskey[printnoidxglossary]{sort} key, which isn't available). + +All glossaries may be displayed in the order of their definition +using: +\begin{definition}[\DescribeMacro\printunsrtglossaries] +\cs{printunsrtglossaries} +\end{definition} +which is analogous to \cs{printnoidxglossaries}. This just +iterates over all defined glossaries (that aren't on the ignored +list) and does \cs{printunsrtglossary}[type=\meta{type}]. + +To avoid complications caused by \env{tabular}-like glossary +styles, \cs{printunsrtglossary} iterates over all entries +in the selected glossary and appends the appropriate code +to an internal command. Once the construction of this +command is complete, then it's performed to display the +glossary. This puts the loop outside the style code. +For convenience, there's a hook used within the loop: +\begin{definition}[\DescribeMacro\printunsrtglossaryentryprocesshook] +\cs{printunsrtglossaryentryprocesshook}\marg{label} +\end{definition} +This hook should not display any content, but may be used +to perform calculations. For example, to calculate widths. +Within this hook you can use: +\begin{definition}[\DescribeMacro\printunsrtglossaryskipentry] +\cs{printunsrtglossaryskipentry} +\end{definition} +to skip the current entry. This will prevent the entry from +being added to the internal command. + +There's another hook immediately before the internal command +containing the glossary code is performed: +\begin{definition}[\DescribeMacro\printunsrtglossarypredoglossary] +\cs{printunsrtglossarypredoglossary} +\end{definition} + +The internal command uses +\begin{definition}[\DescribeMacro\printunsrtglossaryhandler] +\cs{printunsrtglossaryhandler}\marg{label} +\end{definition} +to display each item in the list, where \meta{label} is the current label. + +By default the handler just does +\begin{definition}[\DescribeMacro\glsxtrunsrtdo] +\cs{glsxtrunsrtdo}\marg{label} +\end{definition} +which determines whether to use \cs{glossentry} or +\cs{subglossentry} and checks the \gloskey{location} and +\gloskey{loclist} fields for the \gls{numberlist}. If you want to +use a different field to be used instead of \gloskey{location} +then redefine: +\begin{definition}[\DescribeMacro\GlsXtrLocationField] +\cs{GlsXtrLocationField} +\end{definition} +to the internal name of the desired field. For example: +\begin{verbatim} +\renewcommand{\GlsXtrLocationField}{primarylocation} +\end{verbatim} +\begin{important} +Note that if the given location field is undefined or unset, +the handler will fallback on the \gloskey{loclist} field. +\end{important} +You can instruct \gls{bib2gls} to omit setting the \gloskey{loclist} +field with the resource option \texttt{--save-loclist=false} +to prevent it from being used as a fallback. + +You can redefine the handler if required. For example, +you may want to filter entries according to the category +label. You can test if a label is contained in a comma-separated +list of labels using: +\begin{definition}[\DescribeMacro\glsxtriflabelinlist] +\cs{glsxtriflabelinlist}\marg{label}\marg{label list}\marg{true}\marg{false} +\end{definition} +The \meta{label} and \meta{label list} will be fully expanded. + +\begin{important} +If you redefine the handler to exclude entries, you may end +up with an empty glossary. This could cause a problem for +the list-based styles. +\end{important} + +For example, if the preamble includes: +\begin{verbatim} +\usepackage[record,style=index]{glossaries-extra} +\GlsXtrRecordCounter{section} +\end{verbatim} +then you can print the glossary but first redefine the handler +to only select entries that include the current section number +in the \texttt{record.section} field: +\begin{verbatim} +\renewcommand{\printunsrtglossaryhandler}[1]{% + \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + {\glsxtrunsrtdo{#1}}% + {}% +} +\end{verbatim} + +Alternatively you can use the starred form of +\cs{printunsrtglossary} which will localise the change: + +\begin{verbatim} +\printunsrtglossary*{% + \renewcommand{\printunsrtglossaryhandler}[1]{% + \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + {\glsxtrunsrtdo{#1}}% + {}% + }% +} +\end{verbatim} + +If you are using the \sty{hyperref} package and want to +display the same glossary more than once, you can also +add a temporary redefinition of \cs{glolinkprefix} to +avoid duplicate hypertarget names. For example: + +\begin{verbatim} +\printunsrtglossary*{% + \renewcommand{\printunsrtglossaryhandler}[1]{% + \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + {\glsxtrunsrtdo{#1}}% + {}% + }% + \ifcsundef{theHsection}% + {% + \renewcommand*{\glolinkprefix}{record.\csuse{thesection}.}% + }% + {% + \renewcommand*{\glolinkprefix}{record.\csuse{theHsection}.}% + }% +} +\end{verbatim} +Note that this will cause a problem if your descriptions +contain commands like \cs{gls} that need to link an entry that +doesn't appear in the summary. In this case, it's a better approach +to use: +\begin{verbatim} +\printunsrtglossary*{% + \renewcommand{\printunsrtglossaryhandler}[1]{% + \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + {\glsxtrunsrtdo{#1}}% + {}% + }% + \ifcsundef{theHsection}% + {% + \setkeys{printgloss}{targetnameprefix={record.\csuse{thesection}.}}% + }% + {% + \setkeys{printgloss}{targetnameprefix={record.\csuse{theHsection}.}}% + }% +} +\end{verbatim} + +If it's a short summary at the start of a section, you might +also want to suppress the glossary header and add some vertical +space afterwards: +\begin{verbatim} +\printunsrtglossary*{% + \renewcommand{\printunsrtglossaryhandler}[1]{% + \glsxtrfieldxifinlist{#1}{record.section}{\thesection} + {\glsxtrunsrtdo{#1}}% + {}% + }% + \ifcsundef{theHsection}% + {% + \renewcommand*{\glolinkprefix}{record.\csuse{thesection}.}% + }% + {% + \renewcommand*{\glolinkprefix}{record.\csuse{theHsection}.}% + }% + \renewcommand*{\glossarysection}[2][]{}% + \appto\glossarypostamble{\glspar\medskip\glspar}% +} +\end{verbatim} + +There's a shortcut command that essentially does this: +\begin{definition}[\DescribeMacro\printunsrtglossaryunit] +\cs{printunsrtglossaryunit}\oarg{options}\marg{counter name} +\end{definition} +The above example can simply be replaced with: +\begin{verbatim} +\printunsrtglossaryunit{section} +\end{verbatim} + +This shortcut command is actually defined to use \cs{printunsrtglossary*} with +\begin{definition}[\DescribeMacro\printunsrtglossaryunitsetup] +\cs{printunsrtglossaryunitsetup}\marg{counter name} +\end{definition} +so if you want to just make some minor modifications you can +do +\begin{verbatim} +\printunsrtglossary*{\printunsrtglossaryunitsetup{section}% + \renewcommand*{\glossarysection}[2][]{\subsection*{Summary}}% +} +\end{verbatim} +which will start the list with a subsection header with the +title \qt{Summary} (overriding the glossary's title). + +Note that this shortcut command is only available with the +\pkgopt{record} (or \pkgopt[alsoindex]{record}) package option. + +This temporary change in the hypertarget prefix means you +need to explicitly use \cs{hyperlink} to create a link to it +as commands like \cs{gls} will try to link to the target +created with the default definition of \cs{gloslinkprefix}. +This isn't a problem if you want a primary glossary of all terms +produced using just \cs{printunsrtglossary} (in the front or back +matter) which can be the target for all glossary references +and then just use \cs{printunsrtglossaryunit} for a quick +summary at the start of a section etc. + +\section{Standalone Entry Items} +\label{sec:glossentry} + +It may be that you don't want a list but would rather display +entry details throughout the document. You can simply +do \cs{glsentryname} followed by \cs{glsentrydesc}. +(Remember that if you don't want a sorted list, use +\pkgopt[none]{sort} to skip the construction of the +\gloskey{sort} field.) +For example, in the preamble provide a custom command: +\begin{verbatim} +\newcommand{\displayterm}[1]{% + \par\medskip\par\noindent + Definition: \glsentryname{#1}.\par + \glsentrydesc{#1} + \par\medskip +} +\end{verbatim} +define your entries +\begin{verbatim} +\newglossaryentry{function}{name={function}, + description={a relation or expression involving variables} +} +\end{verbatim} +and then later in the text: +\begin{verbatim} +\displayterm{function} +\end{verbatim} + +However, if may be that you want to use \sty{hyperref} and +have commands like \cs{gls} link back to the place where +the term is described. Instead of using \cs{glsentryname} +use +\begin{definition}[\DescribeMacro\glsxtrglossentry] +\cs{glsxtrglossentry}\marg{label} +\end{definition} +where \meta{label} is the entry's label. + +This is designed to behave much like the way the name is displayed +in the glossary. It performs the following: +\begin{itemize} +\item Defines \cs{glscurrententrylabel} to the entry's label. +This is usually done at the start of the glossary style commands +\cs{glossentry} and \cs{subglossentry} and may be used by hooks, +such as the post-name hooks. Here the definition is localised +so that it's only available for use in \cs{glossentryname}. + +\item Defines \cs{currentglossary} to the entry's glossary type. +This is usually done at the start of commands like +\cs{printglossary} and may be used by style hooks. +Here the definition is localised so that it's only available for use +in \cs{glsentryitem} and \cs{glssubentryitem}. The value is obtained +by fully expanding: +\begin{definition}[\DescribeMacro\GlsXtrStandaloneGlossaryType] +\cs{GlsXtrStandaloneGlossaryType} +\end{definition} +which defaults to the value of the \gloskey{type} field for the +current entry. + +\item Increments and display the entry counters + if the \pkgopt{entrycounter} or \pkgopt{subentrycounter} + package options are set. If the entry doesn't have a parent, then + this does + \begin{itemize} + \item \cs{glsentryitem}\marg{label} + \end{itemize} + otherwise it does (as from v1.31) + \begin{itemize} + \item \ics{GlsXtrStandaloneSubEntryItem}\marg{label} +which defaults to \cs{glssubentryitem}\marg{label} if the entry +has a parent but not a grandparent. + \end{itemize} + This reflects the behaviour of the predefined hierarchical styles. +A bug in pre-version~1.31 used \cs{glsentryitem} for all child levels, +which doesn't match the hierarchical glossary styles. If you want to +restore this behaviour, just do: +\begin{verbatim} +\renewcommand*{\GlsXtrStandaloneSubEntryItem}[1]{\glssubentryitem{#1}} +\end{verbatim} + +\item Sets the hyper-target if supported (using \cs{glstarget}) +and displays the entry name using: +\begin{definition}[\DescribeMacro\GlsXtrStandaloneEntryName] +\cs{GlsXtrStandaloneEntryName}\marg{label} +\end{definition} + which uses + \cs{glstarget}\marg{label}\{\cs{glossentryname}\marg{label}\} + by default. + Remember that \cs{glossentryname} uses \cs{glsnamefont} or picks up + the style from category attributes such as + \catattr{glossnamefont}. +\end{itemize} +If you have used \ics{nopostdesc} or \ics{glsxtrnopostpunc} +in any of your description fields, you can use +\begin{definition}[\DescribeMacro\glsxtractivatenopost] +\cs{glsxtractivatenopost} +\end{definition} +to make these commands behave as they normally do within a glossary. +This needs to be placed before +\begin{alltt} +\cs{glossentrydesc}\marg{label}\cs{glspostdescription} +\end{alltt} +and scoped. Note that \cs{glsnonextpages} and \cs{glsnextpages} have no +effect outside of the glossary and are not intended for use in a +standalone context. + +It's also possible to select a different field (rather than +using \gloskey{name}): +\begin{definition}[\DescribeMacro\glsxtrglossentryother] +\cs{glsxtrglossentryother}\marg{header}\marg{label}\marg{field} +\end{definition} +The \meta{field} must be given using its internal field label +which may not be the same as the key used to set the field. +See the key to field mappings table in the \styfmt{glossaries} +user manual. The \meta{header} argument is the code +to pass to the third argument of \cs{glsxtrtitleorpdforheading}. +It may be left empty in which case the default is determined as follows: +\begin{itemize} +\item If \cs{glsxtrhead\meta{field}} is defined, then \meta{header} +is \cs{glsxtrhead\meta{field}}\marg{label}. +\item Otherwise \meta{header} is simply the field value. +\end{itemize} +The \cs{glsxtrglossentryother} command internally uses +\begin{definition}[\DescribeMacro\GlsXtrStandaloneEntryOther] +\cs{GlsXtrStandaloneEntryOther}\marg{label}\marg{field} +\end{definition} +instead of \cs{GlsXtrStandaloneEntryName}, which uses +\cs{glossentrynameother}\marg{label}\marg{field} instead of +\cs{glossentryname}\marg{label}. + +If you have loaded the +\sty{glossaries-accsupp} package (through the \pkgopt{accsupp} +option) then accessibility support will be provided if +there's a corresponding command +\begin{alltt} +\cs{gls\meta{field}accessdisplay}\marg{text}\marg{label} +\end{alltt} +(for example, \cs{glssymbolaccessdisplay}). + +This means that my custom command can be changed to: +\begin{verbatim} +\newcommand{\displayterm}[1]{% + \par\medskip\par\noindent + Definition: \glsxtrglossentry{#1}.\par + \glsentrydesc{#1} + \par\medskip +} +\end{verbatim} +If I want numbered definitions, then I can use the +package options \sty{entrycounter} or \sty{subentrycounter} +and remove the colon: +\begin{verbatim} +\newcommand{\displayterm}[1]{% + \par\medskip\par\noindent + Definition \glsxtrglossentry{#1}.\par + \glsentrydesc{#1} + \par\medskip +} +\end{verbatim} +The counter label uses a dot after the number by default +but this can be changed to a colon: +\begin{verbatim} +\renewcommand*{\glsentrycounterlabel}{\theglossaryentry:\space} +\end{verbatim} +It's now possible to not only use \cs{gls} to link back to the +definition but also use \cs{glsrefentry} to reference +the counter and \cs{glsxtrpageref} to reference the page number. + +If I want the description to behave more like it does +in a glossary in need to make the following modification: +\begin{verbatim} +\newcommand{\displayterm}[1]{% + \par\medskip\par\noindent + Definition \glsxtrglossentry{#1}.\par + \begingroup + \glsxtractivatenopost + \glossentrydesc{#1}\glspostdescription + \endgroup + \par\medskip +} +\end{verbatim} +(Note the grouping to localise \cs{glsxtractivatenopost}.) + +You can also use \cs{glsxtrglossentry} within section headings. +For example: +\begin{verbatim} +\section{\glsxtrglossentry{function}} +\end{verbatim} +This will use \cs{glsentryname} in PDF bookmarks (if +\cs{texorpdfstring} is defined) and will use \cs{glsxtrheadname} in +page headers and table of contents. (If you're using a page style or +table of contents that doesn't use \cs{markright} or \cs{markbook} +or \cs{@starttoc} then you need to insert \cs{glsxtrmarkhook} and +\cs{@glsxtrinmark} at the start of the header or table of contents +either scoped or afterwards cancelled with \cs{@glsxtrnotinmark} and +\cs{glsxtrrestoremarkhook}.) + +\section{Entry Aliases} +\label{sec:alias} + +An entry can be made an alias of another entry using the +\gloskey{alias} key. The value should be the label of the other +term. There's no check for the other's existence when the aliased +entry is defined. This is to allow the possibility of defining the +other entry after the aliased entry. (For example, when used with +\gls{bib2gls}.) + +If an entry \meta{entry-1} is made an alias of \meta{entry-2} then: +\begin{itemize} +\item If the \gloskey{see} field wasn't provided when \meta{entry-1} +was defined, the \gloskey{alias} key will automatically trigger +\begin{alltt} +\cs{glssee}\marg{entry-1}\marg{entry-2} +\end{alltt} +\item If the \sty{hyperref} package has been loaded then +\cs{gls}\marg{entry-1} will link to \meta{entry-2}'s target. (Unless +the \catattr{targeturl} attribute has been set for \meta{entry-1}'s +category.) +\item With \pkgopt[off]{record} or \pkgopt[alsoindex]{record}, the \gloskey[glslink]{noindex} setting will automatically be triggered +when referencing \meta{entry-1} with commands like \cs{gls} or +\cs{glstext}. This prevents \meta{entry-1} from have a +\gls{locationlist} (aside from the cross-reference added with +\cs{glssee}) unless it's been explicitly indexed with \cs{glsadd} or +if the indexing has been explicitly set using +\texttt{noindex=false}. + +Note that with \pkgopt[only]{record}, the \gls{locationlist} +for aliased entries is controlled with \gls{bib2gls}['s] settings. +\end{itemize} + +The index suppression trigger is performed by +\begin{definition}[\DescribeMacro\glsxtrsetaliasnoindex] +\cs{glsxtrsetaliasnoindex} +\end{definition} +This is performed after the default options provided by +\ics{GlsXtrSetDefaultGlsOpts} have been set. +With \pkgopt[only]{record}, \cs{glsxtrsetaliasnoindex} will +default to do nothing. + +Within the definition of \cs{glsxtrsetaliasnoindex} you can use +\begin{definition}[\DescribeMacro\glsxtrindexaliased] +\cs{glsxtrindexaliased} +\end{definition} +to index \meta{entry-2}. + +The index suppression command can be redefined to index the main +term instead. For example: +\begin{verbatim} +\renewcommand{\glsxtrsetaliasnoindex}{% + \glsxtrindexaliased + \setkeys{glslink}{noindex}% +} +\end{verbatim} + +The value of the \gloskey{alias} field can be accessed using +\begin{definition}[\DescribeMacro\glsxtralias] +\cs{glsxtralias}\marg{label} +\end{definition} + +\chapter{Supplemental Packages} +\label{sec:supplemental} + +The \styfmt{glossaries} bundle provides additional support packages +\sty{glossaries-prefix} (for prefixing) and \sty{glossaries-accsupp} +(for accessibility support). These packages aren't automatically +loaded. + +\section{Prefixes or Determiners} +\label{sec:prefix} + +If prefixing is required, you can simply load +\sty{glossaries-prefix} after \styfmt{glossaries-extra}. For example: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries-extra} +\usepackage{glossaries-prefix} + +\makeglossaries + +\newabbreviation + [prefix={an\space}, + prefixfirst={a~}] + {svm}{SVM}{support vector machine} + +\begin{document} + +First use: \pgls{svm}. +Next use: \pgls{svm}. + +\printglossaries + +\end{document} +\end{verbatim} + +\section{Accessibility Support} +\label{sec:accsupp} + +The \sty{glossaries-accsupp} package needs to be loaded before +\styfmt{glossaries-extra} or through the \pkgopt{accsupp} package +option: +\begin{verbatim} +\usepackage[accsupp]{glossaries-extra} +\end{verbatim} +If you don't load \sty{glossaries-accsupp} or you load +\sty{glossaries-accsupp} after \styfmt{glossaries-extra} +the new \cs{glsaccess}\meta{xxx} commands described below will +simply be equivalent to the corresponding \cs{glsentry}\meta{xxx} +commands. + +The following \cs{glsaccess}\meta{xxx} commands add accessibility information wrapped around +the corresponding \cs{glsentry}\meta{xxx} commands. There is +no check for existence of the entry nor do any of these commands +add formatting, hyperlinks or indexing information. + +\begin{definition}[\DescribeMacro\glsaccessname] +\cs{glsaccessname}\marg{label} +\end{definition} +This displays the value of the \gloskey{name} field for the entry +identified by \meta{label}. + +If the \sty{glossaries-accsupp} package isn't loaded, this is +simply defined as: +\begin{verbatim} +\newcommand*{\glsaccessname}[1]{\glsentryname{#1}} +\end{verbatim} +otherwise it's defined as: +\begin{verbatim} +\newcommand*{\glsaccessname}[1]{% + \glsnameaccessdisplay + {% + \glsentryname{#1}% + }% + {#1}% +} +\end{verbatim} +(\ics{glsnameaccessdisplay} is defined by the +\sty{glossaries-accsupp} package.) The first letter upper case +version is: +\begin{definition}[\DescribeMacro\Glsaccessname] +\cs{Glsaccessname}\marg{label} +\end{definition} +Without the \sty{glossaries-accsupp} package this is just defined +as: +\begin{verbatim} +\newcommand*{\Glsaccessname}[1]{\Glsentryname{#1}} +\end{verbatim} +With the \sty{glossaries-accsupp} package this is defined as: +\begin{verbatim} +\newcommand*{\Glsaccessname}[1]{% + \glsnameaccessdisplay + {% + \Glsentryname{#1}% + }% + {#1}% +} +\end{verbatim} + +The following commands are all defined in an analogous manner. +\begin{definition}[\DescribeMacro\glsaccesstext] +\cs{glsaccesstext}\marg{label} +\end{definition} +This displays the value of the \gloskey{text} field. + +\begin{definition}[\DescribeMacro\Glsaccesstext] +\cs{Glsaccesstext}\marg{label} +\end{definition} +This displays the value of the \gloskey{text} field with the first +letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccessplural] +\cs{glsaccessplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{plural} field. + +\begin{definition}[\DescribeMacro\Glsaccessplural] +\cs{Glsaccessplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{plural} field +with the first letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccessfirst] +\cs{glsaccessfirst}\marg{label} +\end{definition} +This displays the value of the \gloskey{first} field. + +\begin{definition}[\DescribeMacro\Glsaccessfirst] +\cs{Glsaccessfirst}\marg{label} +\end{definition} +This displays the value of the \gloskey{first} field +with the first letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccessfirstplural] +\cs{glsaccessfirstplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{firstplural} field. + +\begin{definition}[\DescribeMacro\Glsaccessfirstplural] +\cs{Glsaccessfirstplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{firstplural} field +with the first letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccesssymbol] +\cs{glsaccesssymbol}\marg{label} +\end{definition} +This displays the value of the \gloskey{symbol} field. + +\begin{definition}[\DescribeMacro\Glsaccesssymbol] +\cs{Glsaccesssymbol}\marg{label} +\end{definition} +This displays the value of the \gloskey{symbol} field +with the first letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccesssymbolplural] +\cs{glsaccesssymbolplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{symbolplural} field. + +\begin{definition}[\DescribeMacro\Glsaccesssymbolplural] +\cs{Glsaccesssymbolplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{symbolplural} field +with the first letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccessdesc] +\cs{glsaccessdesc}\marg{label} +\end{definition} +This displays the value of the \gloskey{description} field. + +\begin{definition}[\DescribeMacro\Glsaccessdesc] +\cs{Glsaccessdesc}\marg{label} +\end{definition} +This displays the value of the \gloskey{description} field +with the first letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccessdescplural] +\cs{glsaccessdescplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{descriptionplural} field. + +\begin{definition}[\DescribeMacro\Glsaccessdescplural] +\cs{Glsaccessdescplural}\marg{label} +\end{definition} +This displays the value of the \gloskey{descriptionplural} field +with the first letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccessshort] +\cs{glsaccessshort}\marg{label} +\end{definition} +This displays the value of the \gloskey{short} field. + +\begin{definition}[\DescribeMacro\Glsaccessshort] +\cs{Glsaccessshort}\marg{label} +\end{definition} +This displays the value of the \gloskey{short} field with the first +letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccessshortpl] +\cs{glsaccessshortpl}\marg{label} +\end{definition} +This displays the value of the \gloskey{shortplural} field. + +\begin{definition}[\DescribeMacro\Glsaccessshortpl] +\cs{Glsaccessshortpl}\marg{label} +\end{definition} +This displays the value of the \gloskey{shortplural} field with the first +letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccesslong] +\cs{glsaccesslong}\marg{label} +\end{definition} +This displays the value of the \gloskey{long} field. + +\begin{definition}[\DescribeMacro\Glsaccesslong] +\cs{Glsaccesslong}\marg{label} +\end{definition} +This displays the value of the \gloskey{long} field with the first +letter converted to upper case. + +\begin{definition}[\DescribeMacro\glsaccesslongpl] +\cs{glsaccesslongpl}\marg{label} +\end{definition} +This displays the value of the \gloskey{longplural} field. + +\begin{definition}[\DescribeMacro\Glsaccesslongpl] +\cs{Glsaccesslongpl}\marg{label} +\end{definition} +This displays the value of the \gloskey{longplural} field with the first +letter converted to upper case. + +\chapter{Sample Files} +\label{sec:samples} + +The following sample files are provided with this package: +\begin{description} +\item[sample.tex] Simple sample file that uses one of the dummy +files provided by the \styfmt{glossaries} package for testing. + +\item[sample-abbr-styles.tex] Demonstrates all predefined +abbreviation styles. + +\item[sample-mixture.tex] General entries, acronyms and initialisms +all treated differently. + +\item[sample-name-font] Categories and attributes are used to +customize the way different entries appear. + +\item[sample-abbrv.tex] General abbreviations. + +\item[sample-acronym.tex] Acronyms aren't initialisms and don't +expand on \gls{firstuse}. + +\item[sample-acronym-desc.tex] Acronyms that have a separate long +form and description. + +\item[sample-crossref.tex] Unused entries that have been +cross-referenced automatically are added at the end of the document. + +\item[sample-indexhook.tex] Use the index hook to track +which entries have been indexed (and therefore find out +which ones haven't been indexed). + +\item[sample-footnote.tex] Footnote abbreviation style that moves +the footnote marker outside of the hyperlink generated by \cs{gls} +and moves it after certain punctuation characters for neatness. + +\item[sample-undef.tex] Warn on undefined entries instead of +generating an error. + +\item[sample-mixed-abbrv-styles.tex] Different abbreviation styles +for different entries. + +\item[sample-initialisms.tex] Automatically insert dots into +initialisms. + +\item[sample-postdot.tex] Another initialisms example. + +\item[sample-postlink.tex] Automatically inserting text after +the \gls{linktext} produced by commands like \cs{gls} (outside +of hyperlink, if present). + +\item[sample-header.tex] Using entries in section/chapter headings. + +\item[sample-autoindex.tex] Using the \catattr{dualindex} and +\catattr{indexname} attributes to automatically add glossary +entries to the index (in addition to the glossary \gls{locationlist}). + +\item[sample-autoindex-hyp.tex] As previous but uses \sty{hyperref}. + +\item[sample-nested.tex] Using \ics{gls} within the +value of the \gloskey{name} key. + +\item[sample-entrycount.tex] Enable entry-use counting (only index +if used more than $n$ times, see \sectionref{sec:entrycount}). + +\item[sample-unitentrycount.tex] Enable use of per-unit entry-use counting +(\sectionref{sec:entrycount}). + +\item[sample-onelink.tex] Using the per-unit entry counting +(\sectionref{sec:entrycount}) +to only have one hyperlink per entry per page. + +\item[sample-linkcount.tex] Using link counting +(\sectionref{sec:linkcount}) +to only have one hyperlink per entry. + +\item[sample-pages.tex] Insert \qt{page} or \qt{pages} before the +location list. + +\item[sample-altmodifier.tex] Set the default options for +commands like \cs{gls} and add an alternative modifier. + +\item[sample-mixedsort.tex] Uses the optional argument +of \cs{makeglossaries} to allow a mixture of \cs{printglossary} +and \cs{printnoidxglossary}. + +\item[sample-external.tex] Uses the \catattr{targeturl} attribute +to allow for entries that should link to an external URL +rather than to an internal glossary. + +\item[sample-fmt.tex] Provides text-block commands associated +with entries in order to use \cs{glsxtrfmt}. + +\item[sample-alias.tex] Uses the \gloskey{alias} key. +(See \sectionref{sec:alias}.) + +\item[sample-alttree.tex] Uses the \sty{glossaries-extra-stylemods} +package with the \glostyle{alttree} style (see \sectionref{sec:stylemods}). + +\item[sample-alttree-sym.tex] Another \glostyle{alttree} example +that measures the symbol widths. + +\item[sample-alttree-marginpar.tex] Another \glostyle{alttree} example +that puts the \gls{numberlist} in the margin. + +\item[sample-onthefly.tex] Using on-the-fly commands. Terms with +accents must have the \gloskey{name} key explicitly set. + +\item[sample-onthefly-xetex.tex] Using on-the-fly commands +with \XeLaTeX. Terms with UTF-8 characters don't need to +have the \gloskey{name} key explicitly set. Terms that contain +commands must have the \gloskey{name} key explicitly set +with the commands removed from the label. + +\item[sample-onthefly-utf8.tex] Tries to emulate the previous +sample file for use with \LaTeX\ through the starred version +of \ics{GlsXtrEnableOnTheFly}. This is a bit iffy and may not +always work. Terms that contain commands must have the +\gloskey{name} key explicitly set with the commands removed from +the label. + +\item[sample-accsupp.tex] Integrate \sty{glossaries-accsupp}. + +\item[sample-prefix.tex] Integrate \sty{glossaries-prefix}. + +\item[sample-suppl-main.tex] Uses \gloskey[glsadd]{thevalue} to +reference a location in the supplementary file +\texttt{sample-suppl.tex}. + +\item[sample-suppl-main-hyp.tex] A more complicated version to the +above that uses the \sty{hyperref} package to reference a location +in the supplementary file \texttt{sample-suppl-hyp.tex}. + +\end{description} + +\chapter{Multi-Lingual Support} +\label{sec:lang} + +There's only one command provided by \styfmt{glossaries-extra} +that you're likely to want to change in your document and that's +\ics{abbreviationsname} (\sectionref{sec:pkgopts}) if you use +the \pkgopt{abbreviations} package option to automatically +create the glossary labelled \texttt{abbreviations}. If this +command doesn't already exist, it will be defined to +\qt{Abbreviations} if \sty{babel} hasn't been loaded, otherwise +it will be defined as \cs{acronymname} (provided by +\styfmt{glossaries}). + +You can redefine it in the usual way. For example: +\begin{verbatim} +\renewcommand*{\abbreviationsname}{List of Abbreviations} +\end{verbatim} +Or using \sty{babel} or \sty{polyglossia} captions hook: +\begin{verbatim} +\appto\captionsenglish{% + \renewcommand*{\abbreviationsname}{List of Abbreviations}% +} +\end{verbatim} + +Alternatively you can use the \gloskey[printglossary]{title} +key when you print the list of abbreviations. For example: +\begin{verbatim} +\printabbreviations[title={List of Abbreviations}] +\end{verbatim} +or +\begin{verbatim} +\printglossary[type=abbreviations,title={List of Abbreviations}] +\end{verbatim} + +The other fixed text commands are the diagnostic messages, which +shouldn't appear in the final draft of your document. + +The \styfmt{glossaries-extra} package has the facility to load +language modules (whose filename is in the form +\texttt{glossariesxtr-}\meta{language}\texttt{.ldf}) if they exist, +but won't warn if they don't. If \sty{glossaries-extra-bib2gls} is +loaded via the \pkgopt{record} package option then the check for +language resource files will additionally search for an associated +language script file given by +\texttt{glossariesxtr-}\meta{script}\texttt{.ldf} where +\meta{script} is the four letter script identifier, such as +\texttt{Latn}, associated with the given dialect. There's no warning if the +associated file isn't found. The script file is loaded after the +dialect file. + +If you want to write your own language module, you just need to +create a file called +\texttt{glossariesxtr-}\meta{lang}\texttt{.ldf}, where \meta{lang} +identifies the language or dialect (see the \sty{tracklang} +package). For example, \texttt{glossariesxtr-french.ldf}. + +The simplest code for this file is: +\begin{verbatim} +\ProvidesGlossariesExtraLang{french}[2015/12/09 v1.0] + +\newcommand*{\glossariesxtrcaptionsfrench}{% + \def\abbreviationsname{Abr\'eviations}% +} +\glossariesxtrcaptionsfrench + +\ifcsdef{captions\CurrentTrackedDialect} +{% + \csappto{captions\CurrentTrackedDialect}% + {% + \glossariesxtrcaptionsfrench + }% +}% +{% + \ifcsdef{captions\CurrentTrackedLanguage} + {% + \csappto{captions\CurrentTrackedLanguage}% + {% + \glossariesxtrcaptionsfrench + }% + }% + {}% +} +\end{verbatim} + +You can adapt this for other languages by replacing +all instances of the language identifier \texttt{french} and +the translated text \verb|Abr\'eviations| as appropriate. +You can also use the \texttt{.ldf} file to provide rule +blocks for a particular language for use with \gls{bib2gls}['s] custom +sort rule. See \sectionref{sec:bib2glssty} for further details. + +This \texttt{.ldf} file then needs to be put somewhere on \TeX's +path so that it can be found by \styfmt{glossaries-extra}. +You might also want to consider uploading it to CTAN so that +it can be useful to others. (Please don't send it to me. I already +have more packages than I am able to maintain.) + +If you additionally want to provide translations for the diagnostic +messages used when a glossary is missing, you need to redefine +the following commands: +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningHead] +\cs{GlsXtrNoGlsWarningHead}\marg{label}\marg{file} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningHead{\meta{label}}{\meta{file}} +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningEmptyStart] +\cs{GlsXtrNoGlsWarningEmptyStart} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningEmptyStart +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningEmptyMain] +\cs{GlsXtrNoGlsWarningEmptyMain} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningEmptyMain +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningEmptyNotMain] +\cs{GlsXtrNoGlsWarningEmptyNotMain}\marg{label} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningEmptyNotMain{\meta{label}} +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningCheckFile] +\cs{GlsXtrNoGlsWarningCheckFile}\marg{file} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningCheckFile{\meta{file}} +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningMisMatch] +\cs{GlsXtrNoGlsWarningMisMatch} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningMisMatch +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningNoOut] +\cs{GlsXtrNoGlsWarningNoOut}\marg{file} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningNoOut{\meta{file}} +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningTail] +\cs{GlsXtrNoGlsWarningTail} +\end{definition} +This produces the following text in English: +\begin{quote} +\GlsXtrNoGlsWarningTail +\end{quote} + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningBuildInfo] +\cs{GlsXtrNoGlsWarningBuildInfo} +\end{definition} +This is advice on how to generate the glossary files. +See the documented code (\texttt{glossaries-extra-code.pdf}) +for further details. + +\begin{definition}[\DescribeMacro\GlsXtrNoGlsWarningAutoMake] +\cs{GlsXtrNoGlsWarningAutoMake}\marg{label} +\end{definition} +This is the message produced when the \pkgopt{automake} option +is used, but the document needs a rerun or the shell escape +setting doesn't permit the execution of the external application. +This command also generates a warning in the transcript file. +See the documented code for further details. + +\printglossaries +\PrintIndex + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/glossaries-extra.dtx b/macros/latex/contrib/glossaries-extra/glossaries-extra.dtx new file mode 100644 index 0000000000..3d37899d9b --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/glossaries-extra.dtx @@ -0,0 +1,33306 @@ +%\iffalse +% glossaries-extra.dtx generated using makedtx version 1.2 (c) Nicola Talbot +% Command line args: +% -src "glossaries-extra.sty\Z=>glossaries-extra.sty" +% -src "glossaries-extra-bib2gls.sty\Z=>glossaries-extra-bib2gls.sty" +% -src "glossaries-extra-stylemods.sty\Z=>glossaries-extra-stylemods.sty" +% -src "glossary-bookindex.sty\Z=>glossary-bookindex.sty" +% -src "glossary-longextra.sty\Z=>glossary-longextra.sty" +% -src "glossary-topic.sty\Z=>glossary-topic.sty" +% -src "(example-glossaries-.+\.tex)\Z=>\1" +% -src "(example-glossaries-.+\.bib)\Z=>\1" +% -author "Nicola Talbot" +% -doc "glossaries-extra-codedoc.tex" +% -macrocode ".*\.tex" +% -macrocode ".*\.bib" +% -section "chapter" +% -setambles ".*\.bib=>\nopreamble\nopostamble" +% -comment ".*\.tex" +% -comment ".*\.bib" +% -codetitle "Main Package Code (\\styfmt{glossaries-extra.sty})" +% glossaries-extra +% Created on 2019/4/9 21:59 +%\fi +%\iffalse +%<*package> +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +%\fi +% \iffalse +% Doc-Source file to use with LaTeX2e +% Copyright (C) 2019 Nicola Talbot, all rights reserved. +% \fi +% \iffalse +%<*driver> +\documentclass[report,widecs]{nlctdoc} + +\iffalse +glossaries-extra-codedoc.tex is a stub file used by makedtx to create +glossaries-extra.dtx +\fi + +\usepackage{alltt} +\usepackage{pifont} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[colorlinks, + bookmarks, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, + pdftitle={glossaries-extra.sty: an extension to the glossaries +package}, + pdfkeywords={LaTeX,package,glossary,abbreviations}]{hyperref} +\usepackage[nonumberlist,nopostdot=false]{glossaries-extra} + +\RecordChanges + +\makeglossaries + +\renewcommand*{\main}[1]{\hyperpage{#1}} +\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}} +\newcommand*{\itermdef}[1]{\index{#1|htextbf}} + +\newglossaryentry{xindy}{ + name={\appfmt{xindy}\index{xindy|htextbf}}, + sort={xindy}, + text={\protect\app{xindy}}, + description={An flexible indexing application with multilingual + support written in Perl} +} + +\newglossaryentry{makeindex}{% + name={\appfmt{makeindex}\index{makeindex|htextbf}},% + sort={makeindex},% + text={\protect\app{makeindex}},% + description={An indexing application}, +} + +\newglossaryentry{bib2gls}{% +name={\appfmt{bib2gls}\index{bib2gls=\appfmt{bib2gls}|htextbf}},% +sort={bib2gls},% +text={\appfmt{bib2gls}\iapp{bib2gls}},% +description={A command line Java application that selects +entries from a .bib file and converts them to glossary +definitions (like \appfmt{bibtex} but also performs hierarchical +sorting and collation, thus omitting the need for \gls{xindy} or +\gls{makeindex}). Further details at: +\url{http://www.dickimaw-books.com/software/bib2gls/}.}% +} + +\let\glsd\glsuseri +\let\glsation\glsuserii + +\newglossaryentry{firstuse}{% + name={First use\ifirstuse}, + sort={first use},% + text={first use},% + user1={first used}, + description={The first time a glossary entry is used (from the start + of the document or after a reset) with one of the + following commands: \ics{gls}, \ics{Gls}, \ics{GLS}, \ics{glspl}, + \ics{Glspl}, \ics{GLSpl} or \ics{glsdisp}. + \glsadd{firstuseflag}\glsadd{firstusetext}% + \glsseeformat{firstuseflag,firstusetext}{}\nopostdesc}% +} + +\newglossaryentry{firstuseflag}{% +name={First use flag\ifirstuseflag}, +sort={first use flag},% +text={first use flag},% +description={A conditional that determines whether or not the entry +has been used according to the rules of \gls{firstuse}}% +} + +\newglossaryentry{firstusetext}{% +name={First use text\ifirstusetext}, +sort={first use text},% +text={first use text},% +description={The text that is displayed on \gls{firstuse}, which is +governed by the \gloskey{first} and \gloskey{firstplural} keys of +\ics{newglossaryentry}. (May be overridden by +\ics{glsdisp}.)\nopostdesc}% +} + +\doxitem{Option}{option}{package options} +\doxitem{Counter}{counter}{glossary counters} +\doxitem{AbbrvStyle}{abbrvstyle}{abbreviation styles} +\doxitem{Style}{style}{glossary styles} + +\setcounter{IndexColumns}{2} + +\CheckSum{25503} + +\newcommand*{\ifirstuse}{\iterm{first use}} +\newcommand*{\firstuse}{\gls{firstuse}} +\newcommand*{\firstuseflag}{\gls{firstuseflag}} +\newcommand*{\firstusetext}{\gls{firstusetext}} + +\newcommand*{\ifirstuseflag}{\iterm{first use>flag}} +\newcommand*{\ifirstusetext}{\iterm{first use>text}} + +\newcommand*{\istkey}[1]{\appfmt{#1}\index{makeindex=\appfmt{makeindex}>#1=\texttt{#1}|hyperpage}} +\newcommand*{\locfmt}[1]{\texttt{#1}\SpecialMainIndex{#1}} +\newcommand*{\mkidxspch}{\index{makeindex=\appfmt{makeindex}>special characters|hyperpage}} + +\newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}} +\newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}} + +\newcommand*{\stylefmt}[1]{\textsf{#1}} + +\newcommand*{\glostyle}[1]{\stylefmt{#1}% + \index{glossary styles:>#1=\protect\stylefmt{#1}|main}} + +\newcommand*{\acrstyle}[1]{\stylefmt{#1}% + \index{acronym styles (glossaries):>#1=\protect\stylefmt{#1}|main}} + +\newcommand*{\abbrstyle}[1]{\stylefmt{#1}% + \index{abbreviation styles:>#1=\protect\stylefmt{#1}|main}} + +\newcommand*{\category}[1]{\textsf{#1}\index{entry categories:>#1={\protect\sffamily#1}|main}} + +\newcommand*{\catattr}[1]{\textsf{#1}\index{category attributes:>#1={\protect\sffamily#1}|main}} + +\GlossaryPrologue{% + \chapter*{{Change History}}% + \markboth{{Change History}}{{Change History}}% + \phantomsection + \addcontentsline{toc}{chapter}{Change History}% + \raggedright +} + +\title{glossaries-extra.sty v1.41: + documented code} +\author{Nicola L.C. Talbot\\[10pt] +Dickimaw Books\\ +\url{http://www.dickimaw-books.com/}} + +\date{2019-04-09} + +\begin{document} +\DocInput{glossaries-extra.dtx} +\end{document} +% +%\fi +%\MakeShortVerb{"} +%\DeleteShortVerb{\|} +% +% \maketitle +% +%\begin{abstract} +%This is the documented code for the \sty{glossaries-extra} package. +%See glossaries-extra-manual.pdf for the user manual. +% +%\begin{important} +%This package is experimental and not stable. It's provided for +%testing purposes only. Future versions may not be compatible with +%this version. Once it has stabilised I'll add it to CTAN, at which +%point compatibility with the first stable version will be +%maintained. +%\end{important} +%\end{abstract} +% +%\tableofcontents +% +%\StopEventually{% +% \printglossaries +% \PrintChanges +% \PrintIndex +%} +% +% +% +%\chapter{Main Package Code (\styfmt{glossaries-extra.sty})} +%\iffalse +% \begin{macrocode} +%<*glossaries-extra.sty> +% \end{macrocode} +%\fi +%\changes{0.1}{2015-11-22}{Initial experimental release} +%\section{Package Initialisation and Options} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-extra}[2019/04/09 v1.41 (NLCT)] +% \end{macrocode} +% Requires \sty{xkeyval} to define package options. +% \begin{macrocode} +\RequirePackage{xkeyval} +% \end{macrocode} +% Requires \sty{etoolbox} package. +% \begin{macrocode} +\RequirePackage{etoolbox} +% \end{macrocode} +% Has \styfmt{glossaries} already been loaded? +% \begin{macrocode} +\@ifpackageloaded{glossaries} +{% +% \end{macrocode} +% Already loaded so pass any options to \cs{setupglossaries}. +% This means that the options that can only be set when +% \styfmt{glossaries} is loaded can't be used. +% \begin{macrocode} + \newcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}% + \let\@glsxtr@declareoption\@gls@declareoption +} +{% +% \end{macrocode} +% Not already loaded, so pass options to \styfmt{glossaries}. +% \begin{macrocode} + \newcommand{\glsxtr@dooption}[1]{% + \PassOptionsToPackage{#1}{glossaries}% + }% +% \end{macrocode} +% Set the defaults. +% \begin{macrocode} + \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}% + } +} +% \end{macrocode} +% Declare package options. +%\begin{macro}{\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. +% \begin{macrocode} +\newcommand*{\glsxtrundefaction}[2]{% + \@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtr@warnonexistsordo} +% If user wants \pkgopt[warn]{undefaction}, then \styfmt{glossaries} +% v4.19 is required. +% \begin{macrocode} +\newcommand*{\glsxtr@warnonexistsordo}[1]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrundeftag} +% Text to display when an entry doesn't exist. +% \begin{macrocode} +\newcommand*{\glsxtrundeftag}{??} +\newcommand*{\@glsxtrundeftag}{} +% \end{macrocode} +% 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. +%\end{macro} +% +%\begin{macro}{\@glsxtr@warn@undefaction} +%This is how \cs{glsxtrundefaction} should behave if +%\pkgopt[warn]{undefaction} is set. +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@warn@undefaction}[2]{% + \@glsxtrundeftag\GlossariesExtraWarning{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@err@undefaction} +%This is how \cs{glsxtrundefaction} should behave if +%\pkgopt[error]{undefaction} is set. +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@err@undefaction}[2]{% + \@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@warn@onexistsordo} +%This is how \cs{glsxtr@warnonexistsordo} should behave if +%\pkgopt[warn]{undefaction} is set. +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\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.)}% +} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\@glsxtr@redef@forglsentries} +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@redef@forglsentries}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@do@redef@forglsentries} +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@do@redef@forglsentries}{% + \renewcommand*{\forglsentries}[3][\glsdefaulttype]{% + \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}% + }% + }% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{option}{undefaction} +% \begin{macrocode} +\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 + \let\glsxtrundefaction\@glsxtr@err@undefaction + \let\glsxtr@warnonexistsordo\@gobble + \let\@glsxtr@redef@forglsentries\relax + \fi + } +% \end{macrocode} +%\end{option} +% +%To assist bib2gls, v1.08 introduces the \pkgopt{record} option, which will write +%information to the aux file whenever an entry needs to be indexed. +% +%\begin{macro}{\@glsxtr@record} +%\changes{1.08}{2016-12-13}{new} +%\changes{1.14}{2017-04-18}{added third arg} +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\@glsxtr@record}[3]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@recordsee} +%\changes{1.14}{2017-04-18}{new} +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\glsxtr@recordsee}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@defaultnumberformat} +%\changes{1.19}{2017-09-09}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@defaultnumberformat}{glsnumberformat}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetDefaultNumberFormat} +%\changes{1.19}{2017-09-09}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrSetDefaultNumberFormat}[1]{% + \renewcommand*{\@glsxtr@defaultnumberformat}{#1}% +}% +% \end{macrocode} +%\end{macro} +% +%The \pkgopt{record} option is somewhat problematic. On the first +%\LaTeX\ run the entries aren't defined. This isn't as +%straight-forward as commands like \cs{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. +% +%\begin{macro}{\@glsxtr@do@record@wrglossary} +%\changes{1.21}{2017-11-03}{new} +%The \pkgopt[only]{record} option sets \cs{@@do@wrglossary} to this +%command, which means it's done within \cs{glsadd} and +%\cs{@gls@link}, and so is only done if the entry exists. +% \begin{macrocode} +\newcommand*{\@glsxtr@do@record@wrglossary}[1]{% + \begingroup + \ifKV@glslink@noindex + \else + \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 + \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 +% \end{macrocode} +%Increment associated counter. +% \begin{macrocode} + \glsxtr@inc@wrglossaryctr{#1}% + \@@do@@wrglossary + \fi + }% + \fi + \endgroup +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@do@alsoindex@wrglossary} +%\changes{1.21}{2017-11-03}{new} +%The \pkgopt[alsoindex]{record} option needs to both record and +%index. +% \begin{macrocode} +\newcommand*{\glsxtr@do@alsoindex@wrglossary}[1]{% + \glsxtr@@do@wrglossary{#1}% + \@glsxtr@do@record@wrglossary{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsxtr@record} +%\changes{1.08}{2016-12-13}{new} +%The \pkgopt[only]{record} option sets \cs{@glsxtr@record} to this. +%This performs the recording if the entry \emph{doesn't exist} and is done +%at the start of \cs{@gls@field@link} and commands like \cs{@gls@} +%(before the existence test). This means that it disregards the +%\gloskey[glslink]{wrgloss} key. +% +%The first argument is the option list (as passed in the first optional +%argument to commands like \cs{gls}). This allows the \gloskey[glslink]{noindex} +%setting to be picked up. The second argument is the entry's label. +% The third argument is the key family +%(\texttt{glslink} in most cases, \texttt{glossadd} for \cs{glsadd}). +% \begin{macrocode} +\newcommand*{\@@glsxtr@record}[3]{% + \ifglsentryexists{#2}{}% + {% + \@@glsxtrwrglossmark + \begingroup +% \end{macrocode} +%Save the label in case it's needed. +% \begin{macrocode} + \edef\@gls@label{\glsdetoklabel{#2}}% + \let\glslabel\@gls@label + \let\@glsnumberformat\@glsxtr@defaultnumberformat + \def\@glsxtr@thevalue{}% + \def\@glsxtr@theHvalue{\@glsxtr@thevalue}% + \let\@glsxtr@org@theHvalue\@glsxtr@theHvalue +% \end{macrocode} +%Entry hasn't been defined, so we'll have to assume it's +%\cs{glscounter} by default. +% \begin{macrocode} + \let\@gls@counter\glscounter +% \end{macrocode} +%Unless the \pkgopt{equations} option is on and this is inside a +%numbered maths environment. +% \begin{macrocode} + \if@glsxtr@equations + \@glsxtr@use@equation@counter + \fi +% \end{macrocode} +%Check for default options (which may switch off indexing). +%\changes{1.21}{2017-11-03}{added check for default options} +% \begin{macrocode} + \@gls@setdefault@glslink@opts +% \end{macrocode} +%Implement any pre-key settings. +%\changes{1.30}{2018-04-25}{added check for pre-key hook} +% \begin{macrocode} + \csuse{@glsxtr@#3@prekeys}% +% \end{macrocode} +%Assign keys. +% \begin{macrocode} + \setkeys{#3}{#1}% +% \end{macrocode} +%Implement any post-key settings. Is the auto-add on? +%\changes{1.37}{2018-11-30}{added check for auto-add} +% \begin{macrocode} + \glsxtr@do@autoadd{#3}% +% \end{macrocode} +% Check post-key hook. +%\changes{1.30}{2018-04-25}{added check for post-key hook} +% \begin{macrocode} + \csuse{@glsxtr@#3@postkeys}% +% \end{macrocode} +%Increment associated counter. +% \begin{macrocode} + \glsxtr@inc@wrglossaryctr{#2}% +% \end{macrocode} +%Check if \gloskey[glslink]{noindex} option has been used. +% \begin{macrocode} + \ifKV@glslink@noindex + \else + \glswriteentry{#2}% + {% +% \end{macrocode} +%Check if \gloskey[glsadd]{thevalue} has been set. +% \begin{macrocode} + \ifdefempty{\@glsxtr@thevalue}% + {% +% \end{macrocode} +%Key \gloskey[glsadd]{thevalue} hasn't been set, but check if +%\gloskey[glsadd]{theHvalue} has been set. (Not particularly likely, +%but allow for it.) +% \begin{macrocode} + \ifx\@glsxtr@org@theHvalue\@glsxtr@theHvalue + \else + \let\theHglsentrycounter\@glsxtr@theHvalue + \fi +% \end{macrocode} +%Save the entry counter. +% \begin{macrocode} + \glsxtr@saveentrycounter +% \end{macrocode} +%Temporarily redefine \cs{@@do@@wrglossary} for use with +%\cs{glsxtr@@do@wrglossary}. +% \begin{macrocode} + \let\@@do@@wrglossary\@glsxtr@dorecord + }% + {% +% \end{macrocode} +%\gloskey[glsadd]{thevalue} has been set, so there's no need to +%defer writing the location value. (If it's dependent on the page +%counter, the \gloskey[glslink]{counter} key should be set instead.) +% \begin{macrocode} + \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 +% \end{macrocode} +%No need to escape special characters. +% \begin{macrocode} + \@@do@@wrglossary + \fi + }% + \fi + \endgroup + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@glslink@prekeys} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand{\@glsxtr@glslink@prekeys}{\glslinkpresetkeys} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@glslink@postkeys} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand{\@glsxtr@glslink@postkeys}{\glslinkpostsetkeys} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@glossadd@prekeys} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand{\@glsxtr@glossadd@prekeys}{\glsaddpresetkeys} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@glossadd@postkeys} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand{\@glsxtr@glossadd@postkeys}{\glsaddpostsetkeys} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@dorecord} +%\changes{1.08}{2016-12-13}{new} +%\changes{1.15}{2017-05-10}{corrected premature expansion of \cs{@glslocref}} +%If \pkgopt[alsoindex]{record} is used, then \cs{@glslocref} may +%have been escaped, but this isn't appropriate here. +%\changes{1.19}{2017-09-09}{Use \cs{@glsrecordlocref} instead of \cs{@glslocref}} +% \begin{macrocode} +\newcommand*\@glsxtr@dorecord{% + \global\let\@glsrecordlocref\theglsentrycounter + \let\@glsxtr@orgprefix\@glo@counterprefix + \ifx\theglsentrycounter\theHglsentrycounter + \def\@glo@counterprefix{}% + \else +% \end{macrocode} +%\changes{1.39}{2019-03-22}{added protection for fragile commands} +% Protect against non-expandable commands occurring in the location. +% \begin{macrocode} + \protected@edef\@glsxtr@theentrycounter{\theglsentrycounter}% + \protected@edef\@glsxtr@theHentrycounter{\theHglsentrycounter}% + \@onelevel@sanitize\@glsxtr@theentrycounter + \@onelevel@sanitize\@glsxtr@theHentrycounter + \protected@edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix + {\@glsxtr@theentrycounter}{\@glsxtr@theHentrycounter}% + }% + \@do@gls@getcounterprefix + \fi +% \end{macrocode} +%\changes{1.30}{2018-04-25}{don't suppress expansion of \cs{@glsrecordlocref}} +%\changes{1.29}{2018-04-09}{don't suppress expansion of +%\cs{@glsrecordlocref} if counter isn't page} +%Don't protect the \cs{@glsrecordlocref} from premature expansion. +%If the counter isn't \counter{page} then it needs expanding. If the +%location includes \cs{thepage} then \cs{protected@write} will +%automatically deal with it. +%\changes{1.37}{2018-11-30}{added check for record=nameref} +% \begin{macrocode} + \ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref + \@glsxtr@do@nameref@record + {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}% + {\@glsrecordlocref}% + \else + \protected@write\@auxout{}{\string\glsxtr@record + {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}% + {\@glsrecordlocref}}% + \fi + \@glsxtr@counterrecordhook + \let\@glo@counterprefix\@glsxtr@orgprefix +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@dorecordnodefer} +%\changes{1.16}{2017-06-15}{new} +%As above, but don't defer expansion of location. This uses +%\cs{theglsentrycounter} directly for the location +%rather than \cs{@glslocref} since there's no need to guard against +%premature expansion of the page counter. +%\changes{1.19}{2017-09-09}{Use \cs{theglsentrycounter} for the location +%rather than \cs{@glslocref}} +% \begin{macrocode} +\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 + \protected@write\@auxout{}{\string\glsxtr@record + {\@gls@label}{}{\@gls@counter}{\@glsnumberformat}% + {\theglsentrycounter}}% + \fi + \else + \edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix + {\theglsentrycounter}{\theHglsentrycounter}% + }% + \@do@gls@getcounterprefix + \ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref + \@glsxtr@do@nameref@record + {\@gls@label}{\@glo@counterprefix}{\@gls@counter}% + {\@glsnumberformat}{\theglsentrycounter}% + \else + \protected@write\@auxout{}{\string\glsxtr@record + {\@gls@label}{\@glo@counterprefix}{\@gls@counter}{\@glsnumberformat}% + {\theglsentrycounter}}% + \fi + \fi + \@glsxtr@counterrecordhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@ifnum@mmode} +%\changes{1.37}{2018-11-30}{new} +%Check if in a numbered maths environment. +%The \sty{amsmath} package is automatically loaded by +%\sty{datatool-base}, which is required by \sty{glossaries}, so \cs{ifst@rred} +%and \cs{if@display} should both be defined. +% \begin{macrocode} +\newcommand{\@glsxtr@ifnum@mmode}[2]{% + \ifmmode + \ifst@rred + #2% + \else +% \end{macrocode} +% Non-\sty{amsmath} environments and regular inline math mode isn't +% flagged as starred by \sty{amsmath}, but we can't use \cs{mathchoice} +% in this case as it's not the current style that's relevant. +% Instead we can use \sty{amsmath}'s \cs{if@display}. This may not +% work for environments that aren't provided by \sty{amsmath}. +% \begin{macrocode} + \if@display #1\else #2\fi + \fi + \else + #2% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@do@nameref@record} +%\changes{1.37}{2018-11-30}{new} +%With \pkgopt[nameref]{record}, the current label information is included +%in the record, but this may not have been defined, so \cs{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 +%\sty{amsmath}'s \env{align} environment \cs{@currentHref} will be out. +%There may be other instances where \cs{@currentHref} is out, so +%this also saves \cs{theHglsentrycounter}, which is +%useful if it can't be obtained by prefixing +%\cs{theglsentrycounter}. +% \begin{macrocode} +\newcommand*{\@glsxtr@do@nameref@record}[5]{% + \gls@ifnotmeasuring + {% + \protected@write\@auxout{}{\string\glsxtr@record@nameref + {#1}{#2}{#3}{#4}{#5}% + {\csuse{@currentlabelname}}{\csuse{@currentHref}}% + {\theHglsentrycounter}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsxtr@recordcounter} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\@@glsxtr@recordcounter}{% + \@glsxtr@noop@recordcounter +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@noop@recordcounter} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@noop@recordcounter}[1]{% + \PackageError{glossaries-extra}{\string\GlsXtrRecordCounter\space + requires record=only or record=alsoindex package option}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@op@recordcounter} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@op@recordcounter}[1]{% + \eappto\@glsxtr@counterrecordhook{\noexpand\@glsxtr@docounterrecord{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@recordsee} +%\changes{1.14}{2017-04-18}{new} +%Deal with \cs{glssee} in record mode. (This doesn't increment the +%associated counter.) +% \begin{macrocode} +\newcommand*{\@glsxtr@recordsee}[2]{% + \@@glsxtrwrglossmark + \def\@gls@xref{#2}% + \@onelevel@sanitize\@gls@xref + \protected@write\@auxout{}{\string\glsxtr@recordsee{#1}{\@gls@xref}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaryunit} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\printunsrtglossaryunit}{% + \print@noop@unsrtglossaryunit +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@setup@record} +%\changes{1.08}{2016-12-13}{new} +%Initialise. +% \begin{macrocode} +\newcommand*{\glsxtr@setup@record}{\let\@@do@wrglossary\glsxtr@@do@wrglossary} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@indexonly@saveentrycounter} +%\changes{1.08}{2016-12-13}{new} +% Only store the entry counter information if the +%indexing is on. +% \begin{macrocode} +\newcommand*{\glsxtr@indexonly@saveentrycounter}{% + \ifKV@glslink@noindex + \else + \glsxtr@saveentrycounter + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@addloclistfield} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\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}% + }% + {}% +% \end{macrocode} +%\changes{1.11}{2017-01-19}{added location key} +%The loclist field is just a comma-separated list. The location +%field is the formatted list. +% \begin{macrocode} + \key@ifundefined{glossentry}{location}% + {% + \define@key{glossentry}{location}{\def\@glo@location{##1}}% + \appto\@gls@keymap{,{location}{location}}% + \appto\@newglossaryentryprehook{\def\@glo@location{}}% + \appto\@newglossaryentryposthook{% + \gls@assign@field{}{\@glo@label}{location}{\@glo@location}% + }% + \glssetnoexpandfield{location}% + }% + {}% +% \end{macrocode} +%\changes{1.11}{2017-01-19}{added group key} +%Add a key to store the group heading. +% \begin{macrocode} + \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}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@record@setting} +%\changes{1.19}{2017-09-09}{new} +%Keep track of the \pkgopt{record} package option. +% \begin{macrocode} +\newcommand*{\@glsxtr@record@setting}{off} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@record@setting@alsoindex} +%\changes{1.19}{2017-09-09}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@record@setting@alsoindex}{alsoindex} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@record@setting@only} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@record@setting@only}{only} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@record@setting@nameref} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@record@setting@nameref}{nameref} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@if@record@only} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\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 +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@record@setting@off} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@record@setting@off}{off} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@record@only@setup} +%\changes{1.37}{2018-11-30}{new} +%Initialisation code for record=only and record=nameref +% \begin{macrocode} +\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}% +% \end{macrocode} +%Switch off the index suppression for aliased entries. +%(bib2gls will deal with them.) +% \begin{macrocode} + \def\glsxtrsetaliasnoindex{}% +% \end{macrocode} +% \cs{@gls@setupsort@none} was only introduced to +% \sty{glossaries} v4.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. +%\changes{1.16}{2017-06-15}{added check for \cs{@gls@setupsort@none}} +% \begin{macrocode} + \ifdef\@gls@setupsort@none{\@gls@setupsort@none}{}% +% \end{macrocode} +% Warn about using \cs{printglossary}: +% \begin{macrocode} + \def\glsxtrNoGlossaryWarning{\@glsxtr@record@noglossarywarning}% +% \end{macrocode} +%Load \sty{glossaries-extra-bib2gls}: +% \begin{macrocode} + \RequirePackage{glossaries-extra-bib2gls}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{record} +%Now define the \pkgopt{record} package option. +%\changes{1.08}{2016-12-13}{added \pkgopt{record} package option} +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{record} + [\@glsxtr@record@setting\glsxtr@record@nr]% + {off,only,alsoindex,nameref}% + [only]% + {% + \ifcase\glsxtr@record@nr\relax +% \end{macrocode} +%Don't record. +% \begin{macrocode} + \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 +% \end{macrocode} +%Only record (don't index). +% \begin{macrocode} + \@glsxtr@record@only@setup + \or +% \end{macrocode} +%Record and index. This option doesn't load +%\sty{glossaries-extra-bib2gls} as the sorting is performed by +%\app{xindy} or \app{makeindex}. +% \begin{macrocode} + \def\glsxtr@setup@record{% + \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 +% \end{macrocode} +%Only record (don't index) but also include nameref information. +% \begin{macrocode} + \@glsxtr@record@only@setup + \ifundef\hyperlink + {\GlossariesExtraWarning{You have requested record=nameref but + the document doesn't support hyperlinks}}% + {}% + \fi + } +% \end{macrocode} +%\end{option} +% +%\changes{1.06}{2016-06-18}{docdef option changed to choice} +%Version 1.06 changes the \pkgopt{docdef} option to a choice rather +%than boolean setting. 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. +% +%\begin{macro}{\@glsxtr@docdefval} +%\changes{1.06}{2016-06-18}{new} +%The \pkgopt{docdef} value is stored as an integer: 0 (false), 1 +%(true) and 2 (restricted). +%\changes{1.28}{2018-03-06}{changed from count register to macro} +% \begin{macrocode} +\newcommand*{\@glsxtr@docdefval}{0} +% \end{macrocode} +%\end{macro} +% +%Need to provide conditional commands that are backward compatible: +%\begin{macro}{\if@glsxtrdocdef} +% \begin{macrocode} +\newcommand*{\if@glsxtrdocdef}{\ifnum\@glsxtr@docdefval>0 } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrdocdeftrue} +% \begin{macrocode} +\newcommand*{\@glsxtrdocdeftrue}{\def\@glsxtr@docdefval{1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrdocdeffalse} +% \begin{macrocode} +\newcommand*{\@glsxtrdocdeffalse}{\def\@glsxtr@docdefval{0}} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{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. +%\changes{1.34}{2018-07-29}{added package option docdef=atom} +% \begin{macrocode} +\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 +} +% \end{macrocode} +%\end{option} +%\begin{macro}{\if@glsxtrdocdefrestricted} +%\changes{1.06}{2016-06-18}{new} +%\changes{1.34}{2018-07-29}{changed to allow for atom as well} +% \begin{macrocode} +\newcommand*{\if@glsxtrdocdefrestricted}{\ifnum\@glsxtr@docdefval>1 } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdoifexistsorwarn} +%\changes{1.06}{2016-06-18}{new} +%Need an error to notify user if an undefined entry is being referenced in the +%glossary for the \pkgopt[restricted]{docdef} option. This is used +%by \cs{glossentryname} (but not by \cs{glossentrydesc} etc as one error +%per entry is sufficient). +% \begin{macrocode} +\newcommand*{\@glsdoifexistsorwarn}{\glsdoifexistsorwarn} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{indexcrossrefs} +% Automatically index cross references at the end of the document +% \begin{macrocode} +\define@boolkey{glossaries-extra.sty}[@glsxtr]{indexcrossrefs}[true]{% + \if@glsxtrindexcrossrefs + \else + \renewcommand*{\@glsxtr@autoindexcrossrefs}{}% + \fi +} +% \end{macrocode} +%\end{option} +% Switch off since this can increase the build time. +% \begin{macrocode} +\@glsxtrindexcrossrefsfalse +% \end{macrocode} +% But allow \gloskey{see} key to switch it on automatically. +%\begin{macro}{\@glsxtr@autoindexcrossrefs} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindexcrossrefs}{\@glsxtrindexcrossrefstrue} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{autoseeindex} +%Provide a boolean option to allow the user to prevent the +%automatic indexing of the cross-referencing keys \gloskey{see}, +%\gloskey{seealso} and \gloskey{alias}. +%\changes{1.16}{2017-06-15}{new} +% \begin{macrocode} +\define@boolkey{glossaries-extra.sty}[@glsxtr@]{autoseeindex}[true]{% +} +\@glsxtr@autoseeindextrue +% \end{macrocode} +%\end{option} +% +%\begin{option}{equations} +%Provide a boolean option to automatically switch to the +%\ctr{equation} counter when in a numbered maths environment. +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\define@boolkey{glossaries-extra.sty}[@glsxtr@]{equations}[true]{% +} +\@glsxtr@equationsfalse +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glsxtr@float} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\let\glsxtr@float\@float +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@dblfloat} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\let\glsxtr@dblfloat\@dblfloat +% \end{macrocode} +%\end{macro} +% +%\begin{option}{floats} +%Provide a boolean option to automatically switch to the +%the corresponding counter when in a float. +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\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 + \let\@float\glsxtr@float + \let\@dblfloat\glsxtr@dblfloat + \fi +} +\@glsxtr@floatsfalse +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\GlossariesExtraWarning} +%Allow users to suppress warnings. +% \begin{macrocode} +\newcommand*{\GlossariesExtraWarning}[1]{\PackageWarning{glossaries-extra}{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlossariesExtraWarningNoLine} +%Allow users to suppress warnings. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\GlossariesExtraWarningNoLine}[1]{% + \PackageWarningNoLine{glossaries-extra}{#1}} +% \end{macrocode} +%\end{macro} +% +% \begin{macrocode} +\@glsxtr@declareoption{nowarn}{% + \let\GlossariesExtraWarning\@gobble + \let\GlossariesExtraWarningNoLine\@gobble + \glsxtr@dooption{nowarn}% +} +% \end{macrocode} +% +%\begin{macro}{\@glsxtr@defpostpunc} +%Redefines \cs{glspostdescription}. The \pkgopt{postdot} and +%\pkgopt{nopostdot} options will have to redefine this. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@defpostpunc}{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{postdot} +%Shortcut for \pkgopt[false]{nopostdot} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\@glsxtr@declareoption{postdot}{% + \glsxtr@dooption{nopostdot=false}% + \renewcommand*{\@glsxtr@defpostpunc}{% + \renewcommand*{\glspostdescription}{% + \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi}% + }% +} +% \end{macrocode} +%\end{option} + +%\begin{option}{nopostdot} +%Needs to redefine \cs{@glsxtr@defpostpunc} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{nopostdot}{true,false}[true]{% + \glsxtr@dooption{nopostdot=#1}% + \renewcommand*{\@glsxtr@defpostpunc}{% + \renewcommand*{\glspostdescription}{% + \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi}% + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{postpunc} +%Set the post-description punctuation. This also sets +%the \cs{ifglsnopostdot} conditional, which now indicates if +%the post-description punctuation has been suppressed. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\define@key{glossaries-extra.sty}{postpunc}{% + \glsxtr@dooption{nopostdot=false}% + \ifstrequal{#1}{dot}% + {% + \renewcommand*{\@glsxtr@defpostpunc}{% + \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}% + }% + }% + }% + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glsxtrabbrvtype} +% Glossary type for abbreviations. +% \begin{macrocode} +\newcommand*{\glsxtrabbrvtype}{\glsdefaulttype} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@abbreviationsdef} +% Set by \pkgopt{abbreviations} option. +% \begin{macrocode} +\newcommand*{\@glsxtr@abbreviationsdef}{} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\@glsxtr@doabbreviationsdef} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\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}% +% \end{macrocode} +% If the \pkgopt{acronym} option hasn't been used, change +% \ics{acronymtype} to \ics{glsxtrabbrvtype}. +%\changes{0.4}{2015-12-03}{added redefinition of \cs{acronymtype}} +% \begin{macrocode} + \ifglsacronym + \else + \renewcommand*{\acronymtype}{\glsxtrabbrvtype}% + \fi +}% +% \end{macrocode} +%\end{macro} +% +%\begin{option}{abbreviations} +% If \pkgopt{abbreviations}, create a new glossary type for abbreviations. +% \begin{macrocode} +\@glsxtr@declareoption{abbreviations}{% + \let\@glsxtr@abbreviationsdef\@glsxtr@doabbreviationsdef +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\GlsXtrDefineAbbreviationShortcuts} +% Enable shortcut commands for the abbreviations. Unlike the analogous +% command provided by \styfmt{glossaries}, this uses \cs{newcommand} +% instead of \cs{let} as a safety feature (except for \cs{newabbr} +% which is also provided with \cs{GlsXtrDefineAcShortcuts}). +% \begin{macrocode} +\newcommand*{\GlsXtrDefineAbbreviationShortcuts}{% + \newcommand*{\ab}{\cgls}% + \newcommand*{\abp}{\cglspl}% + \newcommand*{\as}{\glsxtrshort}% + \newcommand*{\asp}{\glsxtrshortpl}% + \newcommand*{\al}{\glsxtrlong}% + \newcommand*{\alp}{\glsxtrlongpl}% + \newcommand*{\af}{\glsxtrfull}% + \newcommand*{\afp}{\glsxtrfullpl}% + \newcommand*{\Ab}{\cGls}% + \newcommand*{\Abp}{\cGlspl}% + \newcommand*{\As}{\Glsxtrshort}% + \newcommand*{\Asp}{\Glsxtrshortpl}% + \newcommand*{\Al}{\Glsxtrlong}% + \newcommand*{\Alp}{\Glsxtrlongpl}% + \newcommand*{\Af}{\Glsxtrfull}% + \newcommand*{\Afp}{\Glsxtrfullpl}% + \newcommand*{\AB}{\cGLS}% + \newcommand*{\ABP}{\cGLSpl}% + \newcommand*{\AS}{\GLSxtrshort}% + \newcommand*{\ASP}{\GLSxtrshortpl}% + \newcommand*{\AL}{\GLSxtrlong}% + \newcommand*{\ALP}{\GLSxtrlongpl}% + \newcommand*{\AF}{\GLSxtrfull}% + \newcommand*{\AFP}{\GLSxtrfullpl}% +% \end{macrocode} +%\changes{1.23}{2017-11-12}{changed \cs{newabbr} definition to use \cs{providecommand}} +% \begin{macrocode} + \providecommand*{\newabbr}{\newabbreviation}% +% \end{macrocode} +% Disable this command after it's been used. +% \begin{macrocode} + \let\GlsXtrDefineAbbreviationShortcuts\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrDefineAcShortcuts} +% Enable shortcut commands for the abbreviations, but uses the +% analogous commands provided by \styfmt{glossaries}. +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrDefineAcShortcuts}{% + \newcommand*{\ac}{\cgls}% + \newcommand*{\acp}{\cglspl}% + \newcommand*{\acs}{\glsxtrshort}% + \newcommand*{\acsp}{\glsxtrshortpl}% + \newcommand*{\acl}{\glsxtrlong}% + \newcommand*{\aclp}{\glsxtrlongpl}% + \newcommand*{\acf}{\glsxtrfull}% + \newcommand*{\acfp}{\glsxtrfullpl}% + \newcommand*{\Ac}{\cGls}% + \newcommand*{\Acp}{\cGlspl}% + \newcommand*{\Acs}{\Glsxtrshort}% + \newcommand*{\Acsp}{\Glsxtrshortpl}% + \newcommand*{\Acl}{\Glsxtrlong}% + \newcommand*{\Aclp}{\Glsxtrlongpl}% + \newcommand*{\Acf}{\Glsxtrfull}% + \newcommand*{\Acfp}{\Glsxtrfullpl}% + \newcommand*{\AC}{\cGLS}% + \newcommand*{\ACP}{\cGLSpl}% + \newcommand*{\ACS}{\GLSxtrshort}% + \newcommand*{\ACSP}{\GLSxtrshortpl}% + \newcommand*{\ACL}{\GLSxtrlong}% + \newcommand*{\ACLP}{\GLSxtrlongpl}% + \newcommand*{\ACF}{\GLSxtrfull}% + \newcommand*{\ACFP}{\GLSxtrfullpl}% +% \end{macrocode} +%\changes{1.23}{2017-11-12}{changed \cs{newabbr} definition to use \cs{providecommand}} +% \begin{macrocode} + \providecommand*{\newabbr}{\newabbreviation}% +% \end{macrocode} +% Disable this command after it's been used. +% \begin{macrocode} + \let\GlsXtrDefineAcShortcuts\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrDefineOtherShortcuts} +% Similarly provide shortcut versions for the commands provided by +% the \pkgopt{symbols} and \pkgopt{numbers} options. +% \begin{macrocode} +\newcommand*{\GlsXtrDefineOtherShortcuts}{% + \newcommand*{\newentry}{\newglossaryentry}% + \ifdef\printsymbols + {% + \newcommand*{\newsym}{\glsxtrnewsymbol}% + }{}% + \ifdef\printnumbers + {% + \newcommand*{\newnum}{\glsxtrnewnumber}% + }{}% + \let\GlsXtrDefineOtherShortcuts\relax +} +% \end{macrocode} +%\end{macro} +% +% 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.) +% +%\begin{macro}{\@glsxtr@setupshortcuts} +% Command used to set the shortcuts option. +% \begin{macrocode} +\newcommand*{\@glsxtr@setupshortcuts}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@shortcutsval} +% Store the value of the shortcuts option. (Needed by bib2gls.) +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@shortcutsval}{\ifglsacrshortcuts acro\else none\fi}% +% \end{macrocode} +%\end{macro} +% +%\begin{option}{shortcuts} +%Provide \pkgopt{shortcuts} option. Unlike the \styfmt{glossaries} +%version, this is a choice rather than a boolean key but it also provides +%\pkgopt[true]{shortcuts} and \pkgopt[false]{shortcuts}, which are +%equivalent to \pkgopt[all]{shortcuts} and +%\pkgopt[none]{shortcuts}. Multiple use of this option in the +%\emph{same} option list will override each other. +%New to v1.17: \pkgopt[ac]{shortcuts} which implements +%\cs{GlsXtrDefineAcShortcuts} (not included in +%\pkgopt[all]{shortcuts} as it conflicts with other shortcuts). +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{shortcuts}% + [\@glsxtr@shortcutsval\@glsxtr@shortcutsnr]% + {acronyms,acro,abbreviations,abbr,other,all,true,ac,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 +% \end{macrocode} +%\changes{1.21}{2017-11-03}{changed true setting to use shortcuts=ac +%instead of shortcuts=acronym} +% \begin{macrocode} + \GlsXtrDefineAcShortcuts + \GlsXtrDefineAbbreviationShortcuts + \GlsXtrDefineOtherShortcuts + }% + \or % true + \renewcommand*{\@glsxtr@setupshortcuts}{% + \glsacrshortcutstrue +% \end{macrocode} +%\changes{1.21}{2017-11-03}{changed true setting to use shortcuts=ac +%instead of shortcuts=acronym} +% \begin{macrocode} + \GlsXtrDefineAcShortcuts + \GlsXtrDefineAbbreviationShortcuts + \GlsXtrDefineOtherShortcuts + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{corrected shortcuts=ac} +% \begin{macrocode} + \or % ac + \renewcommand*{\@glsxtr@setupshortcuts}{% + \glsacrshortcutstrue + \GlsXtrDefineAcShortcuts + }% +% \end{macrocode} +%Leave none and false as last option. +% \begin{macrocode} + \else % none, false + \renewcommand*{\@glsxtr@setupshortcuts}{}% + \fi + } +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@glsxtr@doaccsupp} +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@doaccsupp}{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{accsupp} +% If \pkgopt{accsupp}, load \sty{glossaries-accsupp} package. +% \begin{macrocode} +\@glsxtr@declareoption{accsupp}{% + \renewcommand*{\@glsxtr@doaccsupp}{\RequirePackage{glossaries-accsupp}}} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glsxtrNoGlossaryWarning} +%\changes{0.3}{2015-12-02}{new} +%\changes{1.34}{2018-07-29}{added package warning} +% Warning text displayed in document if the external glossary file +% given by the argument is missing. +% \begin{macrocode} +\newcommand{\glsxtrNoGlossaryWarning}[1]{% + \GlossariesExtraWarning{Glossary `#1' is missing}% + \@glsxtr@defaultnoglossarywarning{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{nomissingglstext} +% If true, suppress the text and warning produced if the external glossary file +% is missing. +% \begin{macrocode} +\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 + } +% \end{macrocode} +%\end{option} +% +% Provide option to load \sty{glossaries-extra-stylemods} +% (Deferred to the end.) +%\begin{macro}{\@glsxtr@redefstyles} +% \begin{macrocode} +\newcommand*{\@glsxtr@redefstyles}{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{stylemods} +%\changes{1.02}{2016-04-25}{new} +%\changes{1.18}{2017-08-10}{changed default value to \qt{default}} +% \begin{macrocode} +\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-\@glsxtr@tmp.sty}% + {% + \eappto\@glsxtr@redefstyles{% + \noexpand\RequirePackage{glossary-\@glsxtr@tmp}}% + }% + {% + \PackageError{glossaries-extra}% + {Glossaries style package `glossary-\@glsxtr@tmp.sty' + 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}% + }% + }% + \appto\@glsxtr@redefstyles{\RequirePackage{glossaries-extra-stylemods}}% + } + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@glsxtr@do@style} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@do@style}{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{style} +%\changes{1.04}{2016-05-02}{new} +% Since the \pkgopt{stylemods} option can automatically load extra +% style packages, deal with the \pkgopt{style} option after those +% packages have been loaded. +% \begin{macrocode} +\define@key{glossaries-extra.sty}{style}{% +% \end{macrocode} +%Defer actual style change: +% \begin{macrocode} + \renewcommand*{\@glsxtr@do@style}{% +% \end{macrocode} +% Set this as the default style: +% \begin{macrocode} + \setkeys{glossaries.sty}{style={#1}}% +% \end{macrocode} +% Set this style: +% \begin{macrocode} + \setglossarystyle{#1}% + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glsxtr@inc@wrglossaryctr} +%\changes{1.29}{2018-04-09}{new} +%Increments the associated counter if enabled. Does nothing by +%default. The optional argument is the entry label in case it's +%required, but the \ctr{wrglossary} counter is globally used by all +%entries. +% \begin{macrocode} +\newcommand*{\glsxtr@inc@wrglossaryctr}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrInternalLocationHyperlink} +%\changes{1.29}{2018-04-09}{new} +%\begin{definition} +%\cs{glsxtrinternallocationhyperlink}\marg{counter}\marg{prefix}\marg{location} +%\end{definition} +%The first two arguments are always control sequences. +% \begin{macrocode} +\newcommand*{\GlsXtrInternalLocationHyperlink}[3]{% + \glsxtrhyperlink{#1#2#3}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@wrglossary@locationhyperlink} +%\changes{1.29}{2018-04-09}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@wrglossary@locationhyperlink}[3]{% + \pageref{wrglossary.#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{indexcounter} +%\changes{1.29}{2018-04-09}{new} +%Define the \ctr{wrglossary} counter that's incremented every time +%an entry is indexed, except for cross-references. This is designed +%for use with \app{bib2gls} v1.4+. It can work with the other indexing +%methods but it will interfere with the number list collation. +%This option automatically implements \pkgopt[wrglossary]{counter}. +% +%Since \styfmt{glossaries} automatically loads \sty{amsmath}, there +%may be a problem if the indexing occurs in the \env{equation} +%environment, because only one \cs{label} is allowed in each +%instance of that environment. It's best to change the counter when +%in maths mode. +% \begin{macrocode} +\@glsxtr@declareoption{indexcounter}{% + \glsxtr@dooption{counter=wrglossary}% + \ifundef\c@wrglossary + {% + \newcounter{wrglossary}% + \renewcommand{\thewrglossary}{\arabic{wrglossary}}% + }% + {}% + \renewcommand*{\glsxtr@inc@wrglossaryctr}[1]{% +% \end{macrocode} +%Only increment if the current counter is \ctr{wrglossary}. +%\changes{1.30}{2018-04-25}{added check for \ctrfmt{wrglossary} counter} +% \begin{macrocode} + \ifdefstring\@gls@counter{wrglossary}% + {% + \refstepcounter{wrglossary}% + \label{wrglossary.\thewrglossary}% + }% + {}% + }% + \renewcommand*{\GlsXtrInternalLocationHyperlink}[3]{% + \ifdefstring\glsentrycounter{wrglossary}% + {% + \@glsxtr@wrglossary@locationhyperlink{##1}{##2}{##3}% + }% + {\glsxtrhyperlink{##1##2##3}{##3}}% + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@glsxtrwrglossmark} +%\changes{1.21}{2017-11-03}{new} +%Marks the place where indexing occurs. +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\@glsxtrwrglossmark}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsxtrwrglossmark} +%\changes{1.21}{2017-11-03}{new} +%Since \cs{glsadd} can be used in the preamble, this action needs to +%be disabled until the start of the document. +% \begin{macrocode} +\newcommand*{\@@glsxtrwrglossmark}{} +\AtBeginDocument{\renewcommand*{\@@glsxtrwrglossmark}{\@glsxtrwrglossmark}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrwrglossmark} +%\changes{1.21}{2017-11-03}{new} +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\glsxtrwrglossmark}{\ensuremath{\cdot}} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{debug} +%\changes{1.21}{2017-11-03}{new} +% Provide extra debug options. +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{debug} + [\@glsxtr@debugval\@glsxtr@debugnr]% + {true,false,showtargets,showwrgloss,all}[true]{% + \ifcase\@glsxtr@debugnr\relax % true + \glsxtr@dooption{debug=true}% + \renewcommand*{\@glsxtrwrglossmark}{}% + \or % false + \glsxtr@dooption{debug=false}% + \renewcommand*{\@glsxtrwrglossmark}{}% + \or % showtargets + \glsxtr@dooption{debug=showtargets}% + \or % showwrgloss + \glsxtr@dooption{debug=true}% + \renewcommand*{\@glsxtrwrglossmark}{\glsxtrwrglossmark}% + \or % all + \glsxtr@dooption{debug=showtargets}% + \renewcommand*{\@glsxtrwrglossmark}{\glsxtrwrglossmark}% + \fi + } +% \end{macrocode} +%\end{option} +% +% Pass all other options to \styfmt{glossaries}. +% \begin{macrocode} +\DeclareOptionX*{% + \expandafter\glsxtr@dooption\expandafter{\CurrentOption}} +% \end{macrocode} +% Process options. +% \begin{macrocode} +\ProcessOptionsX +% \end{macrocode} +% Load \styfmt{glossaries} if not already loaded. +% \begin{macrocode} +\RequirePackage{glossaries} +% \end{macrocode} +% Load the \sty{glossaries-accsupp} package if required. +% \begin{macrocode} +\@glsxtr@doaccsupp +% \end{macrocode} +% Redefine \cs{glspostdescription} if required. +% \begin{macrocode} +\@glsxtr@defpostpunc +% \end{macrocode} +% +%\begin{macro}{\glsshowtarget} +%This command was introduced to \sty{glossaries} v4.32 so it may not +%be defined. Therefore it's defined here using \cs{def}. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\def\glsshowtarget#1{% + \glsxtrtitleorpdforheading + {% + \ifmmode + \texttt{\small [#1]}% + \else + \ifinner + \texttt{\small [#1]}% + \else + \marginpar{\texttt{\small #1}}% + \fi + \fi + }% + {[#1]}% + {\texttt{\small [#1]}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@org@doseeglossary} +%Save original definition of \cs{@do@seeglossary} +% \begin{macrocode} +\let\@glsxtr@org@doseeglossary\@do@seeglossary +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@doseeglossary} +%\changes{1.21}{2017-11-03}{new} +%This doesn't increment the associated counter. +% \begin{macrocode} +\newcommand*{\@glsxtr@doseeglossary}[2]{% + \glsdoifexists{#1}% + {% + \@@glsxtrwrglossmark + \@glsxtr@org@doseeglossary{#1}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@dosee@alsoindex@glossary} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@dosee@alsoindex@glossary}[2]{% + \@glsxtr@recordsee{#1}{#2}% + \@glsxtr@doseeglossary{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@org@gloautosee} +%\changes{1.14}{2017-04-18}{new} +%Save and restore original definition of \cs{@glo@autosee}. +%(That command may not be defined as it was only introduced +%to \sty{glossaries} v4.30, in which case the synonym +%won't be defined either.) +% \begin{macrocode} +\let\@glsxtr@org@gloautosee\@glo@autosee +% \end{macrocode} +%\end{macro} +%Check if user tried \pkgopt[false]{autoseeindex} when it can't be +%supported. +% \begin{macrocode} +\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 +% \end{macrocode} +% +%\begin{macro}{\@glo@autosee} +%\changes{1.16}{2017-06-15}{added redefinition} +%If \cs{@glo@autosee} has been defined (\sty{glossaries} v4.30 +%onwards), redefine it to test the \pkgopt{autoseeindex} option. +% \begin{macrocode} +\ifdef\@glo@autosee +{% + \renewcommand*{\@glo@autosee}{% + \if@glsxtr@autoseeindex\@glsxtr@org@gloautosee\fi}% +}% +{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@checkseeallowed} +%\changes{1.16}{2017-06-15}{added redefinition} +%Don't prohibit the use of the \gloskey{see} key before the indexing +%files have been opened if the automatic see indexing has been +%disabled, since it's no longer an issue. +% \begin{macrocode} +\renewcommand*{\gls@checkseeallowed}{% + \if@glsxtr@autoseeindex\@gls@see@noindex\fi +} +% \end{macrocode} +%\end{macro} +% +% +% Define abbreviations glossaries if required. +% \begin{macrocode} +\@glsxtr@abbreviationsdef +\let\@glsxtr@abbreviationsdef\relax +% \end{macrocode} +% Setup shortcuts if required. +% \begin{macrocode} +\@glsxtr@setupshortcuts +% \end{macrocode} +%Redefine \cs{@glsxtr@redef@forglsentries} if required. +% \begin{macrocode} +\@glsxtr@redef@forglsentries +% \end{macrocode} +% +%\begin{macro}{\glossariesextrasetup} +%Allow user to set options after the package has been loaded. +% First modify \cs{glsxtr@dooption} so that it now uses +% \cs{setupglossaries}: +% \begin{macrocode} +\renewcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}% +% \end{macrocode} +% Now define the user command: +% \begin{macrocode} +\newcommand*{\glossariesextrasetup}[1]{% + \let\glsxtr@setup@record\relax + \let\@glsxtr@setupshortcuts\relax + \let\@glsxtr@redef@forglsentries\relax + \setkeys{glossaries-extra.sty}{#1}% + \@glsxtr@abbreviationsdef + \let\@glsxtr@abbreviationsdef\relax + \@glsxtr@setupshortcuts + \glsxtr@setup@record + \@glsxtr@redef@forglsentries +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@org@@do@wrglossary} +%\changes{1.21}{2017-11-03}{new} +%Save original definition of \cs{@@do@wrglossary}. +% \begin{macrocode} +\let\glsxtr@org@@do@wrglossary\@@do@wrglossary +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@@do@wrglossary} +%\changes{1.08}{2016-12-13}{new} +%The new version adds code that can show a marker for debugging and +%increments the associated counter if enabled. +% \begin{macrocode} +\newcommand*{\glsxtr@@do@wrglossary}[1]{% + \@@glsxtrwrglossmark + \glsxtr@inc@wrglossaryctr{#1}% + \glsxtr@org@@do@wrglossary{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@saveentrycounter} +%\changes{1.08}{2016-12-13}{new} +%Save original definition of \cs{@gls@saveentrycounter}. +% \begin{macrocode} +\let\glsxtr@saveentrycounter\@gls@saveentrycounter +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@saveentrycounter} +%\changes{1.08}{2016-12-13}{new} +%Change \cs{@gls@saveentrycounter} so that it only stores the entry +%counter information if the indexing is on. +% \begin{macrocode} +\let\@gls@saveentrycounter\glsxtr@indexonly@saveentrycounter +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@getcounterprefix} +%\changes{1.37}{2018-11-30}{new} +%This command is provided by the base \sty{glossaries} package, 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 reconstituted in the location list. +%Unfortunately, not all targets are in this form, so the links fail. +%With \pkgopt[nameref]{record}, the complete target name can be +%saved, so this modification adjusts the warning. +% \begin{macrocode} +\renewcommand*\@gls@getcounterprefix[2]{% + \protected@edef\@gls@thisloc{#1}\protected@edef\@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 +% \end{macrocode} +% Warn if no prefix can be formed, unless \pkgopt[nameref]{record}. +% \begin{macrocode} + \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 +} +% \end{macrocode} +%\end{macro} +% +%Provide script dialect hook (does nothing unless +%redefined by \sty{glossaries-extra-bib2gls}). +%\begin{macro}{\@glsxtrdialecthook} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\newcommand*{\@glsxtrdialecthook}{} +% \end{macrocode} +%\end{macro} +% +%Set up record option if required. +% \begin{macrocode} +\glsxtr@setup@record +% \end{macrocode} +% +% Disable preamble-only options and switch on the undefined tag at +% the start of the document. +%\changes{1.06}{2016-06-18}{disabled docdef key at the start of the +%document} +% \begin{macrocode} +\AtBeginDocument{% + \disable@keys{glossaries-extra.sty}{abbreviations,docdef,record}% + \def\@glsxtrundeftag{\glsxtrundeftag}% +} +% \end{macrocode} +% +%\section{Extra Utilities} +% +%\begin{macro}{\GlsXtrIfUnusedOrUndefined} +%\changes{1.34}{2018-07-29}{new} +%\begin{definition} +%\cs{GlsXtrIfUnusedOrUndefined}\marg{label}\marg{true}\marg{false} +%\end{definition} +% Does \meta{true} if the entry given by \meta{label} is either +% undefined or hasn't been used (or has had the first use flag reset). +% \begin{macrocode} +\newcommand*{\GlsXtrIfUnusedOrUndefined}[3]{% + \ifglsentryexists{#1}% + {\ifbool{glo@\glsdetoklabel{#1}@flag}{#3}{#2}}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifemptyglossary} +%\begin{definition} +%\cs{glsxtrifemptyglossary}\marg{type}\marg{true}\marg{false} +%\end{definition} +% 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 +% \cs{glolist@\meta{type}}. If this hasn't been defined, the glosary +% 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.) +%\changes{0.4}{2015-12-03}{new} +% \begin{macrocode} +\newcommand{\glsxtrifemptyglossary}[3]{% + \ifcsdef{glolist@#1}% + {% + \ifcsstring{glolist@#1}{,}{#2}{#3}% + }% + {% + \glsxtrundefaction{Glossary type `#1' doesn't exist}{}% + #2% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifkeydefined} +%\changes{1.12}{2017-02-03}{new} +%Tests if the key given in the first argument has been defined. +% \begin{macrocode} +\newcommand*{\glsxtrifkeydefined}[3]{% + \key@ifundefined{glossentry}{#1}{#3}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrprovidestoragekey} +%\changes{1.12}{2017-02-03}{new} +%Like \cs{glsaddstoragekey} but does nothing if the key has already +%been defined. +% \begin{macrocode} +\newcommand*{\glsxtrprovidestoragekey}{% + \@ifstar\@sglsxtr@provide@storagekey\@glsxtr@provide@storagekey +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@provide@storagekey} +%\changes{1.12}{2017-02-03}{new} +%Unstarred version. +% \begin{macrocode} +\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}% + }% +% \end{macrocode} +%Allow the user to omit the user level command if they only +%intended fetching the value with \cs{glsxtrusefield} +% \begin{macrocode} + \ifblank{#3} + {}% + {% + \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}% + }% + }% + {% +% \end{macrocode} +%Provide the no-link command if not already defined. +% \begin{macrocode} + \ifblank{#3} + {}% + {% + \providecommand*{#3}[1]{\@gls@entry@field{##1}{#1}}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@glsxtr@provide@storagekey} +%\changes{1.12}{2017-02-03}{new} +%Starred version. +% \begin{macrocode} +\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}% +} +% \end{macrocode} +%\end{macro} +% +%The name of a text-block control sequence can be stored in a +%field (given by \cs{GlsXtrFmtField}). This command can then be used +%with \cs{glsxtrfmt}\oarg{options}\marg{label}\marg{text} which +%effectively does +%\cs{glslink}\oarg{options}\marg{label}\{\meta{cs}\marg{text}\} +%If the field hasn't been set for that entry just \meta{text} is +%done. +% +%\begin{macro}{\GlsXtrFmtField} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\GlsXtrFmtField}{useri} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrFmtDefaultOptions} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\GlsXtrFmtDefaultOptions}{noindex} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfmt} +%\changes{1.12}{2017-02-03}{new} +%The post-link hook isn't done. This now has a starred form +%that checks for a final optional argument. +% \begin{macrocode} +\newrobustcmd*{\glsxtrfmt}{\@ifstar\s@glsxtrfmt\@glsxtrfmt} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrfmt} +%\changes{1.23}{2017-11-12}{new} +%Unstarred form. +% \begin{macrocode} +\newcommand*{\@glsxtrfmt}[3][]{\@@glsxtrfmt{#1}{#2}{#3}{}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\s@glsxtrfmt} +%\changes{1.23}{2017-11-12}{new} +%Starred form. +% \begin{macrocode} +\newcommand*{\s@glsxtrfmt}[3][]{% + \new@ifnextchar[{\s@@glsxtrfmt{#1}{#2}{#3}}% + {\@@glsxtrfmt{#1}{#2}{#3}{}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\s@@glsxtrfmt} +%\changes{1.23}{2017-11-12}{new} +%Pick up final optional argument. +% \begin{macrocode} +\def\s@@glsxtrfmt#1#2#3[#4]{\@@glsxtrfmt{#1}{#2}{#3}{#4}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@@glsxtrfmt} +%\changes{1.23}{2017-11-12}{new} +%Actual inner working. +% \begin{macrocode} +\newcommand*{\@@glsxtrfmt}[4]{% +% \end{macrocode} +%Since there's no post-link hook to worry about, grouping can be +%added to provide some protection against nesting (but in general +%nested link text should be avoided). +%\changes{1.23}{2017-11-12}{added grouping} +% \begin{macrocode} + \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}}% + }% + {% +% \end{macrocode} +%Has the default \verb|noindex| been counteracted? If so, this +%needs \cs{glsadd} in case \app{bib2gls} needs to pick up the record. +%\changes{1.23}{2017-11-12}{added check for indexing} +% \begin{macrocode} + \begingroup + \@gls@setdefault@glslink@opts + \setkeys{glslink}{\GlsXtrFmtDefaultOptions,#1}% + \ifKV@glslink@noindex\else\glsadd{#2}\fi + \endgroup + \glsxtrfmtdisplay{@firstofone}{#3}{#4}% + }% + \endgroup +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfmtdisplay} +%\changes{1.23}{2017-11-12}{new} +%The command used internally by \cs{glsxtrfmt} to do the actual +%formatting. The first argument is the control sequence name, +%the second is the control sequence's argument, the third +%is the inserted material (if starred form used). +% \begin{macrocode} +\newcommand{\glsxtrfmtdisplay}[3]{\csuse{#1}{#2}#3} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrentryfmt} +%\changes{1.12}{2017-02-03}{new} +%No link or indexing. +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsxtrentryfmt}[2]{% + \texorpdfstring{\@glsxtrentryfmt{#1}{#2}}{#2}% + } +} +{ + \newcommand*{\glsxtrentryfmt}{\@glsxtrentryfmt} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrentryfmt} +%\changes{1.12}{2017-02-03}{new} +%\changes{1.23}{2017-11-12}{fixed missing label argument} +% \begin{macrocode} +\newrobustcmd*{\@glsxtrentryfmt}[2]{% + \glsdoifexistsordo{#1}% + {% + \ifglshasfield{\GlsXtrFmtField}{#1}% + {% + \csuse{\glscurrentfieldvalue}{#2}% + }% + {#2}% + }% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldlistadd} +%\changes{1.12}{2017-02-03}{new} +%If a field stores an etoolbox internal list (e.g. +%\gloskey{loclist}) then this macro provides a convenient +%way of adding to the list via etoolbox's \cs{listcsadd}. +%The first argument is the entry's label, the second is the field +%label and the third is the element to add to the list. +% \begin{macrocode} +\newcommand*{\glsxtrfieldlistadd}[3]{% + \listcsadd{glo@\glsdetoklabel{#1}@#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldlistgadd} +%\changes{1.12}{2017-02-03}{new} +%Similarly but uses \cs{listcsgadd}. +% \begin{macrocode} +\newcommand*{\glsxtrfieldlistgadd}[3]{% + \listcsgadd{glo@\glsdetoklabel{#1}@#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldlisteadd} +%\changes{1.12}{2017-02-03}{new} +%Similarly but uses \cs{listcseadd}. +% \begin{macrocode} +\newcommand*{\glsxtrfieldlisteadd}[3]{% + \listcseadd{glo@\glsdetoklabel{#1}@#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldlistxadd} +%Similarly but uses \cs{listcsxadd}. +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrfieldlistxadd}[3]{% + \listcsxadd{glo@\glsdetoklabel{#1}@#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%Now provide commands to iterate over these lists. +%\begin{macro}{\glsxtrfielddolistloop} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrfielddolistloop}[2]{% + \dolistcsloop{glo@\glsdetoklabel{#1}@#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldforlistloop} +%\changes{1.12}{2017-02-03}{new} +%\changes{1.29}{2018-04-09}{corrected argument order in \cs{forlistcsloop}} +% \begin{macrocode} +\newcommand*{\glsxtrfieldforlistloop}[3]{% + \forlistcsloop{#3}{glo@\glsdetoklabel{#1}@#2}% +} +% \end{macrocode} +%\end{macro} +% +%List element tests: +%\begin{macro}{\glsxtrfieldifinlist} +%\changes{1.12}{2017-02-03}{new} +%First argument label, second argument field, third argument item, +%fourth true part and fifth false part. +% \begin{macrocode} +\newcommand*{\glsxtrfieldifinlist}[5]{% + \ifinlistcs{#3}{glo@\glsdetoklabel{#1}@#2}{#4}{#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldxifinlist} +%\changes{1.12}{2017-02-03}{new} +%Expands item. +% \begin{macrocode} +\newcommand*{\glsxtrfieldxifinlist}[5]{% + \xifinlistcs{#3}{glo@\glsdetoklabel{#1}@#2}{#4}{#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrforcsvfield} +%\changes{1.24}{2017-11-14}{new} +%\begin{definition} +%\cs{glsxtrforcsvfield}\marg{label}\marg{field}\marg{cs handler} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsxtrforcsvfield}[3]{% + \@glsxtrifhasfield{#2}{#1}% + {% + \let\glsxtrendfor\@endfortrue + \@for\@glsxtr@label:=\glscurrentfieldvalue\do + {\expandafter#3\expandafter{\@glsxtr@label}}}% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifhasfield} +%\changes{1.19}{2017-09-09}{new} +%A simpler alternative to \cs{ifglshasfield} that doesn't complain +%if the entry or the field doesn't exist. (No mapping is used.) +%Grouping is added to the unstarred version allow for nested use. +% \begin{macrocode} +\newrobustcmd{\glsxtrifhasfield}{% + \@ifstar{\s@glsxtrifhasfield}{\@glsxtrifhasfield}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrifhasfield} +%\changes{1.19}{2017-09-09}{new} +%Unstarred version adds grouping. +% \begin{macrocode} +\newcommand{\@glsxtrifhasfield}[4]{% + {\s@glsxtrifhasfield{#1}{#2}{#3}{#4}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@glsxtrifhasfield} +%\changes{1.19}{2017-09-09}{new} +%\changes{1.21}{2017-11-03}{switched from \cs{ifdef} to \cs{ifundef}} +% Starred version omits grouping. +% \begin{macrocode} +\newcommand{\s@glsxtrifhasfield}[4]{% + \letcs{\glscurrentfieldvalue}{glo@\glsdetoklabel{#2}@#1}% + \ifundef\glscurrentfieldvalue + {#4}% + {% + \ifdefempty\glscurrentfieldvalue{#4}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldNonZero} +%\changes{1.31}{2018-05-09}{new} +%Designed for numeric fields. +%\changes{1.39}{2019-03-22}{added starred version} +% \begin{macrocode} +\newcommand{\GlsXtrIfFieldNonZero}{% + \@ifstar\s@GlsXtrIfFieldNonZero\@GlsXtrIfFieldNonZero +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrIfFieldNonZero} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newcommand{\@GlsXtrIfFieldNonZero}[4]{% + \@GlsXtrIfFieldCmpNum{#1}{#2}{=}{0}{#4}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldEqNum} +%\changes{1.31}{2018-05-09}{new} +%\begin{definition} +%\cs{GlsXtrIfFieldEqNum}\marg{field}\marg{label}\marg{value}\marg{true}\marg{false} +%\end{definition} +%Designed for numeric fields. +%\changes{1.39}{2019-03-22}{added starred version} +% \begin{macrocode} +\newcommand{\GlsXtrIfFieldEqNum}{% + \@ifstar\s@GlsXtrIfFieldEqNum\@GlsXtrIfFieldEqNum +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrIfFieldEqNum} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newcommand{\@GlsXtrIfFieldEqNum}[5]{% + \@GlsXtrIfFieldCmpNum{#1}{#2}{=}{#3}{#4}{#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@GlsXtrIfFieldEqNum} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newcommand{\s@GlsXtrIfFieldEqNum}[5]{% + \s@GlsXtrIfFieldCmpNum{#1}{#2}{=}{#3}{#4}{#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldCmpNum} +%\changes{1.31}{2018-05-09}{new} +%\begin{definition} +%\cs{GlsXtrIfFieldCmpNum}\marg{field}\marg{label}\marg{comparison}\marg{value}\marg{true}\marg{false} +%\end{definition} +%Designed for numeric fields. +%\changes{1.39}{2019-03-22}{added starred version} +% \begin{macrocode} +\newcommand{\GlsXtrIfFieldCmpNum}{% + \@ifstar\s@GlsXtrIfFieldCmpNum\@GlsXtrIfFieldCmpNum +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrIfFieldCmpNum} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newcommand{\@GlsXtrIfFieldCmpNum}[6]{% + {% + \letcs{\glscurrentfieldvalue}{glo@\glsdetoklabel{#2}@#1}% + \ifundef\glscurrentfieldvalue + {\def\glscurrentfieldvalue{0}}% + {% + \ifdefempty\glscurrentfieldvalue + {\def\glscurrentfieldvalue{0}}% + {}% + }% + \ifnum\glscurrentfieldvalue#3#4\relax #5\else #6\fi + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@GlsXtrIfFieldCmpNum} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newcommand{\s@GlsXtrIfFieldCmpNum}[6]{% + \letcs{\glscurrentfieldvalue}{glo@\glsdetoklabel{#2}@#1}% + \ifundef\glscurrentfieldvalue + {\def\glscurrentfieldvalue{0}}% + {% + \ifdefempty\glscurrentfieldvalue + {\def\glscurrentfieldvalue{0}}% + {}% + }% + \ifnum\glscurrentfieldvalue#3#4\relax #5\else #6\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldUndef} +%\changes{1.23}{2017-11-12}{new} +%\begin{definition} +%\cs{GlsXtrIfFieldUndef}\marg{field}\marg{label}\marg{true}\marg{false} +%\end{definition} +%Just uses \cs{ifcsundef}. +% \begin{macrocode} +\newcommand{\GlsXtrIfFieldUndef}[2]{% + \ifcsundef{glo@\glsdetoklabel{#2}@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrusefield} +%\changes{1.12}{2017-02-03}{new} +%Provide a user-level alternative to \cs{@gls@entry@field}. +%The first argument is the entry label. The second argument is the +%field label. +% \begin{macrocode} +\newcommand*{\glsxtrusefield}[2]{% + \@gls@entry@field{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrusefield} +%\changes{1.12}{2017-02-03}{new} +%\changes{1.37}{2018-11-30}{fixed internal command and added check for +%\cs{texorpdfstring}} +%Provide a user-level alternative to \cs{@Gls@entry@field}. +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsxtrusefield}[2]{% + \texorpdfstring + {\@Gls@entry@field{#1}{#2}} + {\@gls@entry@field{#1}{#2}}% + } +} +{ + \newcommand*{\Glsxtrusefield}[2]{% + \@Gls@entry@field{#1}{#2}% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrusefield} +%\changes{1.37}{2018-11-30}{new} +%As above but convert to all caps. +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\GLSxtrusefield}[2]{% + \texorpdfstring + {\glsdoifexists{#1}{\mfirstucMakeUppercase{\@gls@entry@field{#1}{#2}}}}% + {\@gls@entry@field{#1}{#2}}% + } +} +{ + \newcommand*{\GLSxtrusefield}[2]{% + \glsdoifexists{#1}{\mfirstucMakeUppercase{\@gls@entry@field{#1}{#2}}}% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrentryparentname} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glsxtrentryparentname}[1]{% + \ifcsdef{glo@\glsdetoklabel{#1}@parent}% + {\csuse{glo@\csuse{glo@\glsdetoklabel{#1}@parent}@name}}% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdeffield} +%\changes{1.12}{2017-02-03}{new} +%Just use \cs{csdef} to provide a field value for the given entry. +% \begin{macrocode} +\newcommand*{\glsxtrdeffield}[2]{\csdef{glo@\glsdetoklabel{#1}@#2}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtredeffield} +%\changes{1.12}{2017-02-03}{new} +%Just use \cs{csedef} to provide a field value for the given entry. +%\changes{1.28}{2018-03-06}{changed \cs{csedef} to +%\cs{protected@csedef}} +% \begin{macrocode} +\newcommand*{\glsxtredeffield}[2]{\protected@csedef{glo@\glsdetoklabel{#1}@#2}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetfieldifexists} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrsetfieldifexists}[3]{\glsdoifexists{#1}{#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetField} +%\changes{1.12}{2017-02-03}{new} +%Allow the user to set a field. First argument entry label, second +%argument field label, third argument value. +% \begin{macrocode} +\newrobustcmd*{\GlsXtrSetField}[3]{% + \glsxtrsetfieldifexists{#1}{#2}% + {\csdef{glo@\glsdetoklabel{#1}@#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLetField} +%\changes{1.12}{2017-02-03}{new} +%Uses \cs{cslet} instead. Third argument should be a macro. +% \begin{macrocode} +\newrobustcmd*{\GlstrLetField}[3]{% + \glsxtrsetfieldifexists{#1}{#2}% + {\cslet{glo@\glsdetoklabel{#1}@#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\csGlsXtrLetField} +%\changes{1.12}{2017-02-03}{new} +%Uses \cs{csletcs} instead. Third argument should be a control +%sequence name. +% \begin{macrocode} +\newrobustcmd*{\csGlsXtrLetField}[3]{% + \glsxtrsetfieldifexists{#1}{#2}% + {\csletcs{glo@\glsdetoklabel{#1}@#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLetFieldToField} +%\changes{1.12}{2017-02-03}{new} +%Sets the field for one entry to the field for another entry. +%Third argument should be the other entry +%and the fourth argument that other field label. +% \begin{macrocode} +\newrobustcmd*{\GlsXtrLetFieldToField}[4]{% + \glsxtrsetfieldifexists{#1}{#2}% + {\csletcs{glo@\glsdetoklabel{#1}@#2}{glo@\glsdetoklabel{#3}@#4}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gGlsXtrSetField} +%\changes{1.12}{2017-02-03}{new} +%Allow the user to set a field. First argument entry label, second +%argument field label, third argument value. +% \begin{macrocode} +\newrobustcmd*{\gGlsXtrSetField}[3]{% + \glsxtrsetfieldifexists{#1}{#2}% + {\csgdef{glo@\glsdetoklabel{#1}@#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\xGlsXtrSetField} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newrobustcmd*{\xGlsXtrSetField}[3]{% + \glsxtrsetfieldifexists{#1}{#2}% + {\protected@csxdef{glo@\glsdetoklabel{#1}@#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\eGlsXtrSetField} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newrobustcmd*{\eGlsXtrSetField}[3]{% + \glsxtrsetfieldifexists{#1}{#2}% + {\protected@csedef{glo@\glsdetoklabel{#1}@#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldEqStr} +%\changes{1.21}{2017-11-03}{new} +%\changes{1.39}{2019-03-22}{added starred form} +%Starred version uses starred version of \cs{glsxtrifhasfield} +%(that is, no grouping). +% \begin{macrocode} +\newcommand*{\GlsXtrIfFieldEqStr}{% + \@ifstar\s@GlsXtrIfFieldEqStr\@GlsXtrIfFieldEqStr +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrIfFieldEqStr} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newrobustcmd*{\@GlsXtrIfFieldEqStr}[5]{% + \@glsxtrifhasfield{#1}{#2}% + {% + \ifdefstring{\glscurrentfieldvalue}{#3}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@GlsXtrIfFieldEqStr} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newrobustcmd*{\s@GlsXtrIfFieldEqStr}[5]{% + \s@glsxtrifhasfield{#1}{#2}% + {% + \ifdefstring{\glscurrentfieldvalue}{#3}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfFieldEqXpStr} +%\changes{1.31}{2018-05-09}{new} +%Like the above but first expands the string. +%Starred version uses starred version of \cs{glsxtrifhasfield} +%(that is, no grouping). +%\changes{1.39}{2019-03-22}{added starred form} +% \begin{macrocode} +\newcommand*{\GlsXtrIfFieldEqXpStr}{% + \@ifstar\s@GlsXtrIfFieldEqXpStr\@GlsXtrIfFieldEqXpStr +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrIfFieldEqXpStr} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newrobustcmd*{\@GlsXtrIfFieldEqXpStr}[5]{% + \@glsxtrifhasfield{#1}{#2}% + {% + \protected@edef\@gls@tmp{#3}% + \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@GlsXtrIfFieldEqXpStr} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newrobustcmd*{\s@GlsXtrIfFieldEqXpStr}[5]{% + \s@glsxtrifhasfield{#1}{#2}% + {% + \protected@edef\@gls@tmp{#3}% + \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfXpFieldEqXpStr} +%\changes{1.31}{2018-05-09}{new} +%Like the above but also expands the field value. +%Starred version uses starred version of \cs{glsxtrifhasfield} +%(that is, no grouping). +%\changes{1.39}{2019-03-22}{added starred form} +% \begin{macrocode} +\newcommand*{\GlsXtrIfXpFieldEqXpStr}{% + \@ifstar\s@GlsXtrIfXpFieldEqXpStr\@GlsXtrIfXpFieldEqXpStr +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrIfXpFieldEqXpStr} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newrobustcmd*{\@GlsXtrIfXpFieldEqXpStr}[5]{% + \@glsxtrifhasfield{#1}{#2}% + {% + \protected@edef\@gls@tmp{\glscurrentfieldvalue}% + \let\glscurrentfieldvalue\@gls@tmp + \protected@edef\@gls@tmp{#3}% + \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@GlsXtrIfXpFieldEqXpStr} +%\changes{1.39}{2019-03-22}{new} +% \begin{macrocode} +\newrobustcmd*{\s@GlsXtrIfXpFieldEqXpStr}[5]{% + \s@glsxtrifhasfield{#1}{#2}% + {% + \protected@edef\@gls@tmp{\glscurrentfieldvalue}% + \let\glscurrentfieldvalue\@gls@tmp + \protected@edef\@gls@tmp{#3}% + \ifdefequal{\glscurrentfieldvalue}{\@gls@tmp}{#4}{#5}% + }% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrForeignText} +%\changes{1.32}{2018-05-24}{new} +%\begin{definition} +%\cs{GlsXtrForeignText}\marg{entry label}\marg{text} +%\end{definition} +%If a field is used to store a language tag (such as \texttt{en-GB} +%or \texttt{de-CH-1996}) then this command uses \sty{tracklang}'s +%interface to encapsulate \meta{text}. The field identifying the +%locale is given by \cs{GlsXtrForeignTextField}. +% \begin{macrocode} +\ifdef\foreignlanguage +{ + \ifdef\GetTrackedDialectFromLanguageTag + { + \newcommand{\GlsXtrForeignText}[2]{% +% \end{macrocode} +%In case this is used inside the argument of \cs{glsxtrifhasfield}, +%save and restore \cs{glscurrentfieldvalue}. +% \begin{macrocode} + \let\@glsxtr@org@currentfieldvalue\glscurrentfieldvalue + \glsxtrifhasfield{\GlsXtrForeignTextField}{#1}% + {% + \expandafter\GetTrackedDialectFromLanguageTag\expandafter + {\glscurrentfieldvalue}{\@glsxtr@dialect}% + \let\@glsxtr@locale\glscurrentfieldvalue + \let\glscurrentfieldvalue\@glsxtr@org@currentfieldvalue + \ifdefempty\@glsxtr@dialect + {% +% \end{macrocode} +% An exact match hasn't been found. A partial match can only be +% obtained with at least \sty{tracklang} v1.3.6. +% \begin{macrocode} + \ifundef\TrackedDialectClosestSubMatch + {% + \GlossariesExtraWarning{Can't obtain dialect label + (tracklang v1.3.6+ required)}% + }% + {\let\@glsxtr@dialect\TrackedDialectClosestSubMatch}% + }% + {}% + \ifdefempty\@glsxtr@dialect + {% +% \end{macrocode} +% No tracked dialect found for the root language. +% \begin{macrocode} + }% + {% +% \end{macrocode} +% Check if there's a caption hook for the given dialect label. +% \begin{macrocode} + \ifcsundef{captions\@glsxtr@dialect}{}% + {% +% \end{macrocode} +% Dialect label not recognised. Check if there's a known mapping. +% \begin{macrocode} + \IfTrackedDialectHasMapping{\@glsxtr@dialect}% + {% + \edef\@glsxtr@dialect{% + \GetTrackedDialectToMapping{\@glsxtr@dialect}}% +% \end{macrocode} +% Does a caption hook exist for this? +% \begin{macrocode} + \ifcsundef{captions\@glsxtr@dialect}{}% + {% +% \end{macrocode} +% No mapping. Try root language label instead. +% \begin{macrocode} + \ifcsundef{captions\@tracklang@lang}{}% + {% + \let\@glsxtr@dialect\@tracklang@lang + }% + }% + }% + {% +% \end{macrocode} +% No mapping. Try root language label instead. +% \begin{macrocode} + \ifcsundef{captions\@tracklang@lang}{}% + {% + \let\@glsxtr@dialect\@tracklang@lang + }% + }% + }% + }% + \ifdefempty\@glsxtr@dialect + {% + \GlsXtrUnknownDialectWarning{\@glsxtr@locale}{\@tracklang@lang}% + #2% + }% + {\foreignlanguage{\@glsxtr@dialect}{#2}}% + }% + {#2}% key not set + } + } + { + \newcommand{\GlsXtrForeignText}[2]{% + \GlossariesExtraWarning{Can't encapsulate foreign text: + tracklang v1.3.6+ required}% + #2% + } + } +} +{ +% \end{macrocode} +%\cs{foreignlanguage} isn't defined so just do \meta{text}. +% \begin{macrocode} + \newcommand{\GlsXtrForeignText}[2]{#2} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrForeignTextField} +%\changes{1.32}{2018-05-24}{new} +%This is the \gloskey{user2} field by default but may be redefined +%as required. +% \begin{macrocode} +\newcommand*{\GlsXtrForeignTextField}{userii} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrUnknownDialectWarning} +%\changes{1.32}{2018-05-24}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrUnknownDialectWarning}[2]{% + \GlossariesExtraWarning{Can't determine valid dialect label + for locale `#1' (root language: #2)}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpageref} +%\changes{1.11}{2017-01-19}{new} +% Like \cs{glsrefentry} but references the page number instead (if +% entry counting is on). The base \sty{glossaries} package only +% introduced \cs{GlsEntryCounterLabelPrefix} in version 4.38, so it +% may not be defined. +% \begin{macrocode} +\ifdef\GlsEntryCounterLabelPrefix +{% + \newcommand*{\glsxtrpageref}[1]{% + \ifglsentrycounter + \pageref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \ifglssubentrycounter + \pageref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \gls{#1}% + \fi + \fi + } +}% +{% + \newcommand*{\glsxtrpageref}[1]{% + \ifglsentrycounter + \pageref{glsentry-\glsdetoklabel{#1}}% + \else + \ifglssubentrycounter + \pageref{glsentry-\glsdetoklabel{#1}}% + \else + \gls{#1}% + \fi + \fi + } +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\apptoglossarypreamble} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\apptoglossarypreamble}[2][\glsdefaulttype]{% + \ifcsdef{glolist@#1}% + {% + \ifcsundef{@glossarypreamble@#1}% + {\csdef{@glossarypreamble@#1}{}}% + {}% + \csappto{@glossarypreamble@#1}{#2}% + }% + {% + \GlossariesExtraWarning{Glossary `#1' is not defined}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\pretoglossarypreamble} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\preglossarypreamble}[2][\glsdefaulttype]{% + \ifcsdef{glolist@#1}% + {% + \ifcsundef{@glossarypreamble@#1}% + {\csdef{@glossarypreamble@#1}{}}% + {}% + \cspreto{@glossarypreamble@#1}{#2}% + }% + {% + \GlossariesExtraWarning{Glossary `#1' is not defined}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\section{Modifications to Commands Provided by \styfmt{glossaries}} +% Some of the commands provided by \styfmt{glossaries} are modified +% to take into account new options or to change default behaviour. +% +%\begin{macro}{\ifglsused} +%\begin{definition} +%\cs{ifglsused}\marg{label}\marg{true part}\marg{false part} +%\end{definition} +%\changes{1.33}{2018-07-26}{added redefinition} +%In the event that undefined entries should trigger a warning rather +%than an error, \cs{ifglsused} needs to be modified to check for +%existence. If the boolean variable is undefined, then its state is +%indeterminate and is neither true nor false, so neither \meta{true +%part} nor \meta{false} part will be performed if \meta{label} is +%undefined. +% \begin{macrocode} +\renewcommand*{\ifglsused}[3]{% + \glsdoifexists{#1}{\ifbool{glo@\glsdetoklabel{#1}@flag}{#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%Provide a starred version of \cs{longnewglossaryentry} that doesn't +%automatically insert \verb|\leavevmode\unskip\nopostdesc| at the +%end of the description. The unstarred version is modified to use +%\cs{glsxtrpostlongdescription} instead. +% +%\begin{macro}{\longnewglossaryentry} +%\changes{1.12}{2017-02-03}{added starred version} +% \begin{macrocode} +\renewcommand*{\longnewglossaryentry}{% + \@ifstar\@glsxtr@s@longnewglossaryentry\@glsxtr@longnewglossaryentry +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@s@longnewglossaryentry} +%\changes{1.12}{2017-02-03}{new} +%Starred version. +% \begin{macrocode} +\newcommand{\@glsxtr@s@longnewglossaryentry}[3]{% + \glsdoifnoexists{#1}% + {% + \bgroup + \let\@org@newglossaryentryprehook\@newglossaryentryprehook + \long\def\@newglossaryentryprehook{% + \long\def\@glo@desc{#3}% + \@org@newglossaryentryprehook + }% + \renewcommand*{\gls@assign@desc}[1]{% + \global\cslet{glo@\glsdetoklabel{#1}@desc}{\@glo@desc}% + \global\cslet{glo@\glsdetoklabel{#1}@descplural}{\@glo@descplural}% + } + \gls@defglossaryentry{#1}{#2}% + \egroup + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@longnewglossaryentry} +%\changes{1.12}{2017-02-03}{new} +%Unstarred version. +% \begin{macrocode} +\newcommand{\@glsxtr@longnewglossaryentry}[3]{% + \glsdoifnoexists{#1}% + {% + \bgroup + \let\@org@newglossaryentryprehook\@newglossaryentryprehook + \long\def\@newglossaryentryprehook{% + \long\def\@glo@desc{#3\glsxtrpostlongdescription}% + \@org@newglossaryentryprehook + }% + \renewcommand*{\gls@assign@desc}[1]{% + \global\cslet{glo@\glsdetoklabel{#1}@desc}{\@glo@desc}% +% \end{macrocode} +%The following is different from the base \sty{glossaries.sty}: +% \begin{macrocode} + \global\cslet{glo@\glsdetoklabel{#1}@descplural}{\@glo@descplural}% + } + \gls@defglossaryentry{#1}{#2}% + \egroup + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlongdescription} +%\changes{1.12}{2017-02-03}{new} +%Hook at the end of the description when using the unstarred +%\cs{longnewglossaryentry}. +% \begin{macrocode} +\newcommand*{\glsxtrpostlongdescription}{\leavevmode\unskip\nopostdesc} +% \end{macrocode} +%\end{macro} +% +%Provide a starred version of \cs{newignoredglossary} that doesn't +%add the glossary to the nohyperlist list. +% +%\begin{macro}{\newignoredglossary} +%\changes{1.11}{2017-01-19}{added starred version} +%Redefine to check for star. +% \begin{macrocode} +\renewcommand{\newignoredglossary}{% + \@ifstar\glsxtr@s@newignoredglossary\glsxtr@org@newignoredglossary +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@org@newignoredglossary} +%The original definition is patched to check for existence. +%\changes{1.11}{2017-01-19}{new} +%\changes{1.12}{2017-02-03}{Added check for existence} +% \begin{macrocode} +\newcommand*{\glsxtr@org@newignoredglossary}[1]{% + \ifcsdef{glolist@#1} + {% + \glsxtrundefaction{Glossary type `#1' already exists}{}% + }% + {% + \ifdefempty\@ignored@glossaries + {% + \edef\@ignored@glossaries{#1}% + }% + {% + \eappto\@ignored@glossaries{,#1}% + }% + \csgdef{glolist@#1}{,}% + \ifcsundef{gls@#1@entryfmt}% + {% + \defglsentryfmt[#1]{\glsentryfmt}% + }% + {}% + \ifdefempty\@gls@nohyperlist + {% + \renewcommand*{\@gls@nohyperlist}{#1}% + }% + {% + \eappto\@gls@nohyperlist{,#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@s@newignoredglossary} +%Starred form. +%\changes{1.11}{2017-01-19}{new} +%\changes{1.12}{2017-02-03}{Added check for existence} +% \begin{macrocode} +\newcommand*{\glsxtr@s@newignoredglossary}[1]{% + \ifcsdef{glolist@#1} + {% + \glsxtrundefaction{Glossary type `#1' already exists}{}% + }% + {% + \ifdefempty\@ignored@glossaries + {% + \edef\@ignored@glossaries{#1}% + }% + {% + \eappto\@ignored@glossaries{,#1}% + }% + \csgdef{glolist@#1}{,}% + \ifcsundef{gls@#1@entryfmt}% + {% + \defglsentryfmt[#1]{\glsentryfmt}% + }% + {}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssettoctitle} +%\changes{1.12}{2017-02-03}{added patch} +%Ignored glossaries don't have an associated title, so modify +%\cs{glssettoctitle} to check for it to prevent an undefined +%command written to the toc file. +% \begin{macrocode} +\glsifusetranslator +{% + \renewcommand*{\glssettoctitle}[1]{% + \ifcsdef{gls@tr@set@#1@toctitle}% + {% + \csuse{gls@tr@set@#1@toctitle}% + }% + {% + \ifcsdef{@glotype@#1@title}% + {\def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}% + {\def\glossarytoctitle{\glossarytitle}}% + }% + }% +} +{ + \renewcommand*{\glssettoctitle}[1]{% + \ifcsdef{@glotype@#1@title}% + {\def\glossarytoctitle{\csname @glotype@#1@title\endcsname}}% + {\def\glossarytoctitle{\glossarytitle}}% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\provideignoredglossary} +%\changes{1.12}{2017-02-03}{new} +%As above but won't do anything if the glossary already exists. +% \begin{macrocode} +\newcommand{\provideignoredglossary}{% + \@ifstar\glsxtr@s@provideignoredglossary\glsxtr@provideignoredglossary +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@provideignoredglossary} +%\changes{1.12}{2017-02-03}{new} +%Unstarred version. +% \begin{macrocode} +\newcommand*{\glsxtr@provideignoredglossary}[1]{% + \ifcsdef{glolist@#1} + {}% + {% + \ifdefempty\@ignored@glossaries + {% + \edef\@ignored@glossaries{#1}% + }% + {% + \eappto\@ignored@glossaries{,#1}% + }% + \csgdef{glolist@#1}{,}% + \ifcsundef{gls@#1@entryfmt}% + {% + \defglsentryfmt[#1]{\glsentryfmt}% + }% + {}% + \ifdefempty\@gls@nohyperlist + {% + \renewcommand*{\@gls@nohyperlist}{#1}% + }% + {% + \eappto\@gls@nohyperlist{,#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@s@provideignoredglossary} +%Starred form. +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@s@provideignoredglossary}[1]{% + \ifcsdef{glolist@#1} + {}% + {% + \ifdefempty\@ignored@glossaries + {% + \edef\@ignored@glossaries{#1}% + }% + {% + \eappto\@ignored@glossaries{,#1}% + }% + \csgdef{glolist@#1}{,}% + \ifcsundef{gls@#1@entryfmt}% + {% + \defglsentryfmt[#1]{\glsentryfmt}% + }% + {}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrcopytoglossary} +%Adds an entry label to another glossary list. First argument is +%entry label. Second argument is glossary label. +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrcopytoglossary}[2]{% + \glsdoifexists{#1}% + {% + \ifcsdef{glolist@#2} + {% + \cseappto{glolist@#2}{#1,}% + }% + {% + \glsxtrundefaction{Glossary type `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Existence Checks} +%\begin{macro}{\glsdoifexists} +% Modify \cs{glsdoifexists} to take account of the +% \pkgopt{undefaction} setting. +% \begin{macrocode} +\renewcommand{\glsdoifexists}[2]{% + \ifglsentryexists{#1}{#2}% + {% +% \end{macrocode} +% Define \cs{glslabel} in case it's needed after this command (for +% example in the post-link hook). +%\changes{1.08}{2016-12-13}{now defines \cs{glslabel}} +% \begin{macrocode} + \edef\glslabel{\glsdetoklabel{#1}}% + \glsxtrundefaction{Glossary entry `\glslabel' + has not been defined}{You need to define a glossary entry before + you can reference it.}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoifnoexists} +% Modify \cs{glsdoifnoexists} to take account of the +% \pkgopt{undefaction} setting. +% \begin{macrocode} +\renewcommand{\glsdoifnoexists}[2]{% + \ifglsentryexists{#1}{% + \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' + has already been defined}{}}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoifexistsordo} +% Modify \cs{glsdoifexistsordo} to take account of the +% \pkgopt{undefaction} setting. This command was introduced in +% \styfmt{glossaries} version 4.19, so check if it has been defined first. +% \begin{macrocode} +\ifdef\glsdoifexistsordo +{% + \renewcommand{\glsdoifexistsordo}[3]{% + \ifglsentryexists{#1}{#2}% + {% + \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' + has not been defined}{You need to define a glossary entry + before you can use it.}% + #3% + }% + }% +} +{% + \glsxtr@warnonexistsordo\glsdoifexistsordo + \newcommand{\glsdoifexistsordo}[3]{% + \ifglsentryexists{#1}{#2}% + {% + \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' + has not been defined}{You need to define a glossary entry + before you can use it.}% + #3% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\doifglossarynoexistsordo} +% Similarly for \cs{doifglossarynoexistsordo}. +% \begin{macrocode} +\ifdef\doifglossarynoexistsordo +{% + \renewcommand{\doifglossarynoexistsordo}[3]{% + \ifglossaryexists{#1}% + {% + \glsxtrundefaction{Glossary type `#1' already exists}{}% + #3% + }% + {#2}% + }% +} +{% + \glsxtr@warnonexistsordo\doifglossarynoexistsordo + \newcommand{\doifglossarynoexistsordo}[3]{% + \ifglossaryexists{#1}% + {% + \glsxtrundefaction{Glossary type `#1' already exists}{}% + #3% + }% + {#2}% + }% +} + +% \end{macrocode} +%\end{macro} +% +%There are now three types of cross-references: the \gloskey{see} key (as +%original), the \gloskey{alias} key (from \styfmt{glossaries-extra} v1.12) +% and the \gloskey{seealso} key (from \styfmt{glossaries-extra} v1.16). +% The original \gloskey{see} key needs to have a corresponding field +% (which it doesn't with the base \sty{glossaries} package). +% +%\begin{macro}{\@newglossaryentryposthook} +% Hook into end of \cs{newglossaryentry} to add \qt{see} value as a +% field. +%\changes{0.5.4}{2015-12-15}{added empty see value if not set and added +% `see' to field key map} +% \begin{macrocode} +\appto\@newglossaryentryposthook{% + \ifdefvoid\@glo@see + {\csxdef{glo@\@glo@label @see}{}}% + {% + \csxdef{glo@\@glo@label @see}{\@glo@see}% + \if@glsxtr@autoseeindex + \@glsxtr@autoindexcrossrefs + \fi + }% +} +\appto\@gls@keymap{,{see}{see}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrusesee} +%\changes{1.06}{2016-06-18}{new} +%Apply \cs{glsseeformat} to the \gloskey{see} key if not empty. +% \begin{macrocode} +\newcommand*{\glsxtrusesee}[1]{% + \glsdoifexists{#1}% + {% + \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@see}% + \ifdefempty\@glo@see + {}% + {% + \expandafter\glsxtr@usesee\@glo@see\@end@glsxtr@usesee + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@usesee} +%\changes{1.06}{2016-06-18}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@usesee}[1][\seename]{% + \@glsxtr@usesee[#1]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@usesee} +%\changes{1.06}{2016-06-18}{new} +% \begin{macrocode} +\def\@glsxtr@usesee[#1]#2\@end@glsxtr@usesee{% + \glsxtruseseeformat{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtruseseeformat} +%\changes{1.06}{2016-06-18}{new} +%The format used by \cs{glsxtrusesee}. The first argument is the tag +%(such as \cs{seename}). The second argument is the comma-separated +%list of cross-referenced labels. +% \begin{macrocode} +\newcommand*{\glsxtruseseeformat}[2]{% + \glsseeformat[#1]{#2}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsseeitemformat} +%\changes{1.21}{2017-11-03}{new} +%\changes{1.22}{2017-11-08}{switched check from regular to short} +%\changes{1.37}{2018-11-30}{removed reference to \cs{glslabel}} +%\styfmt{glossaries} originally defined \cs{glsseeitemformat} +%to use \cs{glsentryname} but in v3.0 this was switched to +%use \cs{glsentrytext} due to problems occurring with the +%\gloskey{name} field being sanitized. Since this is no longer a +%problem, \styfmt{glossaries-extra} restores the original +%definition as it makes more sense to use the \gloskey{name} +%in the cross-reference list. This still uses \cs{glsaccesstext} +%for abbreviations. +% \begin{macrocode} +\renewcommand*{\glsseeitemformat}[1]{% + \ifglshasshort{#1}{\glsaccesstext{#1}}{\glsaccessname{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrhiername} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrhiername}\marg{label} +%\end{definition} +%Displays the hierarchical name for the given entry. The +%cross-reference format \cs{glsseeitemformat} may be redefined to +%use this command to show the hierarchy, if required. +% \begin{macrocode} +\newcommand*{\glsxtrhiername}[1]{% + \glsdoifexists{#1}% + {% + \glsxtrifhasfield{parent}{#1}% + {\glsxtrhiername{\glscurrentfieldvalue}\glsxtrhiernamesep}% + {}% + \ifglshasshort{#1}{\glsaccessshort{#1}}{\glsaccessname{#1}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrhiername} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{Glsxtrhiername}\marg{label} +%\end{definition} +%As above but displays the top-level name with an initial capital. +% \begin{macrocode} +\newcommand*{\Glsxtrhiername}[1]{% + \glsdoifexists{#1}% + {% + \glsxtrifhasfield{parent}{#1}% + {% + \Glsxtrhiername{\glscurrentfieldvalue}\glsxtrhiernamesep + \ifglshasshort{#1}{\glsaccessshort{#1}}{\glsaccessname{#1}}% + }% + {\ifglshasshort{#1}{\Glsaccessshort{#1}}{\Glsaccessname{#1}}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrhiername} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{GlsXtrhiername}\marg{label} +%\end{definition} +%As above but converts the first letter of each name to a capital. +% \begin{macrocode} +\newcommand*{\GlsXtrhiername}[1]{% + \glsdoifexists{#1}% + {% + \glsxtrifhasfield{parent}{#1}% + {\GlsXtrhiername{\glscurrentfieldvalue}\glsxtrhiernamesep}% + {}% + \ifglshasshort{#1}{\Glsaccessshort{#1}}{\Glsaccessname{#1}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrhiername} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{GLSxtrhiername}\marg{label} +%\end{definition} +%As above but displays the top-level name in all-caps. +% \begin{macrocode} +\newcommand*{\GLSxtrhiername}[1]{% + \glsdoifexists{#1}% + {% + \glsxtrifhasfield{parent}{#1}% + {% + \GLSxtrhiername{\glscurrentfieldvalue}\glsxtrhiernamesep + \ifglshasshort{#1}{\glsaccessshort{#1}}{\glsaccessname{#1}}% + }% + {\ifglshasshort{#1}{\GLSaccessshort{#1}}{\GLSaccessname{#1}}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSXTRhiername} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{GLSXTRhiername}\marg{label} +%\end{definition} +%As above but displays all names in all-caps. +% \begin{macrocode} +\newcommand*{\GLSXTRhiername}[1]{% + \glsdoifexists{#1}% + {% + \glsxtrifhasfield{parent}{#1}% + {\GLSXTRhiername{\glscurrentfieldvalue}\glsxtrhiernamesep}% + {} + \ifglshasshort{#1}{\GLSaccessshort{#1}}{\GLSaccessname{#1}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrhiernamesep} +%\changes{1.37}{2018-11-30}{new} +%Separator used in \cs{glsxtrhiername} and variants. +% \begin{macrocode} +\newcommand*{\glsxtrhiernamesep}{\,{\small$\triangleright$}\,} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtruseseealso} +%\changes{1.16}{2017-06-15}{new} +%Apply \cs{glsseeformat} to the \gloskey{seealso} key if not empty. +%There's no optional tag to worry about here. +% \begin{macrocode} +\newcommand*{\glsxtruseseealso}[1]{% + \glsdoifexists{#1}% + {% + \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@seealso}% + \ifdefempty\@glo@see + {}% + {% + \expandafter\glsxtruseseealsoformat\expandafter{\@glo@see}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtruseseealsoformat} +%\changes{1.16}{2017-06-15}{new} +%The format used by \cs{glsxtruseseealso}. The argument is the comma-separated +%list of cross-referenced labels. +% \begin{macrocode} +\newcommand*{\glsxtruseseealsoformat}[1]{% + \glsseeformat[\seealsoname]{#1}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrseelist} +%\changes{1.16}{2017-06-15}{new} +%Fully expands argument before passing to \cs{glsseelist}. +%(The argument to \cs{glsseelist} must be a comma-separated list of +%entry labels.) +% \begin{macrocode} +\newrobustcmd{\glsxtrseelist}[1]{% + \edef\@glo@tmp{\noexpand\glsseelist{#1}}\@glo@tmp +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\seealsoname} +%\changes{1.16}{2017-06-15}{new} +%In case this command hasn't been defined. (Should be provided by +%language packages.) +% \begin{macrocode} +\providecommand{\seealsoname}{see also} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrindexseealso} +%\changes{1.16}{2017-06-15}{new} +%If \cs{@xdycrossrefhook} is defined, provide a +%\texttt{seealso} crossref class. Otherwise this just does +%\cs{glssee} with \cs{seealsoname} as the tag. The hook is only +%defined if both \pkgopt{xindy} and \sty{glossaries} v4.30+ are +%being used. +% \begin{macrocode} +\ifdef\@xdycrossrefhook +{ +% \end{macrocode} +%Add the cross-reference class definition to the hook. +% \begin{macrocode} + \appto\@xdycrossrefhook{% + \write\glswrite{(define-crossref-class \string"seealso\string" + :unverified )}% + \write\glswrite{(markup-crossref-list + :class \string"seealso\string"^^J\space\space\space + :open \string"\string\glsxtruseseealsoformat\glsopenbrace\string" + :close \string"\glsclosebrace\string")}% + } +% \end{macrocode} +%Append to class list. +% \begin{macrocode} + \appto\@xdylocationclassorder{\space\string"seealso\string"} +% \end{macrocode} +%This essentially works like \cs{@do@seeglossary} but uses the +%\texttt{seealso} class. +%\changes{1.21}{2017-11-03}{added check that the entry exists} +%This doesn't increment the associated counter. +% \begin{macrocode} + \newrobustcmd*{\glsxtrindexseealso}[2]{% + \ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex + \@glsxtr@recordsee{#1}{#2}% + \fi + \glsdoifexists{#1}% + {% + \@@glsxtrwrglossmark + \def\@gls@xref{#2}% + \@onelevel@sanitize\@gls@xref + \@gls@checkmkidxchars\@gls@xref + \gls@glossary{\csname glo@#1@type\endcsname}{% + (indexentry + :tkey (\csname glo@#1@index\endcsname) + :xref (\string"\@gls@xref\string") + :attr \string"seealso\string" + ) + }% + }% + } +} +{ +% \end{macrocode} +% \pkgopt{xindy} not in use or \sty{glossaries} version too old to support this. +% \begin{macrocode} + \newrobustcmd*{\glsxtrindexseealso}{\glssee[\seealsoname]} +} +% \end{macrocode} +%\end{macro} +% +%The \gloskey{alias} key should be set to the label of the synonymous entry. +%The \gloskey{seealso} key essentially behaves like +%\texttt{see=[\cs{seealsoname}]\marg{xr-list}}. Neither of these new keys +%has the optional tag part allowed with \gloskey{see}. +% +% If \cs{gls@set@xr@key} has been defined (\sty{glossaries} v4.30), +% use that, otherwise just use \cs{glsaddstoragekey}. +% +% \begin{macrocode} +\ifdef\gls@set@xr@key +{ +% \end{macrocode} +% We have at least \sty{glossaries} v4.30. This means the new keys +% can be governed by the same settings as the see key. +% \begin{macrocode} + \define@key{glossentry}{alias}{% + \gls@set@xr@key{alias}{\@glo@alias}{#1}% + } + \define@key{glossentry}{seealso}{% + \gls@set@xr@key{seealso}{\@glo@seealso}{#1}% + } +% \end{macrocode} +% Add to the key mappings. +% \begin{macrocode} + \appto\@gls@keymap{,{alias}{alias},{seealso}{seealso}} +% \end{macrocode} +% Set the default value. +% \begin{macrocode} + \appto\@newglossaryentryprehook{\def\@glo@alias{}\def\@glo@seealso{}}% +% \end{macrocode} +% Assign the field values. +% \begin{macrocode} + \appto\@newglossaryentryposthook{% + \ifdefvoid\@glo@seealso + {\csxdef{glo@\@glo@label @seealso}{}}% + {% + \csxdef{glo@\@glo@label @seealso}{\@glo@seealso}% + \if@glsxtr@autoseeindex + \@glsxtr@autoindexcrossrefs + \fi + }% +% \end{macrocode} +% The \gloskey{alias} field doesn't trigger the automatic +% cross-reference indexing performed at the end of the document. +% \begin{macrocode} + \ifdefvoid\@glo@alias + {\csxdef{glo@\@glo@label @alias}{}}% + {% + \csxdef{glo@\@glo@label @alias}{\@glo@alias}% + }% + } +% \end{macrocode} +% Provide user-level commands to access the values. +%\begin{macro}{\glsxtralias} +% \begin{macrocode} + \newcommand*{\glsxtralias}[1]{\@gls@entry@field{#1}{alias}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrseealsolabels} +% \begin{macrocode} + \newcommand*{\glsxtrseealsolabels}[1]{\@gls@entry@field{#1}{seealso}} +% \end{macrocode} +%\end{macro} +%Add to the \cs{@glo@autosee} hook. +% \begin{macrocode} + \appto\@glo@autoseehook{% + \ifdefvoid\@glo@alias + {% + \ifdefvoid\@glo@seealso + {}% + {% + \edef\@do@glssee{\noexpand\glsxtrindexseealso + {\@glo@label}{\@glo@seealso}}% + \@do@glssee + }% + }% + {% +% \end{macrocode} +%Add cross-reference if see key hasn't been used. +% \begin{macrocode} + \ifdefvoid\@glo@see + {% + \edef\@do@glssee{\noexpand\glssee{\@glo@label}{\@glo@alias}}% + \@do@glssee + }% + {}% + }% + }% +} +{ +% \end{macrocode} +% We have an older version of \sty{glossaries}, so just use +% \cs{glsaddstoragekey}. +%\begin{macro}{\glsxtralias} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} + \glsaddstoragekey*{alias}{}{\glsxtralias} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrseealsolabels} +%\changes{1.16}{2017-06-15}{new} +% \begin{macrocode} + \glsaddstoragekey*{seealso}{}{\glsxtrseealsolabels} +% \end{macrocode} +%\end{macro} +% +%If \cs{gls@set@xr@key} isn't defined, then \cs{@glo@autosee} won't +%be either, so use the post entry definition hook. +% +%\begin{macro}{\@newglossaryentryposthook} +%\changes{1.12}{2017-02-03}{added check for alias key} +%Append to the hook to check for the \gloskey{alias} and +%\gloskey{seealso} keys. +% \begin{macrocode} + \appto\@newglossaryentryposthook{% + \ifcsvoid{glo@\@glo@label @alias}% + {% + \ifcsvoid{glo@\@glo@label @seealso}% + {}% + {% + \edef\@do@glssee{\noexpand\glsxtrindexseealso + {\@glo@label}{\csuse{glo@\@glo@label @seealso}}}% + \@do@glssee + }% + }% + {% +% \end{macrocode} +%Add cross-reference if see key hasn't been used. +% \begin{macrocode} + \ifdefvoid\@glo@see + {% + \edef\@do@glssee{\noexpand\glssee + {\@glo@label}{\csuse{glo@\@glo@label @alias}}}% + \@do@glssee + }% + {}% + }% + } +% \end{macrocode} +%\end{macro} +% +% \begin{macrocode} +} +% \end{macrocode} +% +% +% Add all unused cross-references at the end of the document. +% \begin{macrocode} +\AtEndDocument{\if@glsxtrindexcrossrefs\glsxtraddallcrossrefs\fi} +% \end{macrocode} +% +%\begin{macro}{\glsxtraddallcrossrefs} +% Iterate through all used entries and if they have a +% cross-reference, make sure the cross-reference has been added. +% \begin{macrocode} +\newcommand*{\glsxtraddallcrossrefs}{% + \forallglossaries{\@glo@type}% + {% + \forglsentries[\@glo@type]{\@glo@label}% + {% + \ifglsused{\@glo@label}% + {\expandafter\@glsxtr@addunusedxrefs\expandafter{\@glo@label}}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@addunusedxrefs} +% If the given entry has a \gloskey{see} or \gloskey{seealso} field add all unused +% cross-references. (The \gloskey{alias} field isn't checked.) +%\changes{1.16}{2017-06-15}{added check for \gloskey{seealso} field} +% \begin{macrocode} +\newcommand*{\@glsxtr@addunusedxrefs}[1]{% + \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@see}% + \ifdefvoid\@glo@see + {}% + {% + \expandafter\glsxtr@addunused\@glo@see\@end@glsxtr@addunused + }% + \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@seealso}% + \ifdefvoid\@glo@see + {}% + {% + \expandafter\glsxtr@addunused\@glo@see\@end@glsxtr@addunused + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@addunused} +% Adds all the entries if they haven't been used. +% \begin{macrocode} +\newcommand*{\glsxtr@addunused}[1][]{% + \@glsxtr@addunused +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@addunused} +% Adds all the entries if they haven't been used. +% \begin{macrocode} +\def\@glsxtr@addunused#1\@end@glsxtr@addunused{% + \@for\@glsxtr@label:=#1\do + {% + \ifglsused{\@glsxtr@label}{}% + {% + \glsadd[format=glsxtrunusedformat]{\@glsxtr@label}% + \glsunset{\@glsxtr@label}% + \expandafter\@glsxtr@addunusedxrefs\expandafter{\@glsxtr@label}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrunusedformat} +% \begin{macrocode} +\newcommand*{\glsxtrunusedformat}[1]{\unskip} +% \end{macrocode} +%\end{macro} +% +%\subsection{Document Definitions} +% +%\begin{macro}{\gls@begindocdefs} +%This command was only introduced to \styfmt{glossaries} v4.37, so +%it may not be defined. If it has been defined, redefine it to check +%\cs{@glsxtr@docdefval} so that it only inputs the \texttt{.glsdefs} +%file if \pkgopt[true]{docdef}. +% \begin{macrocode} +\ifdef\gls@begindocdefs +{% + \renewcommand*{\gls@begindocdefs}{% + \ifnum\@glsxtr@docdefval=1\relax + \@gls@enablesavenonumberlist + \edef\@gls@restoreat{% + \noexpand\catcode`\noexpand\@=\number\catcode`\@\relax}% + \makeatletter + \InputIfFileExists{\jobname.glsdefs}{}{}% + \@gls@restoreat + \undef\@gls@restoreat + \gls@defdocnewglossaryentry + \else + \ifnum\@glsxtr@docdefval=3\relax +% \end{macrocode} +%\changes{1.34}{2018-07-29}{added support for docdef=atom} +%The \pkgopt[atom]{docdef} package option has been set. Create the +%.glsdefs file for the autocomplete support but don't read it. +% \begin{macrocode} + \@gls@enablesavenonumberlist + \let\gls@checkseeallowed\relax + \let\newglossaryentry\new@atom@glossaryentry + \global\newwrite\@gls@deffile + \immediate\openout\@gls@deffile=\jobname.glsdefs +% \end{macrocode} +%Write all currently defined entries. +% \begin{macrocode} + \forallglsentries{\@glsentry}{\@gls@writedef{\@glsentry}}% + \fi + \fi + } +} +{% + \ifnum\@glsxtr@docdefval=3\relax + \PackageError{glossaries-extra}{Package option + `docdef=\@glsxtr@docdefsetting' requires at least version 4.37 + of the base glossaries.sty package}{} + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\new@atom@glossaryentry} +% \begin{macrocode} +\newrobustcmd{\new@atom@glossaryentry}[2]{% + \gls@defglossaryentry{#1}{#2}% + \@gls@writedef{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\makenoidxglossaries} +%Modify \cs{makenoidxglossaries} so that it automatically +%sets \pkgopt[false]{docdef} (unless the restricted setting is on) +%and disables the \pkgopt{docdef} key. +%This command isn't allowed with the \pkgopt{record} option. +% \begin{macrocode} +\let\glsxtr@orgmakenoidxglossaries\makenoidxglossaries +\renewcommand{\makenoidxglossaries}{% + \ifdefequal\@glsxtr@record@setting\@glsxtr@record@setting@off + {% + \glsxtr@orgmakenoidxglossaries +% \end{macrocode} +%Add marker to \cs{@do@seeglossary} but don't increment associated +%counter. +% \begin{macrocode} + \renewcommand{\@do@seeglossary}[2]{% + \@@glsxtrwrglossmark + \edef\@gls@label{\glsdetoklabel{##1}}% + \protected@write\@auxout{}{% + \string\@gls@reference + {\csname glo@\@gls@label @type\endcsname}% + {\@gls@label}% + {% + \string\glsseeformat##2{}% + }% + }% + }% +% \end{macrocode} +%Check for \pkgopt[restricted]{docdefs}: +% \begin{macrocode} + \if@glsxtrdocdefrestricted +% \end{macrocode} +%If restricted document definitions allowed, adjust +%\cs{@gls@reference} so that it doesn't test for existence. +% \begin{macrocode} + \renewcommand*{\@gls@reference}[3]{% + \ifcsundef{@glsref@##1}{\csgdef{@glsref@##1}{}}{}% + \ifinlistcs{##2}{@glsref@##1}% + {}% + {\listcsgadd{@glsref@##1}{##2}}% + \ifcsundef{glo@\glsdetoklabel{##2}@loclist}% + {\csgdef{glo@\glsdetoklabel{##2}@loclist}{}}% + {}% + \listcsgadd{glo@\glsdetoklabel{##2}@loclist}{##3}% + }% + \else +% \end{macrocode} +%Disable document definitions. +% \begin{macrocode} + \@glsxtrdocdeffalse + \fi + \disable@keys{glossaries-extra.sty}{docdef}% + }% + {% + \PackageError{glossaries-extra}{\string\makenoidxglossaries\space + not permitted\MessageBreak + with record=\@glsxtr@record@setting\space package option}% + {You may only use \string\makenoidxglossaries\ space with the + record=off option}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@defdocnewglossaryentry} +% Modify \cs{gls@defdocnewglossaryentry} so that it checks +% the \pkgopt{docdef} value. +% \begin{macrocode} +\renewcommand*{\gls@defdocnewglossaryentry}{% + \ifcase\@glsxtr@docdefval +% \end{macrocode} +% \pkgopt[false]{docdef}: +% \begin{macrocode} + \renewcommand*{\newglossaryentry}[2]{% + \PackageError{glossaries-extra}{Glossary entries must + be \MessageBreak defined in the preamble with \MessageBreak + package option `docdef=false'\MessageBreak(consider using + `docdef=restricted')}{Move your glossary definitions to + the preamble. You can also put them in a \MessageBreak separate file + and load them with \string\loadglsentries.}% + }% + \or +% \end{macrocode} +% (\pkgopt[true]{docdef} case.) +% Since the \gloskey{see} value is now saved in a field, it +% can be used by entries that have been defined in the document. +% \begin{macrocode} + \let\gls@checkseeallowed\relax + \let\newglossaryentry\new@glossaryentry + \else +% \end{macrocode} +%Restricted mode just needs to allow the \gloskey{see} value. +% \begin{macrocode} + \let\gls@checkseeallowed\relax + \fi +}% +% \end{macrocode} +%\end{macro} +% +% Permit a special form of document definition, but only allow +% it if the glossaries come at the end of the document. These +% commands behave a little like a combination of \cs{newterm} +% and \cs{gls}. This must be explicitly enabled with +% the following. +% +%\begin{macro}{\GlsXtrEnableOnTheFly} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableOnTheFly}{% + \@ifstar\@sGlsXtrEnableOnTheFly\@GlsXtrEnableOnTheFly +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@sGlsXtrEnableOnTheFly} +%\changes{0.5.4}{2015-12-15}{new} +% The starred version attempts to allow UTF8 characters in the +% label, but this may break! (Formatting commands mustn't be used in the +% label, but the label may be a command whose replacement text is the +% actual label. This doesn't take into account a command that's +% defined in terms of another command that may eventually expand to +% the label text.) +% \begin{macrocode} +\newcommand*{\@sGlsXtrEnableOnTheFly}{% + \renewcommand*{\glsdetoklabel}[1]{% + \expandafter\@glsxtr@ifcsstart\string##1 \@glsxtr@end@ + {% + \expandafter\detokenize\expandafter{##1}% + }% + {\detokenize{##1}}% + }% + \@GlsXtrEnableOnTheFly +} +\def\@glsxtr@ifcsstart#1#2\@glsxtr@end@#3#4{% + \expandafter\if\glsbackslash#1% + #3% + \else + #4% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrstarflywarn} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrstarflywarn}{% + \GlossariesExtraWarning{Experimental starred version of + \string\GlsXtrEnableOnTheFly\space in use (please ensure you have + read the warnings in the glossaries-extra user manual)}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrEnableOnTheFly} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@GlsXtrEnableOnTheFly}{% +% \end{macrocode} +%\end{macro} +% Don't redefine \cs{glsdetoklabel} if LuaTeX or XeTeX is being +% used, since it's mainly to allow accented characters in the +% label. +% +% These definitions are all assigned the category given by: +%\begin{macro}{\glsxtrcat} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\glsxtrcat}{general} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\glsxtr}[1][]{% + \def\glsxtr@keylist{##1}% + \@glsxtr + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@glsxtr}[2][]{% + \ifglsentryexists{##2}% + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\gls\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\Glsxtr}[1][]{% + \def\glsxtr@keylist{##1}% + \@Glsxtr + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@Glsxtr}[2][]{% + \ifglsentryexists{##2}% + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\Gls\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\glsxtrpl}[1][]{% + \def\glsxtr@keylist{##1}% + \@glsxtrpl + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@glsxtrpl}[2][]{% + \ifglsentryexists{##2}% + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\glspl\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\Glsxtrpl}[1][]{% + \def\glsxtr@keylist{##1}% + \@Glsxtrpl + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@Glsxtrpl}[2][]{% + \ifglsentryexists{##2} + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\Glspl\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrWarning} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\GlsXtrWarning}[2]{% + \def\@glsxtr@optlist{##1}% + \@onelevel@sanitize\@glsxtr@optlist + \GlossariesExtraWarning{The options `\@glsxtr@optlist' have + been ignored for entry `##2' as it has already been defined}% + } +% \end{macrocode} +%\end{macro} +% Disable commands after the glossary: +% \begin{macrocode} + \renewcommand\@printglossary[2]{% + \def\@glsxtr@printglossopts{##1}% + \@glsxtr@orgprintglossary{##1}{##2}% + \def\@glsxtr{\@glsxtr@disabledflycommand\glsxtr}% + \def\@glsxtrpl{\@glsxtr@disabledflycommand\glsxtrpl}% + \def\@Glsxtr{\@glsxtr@disabledflycommand\Glsxtr}% + \def\@Glsxtrpl{\@glsxtr@disabledflycommand\Glsxtrpl}% + } +% \end{macrocode} +% +%\begin{macro}{\@glsxtr@disabledflycommand} +% \begin{macrocode} + \newcommand*{\@glsxtr@disabledflycommand}[1]{% + \PackageError{glossaries-extra}% + {\string##1\space can't be used after any of the \MessageBreak + glossaries have been displayed}% + {The on-the-fly commands enabled by + \string\GlsXtrEnableOnTheFly\space may only be used \MessageBreak + before the glossaries. If you want to use any entries \MessageBreak + after any of the glossaries, you must use the standard \MessageBreak + method of first defining the entry and then using the \MessageBreak + entry with commands like \string\gls}% + \@@glsxtr@disabledflycommand + }% + \newcommand*{\@@glsxtr@disabledflycommand}[2][]{##2} +% \end{macrocode} +%\end{macro} +% +% End of \cs{GlsXtrEnableOnTheFly}. Disable since it can only +% be used once. +% \begin{macrocode} + \let\GlsXtrEnableOnTheFly\relax +} +\@onlypreamble\GlsXtrEnableOnTheFly +% \end{macrocode} +% +%\subsection{Existing Glossary Style Modifications} +% +% Modify \cs{setglossarystyle} to keep track of the current style. +% This allows the \cs{glossaries-extra-stylemods} package to reset the +% current style after the required modifications have been made. +%\begin{macro}{\@glsxtr@current@style} +%\changes{1.02}{2016-04-25}{new} +% Initialise the current style to the default style. +% \begin{macrocode} +\newcommand*{\@glsxtr@current@style}{\@glossary@default@style} +% \end{macrocode} +%\end{macro} +% +% Modify \cs{setglossarystyle} to set \cs{@glsxtr@current@style}. +%\begin{macro}{\setglossarystyle} +% \begin{macrocode} +\renewcommand*{\setglossarystyle}[1]{% + \ifcsundef{@glsstyle@#1}% + {% + \PackageError{glossaries-extra}{Glossary style `#1' undefined}{}% + }% + {% + \csname @glsstyle@#1\endcsname +% \end{macrocode} +% Only set the current style if it exists. +% \begin{macrocode} + \protected@edef\@glsxtr@current@style{#1}% + }% + \ifx\@glossary@default@style\relax + \protected@edef\@glossary@default@style{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +% +% In case we have an old version of \styfmt{glossaries}: +% \begin{macrocode} +\ifdef\@glossary@default@style +{} +{% + \let\@glossary@default@style\relax +} +% \end{macrocode} +% +%\begin{macro}{\glslistdottedwidth} +%If \cs{glslistdottedwidth} has been defined and is currently equal +%to \verb|.5\hsize| then make the modification suggested in +%\href{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=92}{bug report \#92} +% \begin{macrocode} +\ifdef\glslistdottedwidth +{% + \ifdim\glslistdottedwidth=.5\hsize + \setlength{\glslistdottedwidth}{-\dimexpr\maxdimen-1sp\relax} + \AtBeginDocument{% + \ifdim\glslistdottedwidth=-\dimexpr\maxdimen-1sp\relax + \setlength{\glslistdottedwidth}{.5\columnwidth}% + \fi + }% + \fi +} +{}% +% \end{macrocode} +%\end{macro} +% +%Similarly for \cs{glsdescwidth}: +%\begin{macro}{\glsdescwidth} +%\changes{0.5.3}{2015-12-09}{added} +% \begin{macrocode} +\ifdef\glsdescwidth +{% + \ifdim\glsdescwidth=.6\hsize + \setlength{\glsdescwidth}{-\dimexpr\maxdimen-1sp\relax} + \AtBeginDocument{% + \ifdim\glsdescwidth=-\dimexpr\maxdimen-1sp\relax + \setlength{\glsdescwidth}{.6\columnwidth}% + \fi + }% + \fi +} +{}% +% \end{macrocode} +%\end{macro} +%and for \cs{glspagelistwidth}: +%\begin{macro}{\glspagelistwidth} +%\changes{0.5.3}{2015-12-09}{added} +% \begin{macrocode} +\ifdef\glspagelistwidth +{% + \ifdim\glspagelistwidth=.1\hsize + \setlength{\glspagelistwidth}{-\dimexpr\maxdimen-1sp\relax} + \AtBeginDocument{% + \ifdim\glspagelistwidth=-\dimexpr\maxdimen-1sp\relax + \setlength{\glspagelistwidth}{.1\columnwidth}% + \fi + }% + \fi +} +{}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossaryentrynumbers} +% Has the \pkgopt{nonumberlist} option been used? +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\org@glossaryentrynumbers#1{#1\gls@save@numberlist{#1}}% +\ifx\org@glossaryentrynumbers\glossaryentrynumbers + \glsnonumberlistfalse + \renewcommand*{\glossaryentrynumbers}[1]{% + \ifglsentryexists{\glscurrententrylabel}% + {% + \@glsxtrpreloctag + \GlsXtrFormatLocationList{#1}% + \@glsxtrpostloctag + \gls@save@numberlist{#1}% + }{}% + }% +\else + \glsnonumberlisttrue + \renewcommand*{\glossaryentrynumbers}[1]{% + \ifglsentryexists{\glscurrententrylabel}% + {% + \gls@save@numberlist{#1}% + }{}% + }% +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrFormatLocationList} +%\changes{0.5.2}{2015-12-08}{new} +% Provide an easy interface to change the format of the location +% list without removing the save number list stuff. +% \begin{macrocode} +\newcommand*{\GlsXtrFormatLocationList}[1]{#1} +% \end{macrocode} +%\end{macro} +% +% Sometimes users want to prefix the location list with +% \qt{page}\slash\qt{pages}. The simplest way to determine if the +% location list consists of a single location is to check for +% instances of \cs{delimN} or \cs{delimR}, but this isn't so easy to +% do as they might be embedded inside the argument of formatting +% commands. With a bit of trickery we can find out by adjusting +% \cs{delimN} and \cs{delimR} to set a flag and then save +% information to the auxiliary file for the next run. +%\begin{macro}{\GlsXtrEnablePreLocationTag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnablePreLocationTag}[2]{% + \let\@glsxtrpreloctag\@@glsxtrpreloctag + \let\@glsxtrpostloctag\@@glsxtrpostloctag + \renewcommand*{\@glsxtr@pagetag}{#1}% + \renewcommand*{\@glsxtr@pagestag}{#2}% + \renewcommand*{\@glsxtr@savepreloctag}[2]{% + \csgdef{@glsxtr@preloctag@##1}{##2}% + }% + \renewcommand*{\@glsxtr@doloctag}{% + \ifcsundef{@glsxtr@preloctag@\glscurrententrylabel}% + {% + \GlossariesWarning{Missing pre-location tag for `\glscurrententrylabel'. + Rerun required}% + }% + {% + \csuse{@glsxtr@preloctag@\glscurrententrylabel}% + }% + }% +} +\@onlypreamble\GlsXtrEnablePreLocationTag +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrpreloctag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@@glsxtrpreloctag}{% + \let\@glsxtr@org@delimN\delimN + \let\@glsxtr@org@delimR\delimR + \let\@glsxtr@org@glsignore\glsignore +% \end{macrocode} +% \cs{gdef} is required as the delimiters may occur inside a scope. +% \begin{macrocode} + \gdef\@glsxtr@thisloctag{\@glsxtr@pagetag}% + \renewcommand*{\delimN}{% + \gdef\@glsxtr@thisloctag{\@glsxtr@pagestag}% + \@glsxtr@org@delimN}% + \renewcommand*{\delimR}{% + \gdef\@glsxtr@thisloctag{\@glsxtr@pagestag}% + \@glsxtr@org@delimR}% + \renewcommand*{\glsignore}[1]{% + \gdef\@glsxtr@thisloctag{\relax}% + \@glsxtr@org@glsignore{##1}}% + \@glsxtr@doloctag +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrpreloctag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtrpreloctag}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@pagetag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@pagetag}{}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@pagestag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@pagestag}{}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@@glsxtrpostloctag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@@glsxtrpostloctag}{% + \let\delimN\@glsxtr@org@delimN + \let\delimR\@glsxtr@org@delimR + \let\glsignore\@glsxtr@org@glsignore + \protected@write\@auxout{}% + {\string\@glsxtr@savepreloctag{\glscurrententrylabel}{\@glsxtr@thisloctag}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrpostloctag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtrpostloctag}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@preloctag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@savepreloctag}[2]{} +\protected@write\@auxout{}{% + \string\providecommand\string\@glsxtr@savepreloctag[2]{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@doloctag} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@doloctag}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\KV@printgloss@nonumberlist} +% Modify the \gloskey[printglossary]{nonumberlist} key to +% use \cs{GlsXtrFormatLocationList} (and also save the number list): +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\KV@printgloss@nonumberlist}[1]{% + \XKV@plfalse + \XKV@sttrue + \XKV@checkchoice[\XKV@resa]{#1}{true,false}% + {% + \csname glsnonumberlist\XKV@resa\endcsname + \ifglsnonumberlist + \def\glossaryentrynumbers##1{\gls@save@numberlist{##1}}% + \else + \def\glossaryentrynumbers##1{% + \@glsxtrpreloctag + \GlsXtrFormatLocationList{##1}% + \@glsxtrpostloctag + \gls@save@numberlist{##1}}% + \fi + }% +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Entry Formatting, Hyperlinks and Indexing} +% +%\begin{macro}{\glsentryfmt} +% Change default entry format. Use the generic format for regular +% terms (that is, entries that have a category with the \catattr{regular} +% attribute set) or non-regular terms without a short value and use the abbreviation format for non-regular +% terms that have a short value. If further attributes need to be checked, then +% \cs{glsentryfmt} will need redefining as appropriate (or use +% \cs{defglsentryfmt}). +%\changes{0.3}{2015-12-02}{added check for short} +% The abbreviation format is set here for entries that have a short +% form, even if they are regular entries to ensure the abbreviation +% fonts are correct. +%\changes{0.5.2}{2015-12-08}{moved \cs{glssetabbrvfmt} from +%\cs{glsxtrabbrvfmt} to here} +% \begin{macrocode} +\renewcommand*{\glsentryfmt}{% + \ifglshasshort{\glslabel}{\glssetabbrvfmt{\glscategory{\glslabel}}}{}% + \glsifregular{\glslabel}% + {\glsxtrregularfont{\glsgenentryfmt}}% + {% + \ifglshasshort{\glslabel}% + {\glsxtrabbreviationfont{\glsxtrgenabbrvfmt}}% + {\glsxtrregularfont{\glsgenentryfmt}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrregularfont} +%\changes{1.04}{2016-05-02}{new} +% Font used for regular entries. +% \begin{macrocode} +\newcommand*{\glsxtrregularfont}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrabbreviationfont} +%\changes{1.30}{2018-04-25}{new} +% Font used for abbreviation entries. +% \begin{macrocode} +\newcommand*{\glsxtrabbreviationfont}[1]{#1} +% \end{macrocode} +%\end{macro} +% +% Commands like \cs{glsifplural} are only used by the \cs{gls}-like +% commands in the \styfmt{glossaries} package, but it might be useful +% for the postlink hook to know if the user has used, say, +% \cs{glsfirst} or \cs{glsplural}. This can provide better +% consistency with the formatting of the \cs{gls}-like commands, +% even though they don't use \cs{glsentryfmt}. +% +%\begin{macro}{\@gls@field@link} +% Redefine \cs{@gls@field@link} so that commands like \cs{glsfirst} +% can setup \cs{glsxtrifwasfirstuse} etc to allow the postlink hook +% to work better. This now has an optional argument that sets up the +% defaults. +%\changes{0.3}{2015-12-02}{added optional argument} +% \begin{macrocode} +\renewcommand{\@gls@field@link}[4][]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#2}{#3}{glslink}% + \glsdoifexists{#3}% + {% +% \end{macrocode} +%Save and restore the hyper setting (\cs{@gls@link} also does this, +%but that's too late if the optional argument of \cs{@gls@field@link} +%modifies it). +% \begin{macrocode} + \let\glsxtrorg@ifKV@glslink@hyper\ifKV@glslink@hyper + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \def\glscustomtext{#4}% + \@glsxtr@field@linkdefs + #1% + \@gls@link[#2]{#3}{#4}% + \let\ifKV@glslink@hyper\glsxtrorg@ifKV@glslink@hyper + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%The commands \cs{gls}, \cs{Gls} etc don't use \cs{@gls@field@link}, +%so they need modifying as well to use \cs{@glsxtr@record}. +% +%\begin{macro}{\@gls@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@gls@\@gls@ +\def\@gls@#1#2{% + \@glsxtr@record{#1}{#2}{glslink}% + \@glsxtr@org@gls@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glspl@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@glspl@\@glspl@ +\def\@glspl@#1#2{% + \@glsxtr@record{#1}{#2}{glslink}% + \@glsxtr@org@glspl@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Gls@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@Gls@\@Gls@ +\def\@Gls@#1#2{% + \@glsxtr@record{#1}{#2}{glslink}% + \@glsxtr@org@Gls@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glspl@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@Glspl@\@Glspl@ +\def\@Glspl@#1#2{% + \@glsxtr@record{#1}{#2}{glslink}% + \@glsxtr@org@Glspl@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLS@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@GLS@\@GLS@ +\def\@GLS@#1#2{% + \@glsxtr@record{#1}{#2}{glslink}% + \@glsxtr@org@GLS@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSpl@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%\changes{1.10}{2016-12-17}{fixed bug caused by typo in command name} +%Save the original definition and redefine. +% \begin{macrocode} +\let\@glsxtr@org@GLSpl@\@GLSpl@ +\def\@GLSpl@#1#2{% + \@glsxtr@record{#1}{#2}{glslink}% + \@glsxtr@org@GLSpl@{#1}{#2}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdisp} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%\changes{1.13}{2017-02-07}{removed \cs{@glsxtr@org@glsdisp}} +%This is redefined to allow the recording on the first run. +%Can't save and restore \cs{@glsdisp} since it has an optional +%argument. +% \begin{macrocode} +\renewcommand*{\@glsdisp}[3][]{% + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}{% + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \def\glscustomtext{#3}% + \def\glsinsert{}% + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% + \@gls@link[#1]{#2}{\@glo@text}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@@link@} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%Redefine to include \cs{@glsxtr@record} +% \begin{macrocode} +\renewcommand*{\@gls@@link}[3][]{% + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexistsordo{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax +% \end{macrocode} +%\changes{1.35}{2018-08-13}{initialise post-link hook commands} +% Post-link hook commands need initialising. +% \begin{macrocode} + \def\glscustomtext{#3}% + \@glsxtr@field@linkdefs + \@gls@link[#1]{#2}{#3}% + }% + {% + \glstextformat{#3}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrinitwrgloss} +%\changes{1.14}{2017-04-18}{new} +%Set the default if the \gloskey[glslink]{wrgloss} is omitted. +% \begin{macrocode} +\newcommand*{\glsxtrinitwrgloss}{% + \glsifattribute{\glslabel}{wrgloss}{after}% + {% + \glsxtrinitwrglossbeforefalse + }% + {% + \glsxtrinitwrglossbeforetrue + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsxtrwrglossbefore} +%\changes{1.14}{2017-04-18}{new} +%Conditional to determine if the indexing should be done before the +%link text. +% \begin{macrocode} +\newif\ifglsxtrinitwrglossbefore +\glsxtrinitwrglossbeforetrue +% \end{macrocode} +%\end{macro} +% +% Define a \gloskey[glslink]{wrgloss} key to determine whether to +% write the glossary information before or after the link text. +% \begin{macrocode} +\define@choicekey{glslink}{wrgloss}% +[\@glsxtr@wrglossval\@glsxtr@wrglossnr]% +{before,after}% +{% + \ifcase\@glsxtr@wrglossnr\relax + \glsxtrinitwrglossbeforetrue + \or + \glsxtrinitwrglossbeforefalse + \fi +} +% \end{macrocode} +%\changes{1.19}{2017-09-09}{added \cs{glslink} option \texttt{thevalue}} +% \begin{macrocode} +\define@key{glslink}{thevalue}{\def\@glsxtr@thevalue{#1}} +% \end{macrocode} +% +%\changes{1.19}{2017-09-09}{added \cs{glslink} option \texttt{theHvalue}} +% \begin{macrocode} +\define@key{glslink}{theHvalue}{\def\@glsxtr@theHvalue{#1}} +% \end{macrocode} +% +%\begin{macro}{\ifglsxtr@hyperoutside} +%\changes{1.21}{2017-11-03}{new} +% Define a \gloskey[glslink]{hyperoutside} key to determine whether +% \cs{hyperlink} should be outside \cs{glstextformat}. +% \begin{macrocode} +\define@boolkey{glslink}[glsxtr@]{hyperoutside}[true]{} +\glsxtr@hyperoutsidetrue +% \end{macrocode} +% +%\end{macro} +% +%\begin{macro}{\@glsxtr@local@textformat} +%\changes{1.30}{2018-04-25}{new} +%Provide a key to locally change the text format. +% \begin{macrocode} +\define@key{glslink}{textformat}{% + \ifcsdef{#1} + {% + \letcs{\@glsxtr@local@textformat}{#1}% + }% + {% + \PackageError{glossaries-extra}{Unknown control sequence name `#1'}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\changes{1.31}{2018-05-09}{added \texttt{prefix} key for \texttt{glslink}} +% \begin{macrocode} +\define@key{glslink}{prefix}{\def\glolinkprefix{#1}} +% \end{macrocode} +% +%\begin{macro}{\glsxtrinithyperoutside} +%\changes{1.21}{2017-11-03}{new} +%Set the default if the \gloskey[glslink]{hyperoutside} is omitted. +% \begin{macrocode} +\newcommand*{\glsxtrinithyperoutside}{% + \glsifattribute{\glslabel}{hyperoutside}{false}% + {% + \glsxtr@hyperoutsidefalse + }% + {% + \glsxtr@hyperoutsidetrue + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@inc@linkcount} +%\changes{1.26}{2018-01-05}{new} +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\glsxtr@inc@linkcount}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslinkpresetkeys} +%\changes{1.26}{2018-01-05}{new} +%User hook performed immediately before options are set. +%Does nothing by default. +% \begin{macrocode} +\newcommand*{\glslinkpresetkeys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrExpandedFmt} +%\changes{1.30}{2018-04-25}{new} +%Helper command that (protected) fully expands second argument and +%then applies it to the first, which must be a command that takes a +%single argument. +% \begin{macrocode} +\newrobustcmd*{\GlsXtrExpandedFmt}[2]{% + \protected@edef\@glsxtr@tmp{#2}% + \expandafter#1\expandafter{\@glsxtr@tmp}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@use@equation@counter@or} +%\changes{1.37}{2018-11-30}{new} +%If in a numbered equation, change the counter to \ctr{equation}. +%This can be overridden by explicitly setting the counter in the +%optional argument of commands like \cs{gls} and \cs{glslink}. +% \begin{macrocode} +\newcommand*{\@glsxtr@use@equation@counter}{% + \@glsxtr@ifnum@mmode{\def\@gls@counter{equation}}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@do@autoadd} +%\changes{1.37}{2018-11-30}{new} +%If \cs{GlsXtrAutoAddOnFormat} is used, this will automatically use +%\cs{glsadd}. It's therefore only used with \cs{@gls@link} not with +%\cs{glsadd} otherwise it could trigger an infinite loop. The +%argument indicates the key family (glslink or glossadd). +% \begin{macrocode} +\newcommand*{\glsxtr@do@autoadd}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrAutoAddOnFormat} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{GlsXtrAutoAddOnFormat}\oarg{label}\marg{format list}\marg{glsadd options} +%\end{definition} +%If an entry is indexed with the format set to one identified in the +%comma-separated list, then automatically index it using \cs{glsadd} +%with the given options, which may override the current options. +%Scoping is needed to prevent leakage. +% \begin{macrocode} +\newcommand*{\GlsXtrAutoAddOnFormat}[3][\glslabel]{% + \renewcommand*{\glsxtr@do@autoadd}[1]{% + \begingroup + \protected@edef\@glsxtr@do@autoadd{% + \noexpand\ifstrequal{##1}{glslink}% + {% + \noexpand\DTLifinlist{\@glsnumberformat}{#2}{\noexpand\glsadd[format={\@glsnumberformat},#3]{#1}}{}% + }% + {}% + }% + \@glsxtr@do@autoadd + \endgroup + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@link} +%\changes{1.14}{2017-04-18}{added redefinition} +%Redefine to allow the indexing to be placed after the link text. By +%default this is done before the link text to prevent problems that +%can occur from the whatsit, but there may be times when the user +%would like the indexing done afterwards even though it causes a +%whatsit. +% \begin{macrocode} +\def\@gls@link[#1]#2#3{% + \leavevmode + \edef\glslabel{\glsdetoklabel{#2}}% + \def\@gls@link@opts{#1}% + \let\@gls@link@label\glslabel + \let\@glsnumberformat\@glsxtr@defaultnumberformat + \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}% + \edef\glstype{\csname glo@\glslabel @type\endcsname}% + \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper +% \end{macrocode} +%Save current value of \cs{glolinkprefix}: +% \begin{macrocode} + \let\@glsxtr@org@glolinkprefix\glolinkprefix +% \end{macrocode} +%Initialise \cs{@glsxtr@local@textformat} +% \begin{macrocode} + \let\@glsxtr@local@textformat\relax +% \end{macrocode} +% Initialise thevalue and theHvalue (v1.19). +% \begin{macrocode} + \def\@glsxtr@thevalue{}% + \def\@glsxtr@theHvalue{\@glsxtr@thevalue}% +% \end{macrocode} +% Initialise when indexing should occur (new to v1.14). +% \begin{macrocode} + \glsxtrinitwrgloss +% \end{macrocode} +% Initialise whether \cs{hyperlink} should be outside \cs{glstextformat} +% (new to v1.21). +% \begin{macrocode} + \glsxtrinithyperoutside +% \end{macrocode} +% Note that the default link options may +% override \cs{glsxtrinitwrgloss}. +% \begin{macrocode} + \@gls@setdefault@glslink@opts +% \end{macrocode} +%Increment link counter if enabled (new to v1.26). +% \begin{macrocode} + \glsxtr@inc@linkcount +% \end{macrocode} +% Check if the \pkgopt{equations} option has been set (new to v1.37). +% \begin{macrocode} + \if@glsxtr@equations + \@glsxtr@use@equation@counter + \fi +% \end{macrocode} +% As the original definition. +% \begin{macrocode} + \do@glsdisablehyperinlist + \do@gls@link@checkfirsthyper +% \end{macrocode} +%User hook before options are set (new to v1.26): +% \begin{macrocode} + \glslinkpresetkeys +% \end{macrocode} +%Set options. +% \begin{macrocode} + \setkeys{glslink}{#1}% +% \end{macrocode} +%Perform auto add if set (new to v1.37) +% \begin{macrocode} + \glsxtr@do@autoadd{glslink}% +% \end{macrocode} +%User hook after options are set: +% \begin{macrocode} + \glslinkpostsetkeys +% \end{macrocode} +% Check \gloskey[glslink]{thevalue} and \gloskey[glslink]{theHvalue} +% before saving (v1.19). +% \begin{macrocode} + \ifdefempty{\@glsxtr@thevalue}% + {% + \@gls@saveentrycounter + }% + {% + \let\theglsentrycounter\@glsxtr@thevalue + \def\theHglsentrycounter{\@glsxtr@theHvalue}% + }% + \@gls@setsort{\glslabel}% +% \end{macrocode} +%Check if the \gloskey[glslink]{textformat} key has been used. +% \begin{macrocode} + \ifx\@glsxtr@local@textformat\relax +% \end{macrocode} +% Check \catattr{textformat} attribute (new to v1.21). +% \begin{macrocode} + \glshasattribute{\glslabel}{textformat}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{\glslabel}{textformat}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@textformat}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in textformat attribute + for entry `\glslabel'. Reverting to default \string\glstextformat}% + \let\@glsxtr@textformat\glstextformat + }% + }% + {% + \let\@glsxtr@textformat\glstextformat + }% + \else + \let\@glsxtr@textformat\@glsxtr@local@textformat + \fi +% \end{macrocode} +% Do write if it should occur before the link text: +% \begin{macrocode} + \ifglsxtrinitwrglossbefore + \@do@wrglossary{#2}% + \fi +% \end{macrocode} +% Do the link text: +% \begin{macrocode} + \ifKV@glslink@hyper + \ifglsxtr@hyperoutside + \@glslink{\glolinkprefix\glslabel}{\@glsxtr@textformat{#3}}% + \else + \@glsxtr@textformat{\@glslink{\glolinkprefix\glslabel}{#3}}% + \fi + \else + \ifglsxtr@hyperoutside + \glsdonohyperlink{\glolinkprefix\glslabel}{\@glsxtr@textformat{#3}}% + \else + \@glsxtr@textformat{\glsdonohyperlink{\glolinkprefix\glslabel}{#3}}% + \fi + \fi +% \end{macrocode} +% Do write if it should occur after the link text: +% \begin{macrocode} + \ifglsxtrinitwrglossbefore + \else + \@do@wrglossary{#2}% + \fi +% \end{macrocode} +%Restore original value of \cs{glolinkprefix}: +% \begin{macrocode} + \let\glolinkprefix\@glsxtr@org@glolinkprefix +% \end{macrocode} +% As the original definition: +% \begin{macrocode} + \let\ifKV@glslink@hyper\org@ifKV@glslink@hyper +} +% \end{macrocode} +%\end{macro} +% +%\changes{1.14}{2017-04-18}{added \cs{glsadd} option \texttt{thevalue}} +% \begin{macrocode} +\define@key{glossadd}{thevalue}{\def\@glsxtr@thevalue{#1}} +% \end{macrocode} +% +%\changes{1.14}{2017-04-18}{added \cs{glsadd} option \texttt{theHvalue}} +% \begin{macrocode} +\define@key{glossadd}{theHvalue}{\def\@glsxtr@theHvalue{#1}} +% \end{macrocode} +% +%\begin{macro}{\glsaddpresetkeys} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand*{\glsaddpresetkeys}{} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\glsaddpostsetkeys} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand*{\glsaddpostsetkeys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsadd} +%\changes{1.08}{2016-12-13}{added \cs{@glsxtr@record}} +%\changes{1.37}{2018-11-30}{added grouping} +%Redefine to include \cs{@glsxtr@record} and suppress in headings +% \begin{macrocode} +\renewrobustcmd*{\glsadd}[2][]{% + \glsxtrifinmark + {}% + {% + \@gls@adjustmode + \begingroup + \@glsxtr@record{#1}{#2}{glossadd}% + \glsdoifexists{#2}% + {% + \let\@glsnumberformat\@glsxtr@defaultnumberformat + \edef\@gls@counter{\csname glo@\glsdetoklabel{#2}@counter\endcsname}% + \def\@glsxtr@thevalue{}% + \def\@glsxtr@theHvalue{\@glsxtr@thevalue}% +% \end{macrocode} +%Implement any default settings (before options are set) +%\changes{1.30}{2018-04-25}{added \cs{glsaddpresetkeys}} +% \begin{macrocode} + \glsaddpresetkeys + \setkeys{glossadd}{#1}% +% \end{macrocode} +%Implement any default settings (after options are set) +%\changes{1.30}{2018-04-25}{added \cs{glsaddpostsetkeys}} +% \begin{macrocode} + \glsaddpostsetkeys + \ifdefempty{\@glsxtr@thevalue}% + {% + \@gls@saveentrycounter + }% + {% + \let\theglsentrycounter\@glsxtr@thevalue + \def\theHglsentrycounter{\@glsxtr@theHvalue}% + }% +% \end{macrocode} +% Define sort key if necessary (in case of \pkgopt[use]{sort}): +%\changes{1.24}{2017-11-14}{added \cs{@gls@setsort}} +% \begin{macrocode} + \@gls@setsort{#2}% +% \end{macrocode} +%Ensure that indexing occurs (since that's the point of +%\cs{glsadd}). If indexing has been switched off by default, don't +%want the setting to affect \cs{glsadd}. The ignored format +%\cs{glsignore} can be used for selection without location, but the +%indexing still needs to be performed. +%\changes{1.37}{2018-11-30}{ensure that \cs{glsadd} performs indexing} +% \begin{macrocode} + \KV@glslink@noindexfalse + \@@do@wrglossary{#2}% + }% + \endgroup + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaddeach} +%\changes{1.31}{2018-05-09}{new} +%Performs \cs{glsadd} for each entry listed in the mandatory +%argument. +% \begin{macrocode} +\newrobustcmd{\glsaddeach}[2][]{% + \@for\@gls@thislabel:=#2\do{\glsadd[#1]{\@gls@thislabel}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@field@linkdefs} +% Default settings for \cs{@gls@field@link} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@field@linkdefs}{% + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty +} +% \end{macrocode} +%\end{macro} +% +%Redefine the field link commands that need to modify the above. +%Also add accessibility support and set the abbreviation styles if +%required. +%\begin{macro}{\glsxtrassignfieldfont} +%\changes{1.04}{2016-05-02}{new} +%\changes{1.08}{2016-12-13}{added check for existence} +% \begin{macrocode} +\newcommand*{\glsxtrassignfieldfont}[1]{% + \ifglsentryexists{#1}% + {% + \ifglshasshort{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsifregular{#1}% + {\let\@gls@field@font\glsxtrregularfont}% + {\let\@gls@field@font\@firstofone}% + }% + {% + \glsifnotregular{#1}% + {\let\@gls@field@font\@firstofone}% + {\let\@gls@field@font\glsxtrregularfont}% + }% + }% + {% + \let\@gls@field@font\@gobble + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glstext@} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@glstext@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccesstext{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLStext@} +% All uppercase version of \cs{glstext}. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@GLStext@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdofthree]{#1}{#2}% + {\@gls@field@font{\GLSaccesstext{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glstext@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@Glstext@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@secondofthree]{#1}{#2}% + {\@gls@field@font{\Glsaccesstext{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%Version 1.07 ensures that \cs{glsfirst} etc honours the +%\catattr{nohyperfirst} attribute. Allow a convenient way for the +%user to revert to ignoring this attribute for these commands. +%\begin{macro}{\glsxtrchecknohyperfirst} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrchecknohyperfirst}[1]{% + \glsifattribute{#1}{nohyperfirst}{true}{\KV@glslink@hyperfalse}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsfirst@} +% No case changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@glsfirst@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% +% \end{macrocode} +% Ensure that \cs{glsfirst} honours the \catattr{nohyperfirst} attribute. +%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute} +% \begin{macrocode} + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \glsxtrchecknohyperfirst{#2}% + ]{#1}{#2}% + {\@gls@field@font{\glsaccessfirst{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsfirst@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@Glsfirst@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% +% \end{macrocode} +% Ensure that \cs{Glsfirst} honours the \catattr{nohyperfirst} attribute. +%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute} +% \begin{macrocode} + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glscapscase\@secondofthree + \glsxtrchecknohyperfirst{#2}% + ]% + {#1}{#2}{\@gls@field@font{\Glsaccessfirst{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSfirst@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@GLSfirst@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% +% \end{macrocode} +% Ensure that \cs{GLSfirst} honours the \catattr{nohyperfirst} attribute. +%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute} +% \begin{macrocode} + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glscapscase\@thirdofthree + \glsxtrchecknohyperfirst{#2}% + ]% + {#1}{#2}{\@gls@field@font{\GLSaccessfirst{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsplural@} +% No case changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.03}{2016-04-27}{fixed bug \cs{@glsplural@} should be redefined +%not \cs{@glsplural}} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@glsplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glsifplural\@firstoftwo]{#1}{#2}% + {\@gls@field@font{\glsaccessplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsplural@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.03}{2016-04-27}{fixed bug \cs{@Glsplural@} should be redefined +%not \cs{@Glsplural}} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@Glsplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + ]% + {#1}{#2}{\@gls@field@font{\Glsaccessplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSplural@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.03}{2016-04-27}{fixed bug \cs{@GLSplural@} should be redefined +%not \cs{@GLSplural}} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@GLSplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + ]% + {#1}{#2}{\@gls@field@font{\GLSaccessplural{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsfirstplural@} +% No case changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@glsfirstplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% +% \end{macrocode} +% Ensure that \cs{glsfirstplural} honours the \catattr{nohyperfirst} attribute. +%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute} +% \begin{macrocode} + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glsifplural\@firstoftwo + \glsxtrchecknohyperfirst{#2}% + ]% + {#1}{#2}{\@gls@field@font{\glsaccessfirstplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsfirstplural@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.03}{2016-04-27}{bug fix: misspelt cs name} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@Glsfirstplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% +% \end{macrocode} +% Ensure that \cs{glsfirstplural} honours the \catattr{nohyperfirst} attribute. +%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute} +% \begin{macrocode} + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \glsxtrchecknohyperfirst{#2}% + ]% + {#1}{#2}{\@gls@field@font{\Glsaccessfirstplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSfirstplural@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.03}{2016-04-27}{bug fix: misspelt cs name} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@GLSfirstplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% +% \end{macrocode} +% Ensure that \cs{glsfirstplural} honours the \catattr{nohyperfirst} attribute. +%\changes{1.07}{2016-08-15}{added check for nohyperfirst attribute} +% \begin{macrocode} + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \glsxtrchecknohyperfirst{#2}% + ]% + {#1}{#2}% + {\@gls@field@font{\GLSaccessfirstplural{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsname@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@glsname@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccessname{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsname@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{add accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@Glsname@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}% + {\@gls@field@font{\Glsaccessname{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSname@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +% The abbreviation format may also need setting. +% \begin{macrocode} +\def\@GLSname@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}% + {\@gls@field@font{\GLSaccessname{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdesc@} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% \begin{macrocode} +\def\@glsdesc@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccessdesc{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsdesc@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% \begin{macrocode} +\def\@Glsdesc@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}% + {\@gls@field@font{\Glsaccessdesc{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSdesc@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% \begin{macrocode} +\def\@GLSdesc@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\@gls@field@font{\GLSaccessdesc{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdescplural@} +% No case-changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% \begin{macrocode} +\def\@glsdescplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\@gls@field@font{\glsaccessdescplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsdescplural@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% \begin{macrocode} +\def\@Glsdescplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\@gls@field@font{\Glsaccessdescplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSdescplural@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set abbreviation and regular format} +% \begin{macrocode} +\def\@GLSdesc@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@thirdoftwo + \let\glsifplural\@firstoftwo + ]% + {#1}{#2}% + {\@gls@field@font{\GLSaccessdescplural{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glssymbol@} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@glssymbol@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link{#1}{#2}{\@gls@field@font{\glsaccesssymbol{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glssymbol@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glssymbol@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]% + {#1}{#2}{\@gls@field@font{\Glsaccesssymbol{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSsymbol@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSsymbol@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\@gls@field@font{\GLSaccesssymbol{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glssymbolplural@} +% No case-changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@glssymbolplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\@gls@field@font{\glsaccesssymbolplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glssymbolplural@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glssymbolplural@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\@gls@field@font{\Glsaccesssymbolplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSsymbolplural@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{0.5.2}{2015-12-08}{added accessibility support} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSsymbol@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@thirdoftwo + \let\glsifplural\@firstoftwo + ]% + {#1}{#2}% + {\@gls@field@font{\GLSaccesssymbolplural{#2}\mfirstucMakeUppercase{#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuseri@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glsuseri@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}% + {\@gls@field@font{\Glsentryuseri{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuseri@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSuseri@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuseri{#2}#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuserii@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glsuserii@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]% + {#1}{#2}{\@gls@field@font{\Glsentryuserii{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuserii@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSuserii@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuserii{#2}#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuseriii@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glsuseriii@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]% + {#1}{#2}{\@gls@field@font{\Glsentryuseriii{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuseriii@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSuseriii@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuseriii{#2}#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuseriv@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glsuseriv@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]% + {#1}{#2}{\@gls@field@font{\Glsentryuseriv{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuseriv@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSuseriv@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}% + {\@gls@field@font{\mfirstucMakeUppercase{\glsentryuseriv{#2}#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuserv@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glsuserv@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]% + {#1}{#2}{\@gls@field@font{\Glsentryuserv{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuserv@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSuserv@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuserv{#2}#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuservi@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@Glsuservi@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link + [\let\glscapscase\@secondoftwo]% + {#1}{#2}{\@gls@field@font{\Glsentryuservi{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuservi@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +%\changes{1.04}{2016-05-02}{set regular format} +% \begin{macrocode} +\def\@GLSuservi@#1#2[#3]{% + \glsxtrassignfieldfont{#2}% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\@gls@field@font{\mfirstucMakeUppercase{\glsentryuservi{#2}#3}}}% +} +% \end{macrocode} +%\end{macro} +% +%Commands like \cs{acrshort} already set \cs{glsifplural}, but they +%don't set \cs{glsxtrifwasfirstuse} so they need adjusting. +% +%\begin{macro}{\@acrshort} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccessshort{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrshort} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccessshort{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRshort} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccessshort{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrshortpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccessshortpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrshortpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccessshortpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRshortpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccessshortpl{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrlong} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccesslong{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrlong} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccesslong{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRlong} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccesslong{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrlongpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccesslongpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrlongpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccesslongpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRlongpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccesslongpl{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%Modify \cs{@glsaddkey} so additional keys provided by the user can +%be treated in a similar way. +%\begin{macro}{\@glsaddkey} +% \begin{macrocode} +\renewcommand*{\@glsaddkey}[7]{% + \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}% + }% + \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}% + \newcommand*{#4}[1]{\@Gls@entry@field{##1}{#1}}% +% \end{macrocode} +% Now for the commands with links. First the version with no case +% change (same as before): +% \begin{macrocode} + \ifcsdef{@gls@user@#1@}% + {% + \PackageError{glossaries}% + {Can't define `\string#5' as helper command + `\expandafter\string\csname @gls@user@#1@\endcsname' already + exists}% + {}% + }% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname @gls@user@#1\endcsname}[2][]{% + \new@ifnextchar[% + {\csuse{@gls@user@#1@}{##1}{##2}}% + {\csuse{@gls@user@#1@}{##1}{##2}[]}}% + \csdef{@gls@user@#1@}##1##2[##3]{% + \@gls@field@link{##1}{##2}{#3{##2}##3}% + }% + \newrobustcmd*{#5}{% + \expandafter\@gls@hyp@opt\csname @gls@user@#1\endcsname}% + }% +% \end{macrocode} +% Next the version with the first letter converted to upper case +% (modified): +% \begin{macrocode} + \ifcsdef{@Gls@user@#1@}% + {% + \PackageError{glossaries}% + {Can't define `\string#6' as helper command + `\expandafter\string\csname @Gls@user@#1@\endcsname' already + exists}% + {}% + }% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname @Gls@user@#1\endcsname}[2][]{% + \new@ifnextchar[% + {\csuse{@Gls@user@#1@}{##1}{##2}}% + {\csuse{@Gls@user@#1@}{##1}{##2}[]}}% + \csdef{@Gls@user@#1@}##1##2[##3]{% + \@gls@field@link[\let\glscapscase\@secondofthree]% + {##1}{##2}{#4{##2}##3}% + }% + \newrobustcmd*{#6}{% + \expandafter\@gls@hyp@opt\csname @Gls@user@#1\endcsname}% + }% +% \end{macrocode} +% Finally the all caps version (modified): +% \begin{macrocode} + \ifcsdef{@GLS@user@#1@}% + {% + \PackageError{glossaries}% + {Can't define `\string#7' as helper command + `\expandafter\string\csname @GLS@user@#1@\endcsname' already + exists}% + {}% + }% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname @GLS@user@#1\endcsname}[2][]{% + \new@ifnextchar[% + {\csuse{@GLS@user@#1@}{##1}{##2}}% + {\csuse{@GLS@user@#1@}{##1}{##2}[]}}% + \csdef{@GLS@user@#1@}##1##2[##3]{% + \@gls@field@link[\let\glscapscase\@thirdofthree]% + {##1}{##2}{\mfirstucMakeUppercase{#3{##2}##3}}% + }% + \newrobustcmd*{#7}{% + \expandafter\@gls@hyp@opt\csname @GLS@user@#1\endcsname}% + }% + }% + {% + \PackageError{glossaries-extra}{Key `#1' already exists}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@link@nocheckfirsthyper} +% Old versions of \styfmt{glossaries} don't define +% this, so provide it just in case it hasn't been defined. +% \begin{macrocode} +\providecommand*{\@gls@link@nocheckfirsthyper}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@link@checkfirsthyper} +% Modify check to determine if the hyperlink should be automatically +% suppressed, but save the original in case the acronyms are restored. +% \begin{macrocode} +\let\@glsxtr@org@checkfirsthyper\@gls@link@checkfirsthyper +\renewcommand*{\@gls@link@checkfirsthyper}{% +% \end{macrocode} +% \cs{ifglsused} isn't useful in the post link hook as it's already +% been unset by then, so define a command that can be used in the +% post link hook. Since \cs{@gls@link@checkfirsthyper} is only used +% by commands like \cs{gls} but not by other commands, this seems +% the best place to put it to automatically set the value for the +% commands that change the first use flag. The other commands should +% set \cs{glsxtrifwasfirstuse} to \cs{@secondoftwo} (which is done +% in \cs{@glsxtr@field@linkdefs}). +% \begin{macrocode} + \ifglsused{\glslabel}% + {\let\glsxtrifwasfirstuse\@secondoftwo} + {\let\glsxtrifwasfirstuse\@firstoftwo}% +% \end{macrocode} +% Store the category label for convenience. +% \begin{macrocode} + \edef\glscategorylabel{\glscategory{\glslabel}}% + \ifglsused{\glslabel}% + {% + \glsifcategoryattribute{\glscategorylabel}{nohypernext}{true}% + {\KV@glslink@hyperfalse}{}% + }% + {% + \glsifcategoryattribute{\glscategorylabel}{nohyperfirst}{true}% + {\KV@glslink@hyperfalse}{}% + }% + \glslinkcheckfirsthyperhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\do@glsdisablehyperinlist} +% This command was introduced in \styfmt{glossaries} v4.19. If it +% hasn't been defined, we're using an earlier version, in which case +% the \catattr{nohyper} attribute can't be implemented. +% \begin{macrocode} +\ifdef\do@glsdisablehyperinlist +{% + \let\@glsxtr@do@glsdisablehyperinlist\do@glsdisablehyperinlist + \renewcommand*{\do@glsdisablehyperinlist}{% + \@glsxtr@do@glsdisablehyperinlist + \glsifattribute{\glslabel}{nohyper}{true}{\KV@glslink@hyperfalse}{}% + } +} +{} +% \end{macrocode} +%\end{macro} +% +% Define a \gloskey[glslink]{noindex} key to prevent writing information to the +% external file. +% \begin{macrocode} +\define@boolkey{glslink}{noindex}[true]{} +\KV@glslink@noindexfalse +% \end{macrocode} +% +%If \cs{@gls@setdefault@glslink@opts} has been defined +%(\styfmt{glossaries} v4.20) use it to set the default keys in +%\cs{@glslink}. +%\begin{macro}{\@gls@setdefault@glslink@opts} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\ifdef\@gls@setdefault@glslink@opts +{ + \renewcommand*{\@gls@setdefault@glslink@opts}{% + \KV@glslink@noindexfalse + \@glsxtrsetaliasnoindex + } +} +{ +% \end{macrocode} +% Not defined so prepend it to \cs{do@glsdisablehyperinlist} to +% achieve the same effect. +% \begin{macrocode} + \newcommand*{\@gls@setdefault@glslink@opts}{% + \KV@glslink@noindexfalse + \@glsxtrsetaliasnoindex + } + \preto\do@glsdisablehyperinlist{\@gls@setdefault@glslink@opts} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetaliasnoindex} +%\changes{1.12}{2017-02-03}{new} +%\changes{1.13}{2017-02-07}{switched to \cs{providecommand}} +%Allow user to hook into the alias noindex setting. +%Default behaviour switches off indexing for aliases. +%If the record option is on, this will have been defined to do +%nothing. (bib2gls will deal with records for aliased entries.) +% \begin{macrocode} +\providecommand*{\glsxtrsetaliasnoindex}{% + \KV@glslink@noindextrue +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrsetaliasnoindex} +%\changes{1.12}{2017-02-03}{new} +%\changes{1.21}{2017-11-03}{changed to use \cs{glsxtrifhasfield} instead of +%\cs{ifglshasfield}} +% \begin{macrocode} +\newcommand*{\@glsxtrsetaliasnoindex}{% + \glsxtrifhasfield{alias}{\glslabel}% + {% + \let\glsxtrindexaliased\@glsxtrindexaliased + \glsxtrsetaliasnoindex + \let\glsxtrindexaliased\@no@glsxtrindexaliased + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrindexaliased} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\@glsxtrindexaliased}{% + \ifKV@glslink@noindex + \else + \begingroup + \let\@glsnumberformat\@glsxtr@defaultnumberformat + \edef\@gls@counter{\csname glo@\glsdetoklabel{\glslabel}@counter\endcsname}% + \glsxtr@saveentrycounter + \@@do@wrglossary{\glsxtralias{\glslabel}}% + \endgroup + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@no@glsxtrindexaliased} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\@no@glsxtrindexaliased}{% + \PackageError{glossaries-extra}{\string\glsxtrindexaliased\space + not permitted outside definition of \string\glsxtrsetaliasnoindex}% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrindexaliased} +%\changes{1.12}{2017-02-03}{new} +%Provide a command to redirect alias indexing, but only allow it to +%be used within \cs{glsxtrsetaliasnoindex}. +% \begin{macrocode} +\let\glsxtrindexaliased\@no@glsxtrindexaliased +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetDefaultGlsOpts} +%\changes{0.5.4}{2015-12-15}{new} +% Set the default options for \cs{glslink} etc. +% \begin{macrocode} +\newcommand*{\GlsXtrSetDefaultGlsOpts}[1]{% + \renewcommand*{\@gls@setdefault@glslink@opts}{% + \setkeys{glslink}{#1}% + \@glsxtrsetaliasnoindex + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifindexing} +% Provide user level command to access it in \cs{glswriteentry}. +% \begin{macrocode} +\newcommand*{\glsxtrifindexing}[2]{% + \ifKV@glslink@noindex #2\else #1\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glswriteentry} +% Redefine to test for \catattr{indexonlyfirst} category attribute. +% \begin{macrocode} +\renewcommand*{\glswriteentry}[2]{% + \glsxtrifindexing + {% + \ifglsindexonlyfirst + \ifglsused{#1} + {\glsxtrdoautoindexname{#1}{dualindex}}% + {#2}% + \else + \glsifattribute{#1}{indexonlyfirst}{true}% + {% + \ifglsused{#1}% + {\glsxtrdoautoindexname{#1}{dualindex}}% + {#2}% + }% + {#2}% + \fi + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@do@@wrglossary} +% Hook into glossary indexing command so that it can also use +% \ics{index} at the same time if required and add user hook. +% \begin{macrocode} +\appto\@@do@@wrglossary{\@glsxtr@do@@wrindex + \glsxtrdowrglossaryhook{\@gls@label}% +} +% \end{macrocode} +% (The label can be obtained from \cs{@gls@label} at this point.) +%\end{macro} +% Similarly for the \qt{noidx} version: +%\begin{macro}{\gls@noidxglossary} +% \begin{macrocode} +\appto\gls@noidxglossary{\@glsxtr@do@@wrindex + \glsxtrdowrglossaryhook{\@gls@label}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@do@@wrindex} +% \begin{macrocode} +\newcommand*{\@glsxtr@do@@wrindex}{% + \glsxtrdoautoindexname{\@gls@label}{dualindex}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdowrglossaryhook} +% Allow user to hook into indexing code. (Always used by +% \cs{glsadd}. Used by \cs{gls} when indexing, which may or may not occur +% depending on the indexing settings.) +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrdowrglossaryhook}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@alt@hyp@opt} +%\changes{0.5.4}{2015-12-15}{new} +% Commands like \cs{gls} have a star or plus version. Provide a +% third symbol that the user can adapt for convenience. +% \begin{macrocode} +\newcommand*{\@gls@alt@hyp@opt}[1]{% + \let\glslinkvar\@firstofthree + \let\@gls@hyp@opt@cs#1\relax + \@ifstar{\s@gls@hyp@opt}% + {\@ifnextchar+% + {\@firstoftwo{\p@gls@hyp@opt}}% + {% + \expandafter\@ifnextchar\@gls@alt@hyp@opt@char + {\@firstoftwo{\@alt@gls@hyp@opt}}% + {#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@alt@gls@hyp@opt} +% User version +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@alt@gls@hyp@opt}[1][]{% + \let\glslinkvar\@firstofthree + \expandafter\@gls@hyp@opt@cs\expandafter[\@gls@alt@hyp@opt@keys,#1]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@alt@hyp@opt@char} +%\changes{0.5.4}{2015-12-15}{new} +%Contains the character used as the command modifier. +% \begin{macrocode} +\newcommand*{\@gls@alt@hyp@opt@char}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@alt@hyp@opt@keys} +%\changes{0.5.4}{2015-12-15}{new} +%Contains the option list used as the command modifier. +% \begin{macrocode} +\newcommand*{\@gls@alt@hyp@opt@keys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetAltModifier} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrSetAltModifier}[2]{% + \let\@gls@hyp@opt\@gls@alt@hyp@opt + \def\@gls@alt@hyp@opt@char{#1}% + \def\@gls@alt@hyp@opt@keys{#2}% + \ifdefequal\@glsxtr@record@setting\@glsxtr@record@setting@off + {}% + {% +% \end{macrocode} +%Let \gls{bib2gls} know the modifier. +%\changes{1.37}{2018-11-30}{write modifier to aux} +% \begin{macrocode} + \protected@write\@auxout{}{\string\providecommand{\string\@glsxtr@altmodifier}[1]{}}% + \protected@write\@auxout{}{\string\@glsxtr@altmodifier{#1}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@org@dohyperlink} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\let\glsxtr@org@dohyperlink\glsdohyperlink +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnavhyperlink} +%\changes{1.21}{2017-11-03}{patched} +%Now that \cs{glsdohyperlink} (used by \cs{@glslink}) references +%\cs{glslabel} it's necessary to patch \cs{glsnavhyperlink} to +%avoid using it (since \cs{glslabel} won't be defined). This means +%temporarily redefining \cs{glsdohyperlink} to its original +%definition. +% +%This command is provided by \sty{glossary-hypernav} so it may not +%exist. +% \begin{macrocode} +\ifdef\glsnavhyperlink +{ + \renewcommand*{\glsnavhyperlink}[3][\@glo@type]{% + \edef\gls@grplabel{#2}\protected@edef\@gls@grptitle{#3}% +% \end{macrocode} +%Scope: +% \begin{macrocode} + {% + \let\glsdohyperlink\glsxtr@org@dohyperlink + \@glslink{\glsnavhyperlinkname{#1}{#2}}{#3}% + }% + }% +} +{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdohyperlink} +% Unpleasant complications can occur if the \gloskey{text} or +% \gloskey{first} key etc contains \cs{gls}, particularly if there +% are hyperlinks. To get around this problem, patch +% \cs{glsdohyperlink} so that it temporarily makes \ics{gls} behave +% like \ics{glstext}\oarg{hyper=false,noindex}. (This will be +% overridden if the user explicitly cancels either of those options +% in the optional argument of \cs{gls} or using the plus version.) +% This also patches the short form commands like \cs{acrshort} +% and \cs{glsxtrshort} to use \cs{glsentryshort} and, similarly, the +% long form commands like \cs{acrlong} and \cs{glsxtrlong} to use +% \cs{glsentrylong}. Added attribute check. +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\glsdohyperlink}[2]{% + \glshasattribute{\glslabel}{targeturl}% + {% + \glshasattribute{\glslabel}{targetname}% + {% + \glshasattribute{\glslabel}{targetcategory}% + {% + \hyperref{\glsgetattribute{\glslabel}{targeturl}}% + {\glsgetattribute{\glslabel}{targetcategory}}% + {\glsgetattribute{\glslabel}{targetname}}% + {{\glsxtrprotectlinks#2}}% + }% + {% + \hyperref{\glsgetattribute{\glslabel}{targeturl}}% + {}% + {\glsgetattribute{\glslabel}{targetname}}% + {{\glsxtrprotectlinks#2}}% + }% + }% + {% + \href{\glsgetattribute{\glslabel}{targeturl}}% + {{\glsxtrprotectlinks#2}}% + }% + }% + {% +% \end{macrocode} +%Check for alias. +%\changes{1.12}{2017-02-03}{added check for alias field} +% \begin{macrocode} + \glsfieldfetch{\glslabel}{alias}{\gloaliaslabel}% + \ifdefvoid\gloaliaslabel + {% + \glsxtrhyperlink{#1}{{\glsxtrprotectlinks#2}}% + }% + {% +% \end{macrocode} +%Redirect link to the alias target. +% \begin{macrocode} + \glsxtrhyperlink + {\glolinkprefix\glsdetoklabel{\gloaliaslabel}}% + {{\glsxtrprotectlinks#2}}% + }% + }% +} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\glsxtrhyperlink} +%\changes{1.19}{2017-09-09}{new} +%Allows integration with the base \styfmt{glossaries} package's +%\pkgopt[showtargets]{debug} option. +% \begin{macrocode} +\ifdef\@glsshowtarget +{ + \newcommand{\glsxtrhyperlink}[2]{% + \@glsshowtarget{#1}% + \hyperlink{#1}{#2}% + }% +} +{ + \newcommand{\glsxtrhyperlink}[2]{\hyperlink{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdisablehyper} +%\changes{1.14}{2017-04-18}{added redefinition} +% Redefine to set \cs{glslabel} (to allow it to be picked up by +% \cs{glsdohyperlink}). Also made it robust and added grouping to localise the +% definition of \cs{glslabel}. The original internal command +% {@glo@label} could probably be simply replaced with \cs{glslabel}, +% but it's retained in case its removal causes unexpected problems. +%\changes{1.21}{2017-11-03}{added check for existence} +% \begin{macrocode} +\renewrobustcmd*{\glshyperlink}[2][\glsentrytext{\@glo@label}]{% + \glsdoifexists{#2}% + {% + \def\@glo@label{#2}% + {\edef\glslabel{#2}% + \@glslink{\glolinkprefix\glslabel}{#1}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdisablehyper} +%\changes{0.5.4}{2015-12-15}{added} +%\changes{1.21}{2017-11-03}{changed to use \cs{def} rather than \cs{let}} +% Redefine in case we have an old version of \styfmt{glossaries}. +%This now uses \cs{def} rather than \cs{let} to allow for +%redefinitions of \cs{glsdonohyperlink}. +% \begin{macrocode} +\renewcommand{\glsdisablehyper}{% + \KV@glslink@hyperfalse + \def\@glslink{\glsdonohyperlink}% + \let\@glstarget\@secondoftwo +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsenablehyper} +%\changes{1.21}{2017-11-03}{changed to use \cs{def} rather than \cs{let}} +%This now uses \cs{def} rather than \cs{let} to allow for +%redefinitions of \cs{glsdohypertarget} and \cs{glsdohyperlink}. +% \begin{macrocode} +\renewcommand{\glsenablehyper}{% + \KV@glslink@hypertrue + \def\@glslink{\glsdohyperlink}% + \def\@glstarget{\glsdohypertarget}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdonohyperlink} +% This command was only introduced in \styfmt{glossaries} v4.20, so it may +% not be defined (therefore use \cs{def}). For older \styfmt{glossaries} versions, this won't be +% used if \sty{hyperref} hasn't been loaded, which means the +% indexing will still take place. The generated text is scoped +% (the link text in \cs{hyperlink} is also scoped, so it's +% consistent). +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\def\glsdonohyperlink#1#2{{\glsxtrprotectlinks #2}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslink} +% Reset \cs{@glslink} with patched versions: +%\changes{1.21}{2017-11-03}{changed \cs{let} to \cs{def}} +% \begin{macrocode} +\ifcsundef{hyperlink}% +{% + \def\@glslink{\glsdonohyperlink} +}% +{% + \def\@glslink{\glsdohyperlink} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrprotectlinks} +%\changes{0.5.4}{2015-12-15}{new} +% Make \cs{gls} (and variants) behave like the corresponding +% \cs{glstext} (and variants) with hyperlinking and indexing off. +% \begin{macrocode} +\newcommand*{\glsxtrprotectlinks}{% + \KV@glslink@hyperfalse + \KV@glslink@noindextrue + \let\@gls@\@glsxtr@p@text@ + \let\@Gls@\@Glsxtr@p@text@ + \let\@GLS@\@GLSxtr@p@text@ + \let\@glspl@\@glsxtr@p@plural@ + \let\@Glspl@\@Glsxtr@p@plural@ + \let\@GLSpl@\@GLSxtr@p@plural@ + \let\@glsxtrshort\@glsxtr@p@short@ + \let\@Glsxtrshort\@Glsxtr@p@short@ + \let\@GLSxtrshort\@GLSxtr@p@short@ + \let\@glsxtrlong\@glsxtr@p@long@ + \let\@Glsxtrlong\@Glsxtr@p@long@ + \let\@GLSxtrlong\@GLSxtr@p@long@ + \let\@glsxtrshortpl\@glsxtr@p@shortpl@ + \let\@Glsxtrshortpl\@Glsxtr@p@shortpl@ + \let\@GLSxtrshortpl\@GLSxtr@p@shortpl@ + \let\@glsxtrlongpl\@glsxtr@p@longpl@ + \let\@Glsxtrlongpl\@Glsxtr@p@longpl@ + \let\@GLSxtrlongpl\@GLSxtr@p@longpl@ + \let\@acrshort\@glsxtr@p@acrshort@ + \let\@Acrshort\@Glsxtr@p@acrshort@ + \let\@ACRshort\@GLSxtr@p@acrshort@ + \let\@acrshortpl\@glsxtr@p@acrshortpl@ + \let\@Acrshortpl\@Glsxtr@p@acrshortpl@ + \let\@ACRshortpl\@GLSxtr@p@acrshortpl@ + \let\@acrlong\@glsxtr@p@acrlong@ + \let\@Acrlong\@Glsxtr@p@acrlong@ + \let\@ACRlong\@GLSxtr@p@acrlong@ + \let\@acrlongpl\@glsxtr@p@acrlongpl@ + \let\@Acrlongpl\@Glsxtr@p@acrlongpl@ + \let\@ACRlongpl\@GLSxtr@p@acrlongpl@ +} +% \end{macrocode} +%\end{macro} +% +% These protected versions need grouping to prevent the label from +% getting confused. +%\begin{macro}{\@glsxtr@p@text@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@text@#1#2[#3]{{\@glstext@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@text@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@text@#1#2[#3]{{\@Glstext@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@text@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@text@#1#2[#3]{{\@GLStext@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@plural@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@plural@#1#2[#3]{{\@glsplural@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@plural@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@plural@#1#2[#3]{{\@Glsplural@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@plural@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@plural@#1#2[#3]{{\@GLSplural@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@short@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@short@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\glsentryshort{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@short@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@short@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\Glsentryshort{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@short@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@short@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \mfirstucMakeUppercase{\glsabbrvfont{\glsentryshort{#2}}#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@shortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@shortpl@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\glsentryshortpl{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@shortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@shortpl@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\Glsentryshortpl{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@shortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@shortpl@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \mfirstucMakeUppercase{\glsabbrvfont{\glsentryshortpl{#2}}#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@long@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@long@#1#2[#3]{{\glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@long@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@long@#1#2[#3]{{\Glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@long@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@long@#1#2[#3]{% + {\mfirstucMakeUppercase{\glslongfont{\glsentrylong{#2}}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@longpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@longpl@#1#2[#3]{{\glsentrylongpl{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@longpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@longpl@#1#2[#3]{{\glslongfont{\Glsentrylongpl{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@longpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@longpl@#1#2[#3]{% + {\mfirstucMakeUppercase{\glslongfont{\glsentrylongpl{#2}}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrshort@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrshort@#1#2[#3]{{\acronymfont{\glsentryshort{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrshort@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrshort@#1#2[#3]{{\acronymfont{\Glsentryshort{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrshort@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrshort@#1#2[#3]{% + {\mfirstucMakeUppercase{\acronymfont{\glsentryshort{#2}}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrshortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrshortpl@#1#2[#3]{{\acronymfont{\glsentryshortpl{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrshortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrshortpl@#1#2[#3]{{\acronymfont{\Glsentryshortpl{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrshortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrshortpl@#1#2[#3]{% + {\mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{#2}}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrlong@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrlong@#1#2[#3]{{\glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrlong@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrlong@#1#2[#3]{{\Glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrlong@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrlong@#1#2[#3]{% + {\mfirstucMakeUppercase{\glsentrylong{#2}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrlongpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrlongpl@#1#2[#3]{{\glsentrylongpl{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrlongpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrlongpl@#1#2[#3]{{\Glsentrylongpl{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrlongpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrlongpl@#1#2[#3]{% + {\mfirstucMakeUppercase{\glsentrylongpl{#2}#3}}} +% \end{macrocode} +%\end{macro} +% +%Commands to minimise conflict. +%\begin{macro}{\@glsxtrp@opt} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtrp@opt}{hyper=false,noindex} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetpopts} +%\changes{1.07}{2016-08-15}{new} +%Used in glossary to switch hyperlinks on for the \cs{glsxtrp} type +%of commands. +% \begin{macrocode} +\newcommand*{\glsxtrsetpopts}[1]{% + \renewcommand*{\@glsxtrp@opt}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossxtrsetpopts} +%\changes{1.07}{2016-08-15}{new} +%Used in glossary to switch hyperlinks on for the \cs{glsxtrp} type +%of commands. +% \begin{macrocode} +\newcommand*{\glossxtrsetpopts}{% + \glsxtrsetpopts{noindex}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsxtrp} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newrobustcmd*{\@@glsxtrp}[2]{% +% \end{macrocode} +%Add scope. +% \begin{macrocode} + {% + \let\glspostlinkhook\relax + \csname#1\expandafter\endcsname\expandafter[\@glsxtrp@opt]{#2}[]% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrp} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newrobustcmd*{\@glsxtrp}[2]{% + \ifcsdef{gls#1}% + {% + \@@glsxtrp{gls#1}{#2}% + }% + {% + \ifcsdef{glsxtr#1}% + {% + \@@glsxtrp{glsxtr#1}{#2}% + }% + {% + \PackageError{glossaries-extra}{`#1' not recognised by + \string\glsxtrp}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtrp} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newrobustcmd*{\@Glsxtrp}[2]{% + \ifcsdef{Gls#1}% + {% + \@@glsxtrp{Gls#1}{#2}% + }% + {% + \ifcsdef{Glsxtr#1}% + {% + \@@glsxtrp{Glsxtr#1}{#2}% + }% + {% + \PackageError{glossaries-extra}{`#1' not recognised by + \string\Glsxtrp}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtrp} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newrobustcmd*{\@GLSxtrp}[2]{% + \ifcsdef{GLS#1}% + {% + \@@glsxtrp{GLS#1}{#2}% + }% + {% + \ifcsdef{GLSxtr#1}% + {% + \@@glsxtrp{GLSxtr#1}{#2}% + }% + {% + \PackageError{glossaries-extra}{`#1' not recognised by + \string\GLSxtrp}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@entry@p} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtr@headentry@p}[2]{% + \glsifattribute{#1}{headuc}{true}% + {% + \mfirstucMakeUppercase{\@gls@entry@field{#1}{#2}}% + }% + {% + \@gls@entry@field{#1}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrp} +%\changes{1.07}{2016-08-15}{new} +%Not robust as it needs to expand somewhat. +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand{\glsxtrp}[2]{% + \protect\NoCaseChange + {% + \protect\texorpdfstring + {% + \protect\glsxtrifinmark + {% + \ifcsdef{glsxtrhead#1}% + {% + {\protect\csuse{glsxtrhead#1}{#2}}% + }% + {% + \glsxtr@headentry@p{#2}{#1}% + }% + }% + {% + \@glsxtrp{#1}{#2}% + }% + }% + {% + \protect\@gls@entry@field{#2}{#1}% + }% + }% + } +} +{ + \newcommand{\glsxtrp}[2]{% + \protect\NoCaseChange + {% + \protect\glsxtrifinmark + {% + \ifcsdef{glsxtrhead#1}% + {% + {\protect\csuse{glsxtrhead#1}}% + }% + {% + \glsxtr@headentry@p{#2}{#1}% + }% + }% + {% + \@glsxtrp{#1}{#2}% + }% + }% + } +} +% \end{macrocode} +%\end{macro} +% +%Provide short synonyms for the most common option. +%\begin{macro}{\glsps} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newcommand*{\glsps}{\glsxtrp{short}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glspt} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newcommand*{\glspt}{\glsxtrp{text}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrp} +%\changes{1.07}{2016-08-15}{new} +%As above but use first letter upper case (but not for the +%bookmarks, which can't process \cs{uppercase}). +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand{\Glsxtrp}[2]{% + \protect\NoCaseChange + {% + \protect\texorpdfstring + {% + \protect\glsxtrifinmark + {% + \ifcsdef{Glsxtrhead#1}% + {% + {\protect\csuse{Glsxtrhead#1}{#2}}% + }% + {% + \protect\@Gls@entry@field{#2}{#1}% + }% + }% + {% + \@Glsxtrp{#1}{#2}% + }% + }% + {% + \protect\@gls@entry@field{#2}{#1}% + }% + }% + } +} +{ + \newcommand{\Glsxtrp}[2]{% + \protect\NoCaseChange + {% + \protect\glsxtrifinmark + {% + \ifcsdef{Glsxtrhead#1}% + {% + {\protect\csuse{Glsxtrhead#1}}% + }% + {% + \protect\@Gls@entry@field{#2}{#1}% + }% + }% + {% + \@Glsxtrp{#1}{#2}% + }% + }% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrp} +%\changes{1.07}{2016-08-15}{new} +%As above but all upper case (but not for the +%bookmarks, which can't process \cs{uppercase}). +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand{\GLSxtrp}[2]{% + \protect\NoCaseChange + {% + \protect\texorpdfstring + {% + \protect\glsxtrifinmark + {% + \ifcsdef{GLSxtr#1}% + {% + {\protect\GLSxtrshort[noindex,hyper=false]{#1}[]}% + }% + {% + \protect\mfirstucMakeUppercase + {% + \protect\@gls@entry@field{#2}{#1}% + }% + }% + }% + {% + \@GLSxtrp{#1}{#2}% + }% + }% + {% + \protect\@gls@entry@field{#2}{#1}% + }% + }% + } +} +{ + \newcommand{\GLSxtrp}[2]{% + \protect\NoCaseChange + {% + \protect\glsxtrifinmark + {% + \ifcsdef{GLSxtr#1}% + {% + {\protect\GLSxtrshort[noindex,hyper=false]{#1}[]}% + }% + {% + \protect\mfirstucMakeUppercase + {% + \protect\@gls@entry@field{#2}{#1}% + }% + }% + }% + {% + \@GLSxtrp{#1}{#2}% + }% + }% + } +} +% \end{macrocode} +%\end{macro} +% +% +%\subsection{Entry Counting} +% +% The (use) entry counting mechanism from \styfmt{glossaries} is adjusted +% here to work with category attributes. Provide a convenient +% command to enable entry counting, set the \catattr{entrycount} +% attribute for given categories and redefine \ics{gls} etc to +% use \cs{cgls} instead. This form of entry counting is provided to +% adjust the formatting if the number of times an entry has been +% used (through commands that unset the first use flag) doesn't +% exceeding the specified threshold. For link counting, see +% \sectionref{sec:linkcount}. +% +% First adjust definitions of the unset and reset commands to +% provide a hook, but changing the flag can cause problems in +% certain situations, so to allow the normal unsetting to be +% temporarily disabled, \cs{@glsunset} is let to +% \cs{@glsxtr@unset}, which performs the actual unsetting through +% \cs{@@glsunset} and then does the hook. This means that the +% unsetting (and the hook) can switched off by redefining \cs{@glsunset} +% and then switched back on again by changing the definition back to +% \cs{@glsxtr@unset}. +% +%\begin{macro}{\@glsxtr@unset} +%\changes{1.30}{2018-04-25}{new} +% Global unset. +% \begin{macrocode} +\newcommand*{\@glsxtr@unset}[1]{% + \@@glsunset{#1}% + \glsxtrpostunset{#1}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsunset} +% Global unset. +% \begin{macrocode} +\let\@glsunset\@glsxtr@unset +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostunset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostunset}[1]{} +% \end{macrocode} +%\end{macro} +% +%Provide a command to store a list of labels that will need +%unsetting. +%\begin{macro}{\GlsXtrStartUnsetBuffering} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrStartUnsetBuffering}{% + \@ifstar\s@GlsXtrStartUnsetBuffering\@GlsXtrStartUnsetBuffering +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrStartUnsetBuffering} +%\changes{1.31}{2018-05-09}{new} +%Unstarred version doesn't check for duplicates. +% \begin{macrocode} +\newcommand*{\@GlsXtrStartUnsetBuffering}{% + \let\@glsxtr@org@unset@buffer\@glsxtr@unset@buffer + \def\@glsxtr@unset@buffer{}% + \let\@glsunset\@glsxtrbuffer@unset +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@GlsXtrStartUnsetBuffering} +%\changes{1.31}{2018-05-09}{new} +%Starred version checks for duplicates. +% \begin{macrocode} +\newcommand*{\s@GlsXtrStartUnsetBuffering}{% + \let\@glsxtr@org@unset@buffer\@glsxtr@unset@buffer + \def\@glsxtr@unset@buffer{}% + \let\@glsunset\@glsxtrbuffer@nodup@unset +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrbuffer@unset} +%\changes{1.30}{2018-04-25}{new} +%This must use a global change since \cs{gls} may have to be placed +%inside \cs{mbox} (for example, with \sty{soul} commands). +% \begin{macrocode} +\newcommand*{\@glsxtrbuffer@unset}[1]{% + \listxadd\@glsxtr@unset@buffer{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrbuffer@nodup@unset} +%\changes{1.31}{2018-05-09}{new} +%Alternative version that avoids duplicates. +%One level of expansion is performed on the argument in case it's a +%control sequence containing the label. (Not using \cs{xifinlist} as +%the added complexity might cause problems that the buffering is +%trying to overcome.) +% \begin{macrocode} +\newcommand*{\@glsxtrbuffer@nodup@unset}[1]{% + \expandafter\ifinlist\expandafter{#1}{\@glsxtr@unset@buffer}{}% + {\listxadd\@glsxtr@unset@buffer{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrStopUnsetBuffering} +%\changes{1.30}{2018-04-25}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrStopUnsetBuffering}{% + \@ifstar\s@GlsXtrStopUnsetBuffering\@GlsXtrStopUnsetBuffering +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrStopUnsetBuffering} +%\changes{1.30}{2018-04-25}{new} +%Unstarred form (global unset). +% \begin{macrocode} +\newcommand*{\@GlsXtrStopUnsetBuffering}{% + \let\@glsunset\@glsxtr@unset + \forlistloop\@glsunset\@glsxtr@unset@buffer + \let\@glsxtr@unset@buffer\@glsxtr@org@unset@buffer +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@GlsXtrStopUnsetBuffering} +%\changes{1.30}{2018-04-25}{new} +%Starred form (local unset). +% \begin{macrocode} +\newcommand*{\s@GlsXtrStopUnsetBuffering}{% + \forlistloop\@glslocalunset\@glsxtr@unset@buffer + \let\@glsunset\@glsxtr@unset +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrForUnsetBufferedList} +%\changes{1.31}{2018-05-09}{new} +%Iterate over labels stored in the current buffer. +%The argument is the handler macro. +% \begin{macrocode} +\newcommand*{\GlsXtrForUnsetBufferedList}[1]{% + \forlistloop#1\@glsxtr@unset@buffer +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslocalunset} +% Local unset. +% \begin{macrocode} +\renewcommand*{\@glslocalunset}[1]{% + \@@glslocalunset{#1}% + \glsxtrpostlocalunset{#1}% +}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostlocalunset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostlocalunset}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsreset} +% Global reset. +% \begin{macrocode} +\renewcommand*{\@glsreset}[1]{% + \@@glsreset{#1}% + \glsxtrpostreset{#1}% +}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostreset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostreset}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslocalreset} +% Local reset. +% \begin{macrocode} +\renewcommand*{\@glslocalreset}[1]{% + \@@glslocalreset{#1}% + \glsxtrpostlocalreset{#1}% +}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostlocalreset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostlocalreset}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslocalreseteach} +%\changes{1.31}{2018-05-09}{new} +%Locally reset a list of entries. +% \begin{macrocode} +\newcommand*{\glslocalreseteach}[1]{% + \gls@ifnotmeasuring + {% + \@for\@gls@thislabel:=#1\do{% + \glsdoifexists{\@gls@thislabel}% + {% + \@glslocalreset{\@gls@thislabel}% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslocalunseteach} +%Locally unset a list of entries. +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand*{\glslocalunseteach}[1]{% + \gls@ifnotmeasuring + {% + \@for\@gls@thislabel:=#1\do{% + \glsdoifexists{\@gls@thislabel}% + {% + \@glslocalunset{\@gls@thislabel}% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrEnableEntryCounting} +% The first argument is the list of categories and the second +% argument is the value of the \catattr{entrycount} attribute. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableEntryCounting}[2]{% +% \end{macrocode} +% Enable entry counting: +% \begin{macrocode} + \glsenableentrycount +% \end{macrocode} +% Redefine \cs{gls} etc: +% \begin{macrocode} + \renewcommand*{\gls}{\cgls}% + \renewcommand*{\Gls}{\cGls}% + \renewcommand*{\glspl}{\cglspl}% + \renewcommand*{\Glspl}{\cGlspl}% + \renewcommand*{\GLS}{\cGLS}% + \renewcommand*{\GLSpl}{\cGLSpl}% +% \end{macrocode} +% Set the \catattr{entrycount} attribute: +% \begin{macrocode} + \@glsxtr@setentrycountunsetattr{#1}{#2}% +% \end{macrocode} +% In case this command is used again: +% \begin{macrocode} + \let\GlsXtrEnableEntryCounting\@glsxtr@setentrycountunsetattr + \renewcommand*{\GlsXtrEnableEntryUnitCounting}[3]{% + \PackageError{glossaries-extra}{\string\GlsXtrEnableEntryUnitCounting\space + can't be used with \string\GlsXtrEnableEntryCounting}% + {Use one or other but not both commands}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@setentrycountunsetattr} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@setentrycountunsetattr}[2]{% + \@for\@glsxtr@cat:=#1\do + {% + \ifdefempty{\@glsxtr@cat}{}% + {% + \glssetcategoryattribute{\@glsxtr@cat}{entrycount}{#2}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% Redefine the entry counting commands to take into account the +%\catattr{entrycount} attribute. +%\begin{macro}{\glsenableentrycount} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\renewcommand*{\glsenableentrycount}{% +% \end{macrocode} +% Enable new fields: +% \begin{macrocode} + \appto\@newglossaryentry@defcounters{\@@newglossaryentry@defcounters}% +% \end{macrocode} +% Just in case the user has switched on the \pkgopt{docdef} option. +% \begin{macrocode} + \renewcommand*{\gls@defdocnewglossaryentry}{% + \renewcommand*\newglossaryentry[2]{% + \PackageError{glossaries}{\string\newglossaryentry\space + may only be used in the preamble when entry counting has + been activated}{If you use \string\glsenableentrycount\space + you must place all entry definitions in the preamble not in + the document environment}% + }% + }% +% \end{macrocode} +% New commands to access new fields: +% \begin{macrocode} + \newcommand*{\glsentrycurrcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@currcount}% + {0}{\@gls@entry@field{##1}{currcount}}% + }% + \newcommand*{\glsentryprevcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@prevcount}% + {0}{\@gls@entry@field{##1}{prevcount}}% + }% +% \end{macrocode} +% Adjust post unset and reset: +% \begin{macrocode} + \let\@glsxtr@entrycount@org@unset\glsxtrpostunset + \renewcommand*{\glsxtrpostunset}[1]{% + \@glsxtr@entrycount@org@unset{##1}% + \@gls@increment@currcount{##1}% + }% + \let\@glsxtr@entrycount@org@localunset\glsxtrpostlocalunset + \renewcommand*{\glsxtrpostlocalunset}[1]{% + \@glsxtr@entrycount@org@localunset{##1}% + \@gls@local@increment@currcount{##1}% + }% + \let\@glsxtr@entrycount@org@reset\glsxtrpostreset + \renewcommand*{\glsxtrpostreset}[1]{% + \@glsxtr@entrycount@org@reset{##1}% + \csgdef{glo@\glsdetoklabel{##1}@currcount}{0}% + }% + \let\@glsxtr@entrycount@org@localreset\glsxtrpostlocalreset + \renewcommand*{\glsxtrpostlocalreset}[1]{% + \@glsxtr@entrycount@org@localreset{##1}% + \csdef{glo@\glsdetoklabel{##1}@currcount}{0}% + }% +% \end{macrocode} +% Modifications to take into account the attributes that govern +% whether the entry should be unset. +% \begin{macrocode} + \let\@cgls@\@@cgls@ + \let\@cglspl@\@@cglspl@ +% \end{macrocode} +%\changes{1.14}{2017-04-18}{fixed assignment of \cs{@cGls@}} +% \begin{macrocode} + \let\@cGls@\@@cGls@ + \let\@cGlspl@\@@cGlspl@ + \let\@cGLS@\@@cGLS@ + \let\@cGLSpl@\@@cGLSpl@ +% \end{macrocode} +% The rest is as the original definition. +% \begin{macrocode} + \AtEndDocument{\@gls@write@entrycounts}% + \renewcommand*{\@gls@entry@count}[2]{% + \csgdef{glo@\glsdetoklabel{##1}@prevcount}{##2}% + }% + \let\glsenableentrycount\relax + \renewcommand*{\glsenableentryunitcount}{% + \PackageError{glossaries-extra}{\string\glsenableentryunitcount\space + can't be used with \string\glsenableentrycount}% + {Use one or other but not both commands}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@write@entrycounts} +% Modify this command so that it only writes the information for +% entries with the \catattr{entrycount} attribute and issue +% warning if no entries have this attribute set. +% \begin{macrocode} +\renewcommand*{\@gls@write@entrycounts}{% + \immediate\write\@auxout + {\string\providecommand*{\string\@gls@entry@count}[2]{}}% + \count@=0\relax + \forallglsentries{\@glsentry}{% + \glshasattribute{\@glsentry}{entrycount}% + {% + \ifglsused{\@glsentry}% + {% + \immediate\write\@auxout + {\string\@gls@entry@count{\@glsentry}{\glsentrycurrcount{\@glsentry}}}% + }% + {}% + \advance\count@ by \@ne + }% + {}% + }% + \ifnum\count@=0 + \GlossariesExtraWarningNoLine{Entry counting has been enabled + \MessageBreak with \string\glsenableentrycount\space but the + \MessageBreak attribute `entrycount' hasn't + \MessageBreak been assigned to any of the defined + \MessageBreak entries}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifcounttrigger} +%\begin{definition} +%\cs{glsxtrifcounttrigger}\marg{label}\marg{trigger format}\marg{normal} +%\end{definition} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrifcounttrigger}[3]{% + \glshasattribute{#1}{entrycount}% + {% + \ifnum\glsentryprevcount{#1}>\glsgetattribute{#1}{entrycount}\relax + #3% + \else + #2% + \fi + }% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +% Actual internal definitions of \cs{cgls} used when entry counting +% is enabled. +% +%\begin{macro}{\@@cgls@} +% \begin{macrocode} +\def\@@cgls@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cglsformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@gls@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cglspl@} +% \begin{macrocode} +\def\@@cglspl@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cglsplformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@glspl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGls@} +% \begin{macrocode} +\def\@@cGls@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGlsformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@Gls@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGlspl@} +% \begin{macrocode} +\def\@@cGlspl@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGlsplformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@Glspl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGLS@} +% \begin{macrocode} +\def\@@cGLS@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGLSformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@GLS@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGLSpl@} +% \begin{macrocode} +\def\@@cGLSpl@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGLSplformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@GLSpl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +% Remove default warnings from \cs{cgls} etc so that it can be used +% interchangeable with \cs{gls} etc. +%\begin{macro}{\@cgls@} +% \begin{macrocode} +\def\@cgls@#1#2[#3]{\@gls@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@cGls@} +% \begin{macrocode} +\def\@cGls@#1#2[#3]{\@Gls@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@cglspl@} +% \begin{macrocode} +\def\@cglspl@#1#2[#3]{\@glspl@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@cGlspl@} +% \begin{macrocode} +\def\@cGlspl@#1#2[#3]{\@Glspl@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +% Add all upper case versions not provided by \styfmt{glossaries}. +%\begin{macro}{\cGLS} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newrobustcmd*{\cGLS}{\@gls@hyp@opt\@cGLS} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLS} +%\changes{0.5}{2015-12-07}{new} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@cGLS}[2][]{% + \new@ifnextchar[{\@cGLS@{#1}{#2}}{\@cGLS@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLS@} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\def\@cGLS@#1#2[#3]{\@GLS@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGLSformat} +%\changes{0.5}{2015-12-07}{new} +% Format used by \cs{cGLS} if entry only used once on previous run. +% The first argument is the label, the second argument is the insert +% text. +% \begin{macrocode} +\newcommand*{\cGLSformat}[2]{% + \expandafter\mfirstucMakeUppercase\expandafter{\cglsformat{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGLSpl} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newrobustcmd*{\cGLSpl}{\@gls@hyp@opt\@cGLSpl} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLSpl} +%\changes{0.5}{2015-12-07}{new} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@cGLSpl}[2][]{% + \new@ifnextchar[{\@cGLSpl@{#1}{#2}}{\@cGLSpl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLSpl@} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\def\@cGLSpl@#1#2[#3]{\@GLSpl@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGLSplformat} +%\changes{0.5}{2015-12-07}{new} +% Format used by \cs{cGLSpl} if entry only used once on previous run. +% The first argument is the label, the second argument is the insert +% text. +% \begin{macrocode} +\newcommand*{\cGLSplformat}[2]{% + \expandafter\mfirstucMakeUppercase\expandafter{\cglsplformat{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +% Modify the trigger formats to check for the \catattr{regular} attribute. +%\begin{macro}{\cglsformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cglsformat}[2]{% + \glsifregular{#1} + {\glsentryfirst{#1}}% + {\ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGlsformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cGlsformat}[2]{% + \glsifregular{#1} + {\Glsentryfirst{#1}}% + {\ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cglsplformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cglsplformat}[2]{% + \glsifregular{#1} + {\glsentryfirstplural{#1}}% + {\ifglshaslong{#1}{\glsentrylongpl{#1}}{\glsentryfirstplural{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGlsplformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cGlsplformat}[2]{% + \glsifregular{#1} + {\Glsentryfirstplural{#1}}% + {\ifglshaslong{#1}{\Glsentrylongpl{#1}}{\Glsentryfirstplural{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%New code similar to above for unit counting. +% +%\begin{macro}{\@@newglossaryentry@defunitcounters} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@@newglossaryentry@defunitcounters}{% + \edef\@glo@countunit{\csuse{@glsxtr@categoryattr@@\@glo@category @unitcount}}% + \ifdefvoid\@glo@countunit + {}% + {% + \@glsxtr@ifunitcounter{\@glo@countunit}% + {}% + {\expandafter\@glsxtr@addunitcounter\expandafter{\@glo@countunit}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@unitcountlist} +%\changes{0.5.4}{2015-12-15}{new} +% List to keep track of which counters are being used by the entry +% unit count facility. +% \begin{macrocode} +\newcommand*{\@glsxtr@unitcountlist}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@addunitcounter} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@addunitcounter}[1]{% + \listadd{\@glsxtr@unitcountlist}{#1}% + \ifcsundef{glsxtr@theunit@#1} + {% + \ifcsdef{theH#1}% + {\csdef{glsxtr@theunit@#1}{\csuse{theH#1}}}% + {\csdef{glsxtr@theunit@#1}{\csuse{the#1}}}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@ifunitcounter} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@ifunitcounter}[3]{% + \xifinlist{#1}{\@glsxtr@unitcountlist}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@currentunitcount} +% \begin{macrocode} +\newcommand*\@glsxtr@currentunitcount[1]{% + glo@\glsdetoklabel{#1}@currunit@\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@previousunitcount} +% \begin{macrocode} +\newcommand*\@glsxtr@previousunitcount[1]{% + glo@\glsdetoklabel{#1}@prevunit@\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@increment@currunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@gls@increment@currunitcount}[1]{% + \glshasattribute{#1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{#1}}% + \ifcsundef{\@glsxtr@csname}% + {% + \csgdef{\@glsxtr@csname}{1}% + \listcsxadd + {glo@\glsdetoklabel{#1}@unitlist}% + {\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% + }% + }% + {% + \csxdef{\@glsxtr@csname}% + {\number\numexpr\csname\@glsxtr@csname\endcsname+1}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@local@increment@currunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@gls@local@increment@currunitcount}[1]{% + \glshasattribute{#1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{#1}}% + \ifcsundef{\@glsxtr@csname}% + {% + \csdef{\@glsxtr@csname}{1}% + \listcseadd + {glo@\glsdetoklabel{#1}@unitlist}% + {\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% + }% + }% + {% + \csedef{\@glsxtr@csname}% + {\number\numexpr\csname\@glsxtr@csname\endcsname+1}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@currunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@currunitcount}[2]{% + \ifcsundef + {glo@\glsdetoklabel{#1}@currunit@#2}% + {0}% + {\csuse{glo@\glsdetoklabel{#1}@currunit@#2}}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@prevunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@prevunitcount}[2]{% + \ifcsundef + {glo@\glsdetoklabel{#1}@prevunit@#2}% + {0}% + {\csuse{glo@\glsdetoklabel{#1}@prevunit@#2}}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsenableentryunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsenableentryunitcount}{% +% \end{macrocode} +% Enable new fields: +% \begin{macrocode} + \appto\@newglossaryentry@defcounters{\@@newglossaryentry@defunitcounters}% +% \end{macrocode} +% Just in case the user has switched on the \pkgopt{docdef} option. +% \begin{macrocode} + \renewcommand*{\gls@defdocnewglossaryentry}{% + \renewcommand*\newglossaryentry[2]{% + \PackageError{glossaries}{\string\newglossaryentry\space + may only be used in the preamble when entry counting has + been activated}{If you use \string\glsenableentryunitcount\space + you must place all entry definitions in the preamble not in + the document environment}% + }% + }% +% \end{macrocode} +% New commands to access new fields: +% \begin{macrocode} + \newcommand*{\glsentrycurrcount}[1]{% + \@glsxtr@currunitcount{##1}{\glsgetattribute{##1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{##1}{unitcount}}}% + }% + \newcommand*{\glsentryprevcount}[1]{% + \@glsxtr@prevunitcount{##1}{\glsgetattribute{##1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{##1}{unitcount}}}% + }% +% \end{macrocode} +% Access total count: +% \begin{macrocode} + \newcommand*{\glsentryprevtotalcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunittotal}% + {0}% + {% + \number\csuse{glo@\glsdetoklabel{##1}@prevunittotal} + }% + }% +% \end{macrocode} +% Access max value: +% \begin{macrocode} + \newcommand*{\glsentryprevmaxcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunitmax}% + {0}% + {% + \number\csuse{glo@\glsdetoklabel{##1}@prevunitmax} + }% + }% +% \end{macrocode} +% Adjust post unset and reset: +% \begin{macrocode} + \let\@glsxtr@entryunitcount@org@unset\glsxtrpostunset + \renewcommand*{\glsxtrpostunset}[1]{% + \@glsxtr@entryunitcount@org@unset{##1}% + \@gls@increment@currunitcount{##1}% + }% + \let\@glsxtr@entryunitcount@org@localunset\glsxtrpostlocalunset + \renewcommand*{\glsxtrpostlocalunset}[1]{% + \@glsxtr@entryunitcount@org@localunset{##1}% + \@gls@local@increment@currunitcount{##1}% + }% + \let\@glsxtr@entryunitcount@org@reset\glsxtrpostreset + \renewcommand*{\glsxtrpostreset}[1]{% + \glshasattribute{##1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{##1}}% + \ifcsundef{\@glsxtr@csname}% + {}% + {\csgdef{\@glsxtr@csname}{0}}% + }% + {}% + }% + \let\@glsxtr@entryunitcount@org@localreset\glsxtrpostlocalreset + \renewcommand*{\glsxtrpostlocalreset}[1]{% + \@glsxtr@entryunitcount@org@localreset{##1}% + \glshasattribute{##1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{##1}}% + \ifcsundef{\@glsxtr@csname}% + {}% + {\csdef{\@glsxtr@csname}{0}}% + }% + {}% + }% +% \end{macrocode} +% Modifications to take into account the attributes that govern +% whether the entry should be unset. +% \begin{macrocode} + \let\@cgls@\@@cgls@ + \let\@cglspl@\@@cglspl@ +% \end{macrocode} +%\changes{1.14}{2017-04-18}{fixed assignment of \cs{@cGls@}} +% \begin{macrocode} + \let\@cGls@\@@cGls@ + \let\@cGlspl@\@@cGlspl@ + \let\@cGLS@\@@cGLS@ + \let\@cGLSpl@\@@cGLSpl@ +% \end{macrocode} +% Write information to the aux file. +% \begin{macrocode} + \AtEndDocument{\@gls@write@entryunitcounts}% + \renewcommand*{\@gls@entry@unitcount}[3]{% + \csgdef{glo@\glsdetoklabel{##1}@prevunit@##3}{##2}% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunittotal}% + {\csgdef{glo@\glsdetoklabel{##1}@prevunittotal}{##2}}% + {% + \csxdef{glo@\glsdetoklabel{##1}@prevunittotal}{ + \number\numexpr\csuse{glo@\glsdetoklabel{##1}@prevunittotal}+##2}% + }% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunitmax}% + {\csgdef{glo@\glsdetoklabel{##1}@prevunitmax}{##2}}% + {% + \ifnum\csuse{glo@\glsdetoklabel{##1}@prevunitmax}<##2 + \csgdef{glo@\glsdetoklabel{##1}@prevunitmax}{##2}% + \fi + }% + }% + \let\glsenableentryunitcount\relax + \renewcommand*{\glsenableentrycount}{% + \PackageError{glossaries-extra}{\string\glsenableentrycount\space + can't be used with \string\glsenableentryunitcount}% + {Use one or other but not both commands}% + }% +} +\@onlypreamble\glsenableentryunitcount +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@entry@unitcount} +% \begin{macrocode} +\newcommand*{\@gls@entry@unitcount}[3]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@write@entryunitcounts@do} +% \begin{macrocode} +\newcommand*{\@gls@write@entryunitcounts@do}[1]{% + \immediate\write\@auxout + {\string\@gls@entry@unitcount + {\@glsentry}% + {\@glsxtr@currunitcount{\@glsentry}{#1}% + }% + {#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@write@entryunitcounts} +% \begin{macrocode} +\newcommand*{\@gls@write@entryunitcounts}{% + \immediate\write\@auxout + {\string\providecommand*{\string\@gls@entry@unitcount}[3]{}}% + \count@=0\relax + \forallglsentries{\@glsentry}{% + \glshasattribute{\@glsentry}{unitcount}% + {% + \ifglsused{\@glsentry}% + {% + \forlistcsloop + {\@gls@write@entryunitcounts@do}% + {glo@\glsdetoklabel{\@glsentry}@unitlist}% + }% + {}% + \advance\count@ by \@ne + }% + {}% + }% + \ifnum\count@=0 + \GlossariesExtraWarningNoLine{Entry counting has been enabled + \MessageBreak with \string\glsenableentryunitcount\space but the + \MessageBreak attribute `unitcount' hasn't + \MessageBreak been assigned to any of the defined + \MessageBreak entries}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrEnableEntryUnitCounting} +% The first argument is the list of categories, the second +% argument is the value of the \catattr{entrycount} attribute +% and the third is the counter name. +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableEntryUnitCounting}[3]{% +% \end{macrocode} +% Enable entry counting: +% \begin{macrocode} + \glsenableentryunitcount +% \end{macrocode} +% Redefine \cs{gls} etc: +% \begin{macrocode} + \renewcommand*{\gls}{\cgls}% + \renewcommand*{\Gls}{\cGls}% + \renewcommand*{\glspl}{\cglspl}% + \renewcommand*{\Glspl}{\cGlspl}% + \renewcommand*{\GLS}{\cGLS}% + \renewcommand*{\GLSpl}{\cGLSpl}% +% \end{macrocode} +% Set the \catattr{entrycount} attribute: +% \begin{macrocode} + \@glsxtr@setentryunitcountunsetattr{#1}{#2}{#3}% +% \end{macrocode} +% In case this command is used again: +% \begin{macrocode} + \let\GlsXtrEnableEntryUnitCounting\@glsxtr@setentryunitcountunsetattr + \renewcommand*{\GlsXtrEnableEntryCounting}[2]{% + \PackageError{glossaries-extra}{\string\GlsXtrEnableEntryCounting\space + can't be used with \string\GlsXtrEnableEntryUnitCounting}% + {Use one or other but not both commands}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@setentryunitcountunsetattr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@setentryunitcountunsetattr}[3]{% + \@for\@glsxtr@cat:=#1\do + {% + \ifdefempty{\@glsxtr@cat}{}% + {% + \glssetcategoryattribute{\@glsxtr@cat}{entrycount}{#2}% + \glssetcategoryattribute{\@glsxtr@cat}{unitcount}{#3}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% +%\subsection{Acronym Modifications} +% It's more consistent to use the abbreviation code for acronyms, +% but make some adjustments to allow for continued use of the +% \styfmt{glossaries} package's custom acronym format. (For example, +% user may already have defined some acronym styles with +% \cs{newacronymstyle} which they would like to continue to use.) +% The original \styfmt{glossaries} acronym code can be restored +% with \cs{RestoreAcronyms}, but adjust \cs{SetGenericNewAcronym} +% so that \cs{newacronym} adds the category. +% +%\begin{macro}{\SetGenericNewAcronym} +% \begin{macrocode} +\renewcommand*{\SetGenericNewAcronym}{% + \let\@Gls@entryname\@Gls@acrentryname + \renewcommand{\newacronym}[4][]{% + \ifdefempty{\@glsacronymlists}% + {% + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + }% + {}% + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \protected@edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\expandonce{\acronymentry{##2}}},% + sort={\acronymsort{\the\glsshorttok}{\the\glslongtok}},% + text={\the\glsshorttok},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + category=acronym, + \GenericAcronymFields,% + \the\glskeylisttok + }% + }% + \@do@newglossaryentry + }% + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{\genacrfullformat{##2}{##3}}}% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{\Genacrfullformat{##2}{##3}}}% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\genacrfullformat{##2}{##3}}}}% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{\genplacrfullformat{##2}{##3}}}% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{\Genplacrfullformat{##2}{##3}}}% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\genplacrfullformat{##2}{##3}}}}% + \renewcommand*{\glsentryfull}[1]{\genacrfullformat{##1}{}}% + \renewcommand*{\Glsentryfull}[1]{\Genacrfullformat{##1}{}}% + \renewcommand*{\glsentryfullpl}[1]{\genplacrfullformat{##1}{}}% + \renewcommand*{\Glsentryfullpl}[1]{\Genplacrfullformat{##1}{}}% +} +% \end{macrocode} +%\end{macro} +% +% This will cause a problem for glossaries that contain a mixture of +% acronyms and abbreviations, so redefine \cs{newacronym} to use the +% new abbreviation interface. +% +% First save the original definitions: +% \begin{macrocode} +\let\@glsxtr@org@setacronymstyle\setacronymstyle +\let\@glsxtr@org@newacronymstyle\newacronymstyle +% \end{macrocode} +% +%\begin{macro}{\MakeAcronymsAbbreviations} +% Make acronyms use the same interface as abbreviations. +% Note that \cs{newacronymstyle} has a different implementation to +% \cs{newabbrevationstyle} so disable \cs{newacronymstyle} and +% \cs{setacronymstyle}. +%\changes{0.4}{2015-12-03}{set the default type to \cs{acronymtype}} +%\changes{0.5.4}{2015-12-15}{now disables \cs{setacronymstyle}} +% \begin{macrocode} +\newcommand*{\MakeAcronymsAbbreviations}{% + \renewcommand*{\newacronym}[4][]{% + \glsxtr@newabbreviation{type=\acronymtype,category=acronym,##1}{##2}{##3}{##4}% + }% + \renewcommand*{\firstacronymfont}[1]{\glsfirstabbrvfont{##1}}% + \renewcommand*{\acronymfont}[1]{\glsabbrvfont{##1}}% + \renewcommand*{\setacronymstyle}[1]{% + \PackageError{glossaries-extra}{\string\setacronymstyle{##1} + unavailable. + Use \string\setabbreviationstyle\space instead. + The original acronym interface can be restored with + \string\RestoreAcronyms}{}% + }% + \renewcommand*{\newacronymstyle}[1]{% + \GlossariesExtraWarning{New acronym style `##1' won't be + available unless you restore the original acronym interface with + \string\RestoreAcronyms}% + \@glsxtr@org@newacronymstyle{##1}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Switch acronyms to abbreviations: +% \begin{macrocode} +\MakeAcronymsAbbreviations +% \end{macrocode} +% +%\begin{macro}{\RestoreAcronyms} +% Restore acronyms to \styfmt{glossaries} interface. +% \begin{macrocode} +\newcommand*{\RestoreAcronyms}{% + \SetGenericNewAcronym + \renewcommand{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand{\acronymfont}[1]{##1}% + \let\setacronymstyle\@glsxtr@org@setacronymstyle + \let\newacronymstyle\@glsxtr@org@newacronymstyle +% \end{macrocode} +%\changes{1.07}{2016-08-15}{modified \cs{@gls@link@checkfirsthyper} to set +%\cs{glsxtrifwasfirstuse}} +% Need to restore the original definition of \cs{@gls@link@checkfirsthyper} +% but \cs{glsxtrifwasfirstuse} still needs setting for the benefit +% of the post-link hook. +% \begin{macrocode} + \renewcommand*\@gls@link@checkfirsthyper{% + \ifglsused{\glslabel}% + {\let\glsxtrifwasfirstuse\@secondoftwo} + {\let\glsxtrifwasfirstuse\@firstoftwo}% + \@glsxtr@org@checkfirsthyper + } + \glssetcategoryattribute{acronym}{regular}{false}% + \setacronymstyle{long-short}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsacspace} +% Allow the user to customise the maximum value. +% \begin{macrocode} +\renewcommand*{\glsacspace}[1]{% + \settowidth{\dimen@}{(\firstacronymfont{\glsentryshort{#1}})}% + \ifdim\dimen@<\glsacspacemax~\else\space\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsacspacemax} +% Value used in the above. +% \begin{macrocode} +\newcommand*{\glsacspacemax}{3em} +% \end{macrocode} +%\end{macro} +% +%\subsection{Indexing and Displaying Glossaries} +%From time-to-time users ask if they can have one glossary sorted +%normally and another sorted by definition or usage. With the +% base \styfmt{glossaries} package this can only be achieved with the +% \qt{noidx} commands (Option~1). This is an attempt to mix and +% match. +% +%First we need a list of the glossaries that require +%\gls{makeindex}\slash\gls{xindy}. +%\begin{macro}{\@glsxtr@reg@glosslist} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@reg@glosslist}{} +% \end{macrocode} +%\end{macro} +% Save the original definition of \cs{makeglossaries}: +% \begin{macrocode} +\let\@glsxtr@org@makeglossaries\makeglossaries +% \end{macrocode} +% +% Redefine \cs{makeglossaries} to take an optional argument. +% This should be empty for the usual behaviour (all glossaries +% need processing with an indexing application) or a comma-separated +% list of glossary labels indicating those glossaries that should be +% processed with an indexing application. The optional argument +% version shouldn't be used with \pkgopt{record}. +%\begin{macro}{\makeglossaries} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\renewcommand*{\makeglossaries}[1][]{% + \@glsxtr@if@record@only + {% + \PackageError{glossaries-extra}{\string\makeglossaries\space + not permitted\MessageBreak with record=\@glsxtr@record@setting\space + package option}% + {You may only use \string\makeglossaries\space with + record=off or record=alsoindex options}% + }% + {% + \ifblank{#1}% + {\@glsxtr@org@makeglossaries}% + {% + \ifx\@glsxtr@record@setting\@glsxtr@record@setting@alsoindex + \PackageError{glossaries-extra}{\string\makeglossaries[#1]\space + not permitted\MessageBreak with record=alsoindex package option}% + {You may only use the hybrid \string\makeglossaries[...]\space with + record=off option}% + \else +% \end{macrocode} +%\cs{@gls@@automake@immediate} was introduced to \sty{glossaries} +%v4.42 so it may not be defined. +% \begin{macrocode} + \ifdef\@gls@@automake@immediate{\@gls@@automake@immediate}{}% + \edef\@glsxtr@reg@glosslist{#1}% + \ifundef{\glswrite}{\newwrite\glswrite}{}% + \protected@write\@auxout{}{\string\providecommand + \string\@glsorder[1]{}} + \protected@write\@auxout{}{\string\providecommand + \string\@istfilename[1]{}} + \protected@write\@auxout{}{\string\@istfilename{\istfilename}}% + \protected@write\@auxout{}{\string\@glsorder{\glsorder}} + \protected@write\@auxout{}{\string\glsxtr@makeglossaries{#1}} + \write\@auxout{\string\providecommand\string\@gls@reference[3]{}}% +% \end{macrocode} +% Iterate through each supplied glossary type and activate it. +% \begin{macrocode} + \@for\@glo@type:=#1\do{% + \ifdefempty{\@glo@type}{}{\@makeglossary{\@glo@type}}% + }% +% \end{macrocode} +% New glossaries must be created before \cs{makeglossaries}: +% \begin{macrocode} + \renewcommand*\newglossary[4][]{% + \PackageError{glossaries}{New glossaries + must be created before \string\makeglossaries}{You need + to move \string\makeglossaries\space after all your + \string\newglossary\space commands}}% +% \end{macrocode} +% Any subsequence instances of this command should have no effect +% \begin{macrocode} + \let\@makeglossary\relax + \let\makeglossary\relax + \renewcommand\makeglossaries[1][]{}% +% \end{macrocode} +% Disable all commands that have no effect after \cs{makeglossaries} +% \begin{macrocode} + \@disable@onlypremakeg +% \end{macrocode} +% Allow \gloskey{see} key: +% \begin{macrocode} + \let\gls@checkseeallowed\relax +% \end{macrocode} +%Adjust \cs{@do@seeglossary}. This needs to check for the entry's +%existence but don't increment associated counter. +% \begin{macrocode} + \renewcommand*{\@do@seeglossary}[2]{% + \glsdoifexists{##1}% + {% + \edef\@gls@label{\glsdetoklabel{##1}}% + \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}% + \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% + {\@glsxtr@org@doseeglossary{##1}{##2}}% + {% + \@@glsxtrwrglossmark + \protected@write\@auxout{}{% + \string\@gls@reference + {\gls@type}{\@gls@label}{\string\glsseeformat##2{}}% + }% + }% + }% + }% +% \end{macrocode} +% Adjust \cs{@@do@@wrglossary} +% \begin{macrocode} + \let\@glsxtr@@do@@wrglossary\@@do@@wrglossary + \def\@@do@@wrglossary{% + \edef\@gls@type{\csname glo@\@gls@label @type\endcsname}% + \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% + {\@glsxtr@@do@@wrglossary}% + {\gls@noidxglossary}% + }% +% \end{macrocode} +% Suppress warning about no \cs{makeglossaries} +% \begin{macrocode} + \let\warn@nomakeglossaries\relax + \def\warn@noprintglossary{% + \GlossariesWarningNoLine{No \string\printglossary\space + or \string\printglossaries\space + found.^^J(Remove \string\makeglossaries\space if you don't want + any glossaries.)^^JThis document will not have a glossary}% + }% +% \end{macrocode} +% Only warn for glossaries not listed. +% \begin{macrocode} + \renewcommand{\@gls@noref@warn}[1]{% + \edef\@gls@type{##1}% + \expandafter\DTLifinlist\expandafter{\@gls@type}{\@glsxtr@reg@glosslist}% + {% + \GlossariesExtraWarning{Can't use + \string\printnoidxglossary[type={\@gls@type}] + when `\@gls@type' is listed in the optional argument of + \string\makeglossaries}% + }% + {% + \GlossariesWarning{Empty glossary for + \string\printnoidxglossary[type={##1}]. + Rerun may be required (or you may have forgotten to use + commands like \string\gls)}% + }% + }% +% \end{macrocode} +% Adjust display number list to check for type: +% \begin{macrocode} + \renewcommand*{\glsdisplaynumberlist}[1]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {\@glsxtr@idx@displaynumberlist{##1}}% + {\@glsxtr@noidx@displaynumberlist{##1}}% + }% +% \end{macrocode} +% Adjust entry list: +% \begin{macrocode} + \renewcommand*{\glsentrynumberlist}[1]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {\@glsxtr@idx@entrynumberlist{##1}}% + {\@glsxtr@noidx@entrynumberlist{##1}}% + }% +% \end{macrocode} +% Adjust number list loop +% \begin{macrocode} + \renewcommand*{\glsnumberlistloop}[2]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {% + \PackageError{glossaries-extra}{\string\glsnumberlistloop\space + not available for glossary `##1'}{}% + }% + {\@glsxtr@noidx@numberlistloop{##1}{##2}}% + }% +% \end{macrocode} +% Only sanitize sort for normal indexing glossaries. +% \begin{macrocode} + \renewcommand*{\glsprestandardsort}[3]{% + \expandafter\DTLifinlist\expandafter{##2}{\@glsxtr@reg@glosslist}% + {% + \glsdosanitizesort + }% + {% + \ifglssanitizesort + \@gls@noidx@sanitizesort + \else + \@gls@noidx@nosanitizesort + \fi + }% + }% +% \end{macrocode} +% Unlike \cs{makenoidxglossaries} we can't automatically set +% sanitizesort=false. All entries must be defined in the preamble. +% \begin{macrocode} + \renewcommand*\new@glossaryentry[2]{% + \PackageError{glossaries-extra}{Glossary entries must be defined + in the preamble\MessageBreak when you use the optional argument + of \string\makeglossaries}{Either move your definitions to the + preamble or don't use the optional argument of + \string\makeglossaries}% + }% +% \end{macrocode} +% Only activate sort key for glossaries that aren't listed in +% \verb|#1| (glossary label is stored in \cs{@glo@type} but this +% defaults to \cs{glsdefaulttype} so some expansion is required). +% \begin{macrocode} + \let\@glo@assign@sortkey\@glsxtr@mixed@assign@sortkey + \renewcommand*{\@printgloss@setsort}{% +% \end{macrocode} +% Need to extract just the \gloskey[printglossary]{type} value. +% \begin{macrocode} + \expandafter\@glsxtr@gettype\expandafter,\@glsxtr@printglossopts,% + type=\glsdefaulttype,\@end@glsxtr@gettype + \def\@glo@sorttype{\@glo@default@sorttype}% + }% +% \end{macrocode} +% Check \pkgopt{automake} setting: +% \begin{macrocode} + \ifglsautomake + \renewcommand*{\@gls@doautomake}{% + \@for\@gls@type:=\@glsxtr@reg@glosslist\do{% + \ifdefempty{\@gls@type}{}{\@gls@automake{\@gls@type}}% + }% + }% + \fi +% \end{macrocode} +% Check the sort setting (\sty{glossaries} v4.30 onwards): +% \begin{macrocode} + \ifdef\@glo@check@sortallowed{\@glo@check@sortallowed\makeglossaries}{}% + \fi + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%The optional argument version of \cs{makeglossaries} needs an +%adjustment to \cs{@printglossary} to allow \cs{@glo@assign@sortkey} +%to pick up the glossary type. +% +%\begin{macro}{\@glsxtr@orgprintglossary} +%This no longer simply saves \cs{@printglossary} with \cs{let} +%but is actually defined +%to check for the existence of the title, since ignored +%glossaries don't have a title assigned. (bib2gls writes +%\cs{provideignoredglossary} to the glstex file for some settings, +%so the glossary might not have been defined.) +%(This command is also used for on-the-fly setting.) +% \begin{macrocode} +\newcommand{\@glsxtr@orgprintglossary}[2]{% + \def\@glo@type{\glsdefaulttype}% +% \end{macrocode} +%Add check here. +% \begin{macrocode} + \def\glossarytitle{% + \ifcsdef{@glotype@\@glo@type @title}% + {\csuse{@glotype@\@glo@type @title}}% + {\glossaryname}}% + \def\glossarytoctitle{\glossarytitle}% + \let\org@glossarytitle\glossarytitle + \def\@glossarystyle{% + \ifx\@glossary@default@style\relax + \GlossariesWarning{No default glossary style provided \MessageBreak + for the glossary `\@glo@type'. \MessageBreak + Using deprecated fallback. \MessageBreak + To fix this set the style with \MessageBreak + \string\setglossarystyle\space or use the \MessageBreak + style key=value option}% + \fi + }% + \def\gls@dotoctitle{\glssettoctitle{\@glo@type}}% + \let\@org@glossaryentrynumbers\glossaryentrynumbers + \bgroup + \@printgloss@setsort + \setkeys{printgloss}{#1}% + \ifx\glossarytitle\org@glossarytitle + \else + \cslet{@glotype@\@glo@type @title}{\glossarytitle}% + \fi + \let\currentglossary\@glo@type + \let\org@glossaryentrynumbers\glossaryentrynumbers + \let\glsnonextpages\@glsnonextpages + \let\glsnextpages\@glsnextpages +% \end{macrocode} +%\changes{1.22}{2017-11-08}{changed explicit \cs{let} for \cs{nopostdesc} +%to \cs{glsxtractivatenopost}} +% \begin{macrocode} + \glsxtractivatenopost + \gls@dotoctitle + \@glossarystyle + \let\gls@org@glossaryentryfield\glossentry + \let\gls@org@glossarysubentryfield\subglossentry + \renewcommand{\glossentry}[1]{% + \xdef\glscurrententrylabel{\glsdetoklabel{##1}}% + \gls@org@glossaryentryfield{##1}% + }% + \renewcommand{\subglossentry}[2]{% + \xdef\glscurrententrylabel{\glsdetoklabel{##2}}% + \gls@org@glossarysubentryfield{##1}{##2}% + }% + \@gls@preglossaryhook + #2% + \egroup + \global\let\glossaryentrynumbers\@org@glossaryentrynumbers + \global\let\warn@noprintglossary\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtractivatenopost} +%\changes{1.22}{2017-11-08}{new} +%Change \cs{nopostdesc} and \cs{glsxtrnopostpunc} to behave as they +%do in the glossary. +% \begin{macrocode} +\newcommand*{\glsxtractivatenopost}{% + \let\nopostdesc\@nopostdesc + \let\glsxtrnopostpunc\@glsxtr@nopostpunc +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnopostpunc} +%\changes{1.22}{2017-11-08}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrnopostpunc}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@nopostpunc} +%Provide a command that works like \cs{nopostdesc} but only +%switches of the punctuation without suppressing the post-description +%hook. +%\changes{1.22}{2017-11-08}{new} +% \begin{macrocode} +\newcommand{\@glsxtr@nopostpunc}{% + \let\@@glsxtr@org@postdescription\glspostdescription + \ifglsnopostdot + \renewcommand{\glspostdescription}{% + \glsnopostdottrue + \let\glspostdescription\@@glsxtr@org@postdescription + \let\glsxtrrestorepostpunc\@glsxtr@restore@postpunc + \glsxtrpostdescription + \@glsxtr@nopostpunc@postdesc}% + \else + \renewcommand{\glspostdescription}{% + \let\glspostdescription\@@glsxtr@org@postdescription + \let\glsxtrrestorepostpunc\@glsxtr@restore@postpunc + \glsxtrpostdescription + \@glsxtr@nopostpunc@postdesc}% + \fi + \glsnopostdotfalse +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@nopostpunc@postdesc} +%\changes{1.23}{2017-11-12}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@nopostpunc@postdesc}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@restore@postpunc} +%\changes{1.23}{2017-11-12}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@restore@postpunc}{% + \def\@glsxtr@nopostpunc@postdesc{% + \@glsxtr@org@postdescription + \let\@glsxtr@nopostpunc@postdesc\@empty + \let\glsxtrrestorepostpunc\@empty + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrrestorepostpunc} +%\changes{1.23}{2017-11-12}{new} +%Does nothing outside of glossary. +% \begin{macrocode} +\newcommand*{\glsxtrrestorepostpunc}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@printglossary} +%Redefine. +%\changes{1.09}{2016-12-16}{redefined to save options} +% \begin{macrocode} +\renewcommand{\@printglossary}[2]{% + \def\@glsxtr@printglossopts{#1}% + \@glsxtr@orgprintglossary{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%Add a key that switches off the entry targets: +%\changes{1.12}{2017-02-03}{added target key to printgloss family} +% \begin{macrocode} +\define@choicekey{printgloss}{target} +[\@glsxtr@printglossval\@glsxtr@printglossnr]% +{true,false}[true]% +{% + \ifcase\@glsxtr@printglossnr +% \end{macrocode} +%\changes{1.31}{2018-05-09}{changed \cs{let} to \cs{def}} +% \begin{macrocode} + \def\@glstarget{\glsdohypertarget}% + \else + \let\@glstarget\@secondoftwo + \fi +} +% \end{macrocode} +%\begin{macro}{\@glsxtrhypernameprefix} +%\changes{1.20}{2017-09-11}{new} +% \begin{macrocode} +\newcommand{\@glsxtrhypernameprefix}{} +% \end{macrocode} +%\end{macro} +% +%New to v1.20: +% \begin{macrocode} +\define@key{printgloss}{targetnameprefix}{% + \renewcommand{\@glsxtrhypernameprefix}{#1}% +} +% \end{macrocode} +% +%\changes{1.31}{2018-05-09}{added \texttt{prefix} key for \texttt{printgloss}} +% \begin{macrocode} +\define@key{printgloss}{prefix}{% + \renewcommand{\glolinkprefix}{#1}% +} +% \end{macrocode} +% +%\changes{1.39}{2019-03-22}{added \texttt{label} key for \texttt{printgloss}} +% \begin{macrocode} +\define@key{printgloss}{label}{% + \glsxtrsetglossarylabel{#1}% +} +% \end{macrocode} +% +%\begin{macro}{\glsxtrsetglossarylabel} +%\changes{1.39}{2019-03-22}{new} +%Set the label for subsequent glossaries. If the label is +%fixed (that is, doesn't change with each glossary) this will need +%to be scoped or changed again to prevent duplicate labels. +% \begin{macrocode} +\newcommand{\glsxtrsetglossarylabel}[1]{% + \renewcommand*{\@@glossaryseclabel}{% + \protected@edef\@currentlabelname{\glossarytoctitle}% + \label{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdohypertarget} +%\changes{1.20}{2017-09-11}{added redefinition} +%Redefine to insert \cs{@glsxtrhypernameprefix} before the target +%name. +% \begin{macrocode} +\let\@glsxtr@org@glsdohypertarget\glsdohypertarget +\renewcommand{\glsdohypertarget}[2]{% + \@glsxtr@org@glsdohypertarget{\@glsxtrhypernameprefix#1}{#2}% +} +% \end{macrocode} +%\changes{1.31}{2018-05-09}{bug fix: ensure that new version is picked up} +%Update \cs{@glstarget} to use \cs{def} instead being assigned with +%\cs{let} so that it can pick up the new definition and allow any +%further redefinitions: +% \begin{macrocode} +\ifx\@glstarget\@glsxtr@org@glsdohypertarget + \def\@glstarget{\glsdohypertarget}% +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtr@makeglossaries} +%For the benefit of \app{makeglossaries} +%\changes{1.09}{2016-12-16}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@makeglossaries}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@gettype} +%Get just the type. +%\changes{1.09}{2016-12-16}{new} +% \begin{macrocode} +\def\@glsxtr@gettype#1,type=#2,#3\@end@glsxtr@gettype{% + \def\@glo@type{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@mixed@assign@sortkey} +%Assign the sort key. +%\changes{1.09}{2016-12-16}{new} +% \begin{macrocode} +\newcommand\@glsxtr@mixed@assign@sortkey[1]{% + \edef\@glo@type{\@glo@type}% + \expandafter\DTLifinlist\expandafter{\@glo@type}{\@glsxtr@reg@glosslist}% + {% + \@glo@no@assign@sortkey{#1}% + }% + {% + \@@glo@assign@sortkey{#1}% + }% +}% +% \end{macrocode} +%\end{macro} +% Display number list for the regular version: +%\begin{macro}{\@glsxtr@idx@displaynumberlist} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\let\@glsxtr@idx@displaynumberlist\glsdisplaynumberlist +% \end{macrocode} +%\end{macro} +% +% Display number list for the \qt{noidx} version: +%\begin{macro}{\@glsxtr@noidx@displaynumberlist} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@noidx@displaynumberlist}[1]{% + \letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}% + \ifdef\@gls@loclist + {% + \def\@gls@noidxloclist@sep{% + \def\@gls@noidxloclist@sep{% + \def\@gls@noidxloclist@sep{% + \glsnumlistsep + }% + \def\@gls@noidxloclist@finalsep{\glsnumlistlastsep}% + }% + }% + \def\@gls@noidxloclist@finalsep{}% + \def\@gls@noidxloclist@prev{}% + \forlistloop{\glsnoidxdisplayloclisthandler}{\@gls@loclist}% + \@gls@noidxloclist@finalsep + \@gls@noidxloclist@prev + }% + {% +% \end{macrocode} +%\changes{1.17}{2017-08-09}{replace hard-coded ?? with +%\cs{glsxtrundeftag}} +% \begin{macrocode} + \glsxtrundeftag + \glsdoifexists{#1}% + {% + \GlossariesWarning{Missing location list for `#1'. Either + a rerun is required or you haven't referenced the entry.}% + }% + }% +}% + +% \end{macrocode} +%\end{macro} +%And for the number list loop: +%\begin{macro}{\@glsxtr@noidx@numberlistloop} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@noidx@numberlistloop}[3]{% + \letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}% + \let\@gls@org@glsnoidxdisplayloc\glsnoidxdisplayloc + \let\@gls@org@glsseeformat\glsseeformat + \let\glsnoidxdisplayloc#2\relax + \let\glsseeformat#3\relax + \ifdef\@gls@loclist + {% + \forlistloop{\glsnoidxnumberlistloophandler}{\@gls@loclist}% + }% + {% +% \end{macrocode} +%\changes{1.17}{2017-08-09}{replace hard-coded ?? with +%\cs{glsxtrundeftag}} +% \begin{macrocode} + \glsxtrundeftag + \glsdoifexists{#1}% + {% + \GlossariesWarning{Missing location list for `##1'. Either + a rerun is required or you haven't referenced the entry.}% + }% + }% + \let\glsnoidxdisplayloc\@gls@org@glsnoidxdisplayloc + \let\glsseeformat\@gls@org@glsseeformat +}% +% \end{macrocode} +%\end{macro} +% +%Same for entry number list. +%\begin{macro}{\@glsxtr@noidx@entrynumberlist} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@noidx@entrynumberlist}[1]{% + \letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}% + \ifdef\@gls@loclist + {% + \glsnoidxloclist{\@gls@loclist}% + }% + {% +% \end{macrocode} +%\changes{1.17}{2017-08-09}{replace hard-coded ?? with +%\cs{glsxtrundeftag}} +% \begin{macrocode} + \glsxtrundeftag + \glsdoifexists{#1}% + {% + \GlossariesWarning{Missing location list for `#1'. Either + a rerun is required or you haven't referenced the entry.}% + }% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@idx@entrynumberlist} +%\changes{1.0}{2016-01-24}{new} +%\changes{1.04}{2016-05-02}{switched from \cs{let} to \cs{newcommand}} +% \begin{macrocode} +\newcommand*{\@glsxtr@idx@entrynumberlist}[1]{\glsentrynumberlist{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@noidx@getgrouptitle} +%\changes{1.14}{2017-04-18}{new} +%\changes{1.16}{2017-06-15}{fixed bug} +%Patch. +% \begin{macrocode} +\renewcommand*{\@gls@noidx@getgrouptitle}[2]{% + \protected@edef\@glsxtr@titlelabel{#1}% + \ifdefvoid\@glsxtr@titlelabel + {}% + {% + \protected@edef\@glsxtr@titlelabel{\csuse{glsxtr@grouptitle@#1}}% + }% + \ifdefvoid{\@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}}% + }% + }% + {% + \let#2\@glsxtr@titlelabel + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@org@getgrouptitle} +%\changes{1.14}{2017-04-18}{new} +%Save original definition of \cs{@gls@getgrouptitle} +% \begin{macrocode} +\let\glsxtr@org@getgrouptitle\@gls@getgrouptitle +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrgetgrouptitle} +%\changes{1.14}{2017-04-18}{new} +%Provide a user-level command to fetch the group title. The first +%argument is the group label. The second argument is a control +%sequence in which to store the title. +% \begin{macrocode} +\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 +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetgrouptitle} +%\changes{1.14}{2017-04-18}{new} +%Sets the title for the given group label. +%\changes{1.28}{2018-03-06}{changed \cs{csxdef} \cs{protected@csxdef}} +% \begin{macrocode} +\newcommand{\glsxtrsetgrouptitle}[2]{% + \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}% + \@onelevel@sanitize\@glsxtr@titlelabel + \protected@csxdef{\@glsxtr@titlelabel}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrlocalsetgrouptitle} +%\changes{1.24}{2017-11-14}{new} +%As above put only locally defines the title. +%\changes{1.28}{2018-03-06}{changed \cs{csedef} \cs{protected@csedef}} +% \begin{macrocode} +\newcommand{\glsxtrlocalsetgrouptitle}[2]{% + \protected@edef\@glsxtr@titlelabel{glsxtr@grouptitle@#1}% + \@onelevel@sanitize\@glsxtr@titlelabel + \protected@csedef{\@glsxtr@titlelabel}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnavigation} +%\changes{1.14}{2017-04-18}{new} +%Redefine to use new user-level command. +% \begin{macrocode} +\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 + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@print@noidx@glossary} +%\changes{1.11}{2017-01-19}{added redefinition} +% \begin{macrocode} +\renewcommand*{\@print@noidx@glossary}{% + \ifcsdef{@glsref@\@glo@type}% + {% + \ifcsdef{@glo@sortmacro@\@glo@sorttype}% + {% + \csuse{@glo@sortmacro@\@glo@sorttype}{\@glo@type}% + }% + {% + \PackageError{glossaries}{Unknown sort handler `\@glo@sorttype'}{}% + }% + \glossarysection[\glossarytoctitle]{\glossarytitle}% + \glossarypreamble +% \end{macrocode} +%Moved this command definition outside of environment in case of +%scoping issues (e.g. in tabular-like styles). +% \begin{macrocode} + \def\@gls@currentlettergroup{}% + \begin{theglossary}% + \glossaryheader + \glsresetentrylist + \forlistcsloop{\@gls@noidx@do}{@glsref@\@glo@type}% + \end{theglossary}% + \glossarypostamble + }% + {% +% \end{macrocode} +%Add section header if there are actually entries defined in this +%glossary as the document is likely pending a re-run. +% \begin{macrocode} + \glsxtrifemptyglossary{\@glo@type}% + {}% + {\glossarysection[\glossarytoctitle]{\glossarytitle}}% + \@gls@noref@warn{\@glo@type}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnoidxdisplayloc} +%\changes{1.12}{2017-02-03}{added redefinition} +%Patch to check for range formations. +% \begin{macrocode} +\renewcommand*{\glsnoidxdisplayloc}[4]{% + \setentrycounter[#1]{#2}% + \@glsxtr@display@loc#3\empty\end@glsxtr@display@loc{#4}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@display@loc} +%\changes{1.12}{2017-02-03}{new} +%Patch to check for range formations. +% \begin{macrocode} +\def\@glsxtr@display@loc#1#2\end@glsxtr@display@loc#3{% + \ifx#1(\relax + \glsxtrdisplaystartloc{#2}{#3}% + \else + \ifx#1)\relax + \glsxtrdisplayendloc{#2}{#3}% + \else + \glsxtrdisplaysingleloc{#1#2}{#3}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdisplaysingleloc} +%\changes{1.12}{2017-02-03}{new} +%Single location. +% \begin{macrocode} +\newcommand*{\glsxtrdisplaysingleloc}[2]{% + \csuse{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%By default the range identifiers are simply ignored. +%A custom list loop handler can be defined by the user +%to test for ranges by checking the definition of +%\cs{glsxtrlocrangefmt}. +% +%\begin{macro}{\glsxtrdisplaystartloc} +%\changes{1.12}{2017-02-03}{new} +%Start of a location range. +% \begin{macrocode} +\newcommand*{\glsxtrdisplaystartloc}[2]{% + \edef\glsxtrlocrangefmt{#1}% + \ifx\glsxtrlocrangefmt\empty + \def\glsxtrlocrangefmt{glsnumberformat}% + \fi + \expandafter\glsxtrdisplaysingleloc + \expandafter{\glsxtrlocrangefmt}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdisplayendloc} +%\changes{1.12}{2017-02-03}{new} +%\changes{1.14}{2017-04-18}{added check for empty format} +%End of a location range. +% \begin{macrocode} +\newcommand*{\glsxtrdisplayendloc}[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{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdisplayendlochook} +%\changes{1.12}{2017-02-03}{new} +%Allow the user to hook into the end of range command. +% \begin{macrocode} +\newcommand*{\glsxtrdisplayendlochook}[2]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrlocrangefmt} +%\changes{1.12}{2017-02-03}{new} +%Current range format. Empty if not in a range. +% \begin{macrocode} +\newcommand*{\glsxtrlocrangefmt}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\setentrycounter} +%\changes{1.29}{2018-04-09}{new} +%Adjust \cs{setentrycounter} to save the original prefix. +% \begin{macrocode} +\renewcommand*{\setentrycounter}[2][]{% + \def\glsxtrcounterprefix{#1}% + \ifx\glsxtrcounterprefix\@empty + \def\@glo@counterprefix{.}% + \else + \def\@glo@counterprefix{.#1.}% + \fi + \def\glsentrycounter{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@removespaces} +%\changes{1.14}{2017-04-18}{new} +%Redefine to allow adjustments to location hyperlink. +% \begin{macrocode} +\def\@gls@removespaces#1 #2\@nil{% + \toks@=\expandafter{\the\toks@#1}% + \ifx\\#2\\% +% \end{macrocode} +%\changes{1.39}{2019-03-22}{changed \cs{x} to \cs{@glo@tmp}} +% \begin{macrocode} + \edef\@glo@tmp{\the\toks@}% + \ifx\@glo@tmp\empty + \else +% \end{macrocode} +%Expand location (just in case \cs{toks@} is needed for something +%else). +%\changes{1.29}{2018-04-09}{added expansion} +% \begin{macrocode} + \expandafter\glsxtrlocationhyperlink\expandafter + \glsentrycounter\expandafter\@glo@counterprefix\expandafter{\the\toks@}% + \fi + \else + \@gls@ReturnAfterFi{% + \@gls@removespaces#2\@nil + }% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrlocationhyperlink} +%\changes{1.14}{2017-04-18}{new} +%\begin{definition} +%\cs{glsxtrlocationhyperlink}\marg{counter}\marg{prefix}\marg{location} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsxtrlocationhyperlink}[3]{% + \ifdefvoid\glsxtrsupplocationurl + {% + \GlsXtrInternalLocationHyperlink{#1}{#2}{#3}% + }% + {% + \hyperref{\glsxtrsupplocationurl}{}{#1#2#3}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsupphypernumber} +%\changes{1.14}{2017-04-18}{new} +% \begin{macrocode} +\newcommand*{\glsxtrsupphypernumber}[1]{% + {% + \glshasattribute{\glscurrententrylabel}{externallocation}% + {% + \def\glsxtrsupplocationurl{% + \glsgetattribute{\glscurrententrylabel}{externallocation}}% + }% + {% + \def\glsxtrsupplocationurl{}% + }% + \glshypernumber{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Give a bit of assistance to new users who are confused and don't +% know how to read transcript messages. +%\begin{macro}{\@print@glossary} +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\renewcommand{\@print@glossary}{% + \makeatletter + \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}% + \IfFileExists{\jobname.\csname @glotype@\@glo@type @in\endcsname}% + {}% + {\glsxtrNoGlossaryWarning{\@glo@type}}% + \ifglsxindy + \ifcsundef{@xdy@\@glo@type @language}% + {% + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \noexpand\immediate\noexpand\write\@auxout{% + \string\providecommand\string\@xdylanguage[2]{}}% + \noexpand\immediate\noexpand\write\@auxout{% + \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}% + }% + }% + }% + {% + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \noexpand\immediate\noexpand\write\@auxout{% + \string\providecommand\string\@xdylanguage[2]{}}% + \noexpand\immediate\noexpand\write\@auxout{% + \string\@xdylanguage{\@glo@type}{\csname @xdy@\@glo@type + @language\endcsname}}% + }% + }% + }% + \@do@auxoutstuff + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \noexpand\immediate\noexpand\write\@auxout{% + \string\providecommand\string\@gls@codepage[2]{}}% + \noexpand\immediate\noexpand\write\@auxout{% + \string\@gls@codepage{\@glo@type}{\gls@codepage}}% + }% + }% + \@do@auxoutstuff + \fi + \renewcommand*{\@warn@nomakeglossaries}{% + \GlossariesWarningNoLine{\string\makeglossaries\space + hasn't been used,^^Jthe glossaries will not be updated}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Setup the warning text to display if the external file for the given +% glossary is missing. +% +%\begin{macro}{\GlsXtrNoGlsWarningHead} +% Header message. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningHead}[2]{% + This document is incomplete. The external file associated with + the glossary `#1' (which should be called \texttt{#2}) + hasn't been created.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningEmptyStart} +% No entries have been added to the glossary. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningEmptyStart}{% + This has probably happened because there are no entries defined + in this glossary.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningEmptyMain} +% The default \qt{main} glossary is empty. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningEmptyMain}{% + If you don't want this glossary, + add \texttt{nomain} to your package option list when you load + \texttt{glossaries-extra.sty}. For example:% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningEmptyNotMain} +% A glossary that isn't the default \qt{main} glossary is empty. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningEmptyNotMain}[1]{% + Did you forget to use \texttt{type=#1} when you defined your + entries? If you tried to load entries into this glossary with + \texttt{\string\loadglsentries} did you remember to use + \texttt{[#1]} as the optional argument? If you did, check that + the definitions in the file you loaded all had the type set + to \texttt{\string\glsdefaulttype}.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningCheckFile} +% Advisory message to check the file contents. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningCheckFile}[1]{% + Check the contents of the file \texttt{#1}. If + it's empty, that means you haven't indexed any of your entries in this + glossary (using commands like \texttt{\string\gls} or + \texttt{\string\glsadd}) so this list can't be generated. + If the file isn't empty, the document build process hasn't been + completed.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningAutoMake} +% Message when \pkgopt{automake} option has been used. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningAutoMake}[1]{% + You may need to rerun \LaTeX. If you already have, it may be that + \TeX's shell escape doesn't allow you to run + \ifglsxindy xindy\else makeindex\fi. Check the + transcript file \texttt{\jobname.log}. If the shell escape is + disabled, try one of the following: + + \begin{itemize} + \item Run the external (Lua) application: + + \texttt{makeglossaries-lite \string"\jobname\string"} + + \item Run the external (Perl) application: + + \texttt{makeglossaries \string"\jobname\string"} + \end{itemize} + + Then rerun \LaTeX\ on this document. + \GlossariesExtraWarning{Rerun required to build the + glossary `#1' or check TeX's shell escape allows + you to run \ifglsxindy xindy\else makeindex\fi}% +} +% \end{macrocode} +%\end{macro} +% +%\changes{0.5.3}{2015-12-09}{removed \cs{GlsXtrNoGlsWarningNoAutoMakeMain}} +% +%\begin{macro}{\GlsXtrNoGlsWarningMisMatch} +% Mismatching \cs{makenoidxglossaries}. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningMisMatch}{% + You need to either replace \texttt{\string\makenoidxglossaries} + with \texttt{\string\makeglossaries} or replace + \texttt{\string\printglossary} (or \texttt{\string\printglossaries}) with + \texttt{\string\printnoidxglossary} + (or \texttt{\string\printnoidxglossaries}) and then rebuild + this document.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningBuildInfo} +% Build advice. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningBuildInfo}{% + Try one of the following: + \begin{itemize} + \item Add \texttt{automake} to your package option list when you load + \texttt{glossaries-extra.sty}. For example: + + \texttt{\string\usepackage[automake]% + \glsopenbrace glossaries-extra\glsclosebrace} + + \item Run the external (Lua) application: + + \texttt{makeglossaries-lite.lua \string"\jobname\string"} + + \item Run the external (Perl) application: + + \texttt{makeglossaries \string"\jobname\string"} + \end{itemize} + + Then rerun \LaTeX\ on this document.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrRecordWarning} +% Paragraph for \pkgopt[only]{record}. +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand{\GlsXtrRecordWarning}[1]{% + \texttt{\string\printglossary} doesn't work + with the \texttt{record=only} package option + use\par\texttt{\string\printunsrtglossary[type=#1]}\par + instead (or change the package option).% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningTail} +% Final paragraph. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningTail}{% + This message will be removed once the problem has been fixed.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningNoOut} +% No out file created. +% Build advice. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningNoOut}[1]{% + The file \texttt{#1} doesn't exist. This most likely means you haven't used + \texttt{\string\makeglossaries} or you have used + \texttt{\string\nofiles}. If this is just a draft version of the + document, you can suppress this message using the + \texttt{nomissingglstext} package option.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@defaultnoglossarywarning} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@defaultnoglossarywarning}[1]{% + \glossarysection[\glossarytoctitle]{\glossarytitle} + \GlsXtrNoGlsWarningHead{#1}{\jobname.\csname @glotype@\@glo@type @in\endcsname} + \par + \glsxtrifemptyglossary{#1}% + {% + \GlsXtrNoGlsWarningEmptyStart\space + \ifthenelse{\equal{#1}{main}}{\GlsXtrNoGlsWarningEmptyMain\par + \medskip + \noindent\texttt{\string\usepackage[nomain\ifglsacronym ,acronym\fi]% + \glsopenbrace glossaries-extra\glsclosebrace} + \medskip + }% + {\GlsXtrNoGlsWarningEmptyNotMain{#1}}% + }% + {% + \IfFileExists{\jobname.\csname @glotype@\@glo@type @out\endcsname} + {% + \GlsXtrNoGlsWarningCheckFile + {\jobname.\csname @glotype@\@glo@type @out\endcsname} + + \ifglsautomake + + \GlsXtrNoGlsWarningAutoMake{#1} + + \else + + \ifthenelse{\equal{#1}{main}}% + {% + \GlsXtrNoGlsWarningEmptyMain\par + \medskip + \noindent\texttt{\string\usepackage[nomain]% + \glsopenbrace glossaries-extra\glsclosebrace} + \medskip + }% + {}% + + \ifdefequal\makeglossaries\@no@makeglossaries + {% + \GlsXtrNoGlsWarningMisMatch + }% + {% + \GlsXtrNoGlsWarningBuildInfo + }% + \fi + }% + {% + \GlsXtrNoGlsWarningNoOut + {\jobname.\csname @glotype@\@glo@type @out\endcsname}% + }% + }% + \par + \GlsXtrNoGlsWarningTail +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@record@noglossarywarning} +%\changes{1.31}{2018-05-09}{new} +%Warn about using \cs{printglossary} with \pkgopt{record} +% \begin{macrocode} +\newcommand*{\@glsxtr@record@noglossarywarning}[1]{% + \GlossariesExtraWarning{\string\printglossary\space doesn't work\MessageBreak + with record=only package option\MessageBreak(use + \string\printunsrtglossary[type=#1])\MessageBreak + instead (or change the package option)}% + \glossarysection[\glossarytoctitle]{\glossarytitle} + \GlsXtrRecordWarning{#1} + \GlsXtrNoGlsWarningTail +} +% \end{macrocode} +%\end{macro} +% +%Provide some commands to accompany the \pkgopt{record} option +%for use with \href{https://github.com/nlct/bib2gls}{bib2gls}. +% +%\begin{macro}{\GlsXtrDefaultResourceOptions} +%\changes{1.40}{2019-03-31}{new} +%Default resource options. +% \begin{macrocode} +\newcommand*{\GlsXtrDefaultResourceOptions}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrresourcefile} +%\changes{1.08}{2016-12-13}{new} +%\changes{1.11}{2017-01-19}{changed extension to .glstex} +%Since it's dangerous for an external application to +%create a file with a .tex extension, as from v1.11 this +%enforces a .glstex extension to avoid conflict. +% \begin{macrocode} +\newcommand*{\glsxtrresourcefile}[2][]{% +% \end{macrocode} +%The \pkgopt{record} option can't be set after this command. +%\changes{1.21}{2017-11-03}{now disables record key} +% \begin{macrocode} + \disable@keys{glossaries-extra.sty}{record}% + \glsxtr@writefields + \ifdefempty\GlsXtrDefaultResourceOptions + {% + \protected@write\@auxout{\glsxtrresourceinit}% + {\string\glsxtr@resource{#1}{#2}}% + }% + {% + \protected@write\@auxout{\glsxtrresourceinit}% + {\string\glsxtr@resource{\GlsXtrDefaultResourceOptions,#1}{#2}}% + }% + \let\@glsxtr@org@see@noindex\@gls@see@noindex + \let\@gls@see@noindex\relax + \IfFileExists{#2.glstex}% + {% +% \end{macrocode} +%Can't scope \cs{@input} so save and restore the category code of +%\texttt{@} to allow for internal commands in the location list. +%\changes{1.12}{2017-02-03}{added catcode change for @} +% \begin{macrocode} + \edef\@bibgls@restoreat{\noexpand\catcode\noexpand`\noexpand\@=\number\catcode`\@}% + \makeatletter + \@input{#2.glstex}% + \@bibgls@restoreat +% \end{macrocode} +% If the \pkgopt[nameref]{record} option has been set, check if this +% is supported by the installed version of \app{bib2gls}. +% \begin{macrocode} + \@glsxtr@check@bibgls@nameref + }% + {% + \GlossariesExtraWarning{No file `#2.glstex'}% + }% + \let\@gls@see@noindex\@glsxtr@org@see@noindex +} +\@onlypreamble\glsxtrresourcefile +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@check@bibgls@nameref} +%\changes{1.37}{2018-11-30}{new} +%This will only warn after \app{bib2gls} has created the .glstex +%file, but there's way to check before. +% \begin{macrocode} +\newcommand{\@glsxtr@check@bibgls@nameref}{% + \ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref + \ifdef\bibglshrefchar + {}% + {% + \GlossariesExtraWarning{record=nameref requires at least + version 1.8 of bib2gls}% + }% + \fi + \let\@glsxtr@check@bibgls@nameref\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrresourceinit} +%\changes{1.21}{2017-11-03}{new} +%Code used during the protected write operation. +% \begin{macrocode} +\newcommand*{\glsxtrresourceinit}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrresourcecount} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcount\glsxtrresourcecount +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsXtrLoadResources} +%\changes{1.11}{2017-01-19}{new} +%\changes{1.12}{2017-02-03}{removed restriction on only one per document} +%Short cut that uses \cs{glsxtrresourcefile} with \cs{jobname} as +%the mandatory argument. +% \begin{macrocode} +\newcommand*{\GlsXtrLoadResources}[1][]{% + \ifnum\glsxtrresourcecount=0\relax + \glsxtrresourcefile[#1]{\jobname}% + \else + \glsxtrresourcefile[#1]{\jobname-\the\glsxtrresourcecount}% + \fi + \advance\glsxtrresourcecount by 1\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@resource} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@resource}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@fields} +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@fields}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@texencoding} +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@texencoding}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@langtag} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@langtag}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@pluralsuffixes} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@pluralsuffixes}[4]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@shortcutsval} +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@shortcutsval}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@linkprefix} +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@linkprefix}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@writefields} +%\changes{1.11}{2017-01-19}{new} +%This information only needs to be written once, so disable it after +%it's been used. +% \begin{macrocode} +\newcommand*{\glsxtr@writefields}{% +% \end{macrocode} +%\changes{1.16}{2017-06-15}{added \cs{providecommand} lines} +% \begin{macrocode} + \protected@write\@auxout{}% + {\string\providecommand*{\string\glsxtr@fields}[1]{}}% + \protected@write\@auxout{}% + {\string\providecommand*{\string\glsxtr@resource}[2]{}}% + \protected@write\@auxout{}% + {\string\providecommand*{\string\glsxtr@pluralsuffixes}[4]{}}% + \protected@write\@auxout{}% + {\string\providecommand*{\string\glsxtr@shortcutsval}[1]{}}% + \protected@write\@auxout{}% + {\string\providecommand*{\string\glsxtr@linkprefix}[1]{}}% + \protected@write\@auxout{}{\string\glsxtr@fields{\@gls@keymap}}% +% \end{macrocode} +%\changes{1.22}{2017-11-08}{provide \cs{glsxtr@record} in aux file} +% \begin{macrocode} + \protected@write\@auxout{}% + {\string\providecommand*{\string\glsxtr@record}[5]{}}% +% \end{macrocode} +%\changes{1.37}{2018-11-30}{provide \cs{glsxtr@record@nameref} in aux file} +% \begin{macrocode} + \ifx\@glsxtr@record@setting\@glsxtr@record@setting@nameref + \protected@write\@auxout{}% + {\string\providecommand*{\string\glsxtr@record@nameref}[8]{}}% + \fi +% \end{macrocode} +%If any languages have been loaded, the language tag will be +%available in \cs{CurrentTrackedLanguageTag} (provided by +%\sty{tracklang}). For multilingual +%documents, the required locale will have to be indicated in the +%"sort" key when using \cs{glsxtrresourcefile}. +% \begin{macrocode} + \ifdef\CurrentTrackedLanguageTag + {% + \protected@write\@auxout{}{% + \string\glsxtr@langtag{\CurrentTrackedLanguageTag}}% + }% + {}% + \protected@write\@auxout{}{\string\glsxtr@pluralsuffixes + {\glspluralsuffix}{\abbrvpluralsuffix}{\acrpluralsuffix}% + {\glsxtrabbrvpluralsuffix}}% + \ifdef\inputencodingname + {% + \protected@write\@auxout{}{\string\glsxtr@texencoding{\inputencodingname}}% + }% + {% +% \end{macrocode} +%If \sty{fontspec} has been loaded, assume UTF-8. (The encoding can +%be changed with \cs{XeTeXinputencoding}, but I can't work out how +%to determine the current encoding.) +% \begin{macrocode} + \@ifpackageloaded{fontspec}% + {\protected@write\@auxout{}{\string\glsxtr@texencoding{utf8}}}% + {}% + }% + \protected@write\@auxout{}{\string\glsxtr@shortcutsval{\@glsxtr@shortcutsval}}% +% \end{macrocode} +%Prefix deferred until the beginning of the document in case it's +%redefined later in the preamble. This is picked up by bib2gls when +%the external option is used. +% \begin{macrocode} + \AtBeginDocument + {\protected@write\@auxout{}{\string\glsxtr@linkprefix{\glolinkprefix}}}% + \let\glsxtr@writefields\relax +% \end{macrocode} +%If the \pkgopt{automake} option is on, try running bib2gls if +%the aux file exists. This has to be done before the aux file is +%opened (so package options \pkgopt[immediate]{automake} and +%\pkgopt[true]{automake} are identical if just bib2gls is used). +%\changes{1.14}{2017-04-18}{added check for automake} +%\changes{1.19}{2017-09-09}{removed double-quotes around \cs{jobname}} +%The double-quotes around \cs{jobname} have been removed (v1.19) +%since \cs{jobname} will include double-quotes if the file name has +%spaces. +% \begin{macrocode} + \ifglsautomake + \IfFileExists{\jobname.aux}% + {\immediate\write18{bib2gls \jobname}}{}% +% \end{macrocode} +%If \cs{makeglossaries} is also used, allow makeindex/xindy to +%also be run, otherwise disable the error message about requiring +%\cs{makeglossaries} with \pkgopt[true]{automake}. +% \begin{macrocode} + \ifx\@gls@doautomake\@gls@doautomake@err + \let\@gls@doautomake\relax + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@do@automake@err} +%\changes{1.14}{2017-04-18}{new} +% \begin{macrocode} +\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.% + }% +} +% \end{macrocode} +%\end{macro} +% +%Allow locations specific to a particular counter to be recorded. +%\begin{macro}{\glsxtr@record} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@record}[5]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@record@nameref} +%\changes{1.37}{2018-11-30}{new} +%Used with \pkgopt[nameref]{record} to include current label +%information. +% \begin{macrocode} +\newcommand*{\glsxtr@record@nameref}[8]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@counterrecord} +%\changes{1.12}{2017-02-03}{new} +%Aux file command. +% \begin{macrocode} +\newcommand*{\glsxtr@counterrecord}[3]{% + \glsxtrfieldlistgadd{#1}{record.#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@counterrecordhook} +%\changes{1.12}{2017-02-03}{new} +%Hook used by \cs{@glsxtr@dorecord}. +% \begin{macrocode} +\newcommand*{\@glsxtr@counterrecordhook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrRecordCounter} +%\changes{1.12}{2017-02-03}{new} +%Activate recording for a particular counter (identified in the +%argument). +% \begin{macrocode} +\newcommand*{\GlsXtrRecordCounter}[1]{% + \@@glsxtr@recordcounter{#1}% +} +\@onlypreamble\GlsXtrRecordCounter +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@docounterrecord} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@docounterrecord}[1]{% + \protected@write\@auxout{}{\string\glsxtr@counterrecord + {\@gls@label}{#1}{\csuse{the#1}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrglossentry} +%Users may prefer to have entries displayed throughout the document +%rather than gathered together in a list. This command emulates +%the way \cs{glossentry} behaves (without the style formatting +%commands like \cs{item}). This needs to define \cs{currentglossary} +%to the current glossary type (normally set at the start of +%\cs{@printglossary}) and needs to define \cs{glscurrententrylabel} +%to the entry's label (normally set before \cs{glossentry} and +%\cs{subglossentry}). This needs some protection in case it's used +%in a section heading. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrglossentry}[1]{% + \glsxtrtitleorpdforheading + {\@glsxtrglossentry{#1}}% + {\glsentryname{#1}}% + {\glsxtrheadname{#1}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrglossentry} +%\changes{1.21}{2017-11-03}{new} +%Another test is needed in case \cs{@glsxtrglossentry} has been +%written to the table of contents. +% \begin{macrocode} +\newrobustcmd*{\@glsxtrglossentry}[1]{% + \glsxtrtitleorpdforheading + {% + \glsdoifexists{#1}% + {% + \begingroup + \edef\glscurrententrylabel{\glsdetoklabel{#1}}% + \edef\currentglossary{\GlsXtrStandaloneGlossaryType}% + \ifglshasparent{#1}% + {\GlsXtrStandaloneSubEntryItem{#1}}% + {\glsentryitem{#1}}% + \GlsXtrStandaloneEntryName{#1}% + \endgroup + }% + }% + {\glsentryname{#1}}% + {\glsxtrheadname{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrStandaloneEntryName} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrStandaloneEntryName}[1]{% + \glstarget{#1}{\glossentryname{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrStandaloneGlossaryType} +%\changes{1.31}{2018-05-09}{new} +%To make it easier to adjust the definition of \cs{currentglossary} +%within \cs{glsxtrglossentry}, this expands to the default +%definition. (If redefined, it must fully expand to the appropriate +%label.) +% \begin{macrocode} +\newcommand{\GlsXtrStandaloneGlossaryType}{\glsentrytype{\glscurrententrylabel}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrStandaloneSubEntryItem} +%\changes{1.31}{2018-05-09}{new} +%Used for sub-entries in standalone format. The argument is the +%entry's label. +% \begin{macrocode} +\newcommand*{\GlsXtrStandaloneSubEntryItem}[1]{% + \GlsXtrIfFieldEqNum{level}{#1}{1}{\glssubentryitem{#1}}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrglossentryother} +%\changes{1.22}{2017-11-08}{new} +%As \cs{glsxtrglossentry} but uses a different field. +%First argument is code to use in the header. The second argument +%is the entry's label. The third argument is the internal field +%label. This needs to be expandable in case it occurs in a +%sectioning command so it can't have an optional argument. +% \begin{macrocode} +\newcommand*{\glsxtrglossentryother}[3]{% + \ifstrempty{#1}% + {% + \ifcsdef{glsxtrhead#3}% + {% + \glsxtrtitleorpdforheading + {\@glsxtrglossentryother{#2}{#3}{#1}}% + {\@gls@entry@field{#2}{#3}}% + {\csuse{glsxtrhead#3}{#2}}% + }% + {% + \glsxtrtitleorpdforheading + {\@glsxtrglossentryother{#2}{#3}{#1}}% + {\@gls@entry@field{#2}{#3}}% + {\@gls@entry@field{\NoCaseChange{#2}}{#3}}% + }% + }% + {% + \glsxtrtitleorpdforheading + {\@glsxtrglossentryother{#2}{#3}{#1}}% + {\@gls@entry@field{#2}{#3}}% + {#1}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtrglossentryother} +%\changes{1.22}{2017-11-08}{new} +%As \cs{@glsxtrglossentry} but uses a different field. +% \begin{macrocode} +\newrobustcmd*{\@glsxtrglossentryother}[3]{% + \glsxtrtitleorpdforheading + {% + \glsdoifexists{#1}% + {% + \begingroup + \edef\glscurrententrylabel{\glsdetoklabel{#1}}% + \edef\currentglossary{\GlsXtrStandaloneGlossaryType}% + \ifglshasparent{#1}% + {\GlsXtrStandaloneSubEntryItem{#1}}% + {\glsentryitem{#1}}% + \GlsXtrStandaloneEntryOther{#1}% + \endgroup + }% + }% + {\@gls@entry@field{#1}{#2}}% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrStandaloneEntryOther} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrStandaloneEntryOther}[2]{% + \glstarget{#1}{\glossentrynameother{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossary} +%\changes{1.08}{2016-12-13}{new} +%\changes{1.12}{2017-02-03}{added starred form} +%Similar to \cs{printnoidxglossary} but it displays all entries +%defined for the given glossary without sorting. +% \begin{macrocode} +\newcommand*{\printunsrtglossary}{% + \@ifstar\s@printunsrtglossary\@printunsrtglossary +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@printunsrtglossary} +%\changes{1.12}{2017-02-03}{new} +%Unstarred version. +% \begin{macrocode} +\newcommand*{\@printunsrtglossary}[1][]{% + \@printglossary{type=\glsdefaulttype,#1}{\@print@unsrt@glossary}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@printunsrtglossary} +%\changes{1.12}{2017-02-03}{new} +%Starred version. +% \begin{macrocode} +\newcommand*{\s@printunsrtglossary}[2][]{% + \begingroup + #2% + \@printglossary{type=\glsdefaulttype,#1}{\@print@unsrt@glossary}% + \endgroup +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaries} +%\changes{1.08}{2016-12-13}{new} +%Similar to \cs{printnoidxglossaries} but it displays all entries +%defined for the given glossary without sorting. +% \begin{macrocode} +\newcommand*{\printunsrtglossaries}{% + \forallglossaries{\@@glo@type}{\printunsrtglossary[type=\@@glo@type]}% +} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\@print@unsrt@glossary} +%\changes{1.08}{2016-12-13}{new} +% \begin{macrocode} +\newcommand*{\@print@unsrt@glossary}{% + \glossarysection[\glossarytoctitle]{\glossarytitle}% + \glossarypreamble +% \end{macrocode} +%check for empty list +% \begin{macrocode} + \glsxtrifemptyglossary{\@glo@type}% + {% + \GlossariesExtraWarning{No entries defined in glossary `\@glo@type'}% + }% + {% +% \end{macrocode} +%\changes{1.16}{2017-06-15}{corrected misspelt command} +% \begin{macrocode} + \key@ifundefined{glossentry}{group}% + {\let\@gls@getgrouptitle\@gls@noidx@getgrouptitle}% + {\let\@gls@getgrouptitle\@glsxtr@unsrt@getgrouptitle}% + \def\@gls@currentlettergroup{}% +% \end{macrocode} +%A loop within the tabular-like styles can cause problems, so +%move the loop outside. +% \begin{macrocode} + \def\@glsxtr@doglossary{% + \begin{theglossary}% + \glossaryheader + \glsresetentrylist + }% + \expandafter\@for\expandafter\glscurrententrylabel\expandafter + :\expandafter=\csname glolist@\@glo@type\endcsname\do{% + \ifdefempty{\glscurrententrylabel} + {}% + {% +% \end{macrocode} +%Provide a hook (for example to measure width). +% \begin{macrocode} + \let\glsxtr@process\@firstofone + \let\printunsrtglossaryskipentry + \@glsxtr@printunsrtglossaryskipentry + \printunsrtglossaryentryprocesshook{\glscurrententrylabel}% +% \end{macrocode} +%Don't check group for child entries. +% \begin{macrocode} + \glsxtr@process + {% + \ifglshasparent{\glscurrententrylabel}{}% + {% + \@glsxtr@checkgroup\glscurrententrylabel + \expandafter\appto\expandafter\@glsxtr@doglossary\expandafter + {\@glsxtr@groupheading}% + }% + \eappto\@glsxtr@doglossary{% + \noexpand\@printunsrt@glossary@handler{\glscurrententrylabel}}% + }% + }% + }% + \appto\@glsxtr@doglossary{\end{theglossary}}% + \printunsrtglossarypredoglossary + \@glsxtr@doglossary + }% + \glossarypostamble +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaryentryprocesshook} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\printunsrtglossaryentryprocesshook}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaryskipentry} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\printunsrtglossaryskipentry}{% + \PackageError{glossaries-extra}{\string\printunsrtglossaryskipentry\space +can only be used within \string\printunsrtglossaryentryprocesshook}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaryentryprocesshook} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@printunsrtglossaryskipentry}{% + \let\glsxtr@process\@gobble +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossarypredoglossary} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\printunsrtglossarypredoglossary}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@printunsrt@glossary@handler} +%\changes{1.16}{2017-06-15}{new} +% \begin{macrocode} +\newcommand{\@printunsrt@glossary@handler}[1]{% + \xdef\glscurrententrylabel{#1}% + \printunsrtglossaryhandler\glscurrententrylabel +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaryhandler} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\printunsrtglossaryhandler}[1]{% + \glsxtrunsrtdo{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtriflabelinlist} +%\begin{definition} +%\cs{glsxtriflabelinlist}\marg{label}\marg{list}\marg{true}\marg{false} +%\end{definition} +%\changes{1.21}{2017-11-03}{new} +%Might be useful for the handler to check if an entry label +%or category label is contained in a list, so provide a user-level +%version of \cs{@gls@ifinlist} which ensures the label and list are +%fully expanded. +% \begin{macrocode} +\newrobustcmd*{\glsxtriflabelinlist}[4]{% + \protected@edef\@glsxtr@doiflabelinlist{\noexpand\@gls@ifinlist{#1}{#2}}% + \@glsxtr@doiflabelinlist{#3}{#4}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\print@op@unsrtglossaryunit} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\print@op@unsrtglossaryunit}[2][]{% + \s@printunsrtglossary[type=\glsdefaulttype,#1]{% + \printunsrtglossaryunitsetup{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtglossaryunitsetup} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\printunsrtglossaryunitsetup}[1]{% + \renewcommand{\printunsrtglossaryhandler}[1]{% + \glsxtrfieldxifinlist{##1}{record.#1}{\csuse{the#1}} + {\glsxtrunsrtdo{##1}}% + {}% + }% +% \end{macrocode} +%\changes{1.20}{2017-09-11}{switched from redefining \cs{glolinkprefix} to +% \cs{@glsxtrhypernameprefix}} +%Only the target names should have the prefixes adjusted as \cs{gls} +%etc need the original \cs{glolinkprefix}. The \cs{@gobble} part +%discards \cs{glolinkprefix}. +% \begin{macrocode} + \ifcsundef{theH#1}% + {% + \renewcommand*{\@glsxtrhypernameprefix}{record.#1.\csuse{the#1}.\@gobble}% + }% + {% + \renewcommand*{\@glsxtrhypernameprefix}{record.#1.\csuse{theH#1}.\@gobble}% + }% + \renewcommand*{\glossarysection}[2][]{}% + \appto\glossarypostamble{\glspar\medskip\glspar}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\print@noop@unsrtglossaryunit} +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand{\print@noop@unsrtglossaryunit}[2][]{% + \PackageError{glossaries-extra}{\string\printunsrtglossaryunit\space + requires the record=only or record=alsoindex package option}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@unsrt@getgrouptitle} +%\changes{1.11}{2017-01-19}{new} +% \begin{macrocode} +\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}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrunsrtdo} +%\changes{1.12}{2017-02-03}{new} +%Provide a user-level call to \cs{@glsxtr@noidx@do} to make it +%easier to define a new handler. +% \begin{macrocode} +\newcommand{\glsxtrunsrtdo}{\@glsxtr@noidx@do} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrgroupfield} +%\app{bib2gls} provides a supplementary field labelled +%\texttt{secondarygroup} for secondary glossaries, so +%provide a way of switching to that field. (The \gloskey{group} +%key still needs checking. There's no associated key with the +%internal field). +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrgroupfield}{group} +% \end{macrocode} +%\end{macro} +% +%The \env{tabular}-like glossary styles cause quite a problem +%with the iterative approach. In particular for the group skip. +%To compensate for this, the groups are now determined while +%\cs{@glsxtr@doglossary} is being constructed rather than in the +%handler. +%\begin{macro}{\@glsxtr@checkgroup} +%\changes{1.21}{2017-11-03}{new} +%The argument is the entry's label. (This block of code was +%formerly in \cs{@glsxtr@noidx@do}.) Now that this is no longer +%within a tabular environment, the global definitions aren't needed. +%The result is now stored in \cs{@glsxtr@groupheading}, which will +%be empty if no heading is required. +% \begin{macrocode} +\newcommand*{\@glsxtr@checkgroup}[1]{% + \def\@glsxtr@groupheading{}% + \key@ifundefined{glossentry}{group}% + {% + \letcs{\@gls@sort}{glo@\glsdetoklabel{#1}@sort}% + \expandafter\glo@grabfirst\@gls@sort{}{}\@nil + }% + {% +% \end{macrocode} +%\changes{1.16}{2017-06-15}{use \cs{csuse} instead of \cs{csname}} +% \begin{macrocode} + \protected@edef\@glo@thislettergrp{% + \csuse{glo@\glsdetoklabel{#1}@\glsxtrgroupfield}}% + }% + \ifdefequal{\@glo@thislettergrp}{\@gls@currentlettergroup}% + {}% + {% + \ifdefempty{\@gls@currentlettergroup}{}% + {\def\@glsxtr@groupheading{\glsgroupskip}}% + \eappto\@glsxtr@groupheading{% + \noexpand\glsgroupheading{\expandonce\@glo@thislettergrp}% + }% + }% + \let\@gls@currentlettergroup\@glo@thislettergrp +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLocationField} +%\changes{1.37}{2018-11-30}{new} +%Stores the internal name of the location field. +% \begin{macrocode} +\newcommand*{\GlsXtrLocationField}{location} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@noidx@do} +%\changes{1.11}{2017-01-19}{new} +%Minor modification of \cs{@gls@noidx@do} to check for location +%field if present, but also need to check for the \gloskey{group} +%field. +% \begin{macrocode} +\newcommand{\@glsxtr@noidx@do}[1]{% + \ifglsentryexists{#1}% + {% + \global\letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}% + \global\letcs{\@gls@location}{glo@\glsdetoklabel{#1}@\GlsXtrLocationField}% + \ifglshasparent{#1}% + {% + \gls@level=\csuse{glo@\glsdetoklabel{#1}@level}\relax + \ifdefvoid{\@gls@location}% + {% + \ifdefvoid{\@gls@loclist}% + {% + \subglossentry{\gls@level}{#1}{}% + }% + {% + \subglossentry{\gls@level}{#1}% + {% + \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}% + }% + }% + }% + {% + \subglossentry{\gls@level}{#1}{\glossaryentrynumbers{\@gls@location}}% + }% + }% + {% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{removed code dealing with the group} +% \begin{macrocode} + \ifdefvoid{\@gls@location}% + {% + \ifdefvoid{\@gls@loclist} + {% + \glossentry{#1}{}% + }% + {% + \glossentry{#1}% + {% + \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}% + }% + }% + }% + {% + \glossentry{#1}% + {% + \glossaryentrynumbers{\@gls@location}% + }% + }% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%Provide a way to conveniently define commands that behaves like +%\cs{gls} with a label prefix. +% +%It's possible that the user might want minor variations +%with the same prefix but different default options, so +%use a counter to provide unique inner commands. +%\begin{macro}{\glsxtrnewgls} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcount\@glsxtrnewgls@inner +% \end{macrocode} +%\end{macro} +%(The default options supplied in \meta{options} below +%could possibly be used to form the inner control sequence name to +%help make it unique, but it might feasibly contain +%\gloskey[glslink]{thevalue} where the value might contain commands.) +% +%\begin{macro}{\@glsxtr@providenewgls} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@providenewgls}{% + \protected@write\@auxout{}{\string\providecommand{\string\@glsxtr@newglslike}[2]{}}% + \let\@glsxtr@providenewgls\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtridentifyglslike} +%\changes{1.37}{2018-11-30}{new} +%Identify the command given in the second argument for the benefit +%of \gls{bib2gls}. +% \begin{macrocode} +\newcommand{\glsxtridentifyglslike}[2]{% + \ifdefequal\@glsxtr@record@setting\@glsxtr@record@setting@off + {}% + {% + \@glsxtr@providenewgls + \protected@write\@auxout{}{\string\@glsxtr@newglslike{#1}{\string#2}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrnewgls} +%\changes{1.21}{2017-11-03}{new} +%\begin{definition} +%\cs{glsxtrnewgls}\oarg{options}\marg{prefix}\marg{cs}\marg{inner cs +%name} +%\end{definition} +% +% \begin{macrocode} +\newcommand*{\@glsxtrnewgls}[4]{% + \ifdef{#3}% + {% + \PackageError{glossaries-extra}{Command \string#3\space already +defined}{}% + }% + {% +% \end{macrocode} +%Write information to the aux file for bib2gls. +% \begin{macrocode} + \glsxtridentifyglslike{#2}{#3}% + \ifcsdef{@#4like@#2}% + {% + \advance\@glsxtrnewgls@inner by \@ne + \def\@glsxtrnewgls@innercsname{@#4like\number\@glsxtrnewgls@inner @#2}% + }% + {\def\@glsxtrnewgls@innercsname{@#4like@#2}}% + \expandafter\newrobustcmd\expandafter*\expandafter + #3\expandafter{\expandafter\@gls@hyp@opt\csname\@glsxtrnewgls@innercsname\endcsname}% + \ifstrempty{#1}% + {% + \expandafter\newcommand\expandafter*\csname\@glsxtrnewgls@innercsname\endcsname[2][]{% + \new@ifnextchar[% + {\csname @#4@\endcsname{##1}{#2##2}}% + {\csname @#4@\endcsname{##1}{#2##2}[]}% + }% + }% + {% + \expandafter\newcommand\expandafter*\csname\@glsxtrnewgls@innercsname\endcsname[2][]{% + \new@ifnextchar[% + {\csname @#4@\endcsname{#1,##1}{#2##2}}% + {\csname @#4@\endcsname{#1,##1}{#2##2}[]}% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewgls} +%\begin{definition} +%\cs{glsxtrnewgls}\oarg{options}\marg{prefix}\marg{cs} +%\end{definition} +%The first argument prepends to the options and the second argument is the prefix. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrnewgls}[3][]{% + \@glsxtrnewgls{#1}{#2}{#3}{gls}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewglslike} +%Provide a way to conveniently define commands that behave like +%\cs{gls}, \cs{glspl}, \cs{Gls} and \cs{Glspl} with a label prefix. +%The first argument prepends to the options and the second argument is the prefix. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrnewglslike}[6][]{% + \@glsxtrnewgls{#1}{#2}{#3}{gls}% + \@glsxtrnewgls{#1}{#2}{#4}{glspl}% + \@glsxtrnewgls{#1}{#2}{#5}{Gls}% + \@glsxtrnewgls{#1}{#2}{#6}{Glspl}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewGLSlike} +%Provide a way to conveniently define commands that behave like +%\cs{GLS}, \cs{GLSpl} with a label prefix. +%The first argument prepends to the options and the second argument is the prefix. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrnewGLSlike}[4][]{% + \@glsxtrnewgls{#1}{#2}{#3}{GLS}% + \@glsxtrnewgls{#1}{#2}{#4}{GLSpl}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewrgls} +%As \cs{glsxtrnewgls} but for \cs{rgls}. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrnewrgls}[3][]{% + \@glsxtrnewgls{#1}{#2}{#3}{rgls}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewrglslike} +%As \cs{glsxtrnewglslike} but for \cs{rgls} etc. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrnewrglslike}[6][]{% + \@glsxtrnewgls{#1}{#2}{#3}{rgls}% + \@glsxtrnewgls{#1}{#2}{#4}{rglspl}% + \@glsxtrnewgls{#1}{#2}{#5}{rGls}% + \@glsxtrnewgls{#1}{#2}{#6}{rGlspl}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewrGLSlike} +%\changes{1.21}{2017-11-03}{new} +%As \cs{glsxtrnewGLSlike} but for \cs{rGLS} etc. +% \begin{macrocode} +\newrobustcmd*{\glsxtrnewrGLSlike}[4][]{% + \@glsxtrnewgls{#1}{#2}{#3}{rGLS}% + \@glsxtrnewgls{#1}{#2}{#4}{rGLSpl}% +} +% \end{macrocode} +%\end{macro} +% +%Provide easy access to record count fields. +%\begin{macro}{\GlsXtrTotalRecordCount} +%\changes{1.21}{2017-11-03}{new} +%Access total record count. This is designed to +%be expandable. The argument is the label. +% \begin{macrocode} +\newcommand*{\GlsXtrTotalRecordCount}[1]{% + \ifcsdef{glo@\glsdetoklabel{#1}@recordcount}% + {\csname glo@\glsdetoklabel{#1}@recordcount\endcsname}% + {0}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsXtrRecordCount} +%\changes{1.21}{2017-11-03}{new} +%Access record count for a particular counter. The first argument is the label. +%The second argument is the counter name. +% \begin{macrocode} +\newcommand*{\GlsXtrRecordCount}[2]{% + \ifcsdef{glo@\glsdetoklabel{#1}@recordcount.#2}% + {\csname glo@\glsdetoklabel{#1}@recordcount.#2\endcsname}% + {0}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLocationRecordCount} +%\changes{1.21}{2017-11-03}{new} +%Access record count for a particular counter and location. +%The first argument is the label. +%The second argument is the counter name. +%The third argument is the location. +%This command shouldn't be used if the location doesn't fully +%expand unless \cs{glsxtrdetoklocation} can be set to something +%sensible. +% \begin{macrocode} +\newcommand*{\GlsXtrLocationRecordCount}[3]{% + \ifcsdef{glo@\glsdetoklabel{#1}@recordcount.#2.\glsxtrdetoklocation{#3}}% + {\csname glo@\glsdetoklabel{#1}@recordcount.#2.\glsxtrdetoklocation{#3}\endcsname}% + {0}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdetoklocation} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrdetoklocation}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrenablerecordcount} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrenablerecordcount}{% + \renewcommand*{\gls}{\rgls}% + \renewcommand*{\Gls}{\rGls}% + \renewcommand*{\glspl}{\rglspl}% + \renewcommand*{\Glspl}{\rGlspl}% + \renewcommand*{\GLS}{\rGLS}% + \renewcommand*{\GLSpl}{\rGLSpl}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrrecordtriggervalue} +%\changes{1.21}{2017-11-03}{new} +%The value used by the record trigger test. +%The argument is the entry's label. +% \begin{macrocode} +\newcommand*{\glsxtrrecordtriggervalue}[1]{% + \GlsXtrTotalRecordCount{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetRecordCountAttribute} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrSetRecordCountAttribute}[2]{% + \@for\@glsxtr@cat:=#1\do + {% + \ifdefempty{\@glsxtr@cat}{}% + {% + \glssetcategoryattribute{\@glsxtr@cat}{recordcount}{#2}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifrecordtrigger} +%\begin{definition} +%\cs{glsxtrifrecordtrigger}\marg{label}\marg{trigger format}\marg{normal} +%\end{definition} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrifrecordtrigger}[3]{% + \glshasattribute{#1}{recordcount}% + {% + \ifnum\glsxtrrecordtriggervalue{#1}>\glsgetattribute{#1}{recordcount}\relax + #3% + \else + #2% + \fi + }% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@rglstrigger@record} +%\changes{1.21}{2017-11-03}{new} +%Still need a record to ensure that \app{bib2gls} selects the entry. +% \begin{macrocode} +\newcommand*{\@glsxtr@rglstrigger@record}[3]{% + \edef\glslabel{\glsdetoklabel{#2}}% + \let\@gls@link@label\glslabel + \def\@glsxtr@thevalue{}% + \def\@glsxtr@theHvalue{\@glsxtr@thevalue}% + \def\@glsnumberformat{glstriggerrecordformat}% + \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}% + \edef\glstype{\csname glo@\glslabel @type\endcsname}% + \def\@glsxtr@thevalue{}% + \def\@glsxtr@theHvalue{\@glsxtr@thevalue}% + \glsxtrinitwrgloss + \glslinkpresetkeys + \setkeys{glslink}{#1}% + \glslinkpostsetkeys + \ifdefempty{\@glsxtr@thevalue}% + {% + \@gls@saveentrycounter + }% + {% + \let\theglsentrycounter\@glsxtr@thevalue + \def\theHglsentrycounter{\@glsxtr@theHvalue}% + }% + \ifglsxtrinitwrglossbefore + \@do@wrglossary{#2}% + \fi + #3% + \ifglsxtrinitwrglossbefore + \else + \@do@wrglossary{#2}% + \fi + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstriggerrecordformat} +%\changes{1.21}{2017-11-03}{new} +%Typically won't be used as it should be recognised as a special +%type of ignored location by \app{bib2gls}. +% \begin{macrocode} +\newcommand*{\glstriggerrecordformat}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rgls} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\rgls}{\@gls@hyp@opt\@rgls} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rgls} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@rgls}[2][]{% + \new@ifnextchar[{\@rgls@{#1}{#2}}{\@rgls@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rgls@} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\def\@rgls@#1#2[#3]{% + \glsxtrifrecordtrigger{#2}% + {% + \@glsxtr@rglstrigger@record{#1}{#2}{\rglsformat{#2}{#3}}% + }% + {% + \@gls@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rglspl} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\rglspl}{\@gls@hyp@opt\@rglspl} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rglspl} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@rglspl}[2][]{% + \new@ifnextchar[{\@rglspl@{#1}{#2}}{\@rglspl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@rglspl@} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\def\@rglspl@#1#2[#3]{% + \glsxtrifrecordtrigger{#2}% + {% + \@glsxtr@rglstrigger@record{#1}{#2}{\rglsplformat{#2}{#3}}% + }% + {% + \@glspl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGls} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\rGls}{\@gls@hyp@opt\@rGls} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rGls} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@rGls}[2][]{% + \new@ifnextchar[{\@rGls@{#1}{#2}}{\@rGls@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rGls@} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\def\@rGls@#1#2[#3]{% + \glsxtrifrecordtrigger{#2}% + {% + \@glsxtr@rglstrigger@record{#1}{#2}{\rGlsformat{#2}{#3}}% + }% + {% + \@Gls@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGlspl} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\rGlspl}{\@gls@hyp@opt\@rGlspl} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rGlspl} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@rGlspl}[2][]{% + \new@ifnextchar[{\@rGlspl@{#1}{#2}}{\@rGlspl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@rGlspl@} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\def\@rGlspl@#1#2[#3]{% + \glsxtrifrecordtrigger{#2}% + {% + \@glsxtr@rglstrigger@record{#1}{#2}{\rGlsplformat{#2}{#3}}% + }% + {% + \@Glspl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGLS} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\rGLS}{\@gls@hyp@opt\@rGLS} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rGLS} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@rGLS}[2][]{% + \new@ifnextchar[{\@rGLS@{#1}{#2}}{\@rGLS@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@rGLS@} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\def\@rGLS@#1#2[#3]{% + \glsxtrifrecordtrigger{#2}% + {% + \@glsxtr@rglstrigger@record{#1}{#2}{\rGLSformat{#2}{#3}}% + }% + {% + \@GLS@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGLSpl} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\rGLSpl}{\@gls@hyp@opt\@rGLSpl} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@rGLSpl} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\@rGLSpl}[2][]{% + \new@ifnextchar[{\@rGLSpl@{#1}{#2}}{\@rGLSpl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@rGLSpl@} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\def\@rGLSpl@#1#2[#3]{% + \glsxtrifrecordtrigger{#2}% + {% + \@glsxtr@rglstrigger@record{#1}{#2}{\rGLSplformat{#2}{#3}}% + }% + {% + \@GLSpl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rglsformat} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\rglsformat}[2]{% + \glsifregular{#1} + {\glsentryfirst{#1}}% + {\ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rglsplformat} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\rglsplformat}[2]{% + \glsifregular{#1} + {\glsentryfirstplural{#1}}% + {\ifglshaslong{#1}{\glsentrylongplural{#1}}{\glsentryfirstplural{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGlsformat} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\rGlsformat}[2]{% + \glsifregular{#1} + {\Glsentryfirst{#1}}% + {\ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGlsplformat} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\rGlsplformat}[2]{% + \glsifregular{#1} + {\Glsentryfirstplural{#1}}% + {\ifglshaslong{#1}{\Glsentrylongplural{#1}}{\Glsentryfirstplural{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGLSformat} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\rGLSformat}[2]{% + \expandafter\mfirstucMakeUppercase\expandafter{\rglsformat{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\rGLSplformat} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\rGLSplformat}[2]{% + \expandafter\mfirstucMakeUppercase\expandafter{\rglsplformat{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\section{Link Counting} +%\label{sec:linkcount} +%This is different to the entry counting provided by the base +%package (which counts the number of times the first use flag is +%unset). Instead, this method hooks into \cs{@gls@link} (through +%\cs{glsxtr@inc@linkcount}) to increment an associated counter. +%To preserve resources, the counter is only defined if it needs to +%be incremented. This method is independent of the presence of +%hyperlinks. (The \qt{link} part of the name refers to \cs{@gls@link} +%not \cs{hyperlink}.) +% +%\begin{macro}{\@glsxtr@do@inc@linkcount} +%\changes{1.26}{2018-01-05}{new} +%This performs the actual incrementing and counter definition. +%The counter is given by \cs{c@glsxtr@linkcount@\meta{label}} where +%\meta{label} is the entry's label. Since this is performed within +%\cs{@gls@link} the label can be accessed with \cs{glslabel}. +% \begin{macrocode} +\newcommand{\@glsxtr@do@inc@linkcount}{% +% \end{macrocode} +%Does this entry have the \catattr{linkcount} attribute set? +% \begin{macrocode} + \glsifattribute{\glslabel}{linkcount}{true}% + {% +% \end{macrocode} +%Does the counter exist? +% \begin{macrocode} + \ifcsdef{c@glsxtr@linkcount@\glslabel}{}% + {% +% \end{macrocode} +%Counter doesn't exist, so define it. +% \begin{macrocode} + \newcounter{glsxtr@linkcount@\glslabel}% +% \end{macrocode} +%If \catattr{linkcountmaster} is set, add to counter reset. +% \begin{macrocode} + \glshasattribute{\glslabel}{linkcountmaster}% + {% +% \end{macrocode} +%Need to ensure values are fully expanded. +% \begin{macrocode} + \begingroup + \edef\x{\endgroup\noexpand\@addtoreset{glsxtr@linkcount@\glslabel}% + {\glsgetattribute{\glslabel}{linkcountmaster}}}% + \x + }% + {}% + }% +% \end{macrocode} +% Increment counter: +% \begin{macrocode} + \glsxtrinclinkcounter{glsxtr@linkcount@\glslabel}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrinclinkcounter} +%\changes{1.26}{2018-01-05}{new} +%May be redefined to use \cs{refstepcounter} if required. +% \begin{macrocode} +\newcommand*{\glsxtrinclinkcounter}[1]{\stepcounter{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLinkCounterValue} +%\changes{1.26}{2018-01-05}{new} +%Expands to the associated link counter register or 0 if not +%defined. +% \begin{macrocode} +\newcommand*{\GlsXtrLinkCounterValue}[1]{% + \ifcsundef{c@glsxtr@linkcount@#1}{0}{\csname c@glsxtr@linkcount@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrTheLinkCounter} +%\changes{1.26}{2018-01-05}{new} +%Expands to the display value of the associated link counter or 0 if not +%defined. +% \begin{macrocode} +\newcommand*{\GlsXtrTheLinkCounter}[1]{% + \ifcsundef{theglsxtr@linkcount@#1}{0}% + {\csname theglsxtr@linkcount@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfLinkCounterDef} +%\changes{1.26}{2018-01-05}{new} +%Tests if the counter has been defined +% \begin{macrocode} +\newcommand*{\GlsXtrIfLinkCounterDef}[3]{% + \ifcsundef{theglsxtr@linkcount@#1}{#3}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrLinkCounterName} +%\changes{1.26}{2018-01-05}{new} +%Expands to the associated link counter name. (No check for +%existence.) +% \begin{macrocode} +\newcommand*{\GlsXtrLinkCounterName}[1]{glsxtr@linkcount@#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrEnableLinkCounting} +%\changes{1.26}{2018-01-05}{new} +%\begin{definition} +%\cs{GlsXtrEnableLinkCounting}\oarg{master counter}\marg{categories} +%\end{definition} +%Enable link counting for the given categories. +% \begin{macrocode} +\newcommand*{\GlsXtrEnableLinkCounting}[2][]{% + \let\glsxtr@inc@linkcount\@glsxtr@do@inc@linkcount + \@for\@glsxtr@label:=#2\do + {% + \glssetcategoryattribute{\@glsxtr@label}{linkcount}{true}% + \ifstrempty{#1}{}% + {% + \ifcsundef{c@#1}% + {\@nocounterr{#1}}% + {\glssetcategoryattribute{\@glsxtr@label}{linkcountmaster}{#1}}% + }% + }% +} +\@onlypreamble\GlsXtrEnableLinkCounting +% \end{macrocode} +%\end{macro} +% +%\section{Integration with glossaries-accsupp} +% Provide better integration with the \sty{glossaries-accsupp} +% package. (Must be loaded before the main code of +% \styfmt{glossaries-extra} either explicitly or through the +% \pkgopt{accsupp} package option.) +% +% These commands have their definitions set according to whether +% or not \styfmt{glossaries-extra} has been loaded. +%\changes{0.5.2}{2015-12-08}{fixed typo in glossaries-accsupp and tidied up code to use +% just one \cs{@ifpackageloaded}} +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ +% \end{macrocode} +% Define (or redefine) commands to use the accessibility +% information. +%\begin{macro}{\glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessname}[1]{% + \glsnameaccessdisplay + {% + \glsentryname{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessname}[1]{% + \glsnameaccessdisplay + {% + \Glsentryname{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessname} +% Display the \gloskey{name} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessname}[1]{% + \glsnameaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryname{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesstext}[1]{% + \glstextaccessdisplay + {% + \glsentrytext{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\Glsaccesstext}[1]{% + \glstextaccessdisplay + {% + \Glsentrytext{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesstext} +% Display the \gloskey{text} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesstext}[1]{% + \glstextaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrytext{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessplural}[1]{% + \glspluralaccessdisplay + {% + \glsentryplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessplural}[1]{% + \glspluralaccessdisplay + {% + \Glsentryplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessplural}[1]{% + \glspluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessfirst}[1]{% + \glsfirstaccessdisplay + {% + \glsentryfirst{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessfirst}[1]{% + \glsfirstaccessdisplay + {% + \Glsentryfirst{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirst}[1]{% + \glsfirstaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryfirst{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessfirstplural}[1]{% + \glsfirstpluralaccessdisplay + {% + \glsentryfirstplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessfirstplural}[1]{% + \glsfirstpluralaccessdisplay + {% + \Glsentryfirstplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirstplural}[1]{% + \glsfirstpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryfirstplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesssymbol}[1]{% + \glssymbolaccessdisplay + {% + \glsentrysymbol{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccesssymbol}[1]{% + \glssymbolaccessdisplay + {% + \Glsentrysymbol{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbol}[1]{% + \glssymbolaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrysymbol{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesssymbolplural}[1]{% + \glssymbolpluralaccessdisplay + {% + \glsentrysymbolplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccesssymbolplural}[1]{% + \glssymbolpluralaccessdisplay + {% + \Glsentrysymbolplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbolplural}[1]{% + \glssymbolpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrysymbolplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessdesc}[1]{% + \glsdescriptionaccessdisplay + {% + \glsentrydesc{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessdesc}[1]{% + \glsdescriptionaccessdisplay + {% + \Glsentrydesc{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdesc}[1]{% + \glsdescriptionaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrydesc{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessdescplural}[1]{% + \glsdescriptionpluralaccessdisplay + {% + \glsentrydescplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessdescplural}[1]{% + \glsdescriptionpluralaccessdisplay + {% + \Glsentrydescplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdescplural}[1]{% + \glsdescriptionpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrydescplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshort} +% Display the short form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessshort}[1]{% + \glsshortaccessdisplay + {% + \glsentryshort{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshort} +% Display the short form with first letter converted to uppercase +% (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessshort}[1]{% + \glsshortaccessdisplay + {% + \Glsentryshort{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshort} +% Display the \gloskey{short} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshort}[1]{% + \glsshortaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryshort{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshortpl} +% Display the short plural form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessshortpl}[1]{% + \glsshortpluralaccessdisplay + {% + \glsentryshortpl{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshortpl} +% Display the short plural form with first letter converted to +% uppercase (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessshortpl}[1]{% + \glsshortpluralaccessdisplay + {% + \Glsentryshortpl{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshortpl} +% Display the \gloskey{shortplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshortpl}[1]{% + \glsshortpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryshortpl{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslong} +% Display the long form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesslong}[1]{% + \glslongaccessdisplay{\glsentrylong{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslong} +% Display the long form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + + \newcommand*{\Glsaccesslong}[1]{% + \glslongaccessdisplay{\Glsentrylong{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslong} +% Display the \gloskey{long} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslong}[1]{% + \glslongaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrylong{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\glsaccesslongpl}[1]{% + \glslongpluralaccessdisplay{\glsentrylongpl{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + + \newcommand*{\Glsaccesslongpl}[1]{% + \glslongpluralaccessdisplay{\Glsentrylongpl{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslongpl} +% Display the \gloskey{longplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslongpl}[1]{% + \glslongpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrylongpl{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +% Keys for accessibility support. +% \begin{macrocode} + \define@key{glsxtrabbrv}{access}{% + \def\@gls@nameaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{textaccess}{% + \def\@gls@textaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{firstaccess}{% + \def\@gls@firstaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{shortaccess}{% + \def\@gls@shortaccess{#1}% + } +% \end{macrocode} +% +% \begin{macrocode} + \define@key{glsxtrabbrv}{shortpluralaccess}{% + \def\@gls@shortaccesspl{#1}% + } +% \end{macrocode} +%\begin{macro}{\@gls@initaccesskeys} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand*{\@gls@initaccesskeys}{% + \def\@gls@nameaccess{}% + \def\@gls@textaccess{}% + \def\@gls@firstaccess{}% + \def\@gls@shortaccess{}% + \def\@gls@shortaccesspl{}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@ifaccessattribute@set} +%\begin{definition} +%\cs{\@gls@ifaccessattribute@set}\marg{attribute}\marg{true}\marg{false} +%\end{definition} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand*{\@gls@ifaccessattribute@set}[3]{% + \glsifcategoryattribute{\glscategorylabel}{access#1}{true}% + {#2}% + {% + \glsifcategoryattribute{\glscategorylabel}{access#1}{false}% + {#3}% + {% + \glsifcategoryattribute{\glscategorylabel}{#1}{true}% + {#2}% + {#3}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setup@default@short@access} +%\changes{1.31}{2018-05-09}{new} +%Assign the default value of the \gloskey{shortaccess} key. The +%argument is the short value passed to \cs{newabbreviation}. +% \begin{macrocode} + \newcommand{\@gls@setup@default@short@access}[1]{% +% \end{macrocode} +%Check if the \catattr{accessinsertdots} attribute has been set but +%only if \gloskey{shortaccess} hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {% + \glsifcategoryattribute{\glscategorylabel}{accessinsertdots}{true}% + {% + \@glsxtr@insertdots\@gls@shortaccess{#1}% + \eappto\ExtraCustomAbbreviationFields{% + shortaccess={\expandonce\@gls@shortaccess},}% + }% + {}% + }% + {}% +% \end{macrocode} +%If the \gloskey{shortaccess} field has been set but +%\gloskey{shortaccessplural} hasn't been set, assign plural form. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \ifdefempty\@gls@shortaccesspl + {% + \@gls@ifaccessattribute@set{aposplural}% + {% + \expandafter\def\expandafter\@gls@shortaccesspl\expandafter{% + \@gls@shortaccess'\abbrvpluralsuffix}% + }% + {% + \@gls@ifaccessattribute@set{noshortplural}% + {% + \let\@gls@shortaccesspl\@gls@shortaccess + }% + {% + \expandafter\def\expandafter\@gls@shortaccesspl\expandafter{% + \@gls@shortaccess\abbrvpluralsuffix}% + }% + }% + \eappto\ExtraCustomAbbreviationFields{% + shortpluralaccess={\expandonce\@gls@shortaccesspl},}% + }% + {}% + }% +% \end{macrocode} +%If \gloskey{access} key hasn't been set, check if the +%\catattr{nameshortaccess} attribute has been set. +% \begin{macrocode} + \ifdefempty\@gls@nameaccess + {% + \glsifcategoryattribute{\glscategorylabel}{nameshortaccess}{true}% + {% +% \end{macrocode} +%Do nothing if the \gloskey{shortaccess} key hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \eappto\ExtraCustomAbbreviationFields{% + access={\expandonce\@gls@shortaccess},% + }% + }% + }% + {}% + }% + {}% +% \end{macrocode} +%If \gloskey{textaccess} key hasn't been set, check if the +%\catattr{textshortaccess} attribute has been set. +% \begin{macrocode} + \ifdefempty\@gls@textaccess + {% + \glsifcategoryattribute{\glscategorylabel}{textshortaccess}{true}% + {% +% \end{macrocode} +%Do nothing if the \gloskey{shortaccess} key hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \eappto\ExtraCustomAbbreviationFields{% + textaccess={\expandonce\@gls@shortaccess},% + }% + }% + }% + {}% + }% + {}% +% \end{macrocode} +%If \gloskey{firstaccess} key hasn't been set, check if the +%\catattr{firstshortaccess} attribute has been set. +% \begin{macrocode} + \ifdefempty\@gls@firstaccess + {% + \glsifcategoryattribute{\glscategorylabel}{firstshortaccess}{true}% + {% +% \end{macrocode} +%Do nothing if the \gloskey{shortaccess} key hasn't been set. +% \begin{macrocode} + \ifdefempty\@gls@shortaccess + {}% + {% + \eappto\ExtraCustomAbbreviationFields{% + firstaccess={\expandonce\@gls@shortaccess},% + }% + }% + }% + {}% + }% + {}% + } +% \end{macrocode} +%\end{macro} +% End of if accsupp part +% \begin{macrocode} +} +{ +% \end{macrocode} +% No accessibility support. Just define these commands to do +% \cs{glsentry}\meta{xxx} +%\begin{macro}{\glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessname}[1]{\glsentryname{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessname}[1]{\Glsentryname{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessname} +% Display the \gloskey{name} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessname}[1]{% + \protect\mfirstucMakeUppercase{\glsentryname{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesstext}[1]{\glsentrytext{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccesstext}[1]{\Glsentrytext{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesstext} +% Display the \gloskey{text} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesstext}[1]{% + \protect\mfirstucMakeUppercase{\glsentrytext{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessplural}[1]{\glsentryplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessplural}[1]{\Glsentryplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentryplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessfirst}[1]{\glsentryfirst{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessfirst}[1]{\Glsentryfirst{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirst}[1]{% + \protect\mfirstucMakeUppercase{\glsentryfirst{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessfirstplural}[1]{\glsentryfirstplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessfirstplural}[1]{\Glsentryfirstplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirstplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentryfirstplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesssymbol}[1]{\glsentrysymbol{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccesssymbol}[1]{\Glsentrysymbol{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbol}[1]{% + \protect\mfirstucMakeUppercase{\glsentrysymbol{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesssymbolplural}[1]{\glsentrysymbolplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccesssymbolplural}[1]{\Glsentrysymbolplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbolplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentrysymbolplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessdesc}[1]{\glsentrydesc{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessdesc}[1]{\Glsentrydesc{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdesc}[1]{% + \protect\mfirstucMakeUppercase{\glsentrydesc{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessdescplural}[1]{\glsentrydescplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessdescplural}[1]{\Glsentrydescplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdescplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentrydescplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshort} +% Display the short form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessshort}[1]{\glsentryshort{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshort} +% Display the short form with first letter converted to uppercase +% (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccessshort}[1]{\Glsentryshort{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshort} +% Display the \gloskey{short} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshort}[1]{% + \protect\mfirstucMakeUppercase{\glsentryshort{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshortpl} +% Display the short plural form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessshortpl}[1]{\glsentryshortpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshortpl} +% Display the short plural form with first letter converted to +% uppercase (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccessshortpl}[1]{\Glsentryshortpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshortpl} +% Display the \gloskey{shortplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshortpl}[1]{% + \protect\mfirstucMakeUppercase{\glsentryshortpl{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslong} +% Display the long form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesslong}[1]{\glsentrylong{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslong} +% Display the long form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccesslong}[1]{\Glsentrylong{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslong} +% Display the \gloskey{long} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslong}[1]{% + \protect\mfirstucMakeUppercase{\glsentrylong{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesslongpl}[1]{\glsentrylongpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccesslongpl}[1]{\Glsentrylongpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslongpl} +% Display the \gloskey{longplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslongpl}[1]{% + \protect\mfirstucMakeUppercase{\glsentrylongpl{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@initaccesskeys} +%\changes{1.31}{2018-05-09}{new} +%This does nothing if there's no accessibility support. +% \begin{macrocode} + \newcommand*{\@gls@initaccesskeys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setup@default@short@access} +%\changes{1.31}{2018-05-09}{new} +%This does nothing if there's no accessibility support. +% \begin{macrocode} + \newcommand{\@gls@setup@default@short@access}[1]{}% +% \end{macrocode} +% End of else part +% \begin{macrocode} +} +% \end{macrocode} +%\end{macro} +% +%\section{Categories} +%\begin{macro}{\glscategory} +% Add a new storage key that can be used to indicate a category. The +% default category is \category{general}. +% \begin{macrocode} +\glsaddstoragekey{category}{general}{\glscategory} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifcategory} +% Convenient shortcut to determine if an entry has the given +% category. +% \begin{macrocode} +\newcommand{\glsifcategory}[4]{% + \ifglsfieldeq{#1}{category}{#2}{#3}{#4}% +} +% \end{macrocode} +%\end{macro} +% +% Categories can have attributes. +%\begin{macro}{\glssetcategoryattribute} +%\begin{definition} +%\cs{glssetcategoryattribute}\marg{category}\marg{attribute-label}\marg{value} +%\end{definition} +% Set (or override if already set) an attribute for the given +% category. +% \begin{macrocode} +\newcommand*{\glssetcategoryattribute}[3]{% + \csdef{@glsxtr@categoryattr@@#1@#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgetcategoryattribute} +%\begin{definition} +%\cs{glsgetcategoryattribute}\marg{category}\marg{attribute-label} +%\end{definition} +% Get the value of the given attribute for the given +% category. Does nothing if the attribute isn't defined. +% \begin{macrocode} +\newcommand*{\glsgetcategoryattribute}[2]{% + \csuse{@glsxtr@categoryattr@@#1@#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glshascategoryattribute} +%\begin{definition} +%\cs{glshascategoryattribute}\marg{category}\marg{attribute-label}\marg{true}\marg{false} +%\end{definition} +%\changes{0.5}{2015-12-07}{new} +% Tests if the category has the given attribute set. +% \begin{macrocode} +\newcommand*{\glshascategoryattribute}[4]{% + \ifcsvoid{@glsxtr@categoryattr@@#1@#2}{#4}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssetattribute} +%\begin{definition} +%\cs{glssetattribute}\marg{entry label}\marg{attribute-label}\marg{value} +%\end{definition} +% Short cut where the category label is obtained from the entry +% information. +% \begin{macrocode} +\newcommand*{\glssetattribute}[3]{% + \glssetcategoryattribute{\glscategory{#1}}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgetattribute} +%\begin{definition} +%\cs{glsgetattribute}\marg{entry label}\marg{attribute-label} +%\end{definition} +% Short cut where the category label is obtained from the entry +% information. +% \begin{macrocode} +\newcommand*{\glsgetattribute}[2]{% + \glsgetcategoryattribute{\glscategory{#1}}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glshasattribute} +%\begin{definition} +%\cs{glshasattribute}\marg{entry +%label}\marg{attribute-label}\marg{true}\marg{false} +%\end{definition} +%\changes{0.5}{2015-12-07}{new} +%\changes{0.5.4}{2015-12-15}{added check for entry's existence} +% Short cut to test if the given attribute has been set where the +% category label is obtained from the entry information. +% \begin{macrocode} +\newcommand*{\glshasattribute}[4]{% + \ifglsentryexists{#1}% + {\glshascategoryattribute{\glscategory{#1}}{#2}{#3}{#4}}% + {#4}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifcategoryattribute} +%\begin{definition} +%\cs{glsifcategoryattribute}\marg{category}\marg{attribute-label}\marg{value}\marg{true +%part}\marg{false part} +%\end{definition} +% True if category has the attribute with the given value. +% \begin{macrocode} +\newcommand{\glsifcategoryattribute}[5]{% + \ifcsundef{@glsxtr@categoryattr@@#1@#2}% + {#5}% + {\ifcsstring{@glsxtr@categoryattr@@#1@#2}{#3}{#4}{#5}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifattribute} +%\begin{definition} +%\cs{glsifattribute}\marg{entry label}\marg{attribute-label}\marg{value}\marg{true +%part}\marg{false part} +%\end{definition} +%Short cut to determine if the given entry has a category with the +%given attribute set. +%\changes{0.5.4}{2015-12-15}{added check for entry's existence} +% \begin{macrocode} +\newcommand{\glsifattribute}[5]{% + \ifglsentryexists{#1}% + {\glsifcategoryattribute{\glscategory{#1}}{#2}{#3}{#4}{#5}}% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +% Set attributes for the default \category{general} category: +% \begin{macrocode} +\glssetcategoryattribute{general}{regular}{true} +% \end{macrocode} +% Acronyms are regular by default, since they're typically just +% treated like normal words. +% \begin{macrocode} +\glssetcategoryattribute{acronym}{regular}{true} +% \end{macrocode} +% +%\begin{macro}{\glssetregularcategory} +%Convenient shortcut to add the regular attribute. +% \begin{macrocode} +\newcommand*{\glssetregularcategory}[1]{% + \glssetcategoryattribute{#1}{regular}{true}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifregularcategory} +%\begin{definition} +%\cs{glsifregularcategory}\marg{category}\marg{true part}\marg{false part} +%\end{definition} +% Short cut to determine if a category has the regular attribute +% explicitly set to true. +% \begin{macrocode} +\newcommand{\glsifregularcategory}[3]{% + \glsifcategoryattribute{#1}{regular}{true}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifnotregularcategory} +%\begin{definition} +%\cs{glsifnotregularcategory}\marg{category}\marg{true part}\marg{false part} +%\end{definition} +% Short cut to determine if a category has the regular attribute +% explicitly set to false. +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand{\glsifnotregularcategory}[3]{% + \glsifcategoryattribute{#1}{regular}{false}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifregular} +%\begin{definition} +%\cs{glsifregular}\marg{entry label}\marg{true part}\marg{false part} +%\end{definition} +% Short cut to determine if an entry has a regular attribute set to +% true. +% \begin{macrocode} +\newcommand{\glsifregular}[3]{% + \glsifregularcategory{\glscategory{#1}}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifnotregular} +%\begin{definition} +%\cs{glsifnotregular}\marg{entry label}\marg{true part}\marg{false part} +%\end{definition} +% Short cut to determine if an entry has a regular attribute set to +% false. +% \begin{macrocode} +\newcommand{\glsifnotregular}[3]{% + \glsifnotregularcategory{\glscategory{#1}}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsforeachincategory} +%\begin{definition} +%\cs{glsforeachincategory}\oarg{glossary +%labels}\marg{category-label}\marg{glossary-cs}\marg{label-cs}\marg{body} +%\end{definition} +% Iterates through all entries in all the glossaries (or just those +% listed in \meta{glossary labels}) and does \meta{body} if the +% category matches \meta{category-label}. The control sequences +% \meta{glossary-cs} and \meta{label-cs} may be used in \meta{body} +% to access the glossary label and entry label for the current +% iteration. +% \begin{macrocode} +\newcommand{\glsforeachincategory}[5][\@glo@types]{% + \forallglossaries[#1]{#3}% + {% + \forglsentries[#3]{#4}% + {% + \glsifcategory{#4}{#2}{#5}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsforeachwithattribute} +%\begin{definition} +%\cs{glsforeachwithattribute}\oarg{glossary +%labels}\marg{attribute-label}\marg{attribute-value}\marg{glossary-cs}\marg{label-cs}\marg{body} +%\end{definition} +% Iterates through all entries in all the glossaries (or just those +% listed in \meta{glossary labels}) and does \meta{body} if the +% category attribute \meta{attribute-label} matches +% \meta{attribute-value}. The control sequences +% \meta{glossary-cs} and \meta{label-cs} may be used in \meta{body} +% to access the glossary label and entry label for the current +% iteration. +% \begin{macrocode} +\newcommand{\glsforeachwithattribute}[6][\@glo@types]{% + \forallglossaries[#1]{#4}% + {% + \forglsentries[#4]{#5}% + {% + \glsifattribute{#5}{#2}{#3}{#6}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% If \cs{newterm} has been defined, redefine it so that it +% automatically sets the category label to \category{index} and add +% \cs{glsxtrpostdescription}. +% \begin{macrocode} +\ifdef\newterm +{% +% \end{macrocode} +%\begin{macro}{\newterm} +%\changes{0.4}{2015-12-03}{fixed name argument} +% \begin{macrocode} + \renewcommand*{\newterm}[2][]{% + \newglossaryentry{#2}% + {type={index},category=index,name={#2},% + description={\glsxtrpostdescription\nopostdesc},#1}% + } +% \end{macrocode} +%\end{macro} +% Indexed terms are regular by default. +% \begin{macrocode} + \glssetcategoryattribute{index}{regular}{true} +% \end{macrocode} +%\begin{macro}{\glsxtrpostdescindex} +% \begin{macrocode} + \newcommand*{\glsxtrpostdescindex}{} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} +% +%If the \pkgopt{symbols} package option was used, define a similar +%command for symbols, but set the default sort to the label rather +%than the name as the symbols will typically contain commands that +%will confuse makeindex and xindy. +% \begin{macrocode} +\ifdef\printsymbols +{% +% \end{macrocode} +%\begin{macro}{\glsxtrnewsymbol} +%\changes{0.4}{2015-12-03}{added extra argument} +% Unlike \cs{newterm}, this has a separate argument for the label +% (since the symbol will likely contain commands). +% \begin{macrocode} + \newcommand*{\glsxtrnewsymbol}[3][]{% + \newglossaryentry{#2}{name={#3},sort={#2},type=symbols,category=symbol,#1}% + } +% \end{macrocode} +%\end{macro} +% Symbols are regular by default. +% \begin{macrocode} + \glssetcategoryattribute{symbol}{regular}{true} +% \end{macrocode} +%\begin{macro}{\glsxtrpostdescsymbol} +% \begin{macrocode} + \newcommand*{\glsxtrpostdescsymbol}{} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} +% +% Similar for the numbers option. +% \begin{macrocode} +\ifdef\printnumbers +{% +% \end{macrocode} +%\begin{macro}{\glsxtrnewnumber} +%\changes{0.4}{2015-12-03}{added extra argument} +% \begin{macrocode} +\ifdef\printnumbers + \newcommand*{\glsxtrnewnumber}[3][]{% + \newglossaryentry{#2}{name={#3},sort={#2},type=numbers,category=number,#1}% + } +% \end{macrocode} +%\end{macro} +% Numbers are regular by default. +% \begin{macrocode} + \glssetcategoryattribute{number}{regular}{true} +% \end{macrocode} +%\begin{macro}{\glsxtrpostdescnumber} +% \begin{macrocode} + \newcommand*{\glsxtrpostdescnumber}{} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} +% +%\begin{macro}{\glsxtrsetcategory} +% Set the category for all listed labels. The first argument is the +% list of entry labels and the second argument is the category label. +% \begin{macrocode} +\newcommand*{\glsxtrsetcategory}[2]{% + \@for\@glsxtr@label:=#1\do + {% + \glsfieldxdef{\@glsxtr@label}{category}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetcategoryforall} +% Set the category for all entries in the listed glossaries. The first argument +% is the list of glossary labels and the second argument is the category label. +% \begin{macrocode} +\newcommand*{\glsxtrsetcategoryforall}[2]{% + \forallglossaries[#1]{\@glsxtr@type}{% + \forglsentries[\@glsxtr@type]{\@glsxtr@label}% + {% + \glsfieldxdef{\@glsxtr@label}{category}{#2}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldtitlecase} +%\begin{definition} +%\cs{glsxtrfieldtitlecase}\marg{label}\marg{field} +%\end{definition} +% Apply title casing to the contents of the given field. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\glsxtrfieldtitlecase}[2]{% + \expandafter\glsxtrfieldtitlecasecs\expandafter + {\csname glo@\glsdetoklabel{#1}@#2\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldtitlecasecs} +%The command used by \cs{glsxtrfieldtitlecase}. May be +%redefined to use a different command, for example, +%\cs{xcapitalisefmtwords}. +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrfieldtitlecasecs}[1]{\xcapitalisewords{#1}} +% \end{macrocode} +%\end{macro} +% +% Provide a convenient way to modify glossary styles without having +% to define a new style just to convert the first letter of fields +% to upper case. +%\begin{macro}{\glossentrydesc} +% If the \catattr{glossdesc} attribute is \qt{firstuc} convert first +% letter to upper case. If the attribute is \qt{title} use title +% case. +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ + \renewcommand*{\glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% +% \end{macrocode} +% As from version 1.04, allow the \catattr{glossdescfont} attribute +% to determine the font applied. +%\changes{1.04}{2016-05-02}{added glossdescfont attribute check} +% \begin{macrocode} + \glshasattribute{#1}{glossdescfont}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossdescfont}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@glossdescfont}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in glossdescfont attribute + for entry `#1'. Ignoring}% + \let\@glsxtr@glossdescfont\@firstofone + }% + }% + {\let\@glsxtr@glossdescfont\@firstofone}% + \glsifattribute{#1}{glossdesc}{firstuc}% + {% + \@glsxtr@glossdescfont{\Glsaccessdesc{#1}}% + }% + {% + \glsifattribute{#1}{glossdesc}{title}% + {% + \@glsxtr@do@titlecaps@warn + \glsdescriptionaccessdisplay + {% + \@glsxtr@glossdescfont{\glsxtrfieldtitlecase{#1}{desc}}% + }% + {#1}% + }% + {% + \@glsxtr@glossdescfont{\glsaccessdesc{#1}}% + }% + }% + }% + } +} +{ + \renewcommand*{\glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glshasattribute{#1}{glossdescfont}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossdescfont}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@glossdescfont}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in glossdescfont attribute + for entry `#1'. Ignoring}% + \let\@glsxtr@glossdescfont\@firstofone + }% + }% + {\let\@glsxtr@glossdescfont\@firstofone}% + \glsifattribute{#1}{glossdesc}{firstuc}% + {% + \@glsxtr@glossdescfont{\Glsentrydesc{#1}}% + }% + {% + \glsifattribute{#1}{glossdesc}{title}% + {% + \@glsxtr@do@titlecaps@warn + \@glsxtr@glossdescfont{\glsxtrfieldtitlecase{#1}{desc}}% + }% + {% + \@glsxtr@glossdescfont{\glsentrydesc{#1}}% + }% + }% + }% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentryname} +% If the \catattr{glossname} attribute is \qt{firstuc} convert first +% letter to upper case. If the attribute is \qt{title} use title +% case. +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ + \renewcommand*{\glossentryname}[1]{% + \@glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% +% \end{macrocode} +% As from version 1.04, allow the \catattr{glossnamefont} attribute +% to determine the font applied. +%\changes{1.04}{2016-05-02}{added glossnamefont attribute check} +% \begin{macrocode} + \glshasattribute{#1}{glossnamefont}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in glossnamefont attribute + for entry `#1'. Reverting to default \string\glsnamefont}% + \let\@glsxtr@glossnamefont\glsnamefont + }% + }% + {\let\@glsxtr@glossnamefont\glsnamefont}% + \glsifattribute{#1}{glossname}{firstuc}% + {% + \glsnameaccessdisplay + {% + \@glsxtr@glossnamefont{\Glsentryname{#1}}% + }% + {#1}% + }% + {% + \glsifattribute{#1}{glossname}{title}% + {% + \@glsxtr@do@titlecaps@warn + \glsnameaccessdisplay + {% + \@glsxtr@glossnamefont{\glsxtrfieldtitlecase{#1}{name}}% + }% + {#1}% + }% + {% + \glsifattribute{#1}{glossname}{uc}% + {% + \glsnameaccessdisplay + {% +% \end{macrocode} +% Hide the label from the upper-casing command. +% \begin{macrocode} + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \@glsxtr@glossnamefont{\mfirstucMakeUppercase{\glo@name}}% + }% + {#1}% + }% + {% + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \glsnameaccessdisplay + {% + \expandafter\@glsxtr@glossnamefont\expandafter{\glo@name}% + }% + {#1}% + }% + }% + }% +% \end{macrocode} +% Do post-name hook: +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% + } +} +{ + \renewcommand*{\glossentryname}[1]{% + \@glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glshasattribute{#1}{glossnamefont}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in glossnamefont attribute + for entry `#1'. Reverting to default \string\glsnamefont}% + \let\@glsxtr@glossnamefont\glsnamefont + }% + }% + {\let\@glsxtr@glossnamefont\glsnamefont}% + \glsifattribute{#1}{glossname}{firstuc}% + {% + \@glsxtr@glossnamefont{\Glsentryname{#1}}% + }% + {% + \glsifattribute{#1}{glossname}{title}% + {% + \@glsxtr@do@titlecaps@warn + \@glsxtr@glossnamefont{\glsxtrfieldtitlecase{#1}{name}}% + }% + {% + \glsifattribute{#1}{glossname}{uc}% + {% +% \end{macrocode} +% Hide the label from the upper-casing command. +% \begin{macrocode} + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \@glsxtr@glossnamefont{\mfirstucMakeUppercase{\glo@name}}% + }% + {% +% \end{macrocode} +% This little trick is used by \styfmt{glossaries} to allow the user to +% redefine \ics{glsnamefont} to use \cs{makefirstuc}. Support it +% even though they can now use the \catattr{firstuc} attribute. +% \begin{macrocode} + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \expandafter\@glsxtr@glossnamefont\expandafter{\glo@name}% + }% + }% + }% +% \end{macrocode} +% Do post-name hook. +%\changes{1.04}{2016-05-02}{moved post name hook inside condition} +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentryname} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ + \renewcommand*{\Glossentryname}[1]{% + \@glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% +% \end{macrocode} +% As from version 1.04, allow the \catattr{glossnamefont} attribute +% to determine the font applied. +%\changes{1.04}{2016-05-02}{added glossnamefont attribute check} +% \begin{macrocode} + \glshasattribute{#1}{glossnamefont}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in glossnamefont attribute + for entry `#1'. Reverting to default \string\glsnamefont}% + \let\@glsxtr@glossnamefont\glsnamefont + }% + }% + {\let\@glsxtr@glossnamefont\glsnamefont}% + \glsnameaccessdisplay + {% + \@glsxtr@glossnamefont{\Glsentryname{#1}}% + }% + {#1}% +% \end{macrocode} +% Do post-name hook: +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% + } +} +{ + \renewcommand*{\Glossentryname}[1]{% + \@glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glshasattribute{#1}{glossnamefont}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in glossnamefont attribute + for entry `#1'. Reverting to default \string\glsnamefont}% + \let\@glsxtr@glossnamefont\glsnamefont + }% + }% + {\let\@glsxtr@glossnamefont\glsnamefont}% + \@glsxtr@glossnamefont{\Glsentryname{#1}}% +% \end{macrocode} +% Do post-name hook: +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% + } +} +% \end{macrocode} +%\end{macro} +% +% Provide a convenient way to also index the entries using the +% standard \ics{index} mechanism. This may use different actual, +% encap and escape characters to those used for the glossaries. +% +%\begin{macro}{\glsxtrpostnamehook} +%\changes{0.5.3}{2015-12-09}{new} +% Hook to append stuff after the name is displayed in the glossary. +% The argument is the entry's label. +% \begin{macrocode} +\newcommand*{\glsxtrpostnamehook}[1]{% + \let\@glsnumberformat\@glsxtr@defaultnumberformat + \glsxtrdoautoindexname{#1}{indexname}% +% \end{macrocode} +%Allow additional code regardless of category: +% \begin{macrocode} + \glsextrapostnamehook{#1}% +% \end{macrocode} +% Allow categories to hook in here. +%\changes{1.04}{2016-05-02}{added category check} +% \begin{macrocode} + \csuse{glsxtrpostname\glscategory{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsextrapostnamehook} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsextrapostnamehook}[1]{}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdefpostname} +%\changes{1.31}{2018-05-09}{new} +%Provide a convenient command for defining the post-name hook +%for the given category. +% \begin{macrocode} +\newcommand*{\glsdefpostname}[2]{% + \csdef{glsxtrpostname#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@setaccessdisplay} +%\changes{1.22}{2017-11-08}{new} +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ + \newcommand*{\glsxtr@setaccessdisplay}[1]{% + \ifcsdef{gls#1accessdisplay}% + {\letcs\@glsxtr@accessdisplay{gls#1accessdisplay}}% + {% +% \end{macrocode} +%This is essentially the reverse of \cs{@gls@fetchfield}, since the +%field supplied to \cs{glossentryname} has to be the internal label, +%but the \cs{gls\meta{field}accessdisplay} commands use the key name. +% \begin{macrocode} + \edef\@gls@thisval{#1}% + \@for\@gls@map:=\@gls@keymap\do{% + \edef\@this@key{\expandafter\@secondoftwo\@gls@map}% + \ifdefequal{\@this@key}{\@gls@thisval}% + {% + \edef\@gls@thisval{\expandafter\@firstoftwo\@gls@map}% + \@endfortrue + }% + {}% + }% + \ifcsdef{gls\@gls@thisval accessdisplay}% + {\letcs\@glsxtr@accessdisplay{gls\@gls@thisval accessdisplay}}% + {\let\@glsxtr@accessdisplay\@firstoftwo}% + }% + } +} +{% + \newcommand*{\glsxtr@setaccessdisplay}[1]{% + \let\@glsxtr@accessdisplay\@firstoftwo} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentrynameother} +% Provide a command that works like \cs{glossentryname} +% but accesses a different field (which must be supplied using its +% internal field label). +%\changes{1.22}{2017-11-08}{new} +% \begin{macrocode} +\newrobustcmd*{\glossentrynameother}[2]{% + \@glsdoifexistsorwarn{#1}% + {% +% \end{macrocode} +%Accessibility support: +% \begin{macrocode} + \glsxtr@setaccessdisplay{#2}% +% \end{macrocode} +%Set the abbreviation format: +% \begin{macrocode} + \glssetabbrvfmt{\glscategory{#1}}% + \glshasattribute{#1}{glossnamefont}% + {% + \edef\@glsxtr@attrval{\glsgetattribute{#1}{glossnamefont}}% + \ifcsdef{\@glsxtr@attrval}% + {% + \letcs{\@glsxtr@glossnamefont}{\@glsxtr@attrval}% + }% + {% + \GlossariesExtraWarning{Unknown control sequence name + `\@glsxtr@attrval' supplied in glossnamefont attribute + for entry `#1'. Reverting to default \string\glsnamefont}% + \let\@glsxtr@glossnamefont\glsnamefont + }% + }% + {\let\@glsxtr@glossnamefont\glsnamefont}% + \glsifattribute{#1}{glossname}{firstuc}% + {% + \@glsxtr@accessdisplay + {\@glsxtr@glossnamefont{\@Gls@entry@field{#1}{#2}}}% + {#1}% + }% + {% + \glsifattribute{#1}{glossname}{title}% + {% + \@glsxtr@do@titlecaps@warn + \@glsxtr@accessdisplay + {\@glsxtr@glossnamefont{\glsxtrfieldtitlecase{#1}{#2}}}% + {#1}% + }% + {% + \glsifattribute{#1}{glossname}{uc}% + {% + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@#2}% + \@glsxtr@accessdisplay + {\@glsxtr@glossnamefont{\mfirstucMakeUppercase{\glo@name}}}% + {#1}% + }% + {% + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@#2}% + \@glsxtr@accessdisplay + {\expandafter\@glsxtr@glossnamefont\expandafter{\glo@name}}% + {#1}% + }% + }% + }% +% \end{macrocode} +% Do post-name hook. +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\if@glsxtr@format@override} +%\changes{0.5.3}{2015-12-09}{new} +% Determines if the \gloskey[glslink]{format} key should override +% the indexing attribute value. +% \begin{macrocode} +\newif\if@glsxtr@format@override +\@glsxtr@format@overridefalse +% \end{macrocode} +%\end{macro} +% +%If overriding is enabled, the \ics{glshypernumber} command will have to +%be redefined in the index to use \cs{hyperpage} instead. +%\begin{macro}{\GlsXtrEnableIndexFormatOverride} +% \begin{macrocode} +\@ifpackageloaded{hyperref} +{ +% \end{macrocode} +% If \sty{hyperref}'s \pkgoptfmt{hyperindex} option is on, then +% \sty{hyperref} will automatically add \cs{hyperpage}, so don't +% add it. +% \begin{macrocode} + \ifHy@hyperindex + \newcommand*{\GlsXtrEnableIndexFormatOverride}{% + \@glsxtr@format@overridetrue + \appto\theindex{\let\glshypernumber\@firstofone}% + } + \else + \newcommand*{\GlsXtrEnableIndexFormatOverride}{% + \@glsxtr@format@overridetrue + \appto\theindex{\let\glshypernumber\hyperpage}% + } + \fi +} +{ + \newcommand*{\GlsXtrEnableIndexFormatOverride}{% + \@glsxtr@format@overridetrue + } +} +\@onlypreamble\GlsXtrEnableIndexFormatOverride +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdoautoindexname} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrdoautoindexname}[2]{% + \glshasattribute{#1}{#2}% + {% +% \end{macrocode} +% Escape any makeindex/xindy characters in the value of the \gloskey{name} +% field. Take care with \sty{babel} as this won't work if the +% category code has changed for those characters. +% \begin{macrocode} + \@glsxtr@autoindex@setname{#1}% +% \end{macrocode} +% If the attribute value is simply \qt{true} don't add an encap, +% otherwise use the value as the encap. +% \begin{macrocode} + \protected@edef\@glsxtr@attrval{\glsgetattribute{#1}{#2}}% + \if@glsxtr@format@override +% \end{macrocode} +%\changes{1.19}{2017-09-09}{changed format test} +% \begin{macrocode} + \ifx\@glsnumberformat\@glsxtr@defaultnumberformat + \else + \let\@glsxtr@attrval\@glsnumberformat + \fi + \fi + \ifdefstring{\@glsxtr@attrval}{true}% + {}% + {\eappto\@glo@name{\@glsxtr@autoindex@encap\@glsxtr@attrval}}% + \expandafter\glsxtrautoindex\expandafter{\@glo@name}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrautoindex} +%\changes{1.16}{2017-06-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrautoindex}{\index} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrautoindexesc} +%\changes{1.36}{2018-08-18}{new} +% \begin{macrocode} +\newcommand{\glsxtrautoindexesc}{% + \@gls@checkmkidxchars\@glo@sort + \@glsxtr@autoindex@doextra@esc\@glo@sort +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@setname} +%\changes{0.5.3}{2015-12-09}{new} +% Assign \cs{@glo@name} for use with \catattr{indexname} attribute. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@setname}[1]{% + \protected@edef\@glo@name{\glsxtrautoindexentry{#1}}% + \glsxtrautoindexassignsort{\@glo@sort}{#1}% + \glsxtrautoindexesc + \epreto\@glo@name{\@glo@sort\@glsxtr@autoindex@at}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrautoindexentry} +%\changes{1.16}{2017-06-15}{new} +%Command used for the actual part when auto-indexing. +% \begin{macrocode} +\newcommand*{\glsxtrautoindexentry}[1]{\string\glsentryname{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrautoindexassignsort} +%\changes{1.16}{2017-06-15}{new} +%Used to assign the sort value when auto-indexing. +% \begin{macrocode} +\newcommand*{\glsxtrautoindexassignsort}[2]{% + \glsletentryfield{#1}{#2}{sort}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@doextra@esc} +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@doextra@esc}[1]{% +% \end{macrocode} +% Escape the escape character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@esc\@gls@quotechar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@escquote\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@esc\noexpand\@nnil + \@glsxtr@autoindex@esc\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +% \end{macrocode} +% Escape actual character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@at\@gls@actualchar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@escat\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@at\noexpand\@nnil + \@glsxtr@autoindex@at\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +% \end{macrocode} +% Escape level character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@level\@gls@levelchar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@esclevel\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@level\noexpand\@nnil + \@glsxtr@autoindex@level\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +% \end{macrocode} +% Escape encap character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@encap\@gls@encapchar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@escencap\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@encap\noexpand\@nnil + \@glsxtr@autoindex@encap\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +} +% \end{macrocode} +%\end{macro} +% +% The user commands here have a preamble-only restriction to ensure +% they are set before required and also to reduce the chances of +% complications caused by \sty{babel}'s shorthands. +% +%\begin{macro}{\@glsxtr@autoindex@at} +%\changes{0.5.3}{2015-12-09}{new} +% Actual character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@at}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetActualChar} +% Set the actual character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetActualChar}[1]{% + \gdef\@glsxtr@autoindex@at{#1}% + \def\@glsxtr@autoindex@escat##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escat}{##1}{##2}{##3}% + }% +} +\@onlypreamble\GlsXtrSetActualChar +\makeatother +\GlsXtrSetActualChar{@} +\makeatletter +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@encap} +%\changes{0.5.3}{2015-12-09}{new} +% Encap character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@encap}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetEncapChar} +% Set the encap character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetEncapChar}[1]{% + \gdef\@glsxtr@autoindex@encap{#1}% + \def\@glsxtr@autoindex@escencap##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escencap}{##1}{##2}{##3}% + }% +} +\GlsXtrSetEncapChar{|} +\@onlypreamble\GlsXtrSetEncapChar +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@level} +%\changes{0.5.3}{2015-12-09}{new} +% Level character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@level}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetLevelChar} +% Set the encap character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetLevelChar}[1]{% + \gdef\@glsxtr@autoindex@level{#1}% + \def\@glsxtr@autoindex@esclevel##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@esclevel}{##1}{##2}{##3}% + }% +} +\GlsXtrSetLevelChar{!} +\@onlypreamble\GlsXtrSetLevelChar +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@esc} +%\changes{0.5.3}{2015-12-09}{new} +% Escape character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@esc}{"} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetEscChar} +% Set the escape character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetEscChar}[1]{% + \gdef\@glsxtr@autoindex@esc{#1}% + \def\@glsxtr@autoindex@escquote##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escquote}{##1}{##2}{##3}% + }% +} +\GlsXtrSetEscChar{"} +\@onlypreamble\GlsXtrSetEscChar +% \end{macrocode} +%\end{macro} +% +% Set if defined. (For example, if \sty{doc} package has been +% loaded.) Actual character \ics{actualchar}: +% \begin{macrocode} +\ifdef\actualchar + {\expandafter\GlsXtrSetActualChar\expandafter{\actualchar}} + {} +% \end{macrocode} +% Quote character \ics{quotechar}: +% \begin{macrocode} +\ifdef\quotechar + {\expandafter\GlsXtrSetEscChar\expandafter{\quotechar}} + {} +% \end{macrocode} +% Level character \ics{levelchar}: +% \begin{macrocode} +\ifdef\levelchar + {\expandafter\GlsXtrSetLevelChar\expandafter{\levelchar}} + {} +% \end{macrocode} +% Encap character \ics{encapchar}: +% \begin{macrocode} +\ifdef\encapchar + {\expandafter\GlsXtrSetEncapChar\expandafter{\encapchar}} + {} +% \end{macrocode} +% +%\begin{macro}{\@glsxtr@gobbleto@endescspch} +% \begin{macrocode} +\def\@glsxtr@gobbleto@endescspch#1\@glsxtr@endescspch{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsxtr@autoindex@esc@spch} +%\begin{definition} +%\cs{@@glsxtr@autoindex@escspch}\marg{char}\marg{cs}\marg{pre}\marg{mid}\marg{post} +%\end{definition} +% \begin{macrocode} +\newcommand*{\@@glsxtr@autoindex@escspch}[5]{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#3}% + \ifx\@nnil#3\relax + \def\@@glsxtr@checkspch{\@glsxtr@gobbleto@endescspch#5\@glsxtr@endescspch}% + \else + \ifx\@nnil#4\relax + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@glsxtr@checkspch{\@glsxtr@gobbleto@endescspch + #4#5\@glsxtr@endescspch}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@glsxtr@autoindex@esc#1}% + \def\@@glsxtr@checkspch{#2#5#1\@nnil#1\@glsxtr@endescspch}% + \fi + \fi + \@@glsxtr@checkspch +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentrydesc} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\Glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \Glsaccessdesc{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentrysymbol} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\glossentrysymbol}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsaccesssymbol{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentrysymbol} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\Glossentrysymbol}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \Glsaccesssymbol{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%Allow initials to be marked but only use the formatting for the +%tag in the glossary. +%\begin{macro}{\GlsXtrEnableInitialTagging} +% Allow initial tagging. The first argument is a list of categories +% to apply this to. The second argument is the name of the command to +% use to tag the initials. This can't already be defined for safety +% unless the starred version is used. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableInitialTagging}{% + \@ifstar\s@glsxtr@enabletagging\@glsxtr@enabletagging +} +\@onlypreamble\GlsXtrEnableInitialTagging +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@enabletagging} +% Starred version undefines command. +% \begin{macrocode} +\newcommand*{\s@glsxtr@enabletagging}[2]{% + \undef#2% + \@glsxtr@enabletagging{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@enabletagging} +% Internal command. +% \begin{macrocode} +\newcommand*{\@glsxtr@enabletagging}[2]{% +% \end{macrocode} +% Set attributes for categories given in the first argument. +% \begin{macrocode} + \@for\@glsxtr@cat:=#1\do + {% + \ifdefempty\@glsxtr@cat + {}% + {\glssetcategoryattribute{\@glsxtr@cat}{tagging}{true}}% + }% + \newrobustcmd*#2[1]{##1}% + \def\@glsxtr@taggingcs{#2}% + \renewcommand*\@glsxtr@activate@initialtagging{% + \let#2\@glsxtr@tag + }% + \ifundef\@gls@preglossaryhook + {\GlossariesExtraWarning{Initial tagging requires at least + glossaries.sty v4.19 to work correctly}}% + {}% +} +% \end{macrocode} +%\end{macro} +% +%Are we using an old version of \sty{mfirstuc} that has a bug in +%\cs{capitalisewords}? If so, patch it so we don't have a problem +% with a combination of tagging and title case. +%\begin{macro}{\mfu@checkword@do} +%If this command hasn't been defined, then we have pre v2.02 of +%\sty{mfirstuc} +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\ifundef\mfu@checkword@do +{ + \newcommand*{\mfu@checkword@do}[1]{% + \ifdefstring{\mfu@checkword@arg}{#1}% + {% + \let\@mfu@domakefirstuc\@firstofone + \listbreak + }% + {}% + } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\mfu@checkword} +% \cs{capitalisewords} was introduced in \sty{mfirstuc} v1.06. +% If \cs{mfu@checkword} hasn't been defined \sty{mfirstuc} is too +% old to support the title case attribute. +% \begin{macrocode} + \ifundef\mfu@checkword + { + \newcommand{\@glsxtr@do@titlecaps@warn}{% + \GlossariesExtraWarning{mfirstuc.sty too old. Title Caps + support not available}% +% \end{macrocode} +% One warning should suffice. +% \begin{macrocode} + \let\@glsxtr@do@titlecaps@warn\relax + } + } + { + \renewcommand*{\mfu@checkword}[1]{% + \def\mfu@checkword@arg{#1}% + \let\@mfu@domakefirstuc\makefirstuc + \forlistloop\mfu@checkword@do\@mfu@nocaplist + } + } +} +{}% no patch required +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@do@titlecaps@warn} +% Do warning if title case not supported. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@do@titlecaps@warn}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@activate@initialtagging} +% Used in \cs{printglossary} but at least v4.19 of \styfmt{glossaries} +% required. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*\@glsxtr@activate@initialtagging{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@tag} +%\changes{0.5.2}{2015-12-08}{new} +% Definition of tagging command when used in glossary. +% \begin{macrocode} +\newrobustcmd*{\@glsxtr@tag}[1]{% + \glsifattribute{\glscurrententrylabel}{tagging}{true}% + {\glsxtrtagfont{#1}}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtagfont} +% Used in the glossary. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\glsxtrtagfont}[1]{\underline{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@preglossaryhook} +% This macro was introduced in \styfmt{glossaries} version 4.19, so it +% may not be defined. If it hasn't been defined this feature is +% unavailable. A check is added for the entry's existence to prevent +% errors from occurring if the user removes an entry or changes the +% label, which can interrupt the build process. +%\changes{1.04}{2016-05-02}{added check for entry's existence} +% \begin{macrocode} +\ifdef\@gls@preglossaryhook +{ + \renewcommand*{\@gls@preglossaryhook}{% + \@glsxtr@activate@initialtagging +% \end{macrocode} +%\changes{1.12}{2017-02-03}{check for definition} +%Since the glossaries are automatically scoped, +%\cs{@glsxtr@org@postdescription} shouldn't already be defined, but +%check anyway just as a precautionary measure. +% \begin{macrocode} + \ifundef\@glsxtr@org@postdescription + {% + \let\@glsxtr@org@postdescription\glspostdescription + \renewcommand*{\glspostdescription}{% + \ifglsentryexists{\glscurrententrylabel}% + {% + \glsxtrpostdescription + \@glsxtr@org@postdescription + }% + {}% + }% + }% + {}% +% \end{macrocode} +%\changes{1.07}{2016-08-15}{added \cs{glossxtrsetpopts}} +%Enable the options used by \cs{@@glsxtrp}: +% \begin{macrocode} + \glossxtrsetpopts + }% +} +{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescription} +%This command will only be used if \cs{@gls@preglossaryhook} is +%available \emph{and} the glossary style uses +%\cs{glspostdescription} without modifying it. (\cs{nopostdesc} +%will suppress this.) The \sty{glossaries-extra-stylemods} package will +%add the post description hook to all the predefined styles that +%don't include it. +% \begin{macrocode} +\newcommand*{\glsxtrpostdescription}{% + \csuse{glsxtrpostdesc\glscategory{\glscurrententrylabel}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescgeneral} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescgeneral}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescterm} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescterm}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescacronym} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescacronym}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescabbreviation} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescabbreviation}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdefpostdesc} +%\changes{1.31}{2018-05-09}{new} +%Provide a convenient command for defining the post-description hook +%for the given category. +% \begin{macrocode} +\newcommand*{\glsdefpostdesc}[2]{% + \csdef{glsxtrpostdesc#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspostlinkhook} +% Redefine the post link hook used by commands like \cs{gls} to +% make it easier for categories or attributes to modify this action. +% Since this hook occurs outside the existence check of commands like +% \cs{gls}, this needs to be checked again here. Do nothing if the +% entry hasn't been defined. +%\changes{0.5.4}{2015-12-15}{added existence check} +% \begin{macrocode} +\renewcommand*{\glspostlinkhook}{% + \ifglsentryexists{\glslabel}{\glsxtrpostlinkhook}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkhook} +% The entry label should already be stored in \cs{glslabel} by +% \cs{@gls@link}. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkhook}{% + \glsxtrdiscardperiod{\glslabel}% + {\glsxtrpostlinkendsentence}% + {\glsxtrifcustomdiscardperiod + {\glsxtrifperiod{\glsxtrpostlinkendsentence}{\glsxtrpostlink}}% + {\glsxtrpostlink}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifcustomdiscardperiod} +%\changes{1.23}{2017-11-12}{new} +%Allow user to provide a custom check. Should expand to \verb|#2| if +%no check is required otherwise expand to \verb|#1|. +% \begin{macrocode} +\newcommand*{\glsxtrifcustomdiscardperiod}[2]{#2} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlink} +% \begin{macrocode} +\newcommand*{\glsxtrpostlink}{% + \csuse{glsxtrpostlink\glscategory{\glslabel}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdefpostlink} +%\changes{1.31}{2018-05-09}{new} +%Provide a convenient command for defining the post-link hook +%for the given category. Doesn't allow an empty argument (which) +%would overwrite \cs{glsxtrpostlink}. +% \begin{macrocode} +\newcommand*{\glsdefpostlink}[2]{% +% \end{macrocode} +% \cs{ifthenelse} is used to ensure that the expanded value is +% tested. (The category label must be fully expandable.) +% \begin{macrocode} + \ifthenelse{\equal{#1}{}}% + {\PackageError{glossaries-extra} + {Invalid empty category label in \string\glsdefpostlink}{}}% + {\csdef{glsxtrpostlink#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkendsentence} +%\changes{0.3}{2015-12-02}{new} +% Done by \cs{glsxtrpostlinkhook} if a full stop is discarded. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkendsentence}{% + \ifcsdef{glsxtrpostlink\glscategory{\glslabel}} + {% + \csuse{glsxtrpostlink\glscategory{\glslabel}}% +% \end{macrocode} +% Put the full stop back. +% \begin{macrocode} + .\spacefactor\sfcode`\. \relax + }% + {% +% \end{macrocode} +% Assume the full stop was discarded because the entry ends with a +% period, so adjust the spacefactor. +% \begin{macrocode} + \spacefactor\sfcode`\. \relax + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkAddDescOnFirstUse} +%\changes{0.3}{2015-12-02}{new} +% Provide a command for appending the description in parentheses on +% first use, for the convenience of users wanting to add this to the +% post link hook. +%\changes{1.25}{2017-11-24}{changed to use \cs{glsxtrparen}} +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkAddDescOnFirstUse}{% + \glsxtrifwasfirstuse{\space\glsxtrparen{\glsaccessdesc{\glslabel}}}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkAddSymbolOnFirstUse} +%\changes{0.3}{2015-12-02}{new} +% Provide a command for appending the symbol (if defined) in parentheses on +% first use, for the convenience of users wanting to add this to the +% post link hook. +%\changes{1.25}{2017-11-24}{changed to use \cs{glsxtrparen}} +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkAddSymbolOnFirstUse}{% + \glsxtrifwasfirstuse + {% + \ifglshassymbol{\glslabel}% + {\space\glsxtrparen{\glsaccesssymbol{\glslabel}}}% + {}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkAddSymbolDescOnFirstUse} +%\changes{1.31}{2018-05-09}{new} +% Provide a command for appending the symbol (if defined) and +% description in parentheses on +% first use, for the convenience of users wanting to add this to the +% post link hook. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkAddSymbolDescOnFirstUse}{% + \glsxtrifwasfirstuse + {% + \space\glsxtrparen + {% + \ifglshassymbol{\glslabel}% + {\glsaccesssymbol{\glslabel}, }% + {}% + \glsaccessdesc{\glslabel}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdiscardperiod} +% Discard following period (if present) if the +% \catattr{discardperiod} attribute is true. If a period is +% discarded, do the second argument otherwise do the third +% argument. The entry label is in the first argument. +% Since this is designed for abbreviations that end with a period, +% check if the plural form was used (which typically won't end with +% a period). +%\changes{0.3}{2015-12-02}{added check for plural} +%\changes{1.01}{2016-02-02}{added check for first use} +% \begin{macrocode} +\newcommand*{\glsxtrdiscardperiod}[3]{% + \glsxtrifwasfirstuse + {% + \glsifattribute{#1}{retainfirstuseperiod}{true}% + {#3}% + {% + \glsifattribute{#1}{discardperiod}{true}% + {% + \glsifplural + {% + \glsifattribute{#1}{pluraldiscardperiod}{true}% + {\glsxtrifperiod{#2}{#3}}% + {#3}% + }% + {% + \glsxtrifperiod{#2}{#3}% + }% + }% + {#3}% + }% + }% + {% + \glsifattribute{#1}{discardperiod}{true}% + {% + \glsifplural + {% + \glsifattribute{#1}{pluraldiscardperiod}{true}% + {\glsxtrifperiod{#2}{#3}}% + {#3}% + }% + {% + \glsxtrifperiod{#2}{#3}% + }% + }% + {#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifperiod} +% Make a convenient user command to check if the next character is a +% full stop (period). Works like \cs{@ifstar} but uses +% \cs{new@ifnextchar} rather than \cs{@ifnextchar} +% \begin{macrocode} +\newcommand*{\glsxtrifperiod}[1]{\new@ifnextchar.{\@firstoftwo{#1}}} +% \end{macrocode} +%\end{macro} +% +% Sometimes it's useful to test if there's a punctuation character +% following the glossary entry. +%\begin{macro}{\glsxtr@punclist} +% List of characters identified as punctuation marks. (Be careful of +% \sty{babel} shorthands!) This doesn't allow for punctuation marks +% made up from multiple characters (such as \verb|''|). +% \begin{macrocode} +\newcommand*{\glsxtr@punclist}{.,:;?!} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtraddpunctuationmark} +% Add character to punctuation list. +% \begin{macrocode} +\newcommand*{\glsxtraddpunctuationmark}[1]{\appto\glsxtr@punclist{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetpunctuationmarks} +% Reset the punctuation list. +% \begin{macrocode} +\newcommand*{\glsxtrsetpunctuationmarks}[1]{\def\glsxtr@punclist{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifpunc} +%\begin{definition} +%\cs{glsxtrifnextpunc}\marg{true part}\marg{false part} +%\end{definition} +%Test if this is followed by a punctuation mark. (Adapted from +%\cs{new@ifnextchar}.) +% \begin{macrocode} +\newcommand*{\glsxtrifnextpunc}[2]{% + \def\reserved@a{#1}% + \def\reserved@b{#2}% + \futurelet\@glspunc@token\glsxtr@ifnextpunc +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@ifnextpunc} +% \begin{macrocode} +\newcommand*{\glsxtr@ifnextpunc}{% + \glsxtr@ifpunctoken{\@glspunc@token}{\let\reserved@b\reserved@a}{}% + \reserved@b +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@ifpunctoken} +% Test if the token given in the first argument is in the +% punctuation list. +% \begin{macrocode} +\newcommand*{\glsxtr@ifpunctoken}[1]{% + \expandafter\@glsxtr@ifpunctoken\expandafter#1\glsxtr@punclist\@nnil +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@ifpunctoken} +% \begin{macrocode} +\def\@glsxtr@ifpunctoken#1#2{% + \let\reserved@d=#2% + \ifx\reserved@d\@nnil + \let\glsxtr@next\@glsxtr@notfoundinlist + \else + \ifx#1\reserved@d + \let\glsxtr@next\@glsxtr@foundinlist + \else + \let\glsxtr@next\@glsxtr@ifpunctoken + \fi + \fi + \glsxtr@next#1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@foundinlist} +% \begin{macrocode} +\def\@glsxtr@foundinlist#1\@nnil{\@firstoftwo} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@notfoundinlist} +% \begin{macrocode} +\def\@glsxtr@notfoundinlist#1{\@secondoftwo} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdopostpunc} +%\begin{definition} +%\cs{glsxtrdopostpunc}\marg{code} +%\end{definition} +% If this is followed be a punctuation character, do \meta{code} +% after the character otherwise do \meta{code} before whatever comes +% next. +% \begin{macrocode} +\newcommand{\glsxtrdopostpunc}[1]{% + \glsxtrifnextpunc{\@glsxtr@swaptwo{#1}}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@swaptwo} +% \begin{macrocode} +\newcommand{\@glsxtr@swaptwo}[2]{#2#1} +% \end{macrocode} +%\end{macro} +% +%\section{Abbreviations} +% +%The \qt{acronym} code from \styfmt{glossaries} is misnamed as it's more +%often used for other forms of abbreviations. This code corrects +%this inconsistency, but rather than just having synonyms, provide +% commands for abbreviations that have a similar, but not identical, +% underlying mechanism to acronyms. +% +% If there's a style for the given category, apply it. +% \begin{macrocode} +\define@key{glsxtrabbrv}{category}{% + \edef\glscategorylabel{#1}% + \ifcsdef{@glsabbrv@current@#1}% + {% +% \end{macrocode} +% Warning should already have been issued. +% \begin{macrocode} + \let\@glsxtr@orgwarndep\GlsXtrWarnDeprecatedAbbrStyle + \let\GlsXtrWarnDeprecatedAbbrStyle\@gobbletwo + \glsxtr@applyabbrvstyle{\csname @glsabbrv@current@#1\endcsname}% + \let\GlsXtrWarnDeprecatedAbbrStyle\@glsxtr@orgwarndep + }% + {}% +} +% \end{macrocode} +% Save the short plural form. This may be needed before the entry is +% defined. +% \begin{macrocode} +\define@key{glsxtrabbrv}{shortplural}{% + \def\@gls@shortpl{#1}% +} +% \end{macrocode} +% Similarly for the long plural form. +% \begin{macrocode} +\define@key{glsxtrabbrv}{longplural}{% + \def\@gls@longpl{#1}% +} +% \end{macrocode} +% +% Token registers for the short plural and long plural, provided for +% use in the abbreviation style definitions. +%\begin{macro}{\glsshortpltok} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newtoks\glsshortpltok +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongpltok} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newtoks\glslongpltok +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@insertdots} +%\changes{0.3}{2015-12-02}{new} +% Provided in case user wants to automatically insert dots between +% each letter of the abbreviation. This should be applied before +% defining the abbreviation to optimise the document build. +% (Otherwise, it would have to be done each time the short form is +% required, which is an unnecessary waste of time.) For this to work +% the short form must be expanded when passed to +% \cs{newabbreviation}. Note that explicitly using the +% \gloskey{short} or \gloskey{shortplural} keys will override this. +% \begin{macrocode} +\newcommand*{\@glsxtr@insertdots}[2]{% + \def#1{}% + \@glsxtr@insert@dots#1#2\@nnil +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@insert@dots} +% \begin{macrocode} +\newcommand*{\@glsxtr@insert@dots}[2]{% + \ifx\@nnil#2\relax + \let\@glsxtr@insert@dots@next\@gobble + \else + \ifx\relax#2\relax + \else + \appto#1{#2.}% + \fi + \let\@glsxtr@insert@dots@next\@glsxtr@insert@dots + \fi + \@glsxtr@insert@dots@next#1% +} +% \end{macrocode} +%\end{macro} +% +%Similarly provide a way of replacing spaces with +%\cs{glsxtrwordsep}, which first needs to be defined: +%\begin{macro}{\glsxtrwordsep} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrwordsep}{\space} +% \end{macrocode} +%\end{macro} +%Each word is marked with +%\begin{macro}{\glsxtrword} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrword}[1]{#1} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@markwordseps} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@markwordseps}[2]{% + \def#1{}% + \@glsxtr@mark@wordseps#1#2 \@nnil +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@mark@wordseps} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\def\@glsxtr@mark@wordseps#1#2 #3{% + \ifdefempty{#1}% + {\def#1{\protect\glsxtrword{#2}}}% + {\appto#1{\protect\glsxtrwordsep\protect\glsxtrword{#2}}}% + \ifx\@nnil#3\relax + \let\@glsxtr@mark@wordseps@next\relax + \else + \def\@glsxtr@mark@wordseps@next{% + \@glsxtr@mark@wordseps#1#3}% + \fi + \@glsxtr@mark@wordseps@next +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newabbreviation} +% Define a new generic abbreviation. +% \begin{macrocode} +\newcommand*{\newabbreviation}[4][]{% + \glsxtr@newabbreviation{#1}{#2}{#3}{#4}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@newabbreviation} +% Internal macro. (bib2gls has an option that needs to +% temporarily redefine \cs{newabbreviation}. This is just makes +% it easier to save and restore the original definition.) +%\changes{1.12}{2017-02-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@newabbreviation}[4]{% + \glskeylisttok{#1}% + \glslabeltok{#2}% + \glsshorttok{#3}% + \glslongtok{#4}% +% \end{macrocode} +%Save the original short and long values (before attribute settings +%modify them). +%\changes{1.17}{2017-08-09}{added \cs{glsxtrorgshort} and \cs{glsxtrorglong}} +% \begin{macrocode} + \def\glsxtrorgshort{#3}% + \def\glsxtrorglong{#4}% +% \end{macrocode} +%\changes{1.31}{2018-05-09}{added \cs{ExtraCustomAbbreviationFields}} +%Provide extra settings for hooks (if modified, this command must +%end with a comma). +% \begin{macrocode} + \def\ExtraCustomAbbreviationFields{}% +% \end{macrocode} +%Initialise accessibility settings if required. +% \begin{macrocode} + \@gls@initaccesskeys +% \end{macrocode} +% Get the category. +%\changes{0.3}{2015-12-02}{fixed family name in \cs{setkeys}} +% \begin{macrocode} + \def\glscategorylabel{abbreviation}% + \glsxtr@applyabbrvstyle{\@glsabbrv@current@abbreviation}% +% \end{macrocode} +% Ignore the shortplural and longplural keys. +% \begin{macrocode} + \setkeys*{glsxtrabbrv}[shortplural,longplural]{#1}% +% \end{macrocode} +% Set the default long plural +% \begin{macrocode} + \def\@gls@longpl{#4\glspluralsuffix}% + \let\@gls@default@longpl\@gls@longpl +% \end{macrocode} +% Has the \catattr{markwords} attribute been set? +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{markwords}{true}% + {% + \@glsxtr@markwordseps\@gls@long{#4}% + \expandafter\def\expandafter\@gls@longpl\expandafter + {\@gls@long\glspluralsuffix}% + \let\@gls@default@longpl\@gls@longpl +% \end{macrocode} +% Update \cs{glslongtok}. +% \begin{macrocode} + \expandafter\glslongtok\expandafter{\@gls@long}% + }% + {}% +% \end{macrocode} +% Has the \catattr{markshortwords} attribute been set? (Not +% compatible with \catattr{insertdots}.) +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{markshortwords}{true}% + {% + \@glsxtr@markwordseps\@gls@short{#3}% + }% + {% +% \end{macrocode} +% Has the \catattr{insertdots} attribute been set? +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{insertdots}{true}% + {% + \@glsxtr@insertdots\@gls@short{#3}% + \expandafter\glsshorttok\expandafter{\@gls@short\spacefactor1000 \relax}% + }% + {\def\@gls@short{#3}}% + }% +% \end{macrocode} +% Has the \catattr{aposplural} attribute been set? (Not compatible +% with \catattr{noshortplural}.) +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{aposplural}{true}% + {% + \expandafter\def\expandafter\@gls@shortpl\expandafter{\@gls@short + '\abbrvpluralsuffix}% + }% + {% +% \end{macrocode} +% Has the \catattr{noshortplural} attribute been set? +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{noshortplural}{true}% + {% + \let\@gls@shortpl\@gls@short + }% + {% + \expandafter\def\expandafter\@gls@shortpl\expandafter{\@gls@short + \abbrvpluralsuffix}% + }% + }% +% \end{macrocode} +% Update \cs{glsshorttok}: +% \begin{macrocode} + \expandafter\glsshorttok\expandafter{\@gls@short}% +% \end{macrocode} +% Hook for further customisation if required: +% \begin{macrocode} + \glsxtrnewabbrevpresetkeyhook{#1}{#2}{#3}% +% \end{macrocode} +% Get the short and long plurals provided by user in optional +% argument to override defaults, if necessary. +% Ignore the category key (already obtained). +% \begin{macrocode} + \setkeys*{glsxtrabbrv}[category]{#1}% +% \end{macrocode} +% Has the plural been explicitly set? +% \begin{macrocode} + \ifx\@gls@default@longpl\@gls@longpl + \else +% \end{macrocode} +% Has the \catattr{markwords} attribute been set? +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{markwords}{true}% + {% + \expandafter\@glsxtr@markwordseps\expandafter\@gls@longpl\expandafter + {\@gls@longpl}% + }% + {}% + \fi +% \end{macrocode} +% Set the plural token registers so the values can be accessed by +% the abbreviation styles. +% \begin{macrocode} + \expandafter\glsshortpltok\expandafter{\@gls@shortpl}% + \expandafter\glslongpltok\expandafter{\@gls@longpl}% +% \end{macrocode} +% Hook for accessibility support (does nothing if +% \sty{glossaries-accsupp} hasn't been loaded). +% \begin{macrocode} + \@gls@setup@default@short@access{#3}% +% \end{macrocode} +% Do any extra setup provided by hook: +% \begin{macrocode} + \newabbreviationhook +% \end{macrocode} +% Define this entry: +% \begin{macrocode} + \protected@edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\glsxtrabbrvtype,% + category=abbreviation,% + short={\the\glsshorttok},% + shortplural={\the\glsshortpltok},% + long={\the\glslongtok},% + longplural={\the\glslongpltok},% + name={\the\glsshorttok},% + \CustomAbbreviationFields,% +% \end{macrocode} +% Hook may override abbreviation style default settings (this hook +% must end with a comma if set). +% \begin{macrocode} + \ExtraCustomAbbreviationFields +% \end{macrocode} +% Any explicit fields set in the optional argument override all +% other settings. +% \begin{macrocode} + \the\glskeylisttok + }% + }% + \@do@newglossaryentry + \GlsXtrPostNewAbbreviation +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewabbrevpresetkeyhook} +% Hook for extra stuff in \cs{newabbreviation} +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\glsxtrnewabbrevpresetkeyhook}[3]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrPostNewAbbreviation} +% Hook used by abbreviation styles. +% \begin{macrocode} +\newcommand*{\GlsXtrPostNewAbbreviation}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newabbreviationhook} +% Hook for use with \cs{newabbreviation}. +% \begin{macrocode} +\newcommand*{\newabbreviationhook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\CustomAbbreviationFields} +% \begin{macrocode} +\newcommand*{\CustomAbbreviationFields}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrparen} +%\changes{1.17}{2017-08-09}{new} +%For the parenthetical styles. +% \begin{macrocode} +\newcommand*{\glsxtrparen}[1]{(#1)} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullformat} +% Full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{#1}}#2\glsxtrfullsep{#1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{#1}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfullformat} +% Full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongfont{\Glsaccesslong{#1}}#2\glsxtrfullsep{#1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{#1}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullplformat} +% Plural full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{#1}}#2\glsxtrfullsep{#1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{#1}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfullplformat} +% Plural full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongfont{\Glsaccesslongpl{#1}}#2\glsxtrfullsep{#1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{#1}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullsep} +% Separator used by full format is a space by default. The argument +% is the entry's label. +% \begin{macrocode} +\newcommand*{\glsxtrfullsep}[1]{\space} +% \end{macrocode} +%\end{macro} +% +% In-line formats in case first use isn't compatible with +% \cs{glsentryfull} (for example, first use suppresses the long form +% or uses a footnote). +%\begin{macro}{\glsxtrinlinefullformat} +% Full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrinlinefullformat} +% Full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullplformat} +% Plural full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrinlinefullplformat} +% Plural full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat} +% \end{macrocode} +%\end{macro} +% +% Redefine \cs{glsentryfull} etc to use the inline format. +% Since these commands as supposed to be expandable, they can only +% use the currently applied style. If there are mixed styles, you'll +% need to use the \cs{glsxtrfull} set of commands instead. +%\begin{macro}{\glsentryfull} +% \begin{macrocode} +\renewcommand*{\glsentryfull}[1]{\glsxtrinlinefullformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsentryfull} +% \begin{macrocode} +\renewcommand*{\Glsentryfull}[1]{\Glsxtrinlinefullformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryfullpl} +% \begin{macrocode} +\renewcommand*{\glsentryfullpl}[1]{\glsxtrinlinefullplformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsentryfullpl} +% \begin{macrocode} +\renewcommand*{\Glsentryfullpl}[1]{\Glsxtrinlinefullplformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstabbrvfont} +% Font changing command used for the abbreviation on first use or in +% the full format. +% \begin{macrocode} +\newcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstabbrvdefaultfont} +% Font changing command used for the abbreviation on first use or in +% the full format. +%\changes{0.5}{2015-12-07}{new} +%\changes{1.40}{2019-03-31}{changed definition from \cs{glsabbrvfont} to +%\cs{glsabbrvdefaultfont} for consistency} +% \begin{macrocode} +\newcommand*{\glsfirstabbrvdefaultfont}[1]{\glsabbrvdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsabbrvfont} +% Font changing command used for the abbreviation on subsequent use. +% \begin{macrocode} +\newcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsabbrvdefaultfont} +%\changes{0.3}{2015-12-02}{renamed from \cs{abbrvdefaultfont}} +% \begin{macrocode} +\newcommand*{\glsabbrvdefaultfont}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongfont} +%\changes{1.04}{2016-05-02}{new} +% Font changing command used for the long form in commands like +% \cs{glsxtrlong}. +% \begin{macrocode} +\newcommand*{\glslongfont}[1]{\glslongdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongdefaultfont} +% Default font changing command used for the long form in commands like +%\changes{1.04}{2016-05-02}{new} +% \cs{glsxtrlong}. +% \begin{macrocode} +\newcommand*{\glslongdefaultfont}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstlongfont} +% Font changing command used for the long form on first use or in +% the full format. +% \begin{macrocode} +\newcommand*{\glsfirstlongfont}[1]{\glslongfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstlongdefaultfont} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsfirstlongdefaultfont}[1]{\glslongdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrabbrvpluralsuffix} +% Default plural suffix. +%\changes{1.12}{2017-02-03}{new} +%Allow an alternative default suffix for abbreviations. +% \begin{macrocode} +\newcommand*{\glsxtrabbrvpluralsuffix}{\glspluralsuffix} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\abbrvpluralsuffix} +% Default plural suffix. +% \begin{macrocode} +\newcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfull} +% Full form (no case-change). +% \begin{macrocode} +\newrobustcmd*{\glsxtrfull}{\@gls@hyp@opt\ns@glsxtrfull} +\newcommand*\ns@glsxtrfull[2][]{% + \new@ifnextchar[{\@glsxtr@full{#1}{#2}}% + {\@glsxtr@full{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@full} +% Low-level macro: +% \begin{macrocode} +\def\@glsxtr@full#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{\glsxtrinlinefullformat{#2}{#3}}% +% \end{macrocode} +% What should \cs{glsxtrifwasfirstuse} be set to here? Where the inline +% and display full forms are the same, this is essentially emulating +% first use, to it make sense for the postlink hook to pretend it +% was a first use instance. It makes less sense if the inline and +% display forms are different. Provide a hook to make it easier to +% reconfigure. +% \begin{macrocode} + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetupfulldefs} +% \begin{macrocode} +\newcommand*{\glsxtrsetupfulldefs}{% + \let\glsxtrifwasfirstuse\@firstoftwo +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfull} +% Full form (first letter uppercase). +% \begin{macrocode} +\newrobustcmd*{\Glsxtrfull}{\@gls@hyp@opt\ns@Glsxtrfull} +\newcommand*\ns@Glsxtrfull[2][]{% + \new@ifnextchar[{\@Glsxtr@full{#1}{#2}}% + {\@Glsxtr@full{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@Glsxtr@full} +% Low-level macro: +% \begin{macrocode} +\def\@Glsxtr@full#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{\Glsxtrinlinefullformat{#2}{#3}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrfull} +% Full form (all uppercase). +% \begin{macrocode} +\newrobustcmd*{\GLSxtrfull}{\@gls@hyp@opt\ns@GLSxtrfull} +\newcommand*\ns@GLSxtrfull[2][]{% + \new@ifnextchar[{\@GLSxtr@full{#1}{#2}}% + {\@GLSxtr@full{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@GLSxtr@full} +% Low-level macro: +% \begin{macrocode} +\def\@GLSxtr@full#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{\mfirstucMakeUppercase{\glsxtrinlinefullformat{#2}{#3}}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullpl} +% Plural full form (no case-change). +% \begin{macrocode} +\newrobustcmd*{\glsxtrfullpl}{\@gls@hyp@opt\ns@glsxtrfullpl} +\newcommand*\ns@glsxtrfullpl[2][]{% + \new@ifnextchar[{\@glsxtr@fullpl{#1}{#2}}% + {\@glsxtr@fullpl{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@fullpl} +% Low-level macro: +% \begin{macrocode} +\def\@glsxtr@fullpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{\glsxtrinlinefullplformat{#2}{#3}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfullpl} +% Plural full form (first letter uppercase). +% \begin{macrocode} +\newrobustcmd*{\Glsxtrfullpl}{\@gls@hyp@opt\ns@Glsxtrfullpl} +\newcommand*\ns@Glsxtrfullpl[2][]{% + \new@ifnextchar[{\@Glsxtr@fullpl{#1}{#2}}% + {\@Glsxtr@fullpl{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@Glsxtr@fullpl} +% Low-level macro: +% \begin{macrocode} +\def\@Glsxtr@fullpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{\Glsxtrinlinefullplformat{#2}{#3}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrfullpl} +% Plural full form (all upper case). +% \begin{macrocode} +\newrobustcmd*{\GLSxtrfullpl}{\@gls@hyp@opt\ns@GLSxtrfullpl} +\newcommand*\ns@GLSxtrfullpl[2][]{% + \new@ifnextchar[{\@GLSxtr@fullpl{#1}{#2}}% + {\@GLSxtr@fullpl{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@GLSxtr@fullpl} +% Low-level macro: +% \begin{macrocode} +\def\@GLSxtr@fullpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\glsxtrinlinefullplformat{#2}{#3}}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% The short and long forms work in a similar way to acronyms. +%\begin{macro}{\glsxtrshort} +% \begin{macrocode} +\newrobustcmd*{\glsxtrshort}{\@gls@hyp@opt\ns@glsxtrshort} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrshort}[2][]{% + \new@ifnextchar[{\@glsxtrshort{#1}{#2}}{\@glsxtrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrshort#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% +% \end{macrocode} +% Need to make sure \cs{glsabbrvfont} is set correctly. +% \begin{macrocode} + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\glsaccessshort{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrshort} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrshort}{\@gls@hyp@opt\ns@Glsxtrshort} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrshort}[2][]{% + \new@ifnextchar[{\@Glsxtrshort{#1}{#2}}{\@Glsxtrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrshort#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\Glsaccessshort{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrshort} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrshort}{\@gls@hyp@opt\ns@GLSxtrshort} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrshort}[2][]{% + \new@ifnextchar[{\@GLSxtrshort{#1}{#2}}{\@GLSxtrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrshort#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase + {\glsabbrvfont{\glsaccessshort{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrlong} +% \begin{macrocode} +\newrobustcmd*{\glsxtrlong}{\@gls@hyp@opt\ns@glsxtrlong} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrlong}[2][]{% + \new@ifnextchar[{\@glsxtrlong{#1}{#2}}{\@glsxtrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrlong#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glslongfont{\glsaccesslong{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrlong} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrlong}{\@gls@hyp@opt\ns@Glsxtrlong} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrlong}[2][]{% + \new@ifnextchar[{\@Glsxtrlong{#1}{#2}}{\@Glsxtrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrlong#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glslongfont{\Glsaccesslong{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrlong} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrlong}{\@gls@hyp@opt\ns@GLSxtrlong} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrlong}[2][]{% + \new@ifnextchar[{\@GLSxtrlong{#1}{#2}}{\@GLSxtrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrlong#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase + {\glslongfont{\glsaccesslong{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% Plural short forms: +%\begin{macro}{\glsxtrshortpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrshortpl}{\@gls@hyp@opt\ns@glsxtrshortpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrshortpl}[2][]{% + \new@ifnextchar[{\@glsxtrshortpl{#1}{#2}}{\@glsxtrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrshortpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\glsaccessshortpl{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrshortpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrshortpl}{\@gls@hyp@opt\ns@Glsxtrshortpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrshortpl}[2][]{% + \new@ifnextchar[{\@Glsxtrshortpl{#1}{#2}}{\@Glsxtrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrshortpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\Glsaccessshortpl{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrshortpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrshortpl}{\@gls@hyp@opt\ns@GLSxtrshortpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrshortpl}[2][]{% + \new@ifnextchar[{\@GLSxtrshortpl{#1}{#2}}{\@GLSxtrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrshortpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase + {\glsabbrvfont{\glsaccessshortpl{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% Plural long forms: +%\begin{macro}{\glsxtrlongpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrlongpl}{\@gls@hyp@opt\ns@glsxtrlongpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrlongpl}[2][]{% + \new@ifnextchar[{\@glsxtrlongpl{#1}{#2}}{\@glsxtrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrlongpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glslongfont{\glsaccesslongpl{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrlongpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrlongpl}{\@gls@hyp@opt\ns@Glsxtrlongpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrlongpl}[2][]{% + \new@ifnextchar[{\@Glsxtrlongpl{#1}{#2}}{\@Glsxtrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrlongpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glslongfont{\Glsaccesslongpl{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrlongpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrlongpl}{\@gls@hyp@opt\ns@GLSxtrlongpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrlongpl}[2][]{% + \new@ifnextchar[{\@GLSxtrlongpl{#1}{#2}}{\@GLSxtrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrlongpl#1#2[#3]{% +% \end{macrocode} +%If the \pkgopt{record} option has been used, the information needs +%to be written to the aux file regardless of whether the entry +%exists (unless indexing has been switched off). +%\changes{1.30}{2018-04-25}{added \cs{@glsxtr@record}} +% \begin{macrocode} + \@glsxtr@record{#1}{#2}{glslink}% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase + {\glslongfont{\glsaccesslongpl{#2}\ifglsxtrinsertinside#3\fi}% + \ifglsxtrinsertinside\else#3\fi + }% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssetabbrvfmt} +% Set the current format for the given category (or the +% \category{abbreviation} category if unset). +% \begin{macrocode} +\newcommand*{\glssetabbrvfmt}[1]{% + \ifcsdef{@glsabbrv@current@#1}% + {\glsxtr@applyabbrvfmt{\csname @glsabbrv@current@#1\endcsname}}% + {\glsxtr@applyabbrvfmt{\@glsabbrv@current@abbreviation}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsuseabbrvfont} +% Provide a way to use the abbreviation font for a given category +% for arbitrary text. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsuseabbrvfont}[2]{{\glssetabbrvfmt{#2}\glsabbrvfont{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsuselongfont} +% Provide a way to use the long font for a given category +% for arbitrary text. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsuselongfont}[2]{{\glssetabbrvfmt{#2}\glslongfont{#1}}} +% \end{macrocode} +%\end{macro} +% +%\changes{0.5.2}{2015-12-08}{removed \cs{glsxtrabbrvfmt}} +%\begin{macro}{\glsxtrgenabbrvfmt} +% Similar to \cs{glsgenacfmt}, but for abbreviations. +%\changes{1.17}{2017-08-09}{added check for \cs{ifglsxtrinsertinside}} +% \begin{macrocode} +\newcommand*{\glsxtrgenabbrvfmt}{% + \ifdefempty\glscustomtext + {% + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use: +% \begin{macrocode} + \glsifplural + {% +% \end{macrocode} +% Subsequent plural form: +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Subsequent plural form, don't adjust case: +% \begin{macrocode} + \glsxtrsubsequentplfmt{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Subsequent plural form, make first letter upper case: +% \begin{macrocode} + \Glsxtrsubsequentplfmt{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Subsequent plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsxtrsubsequentplfmt{\glslabel}{\glsinsert}}% + }% + }% + {% +% \end{macrocode} +% Subsequent singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Subsequent singular form, don't adjust case: +% \begin{macrocode} + \glsxtrsubsequentfmt{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Subsequent singular form, make first letter upper case: +% \begin{macrocode} + \Glsxtrsubsequentfmt{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Subsequent singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsxtrsubsequentfmt{\glslabel}{\glsinsert}}% + }% + }% + }% + {% +% \end{macrocode} +% First use: +% \begin{macrocode} + \glsifplural + {% +% \end{macrocode} +% First use plural form: +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% First use plural form, don't adjust case: +% \begin{macrocode} + \glsxtrfullplformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, make first letter upper case: +% \begin{macrocode} + \Glsxtrfullplformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsxtrfullplformat{\glslabel}{\glsinsert}}% + }% + }% + {% +% \end{macrocode} +% First use singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% First use singular form, don't adjust case: +% \begin{macrocode} + \glsxtrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, make first letter upper case: +% \begin{macrocode} + \Glsxtrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsxtrfullformat{\glslabel}{\glsinsert}}% + }% + }% + }% + }% + {% +% \end{macrocode} +% User supplied text. +% \begin{macrocode} + \glscustomtext + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsubsequentfmt} +% Subsequent use format (singular no case change). +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrsubsequentfmt}[2]{% + \glsabbrvfont{\glsaccessshort{#1}\ifglsxtrinsertinside #2\fi}% + \ifglsxtrinsertinside \else#2\fi +} +\let\glsxtrdefaultsubsequentfmt\glsxtrsubsequentfmt +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsubsequentplfmt} +% Subsequent use format (plural no case change). +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrsubsequentplfmt}[2]{% + \glsabbrvfont{\glsaccessshortpl{#1}\ifglsxtrinsertinside #2\fi}% + \ifglsxtrinsertinside \else#2\fi +} +\let\glsxtrdefaultsubsequentplfmt\glsxtrsubsequentplfmt +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrsubsequentfmt} +% Subsequent use format (singular, first letter uppercase). +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\Glsxtrsubsequentfmt}[2]{% + \glsabbrvfont{\Glsaccessshort{#1}\ifglsxtrinsertinside #2\fi}% + \ifglsxtrinsertinside \else#2\fi +} +\let\Glsxtrdefaultsubsequentfmt\Glsxtrsubsequentfmt +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrsubsequentplfmt} +% Subsequent use format (plural, first letter uppercase). +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glsabbrvfont{\Glsaccessshortpl{#1}\ifglsxtrinsertinside #2\fi}% + \ifglsxtrinsertinside \else#2\fi +} +\let\Glsxtrdefaultsubsequentplfmt\Glsxtrsubsequentplfmt +% \end{macrocode} +%\end{macro} +% +%\subsection{Abbreviation Styles Setup} +% +%\begin{macro}{\setabbreviationstyle} +% \begin{macrocode} +\newcommand*{\setabbreviationstyle}[2][abbreviation]{% + \ifcsundef{@glsabbrv@dispstyle@setup@#2} + {% + \PackageError{glossaries-extra}{Undefined abbreviation style `#2'}{}% + }% + {% +% \end{macrocode} +% Have abbreviations already been defined for this category? +%\changes{0.5.2}{2015-12-08}{added check for post-definition style switch} +% \begin{macrocode} + \ifcsstring{@glsabbrv@current@#1}{#2}% + {% +% \end{macrocode} +% Style already set. +% \begin{macrocode} + }% + {% + \def\@glsxtr@dostylewarn{}% + \glsforeachincategory{#1}{\@gls@type}{\@gls@label}% + {% + \def\@glsxtr@dostylewarn{\GlossariesWarning{Abbreviation + style has been switched \MessageBreak + for category `#1', \MessageBreak + but there have already been entries \MessageBreak + defined for this category. Unwanted \MessageBreak + side-effects may result}}% + \@endfortrue + }% + \@glsxtr@dostylewarn +% \end{macrocode} +% Set up the style for the given category. +% \begin{macrocode} + \csdef{@glsabbrv@current@#1}{#2}% + \glsxtr@applyabbrvstyle{#2}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@applyabbrvstyle} +% Apply the abbreviation style without existence check. +% \begin{macrocode} +\newcommand*{\glsxtr@applyabbrvstyle}[1]{% + \csuse{@glsabbrv@dispstyle@setup@#1}% + \csuse{@glsabbrv@dispstyle@fmts@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@applyabbrvfmt} +% Only apply the style formats. +% \begin{macrocode} +\newcommand*{\glsxtr@applyabbrvfmt}[1]{% + \csuse{@glsabbrv@dispstyle@fmts@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newabbreviationstyle} +% This is different from \cs{newacronymstyle}. The first argument is +% the label, the second argument sets the information required when +% defining the new abbreviation and the third argument sets the +% commands used to display the full format. +%\changes{1.04}{2016-05-02}{bug fix: corrected test for existence} +% \begin{macrocode} +\newcommand*{\newabbreviationstyle}[3]{% + \ifcsdef{@glsabbrv@dispstyle@setup@#1} + {% + \PackageError{glossaries-extra}{Abbreviation style `#1' already + defined}{}% + }% + {% + \csdef{@glsabbrv@dispstyle@setup@#1}{% +% \end{macrocode} +% Initialise hook to do nothing. The style may change this. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{}% + #2}% + \csdef{@glsabbrv@dispstyle@fmts@#1}{% +% \end{macrocode} +% Assume in-line form is the same as first use. The style may change +% this. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat}% + \renewcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat}% + \renewcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat}% + \renewcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat}% +% \end{macrocode} +% Reset \cs{glsxtrsubsequentfmt} etc in case a style changes this. +% \begin{macrocode} + \let\glsxtrsubsequentfmt\glsxtrdefaultsubsequentfmt + \let\glsxtrsubsequentplfmt\glsxtrdefaultsubsequentplfmt + \let\Glsxtrsubsequentfmt\Glsxtrdefaultsubsequentfmt + \let\Glsxtrsubsequentplfmt\Glsxtrdefaultsubsequentplfmt + #3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\renewabbreviationstyle} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\renewabbreviationstyle}[3]{% + \ifcsundef{@glsabbrv@dispstyle@setup@#1} + {% + \PackageError{glossaries-extra}{Abbreviation style `#1' not defined}{}% + }% + {% + \csdef{@glsabbrv@dispstyle@setup@#1}{% +% \end{macrocode} +% Initialise hook to do nothing. The style may change this. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{}% + #2}% + \csdef{@glsabbrv@dispstyle@fmts@#1}{% +% \end{macrocode} +% Assume in-line form is the same as first use. The style may change +% this. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat}% + \renewcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat}% + \renewcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat}% + \renewcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat}% + #3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\letabbreviationstyle} +%\changes{1.04}{2016-05-02}{new} +% Define a synonym for an abbreviation style. The first argument is +% the new name. The second argument is the original style's name. +% \begin{macrocode} +\newcommand*{\letabbreviationstyle}[2]{% + \csletcs{@glsabbrv@dispstyle@setup@#1}{@glsabbrv@dispstyle@setup@#2}% + \csletcs{@glsabbrv@dispstyle@fmts@#1}{@glsabbrv@dispstyle@fmts@#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@deprecated@abbrstyle} +%\changes{1.04}{2016-05-02}{new} +%\begin{definition} +%\cs{@glsxtr@deprecated@abbrstyle}\marg{old-name}\marg{new-name} +%\end{definition} +% Define a synonym for a deprecated abbreviation style. +% \begin{macrocode} +\newcommand*{\@glsxtr@deprecated@abbrstyle}[2]{% + \csdef{@glsabbrv@dispstyle@setup@#1}{% + \GlsXtrWarnDeprecatedAbbrStyle{#1}{#2}% + \csuse{@glsabbrv@dispstyle@setup@#2}% + }% + \csletcs{@glsabbrv@dispstyle@fmts@#1}{@glsabbrv@dispstyle@fmts@#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrWarnDeprecatedAbbrStyle} +%Generate warning for deprecated style use. +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrWarnDeprecatedAbbrStyle}[2]{% + \GlossariesExtraWarning{Deprecated abbreviation style name `#1', + use `#2' instead}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrUseAbbrStyleSetup} +% \begin{macrocode} +\newcommand*{\GlsXtrUseAbbrStyleSetup}[1]{% + \ifcsundef{@glsabbrv@dispstyle@setup@#1}% + {% + \PackageError{glossaries-extra}% + {Unknown abbreviation style definitions `#1'}{}% + }% + {% + \csname @glsabbrv@dispstyle@setup@#1\endcsname + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrUseAbbrStyleFmts} +% \begin{macrocode} +\newcommand*{\GlsXtrUseAbbrStyleFmts}[1]{% + \ifcsundef{@glsabbrv@dispstyle@fmts@#1}% + {% + \PackageError{glossaries-extra}% + {Unknown abbreviation style formats `#1'}{}% + }% + {% + \csname @glsabbrv@dispstyle@fmts@#1\endcsname + }% +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Predefined Styles (Default Font)} +% Define some common styles. These will set the \gloskey{first}, +% \gloskey{firstplural}, \gloskey{text} and \gloskey{plural} +% keys, even if the \catattr{regular} attribute isn't set to +% \qt{true}. If this attribute is set, commands like \cs{gls} will +% use them as per a regular entry, otherwise those keys will be +% ignored unless explicitly invoked by the user with commands like +% \cs{glsfirst}. In order for the first letter uppercase versions to +% work correctly, \cs{glsxtrfullformat} needs to be expanded when +% those keys are set. The final optional argument of \cs{glsfirst} +% will behave differently to the final optional argument of \cs{gls} +% with some styles. +% +%\begin{macro}{\ifglsxtrinsertinside} +%\changes{1.02}{2016-04-25}{new} +% Switch to determine if the insert text should be inside or outside +% the font changing command. The default is outside. +% \begin{macrocode} +\newif\ifglsxtrinsertinside +\glsxtrinsertinsidefalse +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrlongshortname} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrlongshortname}{% + \protect\glsabbrvfont{\the\glsshorttok}% +} +% \end{macrocode} +%\end{macro} +% +%\changes{1.17}{2017-08-09}{removed some inconsistencies in the abbreviation +%styles} +%\begin{abbrvstyle}{long-short} +% \begin{macrocode} +\newabbreviationstyle{long-short}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshortpltok}}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvfont{\the\glsshortpltok}},% + description={\the\glslongtok}}% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +% Set this as the default style for general abbreviations: +% \begin{macrocode} +\setabbreviationstyle{long-short} +% \end{macrocode} +% +%\begin{macro}{\glsxtrlongshortdescsort} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\glsxtrlongshortdescsort}{% + \expandonce\glsxtrorglong\space (\expandonce\glsxtrorgshort)% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrlongshortdescname} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrlongshortdescname}{% + \protect\glslongfont{\the\glslongtok} + \glsxtrparen{\protect\glsabbrvfont{\the\glsshorttok}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-short-desc} +% User supplies description. The long form is included in the name. +%\changes{0.3}{2015-12-02}{fixed name to use \cs{glslabeltok}} +% \begin{macrocode} +\newabbreviationstyle{long-short-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortdescname}, + sort={\glsxtrlongshortdescsort},% + first={\protect\glsfirstlongfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvfont{\the\glsshortpltok}}},% +% \end{macrocode} +%The \gloskey{text} key should only have the short form. +%\changes{1.07}{2016-08-15}{added missing text key} +% \begin{macrocode} + text={\protect\glsabbrvfont{\the\glsshorttok}},% +% \end{macrocode} +%\changes{1.07}{2016-08-15}{fixed misspelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-short}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrshortlongname} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrshortlongname}{% + \protect\glsabbrvfont{\the\glsshorttok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{short-long} +% Short form followed by long form in parenthesis on first use. +% \begin{macrocode} +\newabbreviationstyle{short-long}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongfont{\the\glslongpltok}}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvfont{\the\glsshortpltok}}}% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrshortlongdescsort} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrshortlongdescsort}{\the\glsshorttok} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrshortlongdescname} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrshortlongdescname}{% + \protect\glsabbrvfont{\the\glsshorttok} + \glsxtrparen{\protect\glslongfont{\the\glslongtok}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{short-long-desc} +% User supplies description. The long form is included in the name. +%\changes{0.3}{2015-12-02}{fixed name to use \cs{glslabeltok}} +% \begin{macrocode} +\newabbreviationstyle{short-long-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongdescname}, + sort={\glsxtrshortlongdescsort}, + first={\protect\glsfirstabbrvfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongfont{\the\glslongpltok}}},% +% \end{macrocode} +%\changes{1.07}{2016-08-15}{added text key} +% \begin{macrocode} + text={\protect\glsabbrvfont{\the\glsshorttok}},% +% \end{macrocode} +%\changes{1.07}{2016-08-15}{fixed misspelling of \cs{glsabbrvfont} in plural +%key} +% \begin{macrocode} + plural={\protect\glsabbrvfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-long}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsfirstlongfootnotefont} +%\changes{1.05}{2016-06-10}{new} +%Only used by the \qt{footnote} styles. +% \begin{macrocode} +\newcommand*{\glsfirstlongfootnotefont}[1]{\glslongfootnotefont{#1}}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongfootnotefont} +%\changes{1.05}{2016-06-10}{new} +%Only used by the \qt{footnote} styles. +% \begin{macrocode} +\newcommand*{\glslongfootnotefont}[1]{\glslongdefaultfont{#1}}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrabbrvfootnote} +%\begin{definition} +%\cs{glsxtrabbrvfootnote}\marg{label}\marg{long} +%\end{definition} +%\changes{1.07}{2016-08-15}{new} +%Command used by footnote abbreviation styles. The default +%definition ignores the first argument. The second argument +%\meta{long} includes the font changing command and may be the +%singular or plural form, depending on the command that was used +%(for example, \cs{gls} or \cs{glspl}). +% \begin{macrocode} +\newcommand*{\glsxtrabbrvfootnote}[2]{\footnote{#2}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfootnotename} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrfootnotename}{% + \protect\glsabbrvfont{\the\glsshorttok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{footnote} +% Short form followed by long form in footnote on first use. +% \begin{macrocode} +\newabbreviationstyle{footnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% +% \end{macrocode} +%\changes{1.07}{2016-08-15}{changed first forms to use +%\cs{glsfirstlongfootnotefont}} +% \begin{macrocode} + first={\protect\glsfirstabbrvfont{\the\glsshorttok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Switch off hyperlinks on first use to prevent nested hyperlinks, +% and unset the \catattr{regular} attribute if it has been set. +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form followed by the long form +% as a footnote. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{short-footnote} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-footnote}{footnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{postfootnote} +% Similar to the above but the footnote is placed afterwards, +% outside the link. This avoids nested links and can also move the +% footnote marker after any following punctuation mark. +% Pre v1.07 included \cs{footnote} in the first keys, which was +% incorrect as it caused duplicate footnotes. +%\changes{1.07}{2016-08-15}{removed \cs{footnote} from first keys} +% \begin{macrocode} +\newabbreviationstyle{postfootnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvfont{\the\glsshorttok}},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Make this category insert a footnote after the link if this was +% the first use, and +% unset the \catattr{regular} attribute if it has been set. +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% +% \end{macrocode} +% Needs the specific font command here as the style may have been +% lost by the time the footnote occurs. +% \begin{macrocode} + \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}% + {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +% \end{macrocode} +%\changes{1.02}{2016-04-25}{added redef of \cs{glsxtrsetupfulldefs}} +% The footnote needs to be suppressed in the inline form, so +% \cs{glsxtrfull} must set the first use switch off. +% \begin{macrocode} + \renewcommand*{\glsxtrsetupfulldefs}{% + \let\glsxtrifwasfirstuse\@secondoftwo + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form. The long form is +% deferred. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +%\changes{1.07}{2016-08-15}{switched from \cs{glsfirstlongfont} to +%\cs{glsfirstlongfootnotefont}} +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-postfootnote} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-postfootnote}{postfootnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrshortnolongname} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrshortnolongname}{% + \protect\glsabbrvfont{\the\glsshorttok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{short} +% Provide a style that only displays the short form on first use, +% but the short and long form can be displayed with the \qt{full} +% commands that use the inline format. If the user supplies a +% description, the long form won't be displayed in the predefined +% glossary styles, but the post description hook can be employed to +% automatically insert it. +% \begin{macrocode} +\newabbreviationstyle{short}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortnolongname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}}, + text={\protect\glsabbrvfont{\the\glsshorttok}}, + plural={\protect\glsabbrvfont{\the\glsshortpltok}}, + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short form followed by the +% long form in parentheses. +%\changes{0.2}{2015-11-30}{switched inline full form to short (long)} +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\Glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\Glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% Set this as the default style for acronyms: +% \begin{macrocode} +\setabbreviationstyle[acronym]{short} +% \end{macrocode} +% +%\begin{abbrvstyle}{short-nolong} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-nolong}{short} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-nolong-noreg} +%\changes{1.17}{2017-08-09}{new} +% Like \abbrstyle{short-nolong} but doesn't set the \catattr{regular} attribute. +% \begin{macrocode} +\newabbreviationstyle{short-nolong-noreg}% +{% + \GlsXtrUseAbbrStyleSetup{short-nolong}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-nolong}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +% +%\begin{macro}{\glsxtrshortdescname} +%\changes{1.17}{2017-08-09}{new} +%\changes{1.39}{2019-03-22}{corrected to show long form as advertised in the +%manual} +% \begin{macrocode} +\newcommand*{\glsxtrshortdescname}{% + \protect\glsabbrvfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \protect\glsxtrparen{\protect\glslongfont{\the\glslongtok}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{short-desc} +% The user must supply the description in this style. The long form +% is added to the name. The \abbrstyle{short} style (possibly with the +% post-description hooks set) might be a better option. +%\changes{1.01}{2016-02-02}{fixed typo in +%\cs{glsxtrinlinefullformat} and added missing second argument} +%\changes{1.39}{2019-03-22}{corrected to omit \gloskey{description} key as advertised in the +%manual} +% \begin{macrocode} +\newabbreviationstyle{short-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortdescname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}}, + text={\protect\glsabbrvfont{\the\glsshorttok}}, + plural={\protect\glsabbrvfont{\the\glsshortpltok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short format followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{short-nolong-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-nolong-desc}{short-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-nolong-desc-noreg} +%\changes{1.17}{2017-08-09}{new} +% Like \abbrstyle{short-nolong-desc} but doesn't set the \catattr{regular} attribute. +% \begin{macrocode} +\newabbreviationstyle{short-nolong-desc-noreg}% +{% + \GlsXtrUseAbbrStyleSetup{short-nolong-desc}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-nolong-desc}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{nolong-short} +% Similar to \abbrstyle{short-nolong} but the full form shows the +% long form followed by the short form in parentheses. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newabbreviationstyle{nolong-short}% +{% + \GlsXtrUseAbbrStyleSetup{short-nolong}% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-nolong}% +% \end{macrocode} +% The inline full form displays the long form followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongfont{\glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongfont{\glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongfont{\glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\Glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongfont{\glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvfont{\Glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{nolong-short-noreg} +%\changes{1.21}{2017-11-03}{new} +% Like \abbrstyle{nolong-short} but doesn't set the \catattr{regular} attribute. +% \begin{macrocode} +\newabbreviationstyle{nolong-short-noreg}% +{% + \GlsXtrUseAbbrStyleSetup{nolong-short}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{nolong-short}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrlongnoshortdescname} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrlongnoshortdescname}{% + \protect\glslongfont{\the\glslongtok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-desc} +% Provide a style that only displays the long form, +% but the long and short form can be displayed with the \qt{full} +% commands that use the inline format. The predefined glossary styles +% won't show the short form. The user must supply a description for +% this style. +% \begin{macrocode} +\newabbreviationstyle{long-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortdescname}, + sort={\the\glslongtok}, + first={\protect\glsfirstlongfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}}, + text={\glslongfont{\the\glslongtok}}, + plural={\glslongfont{\the\glslongpltok}}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{long-noshort-desc} +%\changes{1.04}{2016-05-02}{new} +%Provide a synonym that matches similar styles. +% \begin{macrocode} +\letabbreviationstyle{long-noshort-desc}{long-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-desc-noreg} +%\changes{1.17}{2017-08-09}{new} +% Like long-noshort-desc but doesn't set the \catattr{regular} attribute. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-desc-noreg}% +{% + \GlsXtrUseAbbrStyleSetup{long-noshort-desc}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-noshort-desc}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrlongnoshortname} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrlongnoshortname}{% + \protect\glsabbrvfont{\the\glsshorttok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long} +% It doesn't really make a great deal of sense to have a long-only +% style that doesn't have a description (unless no glossary is +% required), but the best course of +% action here is to use the short form as the name and the long +% form as the description. +% \begin{macrocode} +\newabbreviationstyle{long}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}}, + text={\glslongfont{\the\glslongtok}}, + plural={\glslongfont{\the\glslongpltok}},% + description={\the\glslongtok}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-desc}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort} +%\changes{1.04}{2016-05-02}{new} +%Provide a synonym that matches similar styles. +% \begin{macrocode} +\letabbreviationstyle{long-noshort}{long} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-noreg} +%\changes{1.17}{2017-08-09}{new} +% Like long-noshort but doesn't set the \catattr{regular} attribute. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-noreg}% +{% + \GlsXtrUseAbbrStyleSetup{long-noshort}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-noshort}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (Small Capitals)} +%These styles use \cs{textsc} for the short form. +%\begin{macro}{\glsxtrscfont} +%\changes{0.5}{2015-12-07}{new} +%Maintained for backward-compatibility. +% \begin{macrocode} +\newcommand*{\glsxtrscfont}[1]{\textsc{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsabbrvscfont} +%\changes{1.17}{2017-08-09}{new} +%Added for consistent naming. +% \begin{macrocode} +\newcommand*{\glsabbrvscfont}{\glsxtrscfont} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrfirstscfont} +%\changes{1.04}{2016-05-02}{new} +%Maintained for backward-compatibility. +% \begin{macrocode} +\newcommand*{\glsxtrfirstscfont}[1]{\glsabbrvscfont{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstabbrvscfont} +%\changes{1.17}{2017-08-09}{new} +%Added for consistent naming. +% \begin{macrocode} +\newcommand*{\glsfirstabbrvscfont}{\glsxtrfirstscfont} +% \end{macrocode} +%\end{macro} +% and for the default short form suffix: +%\begin{macro}{\glsxtrscsuffix} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrscsuffix}{\glstextup{\glsxtrabbrvpluralsuffix}} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-short-sc} +% \begin{macrocode} +\newabbreviationstyle{long-short-sc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshortpltok}}},% + plural={\protect\glsabbrvscfont{\the\glsshortpltok}},% + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% +% \end{macrocode} +% Use the default long fonts. +% \begin{macrocode} + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +% +%\begin{abbrvstyle}{long-short-sc-desc} +% \begin{macrocode} +\newabbreviationstyle{long-short-sc-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortdescname}, + sort={\glsxtrlongshortdescsort},% + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\the\glsshortpltok}}},% + text={\protect\glsabbrvscfont{\the\glsshorttok}},% + plural={\protect\glsabbrvscfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% As long-short-sc style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short-sc}% +} +% \end{macrocode} +% +% Now the short (long) version +% \begin{macrocode} +\newabbreviationstyle{short-sc-long}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvscfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},% + plural={\protect\glsabbrvscfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +% As before but user provides description +% \begin{macrocode} +\newabbreviationstyle{short-sc-long-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongdescname}, + sort={\glsxtrshortlongdescsort}, + first={\protect\glsfirstabbrvscfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},% + text={\protect\glsabbrvscfont{\the\glsshorttok}},% + plural={\protect\glsabbrvscfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% As short-sc-long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-sc-long}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sc} +% \begin{macrocode} +\newabbreviationstyle{short-sc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortnolongname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvscfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}}, + text={\protect\glsabbrvscfont{\the\glsshorttok}}, + plural={\protect\glsabbrvscfont{\the\glsshortpltok}}, + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short form followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvscfont{\glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{corrected first letter uppercasing} +% \begin{macrocode} + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvscfont{\Glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvscfont{\Glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sc-nolong} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-sc-nolong}{short-sc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sc-desc} +%\changes{1.39}{2019-03-22}{bug fix: omit \gloskey{description} key as advertised in the +%manual} +% \begin{macrocode} +\newabbreviationstyle{short-sc-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortdescname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvscfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}}, + text={\protect\glsabbrvscfont{\the\glsshorttok}}, + plural={\protect\glsabbrvscfont{\the\glsshortpltok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short format followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{short-sc-nolong-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-sc-nolong-desc}{short-sc-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{nolong-short-sc} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newabbreviationstyle{nolong-short-sc}% +{% + \GlsXtrUseAbbrStyleSetup{short-sc-nolong}% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-sc-nolong}% +% \end{macrocode} +% The inline full form displays the long form followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongdefaultfont{\glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongdefaultfont{\glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongdefaultfont{\Glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongdefaultfont{\Glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-sc} +%\changes{1.04}{2016-05-02}{renamed from \qt{long-sc}} +% The smallcaps font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsxtrshort}. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-sc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}}, + text={\protect\glslongdefaultfont{\the\glslongtok}}, + plural={\protect\glslongdefaultfont{\the\glslongpltok}},% + description={\the\glslongtok}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{long-sc} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{long-sc}{long-noshort-sc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-sc-desc} +%\changes{1.04}{2016-05-02}{renamed from \qt{long-desc-sc}} +% The smallcaps font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-sc-desc}% +{% + \GlsXtrUseAbbrStyleSetup{long-noshort-desc}% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvscfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{long-desc-sc} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{long-desc-sc}{long-noshort-sc-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sc-footnote} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \qt{footnote-sc}} +% \begin{macrocode} +\newabbreviationstyle{short-sc-footnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvscfont{\the\glsshorttok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},% + plural={\protect\glsabbrvscfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Switch off hyperlinks on first use to prevent nested hyperlinks, +% and unset the \catattr{regular} attribute if it has been set. +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form followed by the long form +% as a footnote. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{footnote-sc} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{footnote-sc}{short-sc-footnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sc-postfootnote} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \qt{postfootnote-sc}} +% \begin{macrocode} +\newabbreviationstyle{short-sc-postfootnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvscfont{\the\glsshorttok}},% + firstplural={\protect\glsfirstabbrvscfont{\the\glsshortpltok}},% + plural={\protect\glsabbrvscfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Make this category insert a footnote after the link if this was +% the first use, and +% unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% +% \end{macrocode} +% Needs the specific font command here as the style may have been +% lost by the time the footnote occurs. +% \begin{macrocode} + \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}% + {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +% \end{macrocode} +% The footnote needs to be suppressed in the inline form, so +% \cs{glsxtrfull} must set the first use switch off. +% \begin{macrocode} + \renewcommand*{\glsxtrsetupfulldefs}{% + \let\glsxtrifwasfirstuse\@secondoftwo + }% +}% +{% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvscfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvscfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form. The long form is +% deferred. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvscfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvscfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{postfootnote-sc} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{postfootnote-sc}{short-sc-postfootnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (Fake Small Capitals)} +% These styles require the \sty{relsize} package, which must be +% loaded by the user. These styles all use: +%\begin{macro}{\glsxtrsmfont} +%\changes{0.5}{2015-12-07}{new} +%Maintained for backward compatibility. +% \begin{macrocode} +\newcommand*{\glsxtrsmfont}[1]{\textsmaller{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsabbrvsmfont} +%\changes{1.17}{2017-08-09}{new} +%Added for consistent naming. +% \begin{macrocode} +\newcommand*{\glsabbrvsmfont}{\glsxtrsmfont} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrfirstsmfont} +%\changes{1.04}{2016-05-02}{new} +%Maintained for backward compatibility. +% \begin{macrocode} +\newcommand*{\glsxtrfirstsmfont}[1]{\glsabbrvsmfont{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstabbrvsmfont} +%\changes{1.17}{2017-08-09}{new} +%Added for consistent naming. +% \begin{macrocode} +\newcommand*{\glsfirstabbrvsmfont}{\glsxtrfirstsmfont} +% \end{macrocode} +%\end{macro} +% and for the default short form suffix: +%\begin{macro}{\glsxtrsmsuffix} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrsmsuffix}{\glsxtrabbrvpluralsuffix} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-short-sm} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-sm}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshortpltok}}},% + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}},% + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +% \end{macrocode} +% Use the default long fonts. +% \begin{macrocode} + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-short-sm-desc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-sm-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortdescname}, + sort={\glsxtrlongshortdescsort},% + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\the\glsshortpltok}}},% + text={\protect\glsabbrvsmfont{\the\glsshorttok}},% + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% As long-short-sm style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short-sm}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-long} +% Now the short (long) version +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-sm-long}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},% + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-long-desc} +% As before but user provides description +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-sm-long-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongdescname}, + sort={\glsxtrshortlongdescsort}, + first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},% + text={\protect\glsabbrvsmfont{\the\glsshorttok}},% + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% As short-sm-long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-sm-long}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-sm}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortnolongname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}}, + text={\protect\glsabbrvsmfont{\the\glsshorttok}}, + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}, + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short form followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvsmfont{\glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{corrected first letter uppercasing} +% \begin{macrocode} + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvsmfont{\Glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvsmfont{\Glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-nolong} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-sm-nolong}{short-sm} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-desc} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.39}{2019-03-22}{corrected to omit \gloskey{description} key as advertised in the +%manual} +% \begin{macrocode} +\newabbreviationstyle{short-sm-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortdescname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}}, + text={\protect\glsabbrvsmfont{\the\glsshorttok}}, + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short format followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{short-sm-nolong-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-sm-nolong-desc}{short-sm-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{nolong-short-sm} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newabbreviationstyle{nolong-short-sm}% +{% + \GlsXtrUseAbbrStyleSetup{short-sm-nolong}% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-sm-nolong}% +% \end{macrocode} +% The inline full form displays the long form followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongdefaultfont{\glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongdefaultfont{\glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongdefaultfont{\Glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongdefaultfont{\Glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-sm} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \qt{long-sm}} +% The smallcaps font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-sm}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}}, + text={\protect\glslongdefaultfont{\the\glslongtok}}, + plural={\protect\glslongdefaultfont{\the\glslongpltok}},% + description={\the\glslongtok}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{long-sm} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{long-sm}{long-noshort-sm} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-sm-desc} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \cs{long-desc-sm}} +% The smaller font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-sm-desc}% +{% + \GlsXtrUseAbbrStyleSetup{long-noshort-desc}% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvsmfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{long-desc-sm} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{long-desc-sm}{long-noshort-sm-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-footnote} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \qt{footnote-sm}} +% \begin{macrocode} +\newabbreviationstyle{short-sm-footnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},% + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Switch off hyperlinks on first use to prevent nested hyperlinks, +% and unset the \catattr{regular} attribute if it has been set. +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form followed by the long form +% as a footnote. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{footnote-sm} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{footnote-sm}{short-sm-footnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-postfootnote} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \qt{postfootnote-sm}} +% \begin{macrocode} +\newabbreviationstyle{short-sm-postfootnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvsmfont{\the\glsshorttok}},% + firstplural={\protect\glsfirstabbrvsmfont{\the\glsshortpltok}},% + plural={\protect\glsabbrvsmfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Make this category insert a footnote after the link if this was +% the first use, and +% unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% +% \end{macrocode} +% Needs the specific font command here as the style may have been +% lost by the time the footnote occurs. +% \begin{macrocode} + \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}% + {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +% \end{macrocode} +% The footnote needs to be suppressed in the inline form, so +% \cs{glsxtrfull} must set the first use switch off. +% \begin{macrocode} + \renewcommand*{\glsxtrsetupfulldefs}{% + \let\glsxtrifwasfirstuse\@secondoftwo + }% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvsmfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form. The long form is +% deferred. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvsmfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvsmfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{postfootnote-sm} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{postfootnote-sm}{short-sm-postfootnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (Emphasized)} +% These styles use \ics{emph} for the short form. +%\begin{macro}{\glsabbrvemfont} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\glsabbrvemfont}[1]{\emph{#1}}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstabbrvemfont} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\glsfirstabbrvemfont}[1]{\glsabbrvemfont{#1}}% +% \end{macrocode} +%\end{macro} +% The default short form suffix: +%\begin{macro}{\glsxtremsuffix} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtremsuffix}{\glsxtrabbrvpluralsuffix} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstlongemfont} +%\changes{1.04}{2016-05-02}{new} +%Only used by the \qt{long-em} styles. +% \begin{macrocode} +\newcommand*{\glsfirstlongemfont}[1]{\glslongemfont{#1}}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongemfont} +%\changes{1.04}{2016-05-02}{new} +%Only used by the \qt{long-em} styles. +% \begin{macrocode} +\newcommand*{\glslongemfont}[1]{\emph{#1}}% +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-short-em} +%\changes{0.5}{2015-12-07}{new} +% The long form is just set in the default long font. +% \begin{macrocode} +\newabbreviationstyle{long-short-em}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}},% + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% +% \end{macrocode} +% Use the default long fonts. +% \begin{macrocode} + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-short-em-desc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-em-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortdescname}, + sort={\glsxtrlongshortdescsort},% + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},% + text={\protect\glsabbrvemfont{\the\glsshorttok}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% As long-short-em style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short-em}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-em-short-em} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{long-em-short-em}% +{% +% \end{macrocode} +%\cs{glslongemfont} is used in the description since \cs{glsdesc} +%doesn't set the style. +% \begin{macrocode} + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongemfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvemfont{\the\glsshortpltok}},% + description={\protect\glslongemfont{\the\glslongtok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-em-short-em-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{long-em-short-em-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortdescname}, + sort={\glsxtrlongshortdescsort},% + first={\protect\glsfirstlongemfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\the\glsshortpltok}}},% + text={\protect\glsabbrvemfont{\the\glsshorttok}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-em-short-em}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-long} +% Now the short (long) version +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em-long}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% Mostly as short-long style: +%\changes{1.05}{2016-06-10}{fixed incorrect font used by long form} +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*\glsfirstabbrvfont[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-long-desc} +% As before but user provides description +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em-long-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongdescname}, + sort={\glsxtrshortlongdescsort}, + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongdefaultfont{\the\glslongpltok}}},% + text={\protect\glsabbrvemfont{\the\glsshorttok}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-em-long}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-long-em} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em-long-em}% +{% +% \end{macrocode} +%\cs{glslongemfont} is used in the description since \cs{glsdesc} +%doesn't set the style. +% \begin{macrocode} + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + description={\protect\glslongemfont{\the\glslongtok}},% + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongpltok}}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongemfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongemfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongemfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongemfont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-long-em-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em-long-em-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongdescname},% + sort={\glsxtrshortlongdescsort},% + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlongemfont{\the\glslongpltok}}},% + text={\protect\glsabbrvemfont{\the\glsshorttok}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-em-long-em}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortnolongname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}}, + text={\protect\glsabbrvemfont{\the\glsshorttok}}, + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}, + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short form followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvemfont{\glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvemfont{\Glsaccessshort{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvemfont{\Glsaccessshortpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-nolong} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-em-nolong}{short-em} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-desc} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.39}{2019-03-22}{bug fix: omit \gloskey{description} key as advertised in the +%manual} +% \begin{macrocode} +\newabbreviationstyle{short-em-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortdescname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}}, + text={\protect\glsabbrvemfont{\the\glsshorttok}}, + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short format followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongdefaultfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{short-em-nolong-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\letabbreviationstyle{short-em-nolong-desc}{short-em-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{nolong-short-em} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newabbreviationstyle{nolong-short-em}% +{% + \GlsXtrUseAbbrStyleSetup{short-em-nolong}% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-em-nolong}% +% \end{macrocode} +% The inline full form displays the long form followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongdefaultfont{\glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongdefaultfont{\glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstlongdefaultfont{\Glsaccesslong{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstlongdefaultfont{\Glsaccesslongpl{##1}% + \ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-em} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \qt{long-em}} +% The short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-em}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongdefaultfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongdefaultfont{\the\glslongpltok}}, + text={\protect\glslongdefaultfont{\the\glslongtok}}, + plural={\protect\glslongdefaultfont{\the\glslongpltok}},% + description={\the\glslongtok}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{long-em} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{long-em}{long-noshort-em} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-em-noshort-em} +%\changes{1.04}{2016-05-02}{new} +% The short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-em-noshort-em}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongemfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}}, + text={\protect\glslongemfont{\the\glslongtok}}, + plural={\protect\glslongemfont{\the\glslongpltok}},% + description={\protect\glslongemfont{\the\glslongtok}}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-em-noshort-em-noreg} +%\changes{1.17}{2017-08-09}{new} +% Like long-em-noshort-em but doesn't set the \catattr{regular} attribute. +% \begin{macrocode} +\newabbreviationstyle{long-em-noshort-em-noreg}% +{% + \GlsXtrUseAbbrStyleSetup{long-em-noshort-em}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-em-noshort-em}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-noshort-em-desc} +%\changes{1.04}{2016-05-02}{renamed from \qt{long-desc-em}} +%\changes{0.5}{2015-12-07}{new} +% The emphasized font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-noshort-em-desc}% +{% + \GlsXtrUseAbbrStyleSetup{long-noshort-desc}% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongdefaultfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongdefaultfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongdefaultfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{long-desc-em} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{long-desc-em}{long-noshort-em-desc} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-em-noshort-em-desc} +%\changes{1.04}{2016-05-02}{new} +% The short form is explicitly invoked through commands like +% \cs{glsxtrshort}. The long form is emphasized. +% \begin{macrocode} +\newabbreviationstyle{long-em-noshort-em-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortdescname}, + sort={\the\glslongtok}, + first={\protect\glsfirstlongemfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongemfont{\the\glslongpltok}}, + text={\glslongemfont{\the\glslongtok}}, + plural={\glslongemfont{\the\glslongpltok}}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongemfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongemfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glslongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glslongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glslongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glslongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside ##2\fi}% + \ifglsxtrinsertinside \else##2\fi + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongemfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongemfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvemfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongemfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongemfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-em-noshort-em-desc-noreg} +%\changes{1.17}{2017-08-09}{new} +% Like long-em-noshort-em-desc but doesn't set the \catattr{regular} attribute. +% \begin{macrocode} +\newabbreviationstyle{long-em-noshort-em-desc-noreg}% +{% + \GlsXtrUseAbbrStyleSetup{long-em-noshort-em-desc}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-em-noshort-em-desc}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-footnote} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2015-04-30}{renamed from \qt{footnote-em}} +% \begin{macrocode} +\newabbreviationstyle{short-em-footnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}% + \protect\glsxtrabbrvfootnote{\the\glslabeltok}% + {\protect\glsfirstlongfootnotefont{\the\glslongpltok}}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Switch off hyperlinks on first use to prevent nested hyperlinks, +% and unset the \catattr{regular} attribute if it has been set. +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form followed by the long form +% as a footnote. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \protect\glsxtrabbrvfootnote{##1}% + {\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{footnote-em} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{footnote-em}{short-em-footnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-postfootnote} +%\changes{0.5}{2015-12-07}{new} +%\changes{1.04}{2016-05-02}{renamed from \qt{postfootnote-em}} +% \begin{macrocode} +\newabbreviationstyle{short-em-postfootnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrfootnotename}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvemfont{\the\glsshorttok}},% + firstplural={\protect\glsfirstabbrvemfont{\the\glsshortpltok}},% + plural={\protect\glsabbrvemfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Make this category insert a footnote after the link if this was +% the first use, and +% unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% +% \end{macrocode} +% Needs the specific font command here as the style may have been +% lost by the time the footnote occurs. +% \begin{macrocode} + \glsxtrdopostpunc{\protect\glsxtrabbrvfootnote{\glslabel}% + {\glsfirstlongfootnotefont{\glsentrylong{\glslabel}}}}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +% \end{macrocode} +% The footnote needs to be suppressed in the inline form, so +% \cs{glsxtrfull} must set the first use switch off. +% \begin{macrocode} + \renewcommand*{\glsxtrsetupfulldefs}{% + \let\glsxtrifwasfirstuse\@secondoftwo + }% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtremsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvemfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvemfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongfootnotefont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongfootnotefont{##1}}% +% \end{macrocode} +% The full format displays the short form. The long form is +% deferred. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvemfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvemfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi\glsxtrfullsep{##1}% + \glsxtrparen{\glsfirstlongfootnotefont{\glsaccesslongpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +%\begin{abbrvstyle}{postfootnote-em} +%Backward compatibility: +% \begin{macrocode} +\@glsxtr@deprecated@abbrstyle{postfootnote-em}{short-em-postfootnote} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (User Parentheses Hook)} +% These styles allow the user to adjust the parenthetical forms. +% These styles all test for the existence of the +% field given by: +%\begin{macro}{\glsxtruserfield} +%\changes{1.04}{2016-05-02}{new} +% Default is the useri field. +% \begin{macrocode} +\newcommand*{\glsxtruserfield}{useri} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtruserparen} +%\changes{1.04}{2016-05-02}{new} +% The format of the parenthetical information. +% The first argument is the long/short form. The second argument +% is the entry's label. If \cs{glscurrentfieldvalue} has been +% defined, then we have at least \styfmt{glossaries} v4.23, which makes +% it easier for the user to adjust this. +% \begin{macrocode} +\ifdef\glscurrentfieldvalue +{ + \newcommand*{\glsxtruserparen}[2]{% + \glsxtrfullsep{#2}% + \glsxtrparen + {#1\ifglshasfield{\glsxtruserfield}{#2}{, \glscurrentfieldvalue}{}}% + } +} +{ + \newcommand*{\glsxtruserparen}[2]{% + \glsxtrfullsep{#2}% + \glsxtrparen + {#1\ifglshasfield{\glsxtruserfield}{#2}{, \@glo@thisvalue}{}}% + } +} +% \end{macrocode} +%\end{macro} +% Font used for short form: +%\begin{macro}{\glsabbrvuserfont} +%\changes{1.04}{2016-05-02}{new} +%\changes{1.17}{2017-08-09}{initialised to default font} +% \begin{macrocode} +\newcommand*{\glsabbrvuserfont}[1]{\glsabbrvdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% Font used for short form on first use: +%\begin{macro}{\glsfirstabbrvuserfont} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\glsfirstabbrvuserfont}[1]{\glsabbrvuserfont{#1}} +% \end{macrocode} +%\end{macro} +% Font used for long form: +%\begin{macro}{\glslonguserfont} +%\changes{1.04}{2016-05-02}{new} +%\changes{1.17}{2017-08-09}{initialised to default font} +% \begin{macrocode} +\newcommand*{\glslonguserfont}[1]{\glslongdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% Font used for long form on first use: +%\begin{macro}{\glsfirstlonguserfont} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\glsfirstlonguserfont}[1]{\glslonguserfont{#1}} +% \end{macrocode} +%\end{macro} +% The default short form suffix: +%\begin{macro}{\glsxtrusersuffix} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newcommand*{\glsxtrusersuffix}{\glsxtrabbrvpluralsuffix} +% \end{macrocode} +%\end{macro} +% +% Description encapsulator. +%\begin{macro}{\glsuserdescription} +%\changes{1.30}{2018-04-25}{new} +%The first argument is the description. The second argument is the +%label. +% \begin{macrocode} +\newcommand*{\glsuserdescription}[2]{\glslonguserfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-short-user} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-user}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlonguserfont{\the\glslongtok}% + \protect\glsxtruserparen{\protect\glsfirstabbrvuserfont{\the\glsshorttok}}% + {\the\glslabeltok}},% + firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}% + \protect\glsxtruserparen + {\protect\glsfirstabbrvuserfont{\the\glsshortpltok}}{\the\glslabeltok}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvuserfont{\the\glsshortpltok}},% + description={\protect\glsuserdescription{\the\glslongtok}% + {\the\glslabeltok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvuserfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlonguserfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlonguserfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlonguserfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlonguserfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-postshort-user} +%\changes{1.12}{2017-02-03}{new} +%Like \abbrstyle{long-short-user} but defers the parenthetical +%matter to after the link. +% \begin{macrocode} +\newabbreviationstyle{long-postshort-user}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlonguserfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvuserfont{\the\glsshortpltok}},% + description={\protect\glsuserdescription{\the\glslongtok}% + {\the\glslabeltok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtruserparen + {\glsfirstabbrvuserfont{\glsentryshort{\glslabel}}}% + {\glslabel}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvuserfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}% +% \end{macrocode} +%First use full form: +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlonguserfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlonguserfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlonguserfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlonguserfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +% \end{macrocode} +% In-line format: +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlonguserfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlonguserfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlonguserfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshort{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlonguserfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstabbrvuserfont{\glsaccessshortpl{##1}}}{##1}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrlongshortuserdescname} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrlongshortuserdescname}{% + \protect\glslonguserfont{\the\glslongtok}% + \protect\glsxtruserparen + {\protect\glsabbrvuserfont{\the\glsshorttok}}{\the\glslabeltok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-postshort-user-desc} +%\changes{1.12}{2017-02-03}{new} +%Like \abbrstyle{long-postshort-user} but the user supplies the +%description. +% \begin{macrocode} +\newabbreviationstyle{long-postshort-user-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortuserdescname}, + sort={\the\glslongtok}, + first={\protect\glsfirstlonguserfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + text={\protect\glsabbrvuserfont{\the\glsshorttok}},% + plural={\protect\glsabbrvuserfont{\the\glsshortpltok}}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtruserparen + {\glsfirstabbrvuserfont{\glsentryshort{\glslabel}}}% + {\glslabel}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-postshort-user}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-postlong-user} +%\changes{1.12}{2017-02-03}{new} +%Like \abbrstyle{short-long-user} but defers the parenthetical +%matter to after the link. +% \begin{macrocode} +\newabbreviationstyle{short-postlong-user}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlonguserfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvuserfont{\the\glsshortpltok}},% + description={\protect\glsuserdescription{\the\glslongtok}% + {\the\glslabeltok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtruserparen + {\glsfirstlonguserfont{\glsentrylong{\glslabel}}}% + {\glslabel}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvuserfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}% +% \end{macrocode} +%First use full form: +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvuserfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvuserfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvuserfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvuserfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +% \end{macrocode} +% In-line format: +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvuserfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvuserfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvuserfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvuserfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrshortlonguserdescname} +%\changes{1.25}{2017-11-24}{new} +% \begin{macrocode} +\newcommand*{\glsxtrshortlonguserdescname}{% + \protect\glsabbrvuserfont{\the\glsshorttok}% + \protect\glsxtruserparen + {\protect\glslonguserfont{\the\glslongpltok}}% + {\the\glslabeltok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{short-postlong-user-desc} +%\changes{1.12}{2017-02-03}{new} +%Like \abbrstyle{short-postlong-user} but leaves the user to specify +%the description. +% \begin{macrocode} +\newabbreviationstyle{short-postlong-user-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlonguserdescname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlonguserfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + text={\protect\glsabbrvuserfont{\the\glsshorttok}},% + plural={\protect\glsabbrvuserfont{\the\glsshortpltok}}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtruserparen + {\glsfirstlonguserfont{\glsentrylong{\glslabel}}}% + {\glslabel}% + }% + {}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-postlong-user}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-short-user-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-user-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortuserdescname}, + sort={\glsxtrlongshortdescsort},% +% \end{macrocode} +%\changes{1.17}{2017-08-09}{corrected first forms} +% \begin{macrocode} + first={\protect\glsfirstlonguserfont{\the\glslongtok}% + \protect\glsxtruserparen{\protect\glsfirstabbrvuserfont{\the\glsshorttok}}% + {\the\glslabeltok}},% + firstplural={\protect\glsfirstlonguserfont{\the\glslongpltok}% + \protect\glsxtruserparen + {\protect\glsfirstabbrvuserfont{\the\glsshortpltok}}{\the\glslabeltok}},% + text={\protect\glsabbrvfont{\the\glsshorttok}},% + plural={\protect\glsabbrvfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-short-user}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-long-user} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{short-long-user}% +{% +% \end{macrocode} +%\cs{glslonguserfont} is used in the description since \cs{glsdesc} +%doesn't set the style. (Now in \cs{glsuserdescription}.) +% \begin{macrocode} + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + description={\protect\glsuserdescription{\the\glslongtok}% + {\the\glslabeltok}},% + first={\protect\glsfirstabbrvuserfont{\the\glsshorttok}% + \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongtok}}% + {\the\glslabeltok}},% + firstplural={\protect\glsfirstabbrvuserfont{\the\glsshortpltok}% + \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongpltok}}% + {\the\glslabeltok}},% +% \end{macrocode} +%\changes{1.15}{2017-05-10}{fixed spelling of \cs{glsabbrvfont}} +% \begin{macrocode} + plural={\protect\glsabbrvuserfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrusersuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvuserfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvuserfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonguserfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonguserfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvuserfont{\glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvuserfont{\glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvuserfont{\Glsaccessshort{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslong{##1}}}{##1}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvuserfont{\Glsaccessshortpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtruserparen{\glsfirstlonguserfont{\glsaccesslongpl{##1}}}{##1}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-long-user-desc} +%\changes{1.04}{2016-05-02}{new} +% \begin{macrocode} +\newabbreviationstyle{short-long-user-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlonguserdescname}, + sort={\glsxtrshortlongdescsort},% +% \end{macrocode} +%\changes{1.17}{2017-08-09}{corrected first forms} +% \begin{macrocode} + first={\protect\glsfirstabbrvuserfont{\the\glsshorttok}% + \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongtok}}% + {\the\glslabeltok}},% + firstplural={\protect\glsfirstabbrvuserfont{\the\glsshortpltok}% + \protect\glsxtruserparen{\protect\glsfirstlonguserfont{\the\glslongpltok}}% + {\the\glslabeltok}},% + text={\protect\glsabbrvfont{\the\glsshorttok}},% + plural={\protect\glsabbrvfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-long-user}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (Hyphen)} +%These styles are designed to work with the \catattr{markwords} +%attribute. They check if the inserted material (provided by the final +%optional argument of commands like \cs{gls}) starts with a hyphen. +%If it does, the insert is added to the parenthetical material. +%Note that commands like \cs{glsxtrlong} set \cs{glsinsert} to empty +%with the entire link-text stored in \cs{glscustomtext}. +% +%\begin{macro}{\glsxtrifhyphenstart} +%Checks if the argument starts with a hyphen. The argument may be +%\cs{glsinsert} so check for that and expand. +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrifhyphenstart}[3]{% + \ifx\glsinsert#1\relax + \expandafter\@glsxtrifhyphenstart#1\relax\relax + \@end@glsxtrifhyphenstart{#2}{#3}% + \else + \@glsxtrifhyphenstart#1\relax\relax\@end@glsxtrifhyphenstart{#2}{#3}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrifhyphenstart} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\def\@glsxtrifhyphenstart#1#2\@end@glsxtrifhyphenstart#3#4{% + \ifx-#1\relax#3\else #4\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrlonghyphenshort} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrlonghyphenshort}\marg{label}\marg{long}\marg{short}\marg{insert} +%\end{definition} +%The \meta{long} and \meta{short} arguments may be the plural form. +%The \meta{long} argument may also be the first letter uppercase form. +% \begin{macrocode} +\newcommand*{\glsxtrlonghyphenshort}[4]{% +% \end{macrocode} +% Grouping is needed to localise the redefinitions. +% \begin{macrocode} + {% +% \end{macrocode} +% If \meta{insert} starts with a hyphen, redefine \ics{glsxtrwordsep} +% to a hyphen. The inserted material is also inserted into the +% parenthetical part. (The inserted material is grouped as a +% precautionary measure.) No change is made to \cs{glsxtrwordsep} if +% \meta{insert} doesn't start with a hyphen. +% \begin{macrocode} + \glsxtrifhyphenstart{#4}{\def\glsxtrwordsep{-}}{}% + \glsfirstlonghyphenfont{#2\ifglsxtrinsertinside{#4}\fi}% + \ifglsxtrinsertinside\else{#4}\fi + \glsxtrfullsep{#1}% + \glsxtrparen{\glsfirstabbrvhyphenfont{#3\ifglsxtrinsertinside{#4}\fi}% + \ifglsxtrinsertinside\else{#4}\fi}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsabbrvhyphenfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsabbrvhyphenfont}{\glsabbrvdefaultfont}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstabbrvhyphenfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsfirstabbrvhyphenfont}{\glsabbrvhyphenfont}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslonghyphenfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glslonghyphenfont}{\glslongdefaultfont}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstlonghyphenfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsfirstlonghyphenfont}{\glslonghyphenfont}% +% \end{macrocode} +%\end{macro} +% The default short form suffix: +%\begin{macro}{\glsxtrhyphensuffix} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrhyphensuffix}{\glsxtrabbrvpluralsuffix} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-hyphen-short-hyphen} +%\changes{1.17}{2017-08-09}{new} +%Designed for use with the \catattr{markwords} attribute. +% \begin{macrocode} +\newabbreviationstyle{long-hyphen-short-hyphen}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlonghyphenfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},% + description={\protect\glslonghyphenfont{\the\glslongtok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\glsxtrhyphensuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsxtrlonghyphenshort{##1}{\glsaccesslong{##1}}{\glsaccessshort{##1}}{##2}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsxtrlonghyphenshort{##1}{\glsaccesslongpl{##1}}% + {\glsaccessshortpl{##1}}{##2}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsxtrlonghyphenshort{##1}{\Glsaccesslong{##1}}{\glsaccessshort{##1}}{##2}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsxtrlonghyphenshort{##1}{\Glsaccesslongpl{##1}}% + {\glsaccessshortpl{##1}}{##2}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-hyphen-short-hyphen-desc} +%\changes{1.17}{2017-08-09}{new} +%Like \abbrstyle{long-hyphen-short-hyphen} but the description +%must be supplied by the user. +% \begin{macrocode} +\newabbreviationstyle{long-hyphen-short-hyphen-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortdescname}, + sort={\glsxtrlongshortdescsort}, + first={\protect\glsfirstlonghyphenfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}}},% + firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}}},% + text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-hyphen-short-hyphen}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrlonghyphennoshort} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrlonghyphennoshort}\marg{label}\marg{long}\marg{insert} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsxtrlonghyphennoshort}[3]{% +% \end{macrocode} +% Grouping is needed to localise the redefinitions. +% \begin{macrocode} + {% +% \end{macrocode} +% If \meta{insert} starts with a hyphen, redefine \ics{glsxtrwordsep} +% to a hyphen. The inserted material is also inserted into the +% parenthetical part. (The inserted material is grouped as a +% precautionary measure.) No change is made to \cs{glsxtrwordsep} if +% \meta{insert} doesn't start with a hyphen. +% \begin{macrocode} + \glsxtrifhyphenstart{#3}{\def\glsxtrwordsep{-}}{}% + \glsfirstlonghyphenfont{#2\ifglsxtrinsertinside{#3}\fi}% + \ifglsxtrinsertinside\else{#3}\fi + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-hyphen-noshort-desc-noreg} +%\changes{1.17}{2017-08-09}{new} +%This version doesn't show the short form (except +%explicitly with \cs{glsxtrshort}). Since \cs{glsxtrshort} doesn't +%support the hyphen switch, the short form just uses the default +%short-form font command. This style won't work with the +%\catattr{regular} as the regular form isn't flexible enough. +% \begin{macrocode} +\newabbreviationstyle{long-hyphen-noshort-desc-noreg}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortdescname}, + sort={\expandonce\glsxtrorglong}, + first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},% + plural={\protect\glslonghyphenfont{\the\glslongpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-hyphen-short-hyphen}% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}% +% \end{macrocode} +% The format for subsequent use (not used when the regular attribute +% is set). +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glsxtrlonghyphennoshort{##1}{\glsaccesslong{##1}}{##2}% + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glsxtrlonghyphennoshort{##1}{\glsaccesslongpl{##1}}{##2}% + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glsxtrlonghyphennoshort{##1}{\Glsaccesslong{##1}}{##2}% + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glsxtrlonghyphennoshort{##1}{\Glsaccesslongpl{##1}}{##2}% + }% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\glsaccesslong{##1}}{##2}% + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\glsaccesslongpl{##1}}{##2}% + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\Glsaccesslong{##1}}{##2}% + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\Glsaccesslongpl{##1}}{##2}% + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}}% + }% +% \end{macrocode} +% The first use full form only displays the long form. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\glsaccesslong{##1}}{##2}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\glsaccesslongpl{##1}}{##2}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\Glsaccesslong{##1}}{##2}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsxtrlonghyphennoshort{##1}{\Glsaccesslongpl{##1}}{##2}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-hyphen-noshort-noreg} +%\changes{1.17}{2017-08-09}{new} +% It doesn't really make a great deal of sense to have a long-only +% style that doesn't have a description (unless no glossary is +% required), but the best course of +% action here is to use the short form as the name and the long +% form as the description. +% \begin{macrocode} +\newabbreviationstyle{long-hyphen-noshort-noreg}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongnoshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},% + text={\protect\glslonghyphenfont{\the\glslongtok}},% + plural={\protect\glslonghyphenfont{\the\glslongpltok}},% + description={\the\glslongtok}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +%\changes{1.40}{2019-03-31}{corrected formatting commands} +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-hyphen-noshort-desc-noreg}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrlonghyphen} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrlonghyphen}\marg{long}\marg{label}\marg{insert} +%\end{definition} +%Used by \abbrstyle{long-hyphen-postshort-hyphen}. The \meta{insert} +%is check to determine if it starts with a hyphen but isn't used +%here as it's moved to the post-link hook. +% \begin{macrocode} +\newcommand*{\glsxtrlonghyphen}[3]{% +% \end{macrocode} +% Grouping is needed to localise the redefinitions. +% \begin{macrocode} + {% + \glsxtrifhyphenstart{#3}{\def\glsxtrwordsep{-}}{}% + \glsfirstlonghyphenfont{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrposthyphenshort} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrposthyphenshort}\marg{label}\marg{insert} +%\end{definition} +%Used in the post-link hook for the +%\abbrstyle{long-hyphen-postshort-hyphen} style. Much like +%\cs{glsxtrlonghyphenshort} but omits the \meta{long} part. This +%always uses the singular short form. +% \begin{macrocode} +\newcommand*{\glsxtrposthyphenshort}[2]{% + {% + \glsxtrifhyphenstart{#2}{\def\glsxtrwordsep{-}}{}% + \ifglsxtrinsertinside{\glsfirstlonghyphenfont{#2}}\else{#2}\fi + \glsxtrfullsep{#1}% + \glsxtrparen + {\glsfirstabbrvhyphenfont{\glsentryshort{#1}\ifglsxtrinsertinside{#2}\fi}% + \ifglsxtrinsertinside\else{#2}\fi + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrposthyphensubsequent} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrposthyphensubsequent}\marg{label}\marg{insert} +%\end{definition} +%Format in the post-link hook for subsequent use. The label is +%ignored by default. +% \begin{macrocode} +\newcommand*{\glsxtrposthyphensubsequent}[2]{% + \glsabbrvfont{\ifglsxtrinsertinside {#2}\fi}% + \ifglsxtrinsertinside \else{#2}\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-hyphen-postshort-hyphen} +%\changes{1.17}{2017-08-09}{new} +%Like \abbrstyle{long-hyphen-short-hyphen} but shifts the insert +%and parenthetical material to the post-link hook. +% \begin{macrocode} +\newabbreviationstyle{long-hyphen-postshort-hyphen}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},% + description={\protect\glslonghyphenfont{\the\glslongtok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtrposthyphenshort{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Put the insertion into the post-link: +% \begin{macrocode} + \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}% + }% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}% +% \end{macrocode} +% Subsequent use needs to omit the insertion: +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glsabbrvfont{\glsaccessshort{##1}}% + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glsabbrvfont{\glsaccessshortpl{##1}}% + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glsabbrvfont{\Glsaccessshort{##1}}% + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glsabbrvfont{\Glsaccessshortpl{##1}}% + }% +% \end{macrocode} +% First use full form: +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsxtrlonghyphen{\glsaccesslong{##1}}{##1}{##2}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsxtrlonghyphen{\glsaccesslongpl{##1}}{##1}{##2}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsxtrlonghyphen{\Glsaccesslong{##1}}{##1}{##2}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsxtrlonghyphen{\Glsaccesslongpl{##1}}{##1}{##2}% + }% +% \end{macrocode} +% In-line format. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlonghyphenfont{\glsaccesslong{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlonghyphenfont{\glsaccesslongpl{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlonghyphenfont{\Glsaccesslong{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlonghyphenfont{\Glsaccesslongpl{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-hyphen-postshort-hyphen-desc} +%\changes{1.17}{2017-08-09}{new} +%Like \abbrstyle{long-hyphen-postshort-hyphen} but the description +%must be supplied by the user. +% \begin{macrocode} +\newabbreviationstyle{long-hyphen-postshort-hyphen-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrlongshortdescname}, + sort={\glsxtrlongshortdescsort},% + first={\protect\glsfirstlonghyphenfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlonghyphenfont{\the\glslongpltok}},% + text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtrposthyphenshort{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Put the insertion into the post-link: +% \begin{macrocode} + \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}% + }% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-hyphen-postshort-hyphen}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrshorthyphenlong} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrshorthyphenlong}\marg{label}\marg{short}\marg{long}\marg{insert} +%\end{definition} +%The \meta{long} and \meta{short} arguments may be the plural form. +%The \meta{long} argument may also be the first letter uppercase form. +% \begin{macrocode} +\newcommand*{\glsxtrshorthyphenlong}[4]{% +% \end{macrocode} +% Grouping is needed to localise the redefinitions. +% \begin{macrocode} + {% +% \end{macrocode} +% If \meta{insert} starts with a hyphen, redefine \cs{glsxtrwordsep} +% to a hyphen. The inserted material is also inserted into the +% parenthetical part. (The inserted material is grouped as a +% precautionary measure.) +% \begin{macrocode} + \glsxtrifhyphenstart{#4}{\def\glsxtrwordsep{-}}{}% + \glsfirstabbrvhyphenfont{#2\ifglsxtrinsertinside{#4}\fi}% + \ifglsxtrinsertinside\else{#4}\fi + \glsxtrfullsep{#1}% + \glsxtrparen{\glsfirstlonghyphenfont{#3\ifglsxtrinsertinside{#4}\fi}% + \ifglsxtrinsertinside\else{#4}\fi}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{short-hyphen-long-hyphen} +%\changes{1.17}{2017-08-09}{new} +%Designed for use with the \catattr{markwords} attribute. +% \begin{macrocode} +\newabbreviationstyle{short-hyphen-long-hyphen}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongpltok}}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},% + description={\protect\glslonghyphenfont{\the\glslongtok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\glsxtrhyphensuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsxtrshorthyphenlong{##1}{\glsaccessshort{##1}}{\glsaccesslong{##1}}{##2}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsxtrshorthyphenlong{##1}% + {\glsaccessshortpl{##1}}{\glsaccesslongpl{##1}}{##2}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsxtrshorthyphenlong{##1}{\glsaccessshort{##1}}{\Glsaccesslong{##1}}{##2}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsxtrshorthyphenlong{##1}% + {\glsaccessshortpl{##1}}{\Glsaccesslongpl{##1}}{##2}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-hyphen-long-hyphen-desc} +%\changes{1.17}{2017-08-09}{new} +%Like \abbrstyle{short-hyphen-long-hyphen} but the description +%must be supplied by the user. +% \begin{macrocode} +\newabbreviationstyle{short-hyphen-long-hyphen-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongdescname}, + sort={\glsxtrshortlongdescsort}, + first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + \glsxtrparen{\protect\glsfirstlonghyphenfont{\the\glslongpltok}}},% + text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-hyphen-long-hyphen}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtrshorthyphen} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrshorthyphen}\marg{short}\marg{label}\marg{insert} +%\end{definition} +%Used by \abbrstyle{short-hyphen-postlong-hyphen}. The \meta{insert} +%is check to determine if it starts with a hyphen but isn't used +%here as it's moved to the post-link hook. +% \begin{macrocode} +\newcommand*{\glsxtrshorthyphen}[3]{% +% \end{macrocode} +% Grouping is needed to localise the redefinitions. +% \begin{macrocode} + {% + \glsxtrifhyphenstart{#3}{\def\glsxtrwordsep{-}}{}% + \glsfirstabbrvhyphenfont{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrposthyphenlong} +%\changes{1.17}{2017-08-09}{new} +%\begin{definition} +%\cs{glsxtrposthyphenlong}\marg{label}\marg{insert} +%\end{definition} +%Used in the post-link hook for the +%\abbrstyle{short-hyphen-postlong-hyphen} style. Much like +%\cs{glsxtrshorthyphenlong} but omits the \meta{short} part. This +%always uses the singular long form. +% \begin{macrocode} +\newcommand*{\glsxtrposthyphenlong}[2]{% + {% + \glsxtrifhyphenstart{#2}{\def\glsxtrwordsep{-}}{}% + \ifglsxtrinsertinside{\glsfirstabbrvhyphenfont{#2}}\else{#2}\fi + \glsxtrfullsep{#1}% + \glsxtrparen + {\glsfirstlonghyphenfont{\glsentrylong{#1}\ifglsxtrinsertinside{#2}\fi}% + \ifglsxtrinsertinside\else{#2}\fi + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{short-hyphen-postlong-hyphen} +%\changes{1.17}{2017-08-09}{new} +%Like \abbrstyle{short-hyphen-long-hyphen} but shifts the insert +%and parenthetical material to the post-link hook. +% \begin{macrocode} +\newabbreviationstyle{short-hyphen-postlong-hyphen}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}},% + firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}},% + description={\protect\glslonghyphenfont{\the\glslongtok}}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtrposthyphenlong{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Put the insertion into the post-link: +% \begin{macrocode} + \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}% + }% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glsxtrabbrvpluralsuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvhyphenfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlonghyphenfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslonghyphenfont{##1}}% +% \end{macrocode} +% Subsequent use needs to omit the insertion: +% \begin{macrocode} + \renewcommand*{\glsxtrsubsequentfmt}[2]{% + \glsabbrvfont{\glsaccessshort{##1}}% + }% + \renewcommand*{\glsxtrsubsequentplfmt}[2]{% + \glsabbrvfont{\glsaccessshortpl{##1}}% + }% + \renewcommand*{\Glsxtrsubsequentfmt}[2]{% + \glsabbrvfont{\Glsaccessshort{##1}}% + }% + \renewcommand*{\Glsxtrsubsequentplfmt}[2]{% + \glsabbrvfont{\Glsaccessshortpl{##1}}% + }% +% \end{macrocode} +% First use full form: +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsxtrshorthyphen{\glsaccessshort{##1}}{##1}{##2}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsxtrshorthyphen{\glsaccessshortpl{##1}}{##1}{##2}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsxtrshorthyphen{\Glsaccessshort{##1}}{##1}{##2}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsxtrshorthyphen{\Glsaccessshortpl{##1}}{##1}{##2}% + }% +% \end{macrocode} +% In-line format. Commands like \cs{glsxtrfull} set \cs{glsinsert} +% to empty. The entire link-text (provided by the following +% commands) is stored in \cs{glscustomtext}. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvhyphenfont{\glsaccessshort{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvhyphenfont{\glsaccessshortpl{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvhyphenfont{\Glsaccessshort{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvhyphenfont{\Glsaccessshortpl{##1}% + \ifglsxtrinsertinside{##2}\fi}% + \ifglsxtrinsertinside \else{##2}\fi + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-hyphen-postlong-hyphen-desc} +%\changes{1.17}{2017-08-09}{new} +%Like \abbrstyle{short-hyphen-postlong-hyphen} but the description +%must be supplied by the user. +% \begin{macrocode} +\newabbreviationstyle{short-hyphen-postlong-hyphen-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtrshortlongdescname}, + sort={\glsxtrshortlongdescsort},% + first={\protect\glsfirstabbrvhyphenfont{\the\glsshorttok}},% + firstplural={\protect\glsfirstabbrvhyphenfont{\the\glsshortpltok}},% + text={\protect\glsabbrvhyphenfont{\the\glsshorttok}},% + plural={\protect\glsabbrvhyphenfont{\the\glsshortpltok}}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse + {% + \glsxtrposthyphenlong{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% Put the insertion into the post-link: +% \begin{macrocode} + \glsxtrposthyphensubsequent{\glslabel}{\glsinsert}% + }% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-hyphen-postlong-hyphen}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (No Short on First Use)} +%These styles show only the long form on first use and only the +%short form on subsequent use. +%\begin{macro}{\glsabbrvonlyfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsabbrvonlyfont}{\glsabbrvdefaultfont}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstabbrvonlyfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsfirstabbrvonlyfont}{\glsabbrvonlyfont}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongonlyfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glslongonlyfont}{\glslongdefaultfont}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstlongonlyfont} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsfirstlongonlyfont}{\glslongonlyfont}% +% \end{macrocode} +%\end{macro} +% The default short form suffix: +%\begin{macro}{\glsxtronlysuffix} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtronlysuffix}{\glsxtrabbrvpluralsuffix} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtronlyname} +%\changes{1.25}{2017-11-24}{new} +% The default name format for this style. +% \begin{macrocode} +\newcommand*{\glsxtronlyname}{% + \protect\glsabbrvonlyfont{\the\glsshorttok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-only-short-only} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newabbreviationstyle{long-only-short-only}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtronlyname}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongonlyfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlongonlyfont{\the\glslongpltok}},% + plural={\protect\glsabbrvonlyfont{\the\glsshortpltok}},% + description={\protect\glslongonlyfont{\the\glslongtok}}}% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtronlysuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvonlyfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvonlyfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongonlyfont{##1}}% + \renewcommand*{\glslongfont}[1]{\glslongonlyfont{##1}}% +% \end{macrocode} +% The first use full form doesn't show the short form. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongonlyfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongonlyfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongonlyfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongonlyfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + }% +% \end{macrocode} +% The inline full form does show the short form. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongonlyfont{\glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvonlyfont{\glsaccessshort{##1}}}% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongonlyfont{\glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvonlyfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongonlyfont{\Glsaccesslong{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvonlyfont{\glsaccessshortpl{##1}}}% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongonlyfont{\Glsaccesslongpl{##1}\ifglsxtrinsertinside##2\fi}% + \ifglsxtrinsertinside\else##2\fi + \glsxtrfullsep{##1}% + \glsxtrparen{\protect\glsfirstabbrvonlyfont{\Glsaccessshortpl{##1}}}% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glsxtronlydescsort} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtronlydescsort}{\the\glslongtok} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtronlydescname} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtronlydescname}{% + \protect\glslongfont{\the\glslongtok}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-only-short-only-desc} +%\changes{1.17}{2017-08-09}{new} +% \begin{macrocode} +\newabbreviationstyle{long-only-short-only-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\glsxtronlydescname}, + sort={\glsxtronlydescsort},% + first={\protect\glsfirstlongonlyfont{\the\glslongtok}},% + firstplural={\protect\glsfirstlongonlyfont{\the\glslongpltok}},% + text={\protect\glsabbrvonlyfont{\the\glsshorttok}},% + plural={\protect\glsabbrvonlyfont{\the\glsshortpltok}}% + }% +% \end{macrocode} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-only-short-only}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\section{Using Entries in Headings} +% +% There are four main problems with using entries in sectioning +% commands: they can mess with the first use flag if they end up in +% the table of contents, they can add unwanted numbers to the +% entry's location list, the label is corrupted if used inside +% \ics{MakeUppercase} (which is used by the default headings style) +% and they need to be expandable for PDF bookmarks. The +% \styfmt{glossaries} package therefore recommends the use of the +% expandable commands, such as \cs{glsentryshort}, instead but this +% doesn't reflect the formatting since it doesn't include +% \cs{glsabbrvfont}. The commands below are an attempt to get around +% these problems. +% +% The PDF bookmark issue can easily be fixed with \sty{hyperref}'s +% \cs{texorpdfstring} which can simply use the expandable command +% in the PDF string case. The \TeX\ string case can now use +% \cs{glsxtrshort} with the \gloskey[glslink]{noindex} key set, which +% prevents the unwanted additions to the location list, and the +% \gloskey[glslink]{hyper} key set to false, which prevents the problem of +% nested links. This just leaves one thing left that needs to be +% dealt with, and that's what to do if the heading style +% uses \cs{MakeUppercase}. +% +% Note that \styfmt{glossaries} automatically loads \sty{textcase}, so +% the label can be protected from case change with \sty{textcase}'s +% \cs{NoCaseChange}. This means that we don't have a problem +% provided the page style uses \cs{MakeTextUppercase}, but the +% default heading page style uses \cs{MakeUppercase}. +% +% To get around this, save the original definition of \cs{markboth} +% and \cs{markright} and adjust it so that \cs{MakeUppercase} is +% temporarily redefined to \cs{MakeTextUppercase}. Some packages or +% classes redefine these commands, so we can't just assume they +% still have the original kernel definition. +% +%\begin{macro}{\markright} +% Save original definition: +% \begin{macrocode} +\let\@glsxtr@org@markright\markright +% \end{macrocode} +% Redefine (grouping not added in case it interferes with the +% original code): +% \begin{macrocode} +\renewcommand*{\markright}[1]{% + \glsxtrmarkhook + \@glsxtr@org@markright{\@glsxtrinmark#1\@glsxtrnotinmark}% + \glsxtrrestoremarkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\markboth} +% Save original definition: +% \begin{macrocode} +\let\@glsxtr@org@markboth\markboth +% \end{macrocode} +% Redefine (grouping not added in case it interferes with the +% original code): +% \begin{macrocode} +\renewcommand*{\markboth}[2]{% + \glsxtrmarkhook + \@glsxtr@org@markboth + {\@glsxtrinmark#1\@glsxtrnotinmark}% + {\@glsxtrinmark#2\@glsxtrnotinmark}% + \glsxtrrestoremarkhook +} +% \end{macrocode} +%\end{macro} +% +%Also do this for \cs{@starttoc} +%\begin{macro}{\@starttoc} +% Save original definition: +% \begin{macrocode} +\let\@glsxtr@org@@starttoc\@starttoc +% \end{macrocode} +% Redefine: +% \begin{macrocode} +\renewcommand*{\@starttoc}[1]{% + \glsxtrmarkhook + \@glsxtrinmark + \@glsxtr@org@@starttoc{#1}% + \@glsxtrnotinmark + \glsxtrrestoremarkhook +} +% \end{macrocode} +%\end{macro} +% +% If this causes a problem provide a simple way of switching back to +% the original definitions: +%\begin{macro}{\glsxtrRevertMarks} +% \begin{macrocode} +\newcommand*{\glsxtrRevertMarks}{% + \let\markright\@glsxtr@org@markright + \let\markboth\@glsxtr@org@markboth + \let\@starttoc\@glsxtr@org@@starttoc +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrRevertTocMarks} +%\changes{1.31}{2018-05-09}{new} +%Just restores \cs{@starttoc}. +% \begin{macrocode} +\newcommand*{\glsxtrRevertTocMarks}{% + \let\@starttoc\@glsxtr@org@@starttoc +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifinmark} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrifinmark}[2]{#2} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrinmark} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newrobustcmd*{\@glsxtrinmark}{% + \let\glsxtrifinmark\@firstoftwo +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrnotinmark} +%\changes{1.07}{2016-08-15}{new} +% \begin{macrocode} +\newrobustcmd*{\@glsxtrnotinmark}{% + \let\glsxtrifinmark\@secondoftwo +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitleorpdforheading} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsxtrtitleorpdforheading}[3]{\texorpdfstring{#1}{#2}} +} +{ + \newcommand*{\glsxtrtitleorpdforheading}[3]{#1} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrmarkhook} +% Hook used in new definition of \cs{markboth} and \cs{markright} +% to make some changes to apply to the marks: +% \begin{macrocode} +\newcommand*{\glsxtrmarkhook}{% +% \end{macrocode} +% Save current definitions: +% \begin{macrocode} + \let\@glsxtr@org@MakeUppercase\MakeUppercase + \let\@glsxtr@org@glsxtrtitleorpdforheading\glsxtrtitleorpdforheading + \let\@glsxtr@org@glsxtrtitleshort\glsxtrtitleshort + \let\@glsxtr@org@glsxtrtitleshortpl\glsxtrtitleshortpl + \let\@glsxtr@org@Glsxtrtitleshort\Glsxtrtitleshort + \let\@glsxtr@org@Glsxtrtitleshortpl\Glsxtrtitleshortpl + \let\@glsxtr@org@glsxtrtitlename\glsxtrtitlename + \let\@glsxtr@org@Glsxtrtitlename\Glsxtrtitlename + \let\@glsxtr@org@glsxtrtitletext\glsxtrtitletext + \let\@glsxtr@org@Glsxtrtitletext\Glsxtrtitletext + \let\@glsxtr@org@glsxtrtitleplural\glsxtrtitleplural + \let\@glsxtr@org@Glsxtrtitleplural\Glsxtrtitleplural + \let\@glsxtr@org@glsxtrtitlefirst\glsxtrtitlefirst + \let\@glsxtr@org@Glsxtrtitlefirst\Glsxtrtitlefirst + \let\@glsxtr@org@glsxtrtitlefirstplural\glsxtrtitlefirstplural + \let\@glsxtr@org@Glsxtrtitlefirstplural\Glsxtrtitlefirstplural + \let\@glsxtr@org@glsxtrtitlelong\glsxtrtitlelong + \let\@glsxtr@org@glsxtrtitlelongpl\glsxtrtitlelongpl + \let\@glsxtr@org@Glsxtrtitlelong\Glsxtrtitlelong + \let\@glsxtr@org@Glsxtrtitlelongpl\Glsxtrtitlelongpl + \let\@glsxtr@org@glsxtrtitlefull\glsxtrtitlefull + \let\@glsxtr@org@glsxtrtitlefullpl\glsxtrtitlefullpl + \let\@glsxtr@org@Glsxtrtitlefull\Glsxtrtitlefull + \let\@glsxtr@org@Glsxtrtitlefullpl\Glsxtrtitlefullpl +% \end{macrocode} +% New definitions +% \begin{macrocode} + \let\glsxtrifinmark\@firstoftwo + \let\MakeUppercase\MakeTextUppercase + \let\glsxtrtitleorpdforheading\@thirdofthree + \let\glsxtrtitleshort\glsxtrheadshort + \let\glsxtrtitleshortpl\glsxtrheadshortpl + \let\Glsxtrtitleshort\Glsxtrheadshort + \let\Glsxtrtitleshortpl\Glsxtrheadshortpl + \let\glsxtrtitlename\glsxtrheadname + \let\Glsxtrtitlename\Glsxtrheadname + \let\glsxtrtitletext\glsxtrheadtext + \let\Glsxtrtitletext\Glsxtrheadtext + \let\glsxtrtitleplural\glsxtrheadplural + \let\Glsxtrtitleplural\Glsxtrheadplural + \let\glsxtrtitlefirst\glsxtrheadfirst + \let\Glsxtrtitlefirst\Glsxtrheadfirst + \let\glsxtrtitlefirstplural\glsxtrheadfirstplural + \let\Glsxtrtitlefirstplural\Glsxtrheadfirstplural + \let\glsxtrtitlelong\glsxtrheadlong + \let\glsxtrtitlelongpl\glsxtrheadlongpl + \let\Glsxtrtitlelong\Glsxtrheadlong + \let\Glsxtrtitlelongpl\Glsxtrheadlongpl + \let\glsxtrtitlefull\glsxtrheadfull + \let\glsxtrtitlefullpl\glsxtrheadfullpl + \let\Glsxtrtitlefull\Glsxtrheadfull + \let\Glsxtrtitlefullpl\Glsxtrheadfullpl +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrrestoremarkhook} +% Hook used in new definition of \cs{markboth} and \cs{markright} +% to restore the modified definitions. (This is in case the original +% \cs{markboth} and \cs{markright} shouldn't be grouped for some +% reason. There already is some grouping within those original +% definitions, but some of the code lies outside that grouping, and +% possibly there's a reason for it.) +% \begin{macrocode} +\newcommand*{\glsxtrrestoremarkhook}{% + \let\glsxtrifinmark\@secondoftwo + \let\MakeUppercase\@glsxtr@org@MakeUppercase + \let\glsxtrtitleorpdforheading\@glsxtr@org@glsxtrtitleorpdforheading + \let\glsxtrtitleshort\@glsxtr@org@glsxtrtitleshort + \let\glsxtrtitleshortpl\@glsxtr@org@glsxtrtitleshortpl + \let\Glsxtrtitleshort\@glsxtr@org@Glsxtrtitleshort + \let\Glsxtrtitleshortpl\@glsxtr@org@Glsxtrtitleshortpl + \let\glsxtrtitlename\@glsxtr@org@glsxtrtitlename + \let\Glsxtrtitlename\@glsxtr@org@Glsxtrtitlename + \let\glsxtrtitletext\@glsxtr@org@glsxtrtitletext + \let\Glsxtrtitletext\@glsxtr@org@Glsxtrtitletext + \let\glsxtrtitleplural\@glsxtr@org@glsxtrtitleplural + \let\Glsxtrtitleplural\@glsxtr@org@Glsxtrtitleplural + \let\glsxtrtitlefirst\@glsxtr@org@glsxtrtitlefirst + \let\Glsxtrtitlefirst\@glsxtr@org@Glsxtrtitlefirst + \let\glsxtrtitlefirstplural\@glsxtr@org@glsxtrtitlefirstplural + \let\Glsxtrtitlefirstplural\@glsxtr@org@Glsxtrtitlefirstplural + \let\glsxtrtitlelong\@glsxtr@org@glsxtrtitlelong + \let\glsxtrtitlelongpl\@glsxtr@org@glsxtrtitlelongpl + \let\Glsxtrtitlelong\@glsxtr@org@Glsxtrtitlelong + \let\Glsxtrtitlelongpl\@glsxtr@org@Glsxtrtitlelongpl + \let\glsxtrtitlefull\@glsxtr@org@glsxtrtitlefull + \let\glsxtrtitlefullpl\@glsxtr@org@glsxtrtitlefullpl + \let\Glsxtrtitlefull\@glsxtr@org@Glsxtrtitlefull + \let\Glsxtrtitlefullpl\@glsxtr@org@Glsxtrtitlefullpl +} +% \end{macrocode} +%\end{macro} +% +%\changes{0.5.1}{2015-12-07}{removed \cs{ifglsxtruseuchead}} +% Instead of using one document-wide conditional, use +% \catattr{headuc} attribute to determine whether or not to use the +% all upper case form. +% +%\begin{macro}{\glsxtrheadshort} +% Command used to display short form in the page header. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadshort}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshort[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrshort[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitleshort} +% Command to display short form of abbreviation in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitleshort}[1]{% + \glsxtrshort[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadshortpl} +% Command used to display plural short form in the page header. +% If you want the text converted to upper case, this needs to be +% redefined to use \cs{GLSxtrshortpl} instead. If you are using a +% smallcaps style, the default fonts don't provide italic smallcaps. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadshortpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshortpl[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrshortpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitleshortpl} +% Command to display plural short form of abbreviation in section title and +% table of contents. +%\changes{1.03}{2016-04-27}{bug fix: changed \cs{glsxtrshort} to +%\cs{glsxtrshortpl}} +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitleshortpl}[1]{% + \glsxtrshortpl[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadshort} +% Command used to display short form in the page header with the +% first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadshort}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshort[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrshort[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitleshort} +% Command to display short form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitleshort}[1]{% + \Glsxtrshort[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadshortpl} +% Command used to display plural short form in the page header with the +% first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadshortpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshortpl[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrshortpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitleshortpl} +% Command to display plural short form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitleshortpl}[1]{% + \Glsxtrshortpl[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadname} +% As above but for the \gloskey{name} value. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrheadname}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSname[noindex,hyper=false]{#1}[]% + }% + {% + \glsname[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlename} +% Command to display \gloskey{name} value in section title and +% table of contents. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlename}[1]{% + \glsname[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadname} +% First letter converted to upper case +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\Glsxtrheadname}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSname[noindex,hyper=false]{#1}[]% + }% + {% + \Glsname[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlename} +% Command to display \gloskey{name} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +%\changes{1.21}{2017-11-03}{new} +\newrobustcmd*{\Glsxtrtitlename}[1]{% + \Glsname[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadtext} +% As above but for the \gloskey{text} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadtext}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLStext[noindex,hyper=false]{#1}[]% + }% + {% + \glstext[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitletext} +% Command to display \gloskey{text} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitletext}[1]{% + \glstext[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\Glsxtrheadtext} +% First letter converted to upper case +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadtext}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLStext[noindex,hyper=false]{#1}[]% + }% + {% + \Glstext[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitletext} +% Command to display \gloskey{text} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitletext}[1]{% + \Glstext[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadplural} +% As above but for the \gloskey{plural} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSplural[noindex,hyper=false]{#1}[]% + }% + {% + \glsplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitleplural} +% Command to display \gloskey{plural} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitleplural}[1]{% + \glsplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadplural} +% Convert first letter to upper case. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSplural[noindex,hyper=false]{#1}[]% + }% + {% + \Glsplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitleplural} +% Command to display \gloskey{plural} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitleplural}[1]{% + \Glsplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadfirst} +% As above but for the \gloskey{first} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadfirst}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirst[noindex,hyper=false]{#1}[]% + }% + {% + \glsfirst[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlefirst} +% Command to display \gloskey{first} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlefirst}[1]{% + \glsfirst[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadfirst} +% First letter converted to upper case +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadfirst}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirst[noindex,hyper=false]{#1}[]% + }% + {% + \Glsfirst[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlefirst} +% Command to display \gloskey{first} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlefirst}[1]{% + \Glsfirst[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadfirstplural} +% As above but for the \gloskey{firstplural} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadfirstplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirstplural[noindex,hyper=false]{#1}[]% + }% + {% + \glsfirstplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlefirstplural} +% Command to display \gloskey{firstplural} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlefirstplural}[1]{% + \glsfirstplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadfirstplural} +% First letter converted to upper case +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadfirstplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirstplural[noindex,hyper=false]{#1}[]% + }% + {% + \Glsfirstplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlefirstplural} +% Command to display \gloskey{first} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlefirstplural}[1]{% + \Glsfirstplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadlong} +% Command used to display long form in the page header. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\glsxtrheadlong}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrlong[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrlong[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlelong} +% Command to display long form of abbreviation in section title and +% table of contents. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlelong}[1]{% + \glsxtrlong[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadlongpl} +% Command used to display plural long form in the page header. +% If you want the text converted to upper case, this needs to be +% redefined to use \cs{GLSxtrlongpl} instead. If you are using a +% smallcaps style, the default fonts don't provide italic smallcaps. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\glsxtrheadlongpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrlongpl[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrlongpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlelongpl} +% Command to display plural long form of abbreviation in section title and +% table of contents. +%\changes{1.02}{2016-04-25}{new} +%\changes{1.03}{2016-04-27}{bug fix: changed \cs{glsxtrlong} to +%\cs{glsxtrlongpl}} +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlelongpl}[1]{% + \glsxtrlongpl[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadlong} +% Command used to display long form in the page header with the +% first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\Glsxtrheadlong}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrlong[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrlong[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlelong} +% Command to display long form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlelong}[1]{% + \Glsxtrlong[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadlongpl} +% Command used to display plural long form in the page header with the +% first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\Glsxtrheadlongpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrlongpl[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrlongpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlelongpl} +% Command to display plural long form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlelongpl}[1]{% + \Glsxtrlongpl[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadfull} +% Command used to display full form in the page header. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\glsxtrheadfull}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrfull[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrfull[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlefull} +% Command to display full form of abbreviation in section title and +% table of contents. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlefull}[1]{% + \glsxtrfull[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadfullpl} +% Command used to display plural full form in the page header. +% If you want the text converted to upper case, this needs to be +% redefined to use \cs{GLSxtrfullpl} instead. If you are using a +% smallcaps style, the default fonts don't provide italic smallcaps. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\glsxtrheadfullpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrfullpl[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrfullpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlefullpl} +% Command to display plural full form of abbreviation in section title and +% table of contents. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlefullpl}[1]{% + \glsxtrfullpl[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadfull} +% Command used to display full form in the page header with the +% first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\Glsxtrheadfull}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrfull[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrfull[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlefull} +% Command to display full form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlefull}[1]{% + \Glsxtrfull[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadfullpl} +% Command used to display plural full form in the page header with the +% first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newcommand*{\Glsxtrheadfullpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrfullpl[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrfullpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlefullpl} +% Command to display plural full form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlefullpl}[1]{% + \Glsxtrfullpl[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtshort} +% Provide a way of using the formatted short form in section +% headings. If \sty{hyperref} has been loaded, use +% \cs{texorpdfstring} for convenience in PDF bookmarks. +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshort}} +%\changes{0.5}{2015-12-07}{changed to use \cs{glsxtrtitleshort}} +%\changes{0.5}{2015-12-07}{renamed from \cs{glsentryfmtshort}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtshort}[1]{% + \texorpdfstring + {\glsxtrtitleshort{#1}}% + {\glsentryshort{#1}}% + } +} +{ + \newcommand*{\glsfmtshort}[1]{% + \glsxtrtitleshort{#1}} +} +% \end{macrocode} +%\end{macro} +%Similarly for the plural version. +%\begin{macro}{\glsfmtshortpl} +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshortpl}} +%\changes{0.5}{2015-12-07}{changed to use \cs{glsxtrtitleshortpl}} +%\changes{0.5}{2015-12-07}{renamed from \cs{glsentryfmtshortpl}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtshortpl}[1]{% + \texorpdfstring + {\glsxtrtitleshortpl{#1}}% + {\glsentryshortpl{#1}}% + } +} +{ + \newcommand*{\glsfmtshortpl}[1]{% + \glsxtrtitleshortpl{#1}} +} +% \end{macrocode} +%\end{macro} +% The case-changing version isn't suitable for PDF bookmarks, so the +% PDF alternative uses the non-case-changing version. +%\begin{macro}{\Glsfmtshort} +% Singular form (first letter uppercase). +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{Glsxtrshort}} +%\changes{0.5}{2015-12-07}{changed to use \cs{Glsxtrtitleshort}} +%\changes{0.5}{2015-12-07}{renamed from \cs{Glsentryfmtshort}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtshort}[1]{% + \texorpdfstring + {\Glsxtrtitleshort{#1}}% + {\glsentryshort{#1}}% + } +} +{ + \newcommand*{\Glsfmtshort}[1]{% + \Glsxtrtitleshort{#1}} +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsfmtshortpl} +%Plural form (first letter uppercase). +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshortpl}} +%\changes{0.5}{2015-12-07}{changed to use \cs{Glsxtrtitleshortpl}} +%\changes{0.5}{2015-12-07}{renamed from \cs{Glsentryfmtshortpl}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtshortpl}[1]{% + \texorpdfstring + {\Glsxtrtitleshortpl{#1}}% + {\glsentryshortpl{#1}}% + } +} +{ + \newcommand*{\Glsfmtshortpl}[1]{% + \Glsxtrtitleshortpl{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtname} +%As above but for the \gloskey{name} value. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtname}[1]{% + \texorpdfstring + {\glsxtrtitlename{#1}}% + {\glsentryname{#1}}% + } +} +{ + \newcommand*{\glsfmtname}[1]{% + \glsxtrtitlename{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtname} +%First letter converted to upper case. +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtname}[1]{% + \texorpdfstring + {\Glsxtrtitlename{#1}}% + {\glsentryname{#1}}% + } +} +{ + \newcommand*{\Glsfmtname}[1]{% + \Glsxtrtitlename{#1}} +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\glsfmttext} +%As above but for the \gloskey{text} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmttext}[1]{% + \texorpdfstring + {\glsxtrtitletext{#1}}% + {\glsentrytext{#1}}% + } +} +{ + \newcommand*{\glsfmttext}[1]{% + \glsxtrtitletext{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmttext} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmttext}[1]{% + \texorpdfstring + {\Glsxtrtitletext{#1}}% + {\glsentrytext{#1}}% + } +} +{ + \newcommand*{\Glsfmttext}[1]{% + \Glsxtrtitletext{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtplural} +%As above but for the \gloskey{plural} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtplural}[1]{% + \texorpdfstring + {\glsxtrtitleplural{#1}}% + {\glsentryplural{#1}}% + } +} +{ + \newcommand*{\glsfmtplural}[1]{% + \glsxtrtitleplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtplural} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtplural}[1]{% + \texorpdfstring + {\Glsxtrtitleplural{#1}}% + {\glsentryplural{#1}}% + } +} +{ + \newcommand*{\Glsfmtplural}[1]{% + \Glsxtrtitleplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtfirst} +%As above but for the \gloskey{first} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtfirst}[1]{% + \texorpdfstring + {\glsxtrtitlefirst{#1}}% + {\glsentryfirst{#1}}% + } +} +{ + \newcommand*{\glsfmtfirst}[1]{% + \glsxtrtitlefirst{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtfirst} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtfirst}[1]{% + \texorpdfstring + {\Glsxtrtitlefirst{#1}}% + {\glsentryfirst{#1}}% + } +} +{ + \newcommand*{\Glsfmtfirst}[1]{% + \Glsxtrtitlefirst{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtfirstpl} +%As above but for the \gloskey{firstplural} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtfirstpl}[1]{% + \texorpdfstring + {\glsxtrtitlefirstplural{#1}}% + {\glsentryfirstplural{#1}}% + } +} +{ + \newcommand*{\glsfmtfirstpl}[1]{% + \glsxtrtitlefirstplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtfirstpl} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtfirstpl}[1]{% + \texorpdfstring + {\Glsxtrtitlefirstplural{#1}}% + {\glsentryfirstplural{#1}}% + } +} +{ + \newcommand*{\Glsfmtfirstpl}[1]{% + \Glsxtrtitlefirstplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtlong} +%As above but for the \gloskey{long} value. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtlong}[1]{% + \texorpdfstring + {\glsxtrtitlelong{#1}}% + {\glsentrylong{#1}}% + } +} +{ + \newcommand*{\glsfmtlong}[1]{% + \glsxtrtitlelong{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtlong} +%First letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtlong}[1]{% + \texorpdfstring + {\Glsxtrtitlelong{#1}}% + {\glsentrylong{#1}}% + } +} +{ + \newcommand*{\Glsfmtlong}[1]{% + \Glsxtrtitlelong{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtlongpl} +%As above but for the \gloskey{longplural} value. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtlongpl}[1]{% + \texorpdfstring + {\glsxtrtitlelongpl{#1}}% + {\glsentrylongpl{#1}}% + } +} +{ + \newcommand*{\glsfmtlongpl}[1]{% + \glsxtrtitlelongpl{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtlongpl} +%First letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtlongpl}[1]{% + \texorpdfstring + {\Glsxtrtitlelongpl{#1}}% + {\glsentrylongpl{#1}}% + } +} +{ + \newcommand*{\Glsfmtlongpl}[1]{% + \Glsxtrtitlelongpl{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtfull} +%In-line full format. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtfull}[1]{% + \texorpdfstring + {\glsxtrtitlefull{#1}}% + {\glsxtrinlinefullformat{#1}{}}% + } +} +{ + \newcommand*{\glsfmtfull}[1]{% + \glsxtrtitlefull{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtfull} +%First letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtfull}[1]{% + \texorpdfstring + {\Glsxtrtitlefull{#1}}% + {\Glsxtrinlinefullformat{#1}{}}% + } +} +{ + \newcommand*{\Glsfmtfull}[1]{% + \Glsxtrtitlefull{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtfullpl} +%In-line full plural format. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtfullpl}[1]{% + \texorpdfstring + {\glsxtrtitlefullpl{#1}}% + {\glsxtrinlinefullplformat{#1}{}}% + } +} +{ + \newcommand*{\glsfmtfullpl}[1]{% + \glsxtrtitlefullpl{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtfullpl} +%First letter converted to upper case. +%\changes{1.02}{2016-04-25}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtfullpl}[1]{% + \texorpdfstring + {\Glsxtrtitlefullpl{#1}}% + {\Glsxtrinlinefullplformat{#1}{}}% + } +} +{ + \newcommand*{\Glsfmtfullpl}[1]{% + \Glsxtrtitlefullpl{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\section{Multi-Lingual Support} +% Add the facility to load language modules, if they are installed, +% but none are provided with this package. +% +%\begin{macro}{\RequireGlossariesExtraLang} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\newcommand*{\RequireGlossariesExtraLang}[1]{% + \@ifundefined{ver@glossariesxtr-#1.ldf}{\input{glossariesxtr-#1.ldf}}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ProvidesGlossariesExtraLang} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\newcommand*{\ProvidesGlossariesExtraLang}[1]{% + \ProvidesFile{glossariesxtr-#1.ldf}% +} +% \end{macrocode} +%\end{macro} +% +% Load any required language modules that are available. This +% doesn't generate any warning if none are found, since they're not +% essential. (The only command that really needs defining for the +% document is \ics{abbreviationsname}, which can simply be +% redefined. However, with \app{bib2gls} it might be useful to +% provide custom rules for a particular locale.) +% +%\begin{macro}{\glsxtr@loaddialect} +%The dialect label should be stored in \cs{this@dialect} +%before using this command. +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\newcommand{\glsxtr@loaddialect}{% + \IfTrackedLanguageFileExists{\this@dialect}% + {glossariesxtr-}% prefix + {.ldf}% + {% + \RequireGlossariesExtraLang{\CurrentTrackedTag}% + }% + {}% not found +% \end{macrocode} +% If \sty{glossaries-extra-bib2gls} has been loaded, +% \cs{@glsxtrdialecthook} will check for the associated script, +% otherwise it will do nothing. +% \begin{macrocode} + \@glsxtrdialecthook +} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +\@ifpackageloaded{tracklang} +{% + \AnyTrackedLanguages + {% + \ForEachTrackedDialect{\this@dialect}{\glsxtr@loaddialect}% + }% + {}% +} +{} +% \end{macrocode} +% Load \sty{glossaries-extra-stylemods} if required. +% \begin{macrocode} +\@glsxtr@redefstyles +% \end{macrocode} +% and set the style: +% \begin{macrocode} +\@glsxtr@do@style +% \end{macrocode} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-extra-bib2gls.sty> +% \end{macrocode} +%\fi +%\changes{1.27}{2018-02-26}{added glossaries-extra-bib2gls.sty} +%\section{glossaries-extra-bib2gls.sty} +%This package provides additional support for \app{bib2gls} and is +%automatically loaded by the record option. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-extra-bib2gls}[2019/04/09 v1.41 (NLCT)] +% \end{macrocode} +%Provide convenient shortcut commands for predefined glossary types. +%\begin{macro}{\printunsrtacronyms} +%\changes{1.40}{2019-03-31}{new} +% \begin{macrocode} +\ifglsacronym + \providecommand*{\printunsrtacronyms}[1][]{% + \printunsrtglossary[type=\acronymtype,#1]}% +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtindex} +%\changes{1.40}{2019-03-31}{new} +% \begin{macrocode} +\ifglossaryexists{index} +{ + \providecommand*{\printunsrtindex}[1][]{% + \printunsrtglossary[type=index,#1]}% +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtsymbols} +%\changes{1.40}{2019-03-31}{new} +% \begin{macrocode} +\ifglossaryexists{symbols} +{ + \providecommand*{\printunsrtsymbols}[1][]{% + \printunsrtglossary[type=symbols,#1]}% +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtnumbers} +%\changes{1.40}{2019-03-31}{new} +% \begin{macrocode} +\ifglossaryexists{numbers} +{ + \providecommand*{\printunsrtnumbers}[1][]{% + \printunsrtglossary[type=numbers,#1]}% +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printunsrtabbreviations} +%\changes{1.40}{2019-03-31}{new} +% \begin{macrocode} +\ifglossaryexists{abbreviations} +{ + \providecommand*{\printunsrtabbreviations}[1][]{% + \printunsrtglossary[type=abbreviations,#1]}% +}{} +% \end{macrocode} +%\end{macro} +% +%These are some convenient macros for use with custom rules. +%\begin{macro}{\glshex} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glshex}{\string\u} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glscapturedgroup} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} +\newcommand*{\glscapturedgroup}{\string\$} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIfHasNonZeroChildCount} +%\changes{1.31}{2018-05-09}{new} +%For use with \app{bib2gls}'s \texttt{save-child-count} resource option. +% \begin{macrocode} +\newcommand*{\GlsXtrIfHasNonZeroChildCount}[3]{% + \GlsXtrIfFieldNonZero{childcount}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrprovidecommand} +%\changes{1.27}{2018-02-26}{new} +%For use in \texttt{@preamble}, this behaves like +%\cs{providecommand} in the document but like \cs{renewcommand} +%in \app{bib2gls}. +% \begin{macrocode} +\newcommand*{\glsxtrprovidecommand}{\providecommand} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsrenewcommand} +%\changes{1.37}{2018-11-30}{new} +%Like \cs{renewcommand} but only generates a warning rather than an +%error if the command isn't defined. +% \begin{macrocode} +\newcommand*{\glsrenewcommand}{\@star@or@long\glsxtr@renewcommand} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@renewcommand} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@renewcommand}[1]{% + \begingroup \escapechar\m@ne\xdef\@gtempa{{\string#1}}\endgroup + \expandafter\@ifundefined\@gtempa + {% + \GlossariesExtraWarning{can't redefine \noexpand#1(not already defined)}% + }% + \relax + \relax + \let\@ifdefinable\@rc@ifdefinable + \new@command#1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@wrglossarylocation} +%\changes{1.29}{2018-04-09}{new} +%For use with \pkgopt{indexcounter} and \app{bib2gls}. +% \begin{macrocode} +\newcommand*{\glsxtr@wrglossarylocation}[2]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrIndexCounterLink} +%\changes{1.29}{2018-04-09}{new} +%\begin{definition} +%\cs{GlsXtrIndexCounterLink}\marg{text}\marg{label} +%\end{definition} +%For use with \pkgopt{indexcounter} and \app{bib2gls}. +% \begin{macrocode} +\ifdef\hyperref +{% + \newcommand*{\GlsXtrIndexCounterLink}[2]{% + \glsxtrifhasfield{indexcounter}{#2}% + {\hyperref[wrglossary.\glscurrentfieldvalue]{#1}}% + {#1}% + } +} +{ + \newcommand*{\GlsXtrIndexCounterLink}[2]{#1} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrDualField} +%\changes{1.30}{2018-04-25}{new} +%\begin{definition} +%\cs{GlsXtrDualField} +%\end{definition} +%The internal field used to store the dual label. The +%\texttt{dual-field} defaults to \texttt{dual} if no value is +%supplied so that's used as the default. +% \begin{macrocode} +\newcommand*{\GlsXtrDualField}{dual} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrDualBackLink} +%\changes{1.30}{2018-04-25}{new} +%\begin{definition} +%\cs{GlsXtrDualBackLink}\marg{text}\marg{label} +%\end{definition} +%Adds a hyperlink to the dual entry. +% \begin{macrocode} +\newcommand*{\GlsXtrDualBackLink}[2]{% + \glsxtrifhasfield{\GlsXtrDualField}{#2}% + {\glshyperlink[#1]{\glscurrentfieldvalue}}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrBibTeXEntryAliases} +%\changes{1.29}{2018-04-09}{new} +%Convenient shortcut for use with \texttt{entry-type-aliases} to +%alias standard \BibTeX\ entry types to \texttt{@bibtexentry}. +% \begin{macrocode} +\newcommand*{\GlsXtrBibTeXEntryAliases}{% + article=bibtexentry, + book=bibtexentry, + booklet=bibtexentry, + conference=bibtexentry, + inbook=bibtexentry, + incollection=bibtexentry, + inproceedings=bibtexentry, + manual=bibtexentry, + mastersthesis=bibtexentry, + misc=bibtexentry, + phdthesis=bibtexentry, + proceedings=bibtexentry, + techreport=bibtexentry, + unpublished=bibtexentry +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrProvideBibTeXFields} +%\changes{1.29}{2018-04-09}{new} +%Convenient shortcut to define the standard \BibTeX\ fields. +% \begin{macrocode} +\newcommand*{\GlsXtrProvideBibTeXFields}{% + \glsaddstoragekey{address}{}{\glsxtrbibaddress}% + \glsaddstoragekey{author}{}{\glsxtrbibauthor}% + \glsaddstoragekey{booktitle}{}{\glsxtrbibbooktitle}% + \glsaddstoragekey{chapter}{}{\glsxtrbibchapter}% + \glsaddstoragekey{edition}{}{\glsxtrbibedition}% + \glsaddstoragekey{howpublished}{}{\glsxtrbibhowpublished}% + \glsaddstoragekey{institution}{}{\glsxtrbibinstitution}% + \glsaddstoragekey{journal}{}{\glsxtrbibjournal}% + \glsaddstoragekey{month}{}{\glsxtrbibmonth}% + \glsaddstoragekey{note}{}{\glsxtrbibnote}% + \glsaddstoragekey{number}{}{\glsxtrbibnumber}% + \glsaddstoragekey{organization}{}{\glsxtrbiborganization}% + \glsaddstoragekey{pages}{}{\glsxtrbibpages}% + \glsaddstoragekey{publisher}{}{\glsxtrbibpublisher}% + \glsaddstoragekey{school}{}{\glsxtrbibschool}% + \glsaddstoragekey{series}{}{\glsxtrbibseries}% + \glsaddstoragekey{title}{}{\glsxtrbibtitle}% + \glsaddstoragekey{bibtextype}{}{\glsxtrbibtype}% + \glsaddstoragekey{volume}{}{\glsxtrbibvolume}% +} +% \end{macrocode} +%\end{macro} +% +%Multiple supplementary references are only supported with +%\app{bib2gls}. +%\begin{macro}{\glsxtrmultisupplocation} +%\changes{1.36}{2018-08-18}{new} +%This is like \cs{glsxtrsupphypernumber} but the second argument is +%the external file name (which isn't obtained from the +%\catattr{externallocation} attribute). The third argument is the +%formatting (encap) control sequence \emph{name}. This is ignored by +%default, but is set by \app{bib2gls} to the original encap in case +%it's required. +% \begin{macrocode} +\newcommand*{\glsxtrmultisupplocation}[3]{% + {% + \def\glsxtrsupplocationurl{#2}% + \glshypernumber{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdisplaysupploc} +%\changes{1.36}{2018-08-18}{new} +%\begin{definition} +%\cs{glsxtrdisplaysupploc}\marg{prefix}\marg{counter}\marg{format}\marg{src}\marg{location} +%\end{definition} +%This is like \cs{glsnoidxdisplayloc} but is used for supplementary +%locations and so requires an extra argument. +% \begin{macrocode} +\newcommand*\glsxtrdisplaysupploc[5]{% + \setentrycounter[#1]{#2}% + \glsxtrmultisupplocation{#5}{#4}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdisplaylocnameref} +%\changes{1.37}{2018-11-30}{new} +%\cs{glsxtrdisplaylocnameref}\marg{prefix}\marg{counter}\marg{format}\marg{location}\marg{name}\marg{href}\marg{hcounter}\marg{external +%file} +%Used with the \sty[nameref]{record} package option. The \meta{href} +%argument was obtained from \cs{@currentHref} and the +%\meta{hcounter} argument was obtained from \cs{theHentrycounter}, +%which is more reliable. +%If \sty{hyperref} hasn't been loaded, this just behaves like \cs{glsnoidxdisplayloc}. +% \begin{macrocode} +\ifundef\hyperlink +{ + \newcommand*{\glsxtrdisplaylocnameref}[8]{% + \glsnoidxdisplayloc{#1}{#2}{#3}{#4}% + } +} +{ +% \end{macrocode} +% Default action uses \meta{hcounter}. Equations and pages typically don't +% have a title, so check the counter name. +% \begin{macrocode} + \newcommand*{\glsxtrdisplaylocnameref}[8]{% + \ifstrequal{#2}{equation}% + {\glsxtrnamereflink{#3}{(#4)}{#2.#7}{#8}}% + {% + \ifstrempty{#5}% + {% +% \end{macrocode} +%No title, so just use the location as the link text. +% \begin{macrocode} + \glsxtrnamereflink{#3}{#4}{#2.#7}{#8}% + }% + {% + \ifstrequal{#2}{page}% + {\glsxtrnamereflink{#3}{#4}{#2.#7}{#8}}% + {\glsxtrnamereflink{#3}{#5}{#2.#7}{#8}}% + }% + }% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnamereflink} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrfmtnamereflink}\marg{format}\marg{title}\marg{href}\marg{external +%file} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsxtrnamereflink}[4]{% +% \end{macrocode} +%Locally change \cs{glshypernumber} to \cs{@firstofone} to +%remove the normal location hyperlink. +% \begin{macrocode} + \begingroup + \let\glshypernumber\@firstofone +% \end{macrocode} +%If the \meta{external file} argument is empty, an internal link is used, +%otherwise an external one is needed. +% \begin{macrocode} + \ifstrempty{#4}% + {\glsxtrfmtinternalnameref{#3}{#1}{#2}}% + {\glsxtrfmtexternalnameref{#3}{#1}{#2}{#4}}% + \endgroup +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnameloclink} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrnamerefloclink}\marg{prefix}\marg{counter}\marg{format}\marg{location}\marg{text}\marg{external +%file} +%\end{definition} +%Like \cs{@gls@numberlink}, this creates a hyperlink to the +%target obtained from the prefix, counter and location but uses +%\meta{text} as the hyperlink text. As with regular indexing, this +%will fail if the target name can't be formed by prefixing the +%location value. +% \begin{macrocode} +\newcommand{\glsxtrnameloclink}[6]{% + \begingroup + \setentrycounter[#1]{#2}% + \def\glsxtr@locationhypertext{#5}% + \let\glshypernumber\@firstofone + \def\@glsnumberformat{#3}% + \def\glsxtrsupplocationurl{#6}% + \toks@={}% + \@glsxtr@bibgls@removespaces#4 \@nil + \endgroup +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@bibgls@removespaces} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\def\@glsxtr@bibgls@removespaces#1 #2\@nil{% + \toks@=\expandafter{\the\toks@#1}% + \ifx\\#2\\% + \edef\x{\the\toks@}% + \ifx\x\empty + \else + \protected@edef\x{\glsentrycounter\@glo@counterprefix\the\toks@}% + \ifdefvoid\glsxtrsupplocationurl + {% + \expandafter\glsxtrfmtinternalnameref\expandafter{\x}% + {\@glsnumberformat}{\glsxtr@locationhypertext}% + }% + {% + \expandafter\glsxtrfmtexternalnameref\expandafter{\x}% + {\@glsnumberformat}{\glsxtr@locationhypertext}{\glsxtrsupplocationurl}% + }% + \fi + \else + \@gls@ReturnAfterFi{% + \@glsxtr@bibgls@removespaces#2\@nil + }% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfmtinternalnameref} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrfmtinternalnameloc}\marg{target}\marg{format}\marg{title} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsxtrfmtinternalnameref}[3]{% + \csuse{#2}{\glsdohyperlink{#1}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfmtexternalnameref} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrfmtexternalnameloc}\marg{target}\marg{format}\marg{title}\marg{file} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsxtrfmtexternalnameref}[4]{% + \csuse{#2}{\hyperref{#4}{}{#1}{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrSetWidest} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrSetWidest}\marg{type}\marg{level}\marg{text} +%\end{definition} +%As from \gls{bib2gls} v1.8, this is used by the \texttt{set-widest} +%resource option for the \glostyle{alttree} and the styles +%provided by the \sty{glossary-longextra} package. +% \begin{macrocode} +\newcommand*{\glsxtrSetWidest}[3]{% +% \end{macrocode} +%Check which style options have been provided. (The style packages +%may not have been loaded.) +% \begin{macrocode} + \ifdef\glsupdatewidest + {% + \ifdef\glslongextraUpdateWidest + {% +% \end{macrocode} +%Relevant style packages all loaded. +%If the \meta{type} has been given, append to glossary preamble. +% \begin{macrocode} + \ifstrempty{#1} + {% + \glsupdatewidest[#2]{#3}% + \ifnum#2=0\relax + \glslongextraUpdateWidest{#3}% + \else + \glslongextraUpdateWidestChild{#2}{#3}% + \fi + }% + {% + \apptoglossarypreamble[#1]{\glsupdatewidest[#2]{#3}}% + \ifnum#2=0\relax + \apptoglossarypreamble[#1]{\glslongextraUpdateWidest{#3}}% + \else + \apptoglossarypreamble[#1]{\glslongextraUpdateWidestChild{#2}{#3}}% + \fi + }% + }% + {% +% \end{macrocode} +%Only \glostyle{alttree}. +% \begin{macrocode} + \ifstrempty{#1} + {% + \glsupdatewidest[#2]{#3}% + }% + {% + \apptoglossarypreamble[#1]{\glsupdatewidest[#2]{#3}}% + }% + }% + }% + {% +% \end{macrocode} +%\cs{glsupdatewidest} hasn't been defined. This could just mean +%that the \sty{glossaries-extra-stylemods} package hasn't been +%loaded. +% \begin{macrocode} + \ifdef\glssetwidest + {% + \ifdef\glslongextraUpdateWidest + {% +% \end{macrocode} +%Relevant \sty{glossary-tree} and \sty{glossary-longextra} have been loaded. +%If the \meta{type} has been given, append to glossary preamble. +% \begin{macrocode} + \ifstrempty{#1} + {% + \glssetwidest[#2]{#3}% + \ifnum#2=0\relax + \glslongextraUpdateWidest{#3}% + \else + \glslongextraUpdateWidestChild{#2}{#3}% + \fi + }% + {% + \apptoglossarypreamble[#1]{\glssetwidest[#2]{#3}}% + \ifnum#2=0\relax + \apptoglossarypreamble[#1]{\glslongextraUpdateWidest{#3}}% + \else + \apptoglossarypreamble[#1]{\glslongextraUpdateWidestChild{#2}{#3}}% + \fi + }% + }% + {% +% \end{macrocode} +%Only \glostyle{alttree}. +% \begin{macrocode} + \ifstrempty{#1} + {% + \glssetwidest[#2]{#3}% + }% + {% + \apptoglossarypreamble[#1]{\glssetwidest[#2]{#3}}% + }% + }% + }% + {% + \ifdef\glslongextraUpdateWidest + {% +% \end{macrocode} +%\sty{glossary-longextra} has been loaded. +% \begin{macrocode} + \ifstrempty{#1} + {% + \ifnum#2=0\relax + \glslongextraUpdateWidest{#3}% + \else + \glslongextraUpdateWidestChild{#2}{#3}% + \fi + }% + {% + \ifnum#2=0\relax + \apptoglossarypreamble[#1]{\glslongextraUpdateWidest{#3}}% + \else + \apptoglossarypreamble[#1]{\glslongextraUpdateWidestChild{#2}{#3}}% + \fi + }% + }% +% \end{macrocode} +%Neither \sty{glossary-tree} nor \sty{glossary-longextra} have been +%loaded. Do nothing. +% \begin{macrocode} + {}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrSetWidestFallback} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrSetWidestFallback}\marg{max depth}\marg{list} +%\end{definition} +%Used when \gls{bib2gls} can't determine the widest name. +%The \meta{list} argument is a comma-separated list of glossary +%labels. The \meta{max depth} refers to the maximum hierarchical +%depth. This will either be 0 (only top-level entries) or 2 +%(up to two child-levels). +% \begin{macrocode} +\newcommand*{\glsxtrSetWidestFallback}[2]{% + \ifnum#1=0\relax + \ifdef\glsFindWidestTopLevelName + {% + \glsFindWidestTopLevelName[#2]% + }% + {% + \GlossariesExtraWarning{You need stylemods={tree} to + provide a fallback for set-widest}% + }% + \else + \ifdef\glsFindWidestLevelTwo + {% + \glsFindWidestLevelTwo[#2]% + \ifdef\glslongextraUpdateWidestChild + {% + \glslongextraUpdateWidestChild{#1}{\csuse{@glswidestnamei}}% + \glslongextraUpdateWidestChild{#1}{\csuse{@glswidestnameii}}% + }% + {}% + }% + {% + \GlossariesExtraWarning{You need stylemods={tree} to + provide a fallback for set-widest}% + }% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@labelprefixes} +%\changes{1.37}{2018-11-30}{new} +%List of label prefixes. +% \begin{macrocode} +\newcommand*{\@glsxtr@labelprefixes}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrclearlabelprefixes} +%\changes{1.37}{2018-11-30}{new} +%List of label prefixes. +% \begin{macrocode} +\newcommand*{\glsxtrclearlabelprefixes}{% + \renewcommand*{\@glsxtr@labelprefixes}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtraddlabelprefix} +%\changes{1.37}{2018-11-30}{new} +%Add prefix to the list. +%These should be added in the order of precedence with the last one +%as a fallback. This doesn't check against +%duplicates as it may be useful to replicate a prefix at the end as +%the fallback. +% \begin{macrocode} +\newcommand*{\glsxtraddlabelprefix}[1]{% + \ifstrempty{#1}% + {\glsxtraddlabelprefix{\empty}}% + {% + \ifdefempty\@glsxtr@labelprefixes + {\def\@glsxtr@labelprefixes{#1}}% + {\appto\@glsxtr@labelprefixes{,#1}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrprependlabelprefix} +%\changes{1.37}{2018-11-30}{new} +%Inserts at the start of the list. +% \begin{macrocode} +\newcommand*{\glsxtrprependlabelprefix}[1]{% + \ifstrempty{#1}% + {\glsxtrprependlabelprefix{\empty}}% + {% + \ifdefempty\@glsxtr@labelprefixes + {\def\@glsxtr@labelprefixes{#1}}% + {\preto\@glsxtr@labelprefixes{#1,}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifinlabelprefixlist} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glsxtrifinlabelprefixlist}\marg{prefix}\marg{true}\marg{false} +%\end{definition} +%Test if the given prefix is in the list. +% \begin{macrocode} +\newcommand*{\glsxtrifinlabelprefixlist}[3]{% + \ifstrempty{#1}% + {\glsxtrifinlabelprefixlist{\empty}{#2}{#3}}% + {% + \DTLifinlist{#1}{\@glsxtr@labelprefixes}{#2}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@prefixlabellist} +%\changes{1.37}{2018-11-30}{new} +%This is provided for the benefit of \gls{bib2gls}. It's possible +%that the user may add more prefixes after the start of the +%document, but that can lead to inconsistencies. The final element +%of the list (the fallback) is the only prefix of interest for \gls{bib2gls}. +% \begin{macrocode} +\AtBeginDocument{% + \protected@write\@auxout{}{\string\providecommand{\string\@glsxtr@prefixlabellist}[1]{}}% + \protected@write\@auxout{}{\string\@glsxtr@prefixlabellist{\@glsxtr@labelprefixes}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@get@prefixedlabel} +%\changes{1.37}{2018-11-30}{new} +%Iterate through all the prefixes and find the first +%prefix and label combination that exists. If none found, this could +%mean that it's the first \LaTeX\ run, so the last prefix in the +%list needs to be the fallback one. Grouping is used in case +%of a nested for loop. +% \begin{macrocode} +\newcommand*{\@glsxtr@get@prefixedlabel}[1]{% + \begingroup +% \end{macrocode} +%Initialise to the unprefixed label in the event that the list is +%empty. +% \begin{macrocode} + \edef\@gls@thislabel{#1}% + \@for\@glsxtr@prefix:=\@glsxtr@labelprefixes\do + {% + \edef\@gls@thislabel{\@glsxtr@prefix#1}% + \ifglsentryexists{\@gls@thislabel}{\@endfortrue}{}% + }% + \edef\x{\endgroup\noexpand\def\noexpand\@gls@thislabel{\@gls@thislabel}}\x +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dgls} +%\changes{1.37}{2018-11-30}{new} +%Like \cs{gls} but tries the prefixes. (Can't use \cs{pgls} as +%that's provided by \sty{glossaries-prefix}.) Since this command +%is designed for \app{bib2gls}'s dual entry system, the \qt{d} +%stands for \qt{dual}. +% \begin{macrocode} +\newrobustcmd*{\dgls}{\@gls@hyp@opt\@dgls} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@dgls} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@dgls}[2][]{% + \@glsxtr@get@prefixedlabel{#2}% + \new@ifnextchar[{\@gls@{#1}{\@gls@thislabel}}{\@gls@{#1}{\@gls@thislabel}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dglspl} +% \begin{macrocode} +\newrobustcmd*{\dglspl}{\@gls@hyp@opt\@dglspl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@dglspl} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@dglspl}[2][]{% + \@glsxtr@get@prefixedlabel{#2}% + \new@ifnextchar[{\@glspl@{#1}{\@gls@thislabel}}{\@glspl@{#1}{\@gls@thislabel}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dGls} +% \begin{macrocode} +\newrobustcmd*{\dGls}{\@gls@hyp@opt\@dGls} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@dGls} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@dGls}[2][]{% + \@glsxtr@get@prefixedlabel{#2}% + \new@ifnextchar[{\@Gls@{#1}{\@gls@thislabel}}{\@Gls@{#1}{\@gls@thislabel}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dGlspl} +% \begin{macrocode} +\newrobustcmd*{\dGlspl}{\@gls@hyp@opt\@dGlspl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@dGlspl} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@dGlspl}[2][]{% + \@glsxtr@get@prefixedlabel{#2}% + \new@ifnextchar[{\@Glspl@{#1}{\@gls@thislabel}}{\@Glspl@{#1}{\@gls@thislabel}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dGLS} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newrobustcmd*{\dGLS}{\@gls@hyp@opt\@dGLS} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@dGLS} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@dGLS}[2][]{% + \@glsxtr@get@prefixedlabel{#2}% + \new@ifnextchar[{\@GLS@{#1}{\@gls@thislabel}}{\@GLS@{#1}{\@gls@thislabel}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dGLSpl} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newrobustcmd*{\dGLSpl}{\@gls@hyp@opt\@dGLSpl} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@dGLSpl} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\@dGLSpl}[2][]{% + \@glsxtr@get@prefixedlabel{#2}% + \new@ifnextchar[{\@GLSpl@{#1}{\@gls@thislabel}}{\@GLSpl@{#1}{\@gls@thislabel}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dglslink} +%\changes{1.37}{2018-11-30}{new} +%Like \cs{glslink} but tries the prefixes. +% \begin{macrocode} +\newrobustcmd*{\dglslink}[3][]{% + \@glsxtr@get@prefixedlabel{#2}% + \glslink[#1]{\@gls@thislabel}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dglsdisp} +%\changes{1.37}{2018-11-30}{new} +%Like \cs{glsdisp} but tries the prefixes. +% \begin{macrocode} +\newrobustcmd*{\dglsdisp}[3][]{% + \@glsxtr@get@prefixedlabel{#2}% + \glsdisp[#1]{\@gls@thislabel}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%Provide missing Greek letters for use in maths mode. +%These commands are recognised by \app{bib2gls} and will be mapped to the +%Mathematical Greek Italic letters. This ensures that the Greek +%letters that have the same shape as Latin letters are kept +%with the other mathematical Greek letters for sorting purposes. +%The \LaTeX\ version of these commands (provided here) use an upright font +%for capitals and italic for lower case to provide a better match +%with the other Greek symbols provided by the kernel. +% +%\begin{macro}{\Alpha} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Alpha}{\mathrm{A}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Beta} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Beta}{\mathrm{B}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Epsilon} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Epsilon}{\mathrm{E}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Zeta} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Zeta}{\mathrm{Z}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Eta} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Eta}{\mathrm{H}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Iota} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Iota}{\mathrm{I}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Kappa} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Kappa}{\mathrm{K}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Mu} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Mu}{\mathrm{M}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Nu} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Nu}{\mathrm{N}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Omicron} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Omicron}{\mathrm{O}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Rho} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Rho}{\mathrm{P}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Tau} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Tau}{\mathrm{T}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Chi} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Chi}{\mathrm{X}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Digamma} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\Digamma}{\mathrm{F}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\omicron} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} +\providecommand*{\omicron}{\mathit{o}} +% \end{macrocode} +%\end{macro} +% +%Provide corresponding upright characters if \sty{upgreek} has been +%loaded. (The upper case characters are the same as above.) +% \begin{macrocode} +\@ifpackageloaded{upgreek}% +{ +% \end{macrocode} +%\begin{macro}{\Upalpha} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upalpha}{\mathrm{A}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upbeta} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upbeta}{\mathrm{B}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upepsilon} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upepsilon}{\mathrm{E}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upzeta} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upzeta}{\mathrm{Z}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upeta} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upeta}{\mathrm{H}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upiota} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upiota}{\mathrm{I}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upkappa} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upkappa}{\mathrm{K}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upmu} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upmu}{\mathrm{M}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upnu} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upnu}{\mathrm{N}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upomicron} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upomicron}{\mathrm{O}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Uprho} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Uprho}{\mathrm{P}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Uptau} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Uptau}{\mathrm{T}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Upchi} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\Upchi}{\mathrm{X}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\upomicron} +%\changes{1.27}{2018-02-26}{new} +% \begin{macrocode} + \providecommand*{\upomicron}{\mathrm{o}} +% \end{macrocode} +%\end{macro} +% +% \begin{macrocode} +}% +{}% upgreek.sty not loaded +% \end{macrocode} +% +%This package provides some basic rules, but it's not intended for +%complete coverage of all locales. The CLDR should provide the +%appropriate locale-sensitive rules. These macros are primarily to +%help construct custom rules to include, for example, Greek maths symbols +%mixed with Latin. For the full rule syntax, see the Java API for +%\href{https://docs.oracle.com/javase/8/docs/api/java/text/RuleBasedCollator.html}{RuleBaseCollator} +% +%If you want to provide a rule-block for a particular locale to +%allow for customization within that locale, create a file called +%\texttt{glossariesxtr-\meta{tag}.ldf} (where \meta{tag} identifies +%the locale) and add similar commands. See the description +%of \cs{IfTrackedLanguageFileExists} in the \sty{tracklang} manual +%for the allowed forms of \meta{tag}. The simplest is to just use +%the root language label or ISO code. The file will then be automatically loaded +%by \styfmt{glossaries-extra} if the document has support for that +%language. +% +%When combining these blocks of rules, remember to separate them +%with the appropriate character. For example: +%\begin{verbatim} +%sort-rule={\glsxtrcontrolrules +% ;\glsxtrspacerules +% ;\glsxtrnonprintablerules +% ;\glsxtrcombiningdiacriticrules +% ,\glsxtrhyphenrules +% <\glsxtrgeneralpuncrules +% <\glsxtrdigitrules +% <\glsxtrfractionrules +% <\glsxtrGeneralLatinIVrules +% <\glsxtrMathItalicGreekIrules +%} +%\end{verbatim} +% +%\begin{macro}{\glsxtrcontrolrules} +%\changes{1.27}{2018-02-26}{new} +%These are control characters that are usually placed at the start +%of a rule in the `ignored characters' section. These control +%characters are unlikely to appear in any entry fields but are +%provided for completeness. +%\cs{string} is used for punctuation characters in case they've been +%made active. +% \begin{macrocode} +\newcommand*{\glsxtrcontrolrules}{% + \string'\glshex 200B\string'\string=\glshex 200C\string=\glshex 200D + \string=\glshex 200E\string=\glshex 200F\string=\glshex 0000\string=\glshex 0001 + \string=\glshex 0002\string=\glshex 0003\string=\glshex 0004\string=\glshex 0005 + \string=\glshex 0006\string=\glshex 0007\string=\glshex 0008 + \string=\string'\glshex 0009\string'\string=\string'\glshex 000B\string' + \string=\glshex 000E\string=\glshex 000F\string=\string'\glshex +0010\string'\string=\glshex 0011 + \string=\glshex 0012\string=\glshex 0013\string=\glshex 0014\string=\glshex 0015 + \string=\glshex 0016\string=\glshex 0017\string=\glshex 0018\string=\glshex 0019 + \string=\glshex 001A\string=\glshex 001B\string=\glshex 001C\string=\glshex 001D + \string=\glshex 001E\string=\glshex 001F\string=\glshex 007F\string=\glshex 0080 + \string=\glshex 0081\string=\glshex 0082\string=\glshex 0083\string=\glshex 0084 + \string=\glshex 0085\string=\glshex 0086\string=\glshex 0087\string=\glshex 0088 + \string=\glshex 0089\string=\glshex 008A\string=\glshex 008B\string=\glshex 008C + \string=\glshex 008D\string=\glshex 008E\string=\glshex 008F\string=\glshex 0090 + \string=\glshex 0091\string=\glshex 0092\string=\glshex 0093\string=\glshex 0094 + \string=\glshex 0095\string=\glshex 0096\string=\glshex 0097\string=\glshex 0098 + \string=\glshex 0099\string=\glshex 009A\string=\glshex 009B\string=\glshex 009C + \string=\glshex 009D\string=\glshex 009E\string=\glshex 009F +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrspacerules} +%\changes{1.27}{2018-02-26}{new} +%These are space characters. +% \begin{macrocode} +\newcommand*{\glsxtrspacerules}{% + \string' \string'\string; + \string'\glshex 00A0\string'\string; + \string'\glshex 2000\string'\string; + \string'\glshex 2001\string'\string; + \string'\glshex 2002\string'\string; + \string'\glshex 2003\string'\string; + \string'\glshex 2004\string'\string; + \string'\glshex 2005\string'\string; + \string'\glshex 2006\string'\string; + \string'\glshex 2007\string'\string; + \string'\glshex 2008\string'\string; + \string'\glshex 2009\string'\string; + \string'\glshex 200A\string'\string; + \string'\glshex 3000\string' +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnonprintablerules} +%\changes{1.27}{2018-02-26}{new} +%These are non-printable characters (BOM, tabs, line feed and carriage +%return). +% \begin{macrocode} +\newcommand*{\glsxtrnonprintablerules}{% + \string'\glshex FEFF\string'\string; + \string'\glshex 000A\string'\string; + \string'\glshex 0009\string'\string; + \string'\glshex 000C\string'\string; + \string'\glshex 000B\string' +} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\glsxtrcombiningdiacriticrules} +%\changes{1.27}{2018-02-26}{new} +%Combining diacritic marks. This is split into multiple macros. +% \begin{macrocode} +\newcommand*{\glsxtrcombiningdiacriticrules}{% + \glsxtrcombiningdiacriticIrules\string; + \glsxtrcombiningdiacriticIIrules\string; + \glsxtrcombiningdiacriticIIIrules\string; + \glsxtrcombiningdiacriticIVrules +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrcombiningdiacriticIrules} +%\changes{1.27}{2018-02-26}{new} +%First set of combining diacritic marks. +% \begin{macrocode} +\newcommand*{\glsxtrcombiningdiacriticIrules}{% + \glshex 0301\string;% combining acute + \glshex 0300\string;% combining grave + \glshex 0306\string;% combining breve + \glshex 0302\string;% combining circumflex + \glshex 030C\string;% combining caron + \glshex 030A\string;% combining ring + \glshex 030D\string;% combining vertical line above + \glshex 0308\string;% combining diaeresis + \glshex 030B\string;% combining double acute + \glshex 0303\string;% combining tilde + \glshex 0307\string;% combining dot above + \glshex 0304% combining macron +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrcombiningdiacriticIIrules} +%\changes{1.27}{2018-02-26}{new} +%Second set of combining diacritic marks. +% \begin{macrocode} +\newcommand*{\glsxtrcombiningdiacriticIIrules}{% + \glshex 0337\string;% combining short solidus overlay + \glshex 0327\string;% combining cedilla + \glshex 0328\string;% combining ogonek + \glshex 0323\string;% combining dot below + \glshex 0332\string;% combining low line + \glshex 0305\string;% combining overline + \glshex 0309\string;% combining hook above + \glshex 030E\string;% combining double vertical line above + \glshex 030F\string;% combining double grave accent + \glshex 0310\string;% combining candrabindu + \glshex 0311\string;% combining inverted breve + \glshex 0312\string;% combining turned comma above + \glshex 0313\string;% combining comma above + \glshex 0314\string;% combining reversed comma above + \glshex 0315\string;% combining comma above right + \glshex 0316\string;% combining grave accent below + \glshex 0317% combining acute accent below +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrcombiningdiacriticIIIrules} +%\changes{1.27}{2018-02-26}{new} +%Third set of combining diacritic marks. +% \begin{macrocode} +\newcommand*{\glsxtrcombiningdiacriticIIIrules}{% + \glshex 0318\string;% combining left tack below + \glshex 0319\string;% combining right tack below + \glshex 031A\string;% combining left angle above + \glshex 031B\string;% combining horn + \glshex 031C\string;% combining left half ring below + \glshex 031D\string;% combining up tack below + \glshex 031E\string;% combining down tack below + \glshex 031F\string;% combining plus sign below + \glshex 0320\string;% combining minus sign below + \glshex 0321\string;% combining palatalized hook below + \glshex 0322\string;% combining retroflex hook below + \glshex 0324\string;% combining diaresis below + \glshex 0325\string;% combining ring below + \glshex 0326\string;% combining comma below + \glshex 0329\string;% combining vertical line below + \glshex 032A\string;% combining bridge below + \glshex 032B\string;% combining inverted double arch below + \glshex 032C\string;% combining caron below + \glshex 032D\string;% combining circumflex accent below + \glshex 032E\string;% combining breve below + \glshex 032F\string;% combining inverted breve below + \glshex 0330\string;% combining tilde below + \glshex 0331\string;% combining macron below + \glshex 0333\string;% combining double low line + \glshex 0334\string;% combining tilde overlay + \glshex 0335\string;% combining short stroke overlay + \glshex 0336\string;% combining long stroke overlay + \glshex 0338\string;% combining long solidus overlay + \glshex 0339\string;% combining combining right half ring below + \glshex 033A\string;% combining inverted bridge below + \glshex 033B\string;% combining square below + \glshex 033C\string;% combining seagull below + \glshex 033D\string;% combining x above + \glshex 033E\string;% combining vertical tilde + \glshex 033F\string;% combining double overline + \glshex 0342\string;% combining Greek perispomeni + \glshex 0344\string;% combining Greek dialytika tonos + \glshex 0345\string;% combining Greek ypogegrammeni + \glshex 0360\string;% combining double tilde + \glshex 0361\string;% combining double inverted breve + \glshex 0483\string;% combining Cyrillic titlo + \glshex 0484\string;% combining Cyrillic palatalization + \glshex 0485\string;% combining Cyrillic dasia pneumata + \glshex 0486% combining Cyrillic psili pneumata +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrcombiningdiacriticIVrules} +%\changes{1.27}{2018-02-26}{new} +%Fourth set of combining diacritic marks. +% \begin{macrocode} +\newcommand*{\glsxtrcombiningdiacriticIVrules}{% + \glshex 20D0\string;% combining left harpoon above + \glshex 20D1\string;% combining right harpoon above + \glshex 20D2\string;% combining long vertical line overlay + \glshex 20D3\string;% combining short vertical line overlay + \glshex 20D4\string;% combining anticlockwise arrow above + \glshex 20D5\string;% combining clockwise arrow above + \glshex 20D6\string;% combining left arrow above + \glshex 20D7\string;% combining right arrow above + \glshex 20D8\string;% combining ring overlay + \glshex 20D9\string;% combining clockwise ring overlay + \glshex 20DA\string;% combining anticlockwise ring overlay + \glshex 20DB\string;% combining three dots above + \glshex 20DC\string;% combining four dots above + \glshex 20DD\string;% combining enclosing circle + \glshex 20DE\string;% combining enclosing square + \glshex 20DF\string;% combining enclosing diamond + \glshex 20E0\string;% combining enclosing circle backslash + \glshex 20E1% combining left right arrow above +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrhyphenrules} +%\changes{1.27}{2018-02-26}{new} +%Hyphens. +% \begin{macrocode} +\newcommand*{\glsxtrhyphenrules}{% + \string'\string-\string'\string;% ASCII hyphen + \glshex 00AD\string;% soft hyphen + \glshex 2010\string;% hyphen + \glshex 2011\string;% non-breaking hyphen + \glshex 2012\string;% figure dash + \glshex 2013\string;% en dash + \glshex 2014\string;% em dash + \glshex 2015\string;% horizontal bar + \glshex 2212\string=\glshex 207B\string=\glshex 208B% minus sign +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrgeneralpuncrules} +%\changes{1.27}{2018-02-26}{new} +%General punctuation. +% \begin{macrocode} +\newcommand*{\glsxtrgeneralpuncrules}{% + \glsxtrgeneralpuncIrules + \string<\glsxtrcurrencyrules + \string<\glsxtrgeneralpuncIIrules +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrgeneralpuncIrules} +%\changes{1.27}{2018-02-26}{new} +%First set of general punctuation. +% \begin{macrocode} +\newcommand*{\glsxtrgeneralpuncIrules}{% + \string'\glshex 005F\string'% underscore + \string<\glshex 00AF% macron + \string<\string'\glshex 002C\string'% comma + \string<\string'\glshex 003B\string'% semi-colon + \string<\string'\glshex 003A\string'% colon + \string<\string'\glshex 0021\string'% exclamation mark + \string<\glshex 00A1% inverted exclamation mark + \string<\string'\glshex 003F\string'% question mark + \string<\glshex 00BF% inverted question mark + \string<\string'\glshex 002F\string'% solidus + \string<\string'\glshex 002E\string'% full stop + \string<\glshex 00B4% acute accent + \string<\string'\glshex 0060\string'% grave accent + \string<\string'\glshex 005E\string'% circumflex accent + \string<\glshex 00A8% diaersis + \string<\string'\glshex 007E\string'% tilde + \string<\glshex 00B7% middle dot + \string<\glshex 00B8% cedilla + \string<\string'\glshex 0027\string'% straight apostrophe + \string<\string'\glshex 0022\string'% straight double quote + \string<\glshex 00AB% left guillemet + \string<\glshex 00BB% right guillemet + \string<\string'\glshex 0028\string'% left parenthesis + \string=\glshex 207D\string=\glshex 208D% super/subscript left parenthesis + \string<\string'\glshex 0029\string'% right parenthesis + \string=\glshex 207E\string=\glshex 208E% super/subscript right parenthesis + \string<\string'\glshex 005B\string'% left square bracket + \string<\string'\glshex 005D\string'% right square bracket + \string<\string'\glshex 007B\string'% left curly bracket + \string<\string'\glshex 007D\string'% right curly bracket + \string<\glshex 00A7% section sign + \string<\glshex 00B6% pilcrow sign + \string<\glshex 00A9% copyright sign + \string<\glshex 00AE% registered sign + \string<\string'\glshex 0040\string'% at sign +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrcurrencyrules} +%\changes{1.27}{2018-02-26}{new} +%General punctuation. +% \begin{macrocode} +\newcommand*{\glsxtrcurrencyrules}{% + \glshex 00A4% currency sign + \string<\glshex 0E3F% Thai currency symbol baht + \string<\glshex 00A2% cent sign + \string<\glshex 20A1% colon sign + \string<\glshex 20A2% cruzeiro sign + \string<\string'\glshex 0024\string'% dollar sign + \string<\glshex 20AB% dong sign + \string<\glshex 20AC% euro sign + \string<\glshex 20A3% French franc sign + \string<\glshex 20A4% lira sign + \string<\glshex 20A5% mill sign + \string<\glshex 20A6% naira sign + \string<\glshex 20A7% peseta sign + \string<\glshex 00A3% pound sign + \string<\glshex 20A8% rupee sign + \string<\glshex 20AA% new sheqel sign + \string<\glshex 20A9% won sign + \string<\glshex 00A5% yen sign +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrgeneralpuncIIrules} +%\changes{1.27}{2018-02-26}{new} +%Second set of general punctuation. +% \begin{macrocode} +\newcommand*{\glsxtrgeneralpuncIIrules}{% + \string'\glshex 002A\string'% asterisk + \string<\string'\glshex 005C\string'% backslash + \string<\string'\glshex 0026\string'% ampersand + \string<\string'\glshex 0023\string'% hash sign + \string<\string'\glshex 0025\string'% percent sign + \string<\string'\glshex 002B\string'% plus sign + \string=\glshex 207A\string=\glshex 208A% super/subscript plus sign + \string<\glshex 00B1% plus-minus sign + \string<\glshex 00F7% division sign + \string<\glshex 00D7% multiplication sign + \string<\string'\glshex 003C\string'% less-than sign + \string<\string'\glshex 003D\string'% equals sign + \string<\string'\glshex 003E\string'% greater-than sign + \string<\glshex 00AC% not sign + \string<\string'\glshex 007C\string'% vertical bar (pipe) + \string<\glshex 00A6% broken bar + \string<\glshex 00B0% degree sign + \string<\glshex 00B5% micron sign +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrGeneralLatinIrules} +%\changes{1.27}{2018-02-26}{new} +%Basic Latin alphabet. +% \begin{macrocode} +\newcommand*{\glsxtrGeneralLatinIrules}{% + \glsxtrLatinA + \string +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-extra-stylemods.sty> +% \end{macrocode} +%\fi +%\chapter{Style Adjustments (\styfmt{glossaries-extra-stylemods.sty})} +% This package adjusts the predefined styles so that they include the post +% description hook. Also, some other minor adjustments may be made +% to make existing styles more flexible. +% +%\section{Package Initialisation} +% First identify package: +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-extra-stylemods}[2019/04/09 v1.41 (NLCT)] +% \end{macrocode} +% Provide package options to automatically load required predefined +% styles. The simplest method is to just test for the existence of +% the file \texttt{glossary-}\meta{option}\texttt{.sty}. Packages +% can't be loaded whilst the options are being processed, so save +% the list in \cs{@glsxtr@loadstyles}. +%\begin{macro}{\@glsxtr@loadstyles} +% \begin{macrocode} +\newcommand*{\@glsxtr@loadstyles}{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{all} +%\changes{1.21}{2017-11-03}{new} +%\changes{1.38}{2018-12-01}{added \styfmt{glossary-longextra}} +%\changes{1.40}{2019-03-22}{added \styfmt{glossary-topic}} +%Provide all known styles. +% \begin{macrocode} +\DeclareOption{all}{% + \appto\@glsxtr@loadstyles{% + \RequirePackage{glossary-inline}% + \RequirePackage{glossary-list}% + \RequirePackage{glossary-tree}% + \RequirePackage{glossary-mcols}% + \RequirePackage{glossary-long}% + \RequirePackage{glossary-longragged}% + \RequirePackage{glossary-longbooktabs}% + \RequirePackage{glossary-super}% + \RequirePackage{glossary-superragged}% + \RequirePackage{glossary-bookindex}% + \RequirePackage{glossary-longextra}% + \RequirePackage{glossary-topic}% + } +} +% \end{macrocode} +%\end{option} +% +% \begin{macrocode} +\DeclareOption*{% + \IfFileExists{glossary-\CurrentOption.sty} + {\eappto\@glsxtr@loadstyles{% + \noexpand\RequirePackage{glossary-\CurrentOption}}% + }% + {% + \PackageError{glossaries-extra-styles}% + {Unknown option `\CurrentOption'}{}% + }% +} +% \end{macrocode} +% Process the package options: +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% Load the required packages: +% \begin{macrocode} +\@glsxtr@loadstyles +% \end{macrocode} +% Adjust the styles so that they all have the post description hook. +% Also, instead of having a hard-coded \cs{space} before the +% location, use: +%\begin{macro}{\glsxtrprelocation} +%\changes{1.21}{2017-11-03}{new} +%This uses \cs{providecommand} as the same command is also +%provided by \sty{glossary-bookindex}. +% \begin{macrocode} +\providecommand*{\glsxtrprelocation}{\space} +% \end{macrocode} +%\end{macro} +% +%In case we have an old version of \sty{glossaries}: +%\begin{macro}{\renewglossarystyle} +% \begin{macrocode} +\providecommand{\renewglossarystyle}[2]{% + \ifcsundef{@glsstyle@#1}% + {% + \PackageError{glossaries-extra}{Glossary style `#1' isn't already defined}{}% + }% + {% + \csdef{@glsstyle@#1}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\section{List-Like Styles} +% The list-like styles mostly already use the post description hook. +% Only the \glostyle{listdotted} style need modifying to add this. +% \begin{macrocode} +\ifdef{\@glsstyle@listdotted} +{% + \renewglossarystyle{listdotted}{% + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[]\makebox[\glslistdottedwidth][l]{% + \glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}% + \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}% + \glossentrydesc{##1}\glspostdescription}% + \renewcommand*{\subglossentry}[3]{% + \item[]\makebox[\glslistdottedwidth][l]{% + \glssubentryitem{##2}% + \glstarget{##2}{\glossentryname{##2}}% + \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}% + \glossentrydesc{##2}\glspostdescription}% + } +} +{% +% \end{macrocode} +% Assume the style isn't required if it hasn't already been defined. +% \begin{macrocode} +} +% \end{macrocode} +% The \glostyle{sublistdotted} style doesn't display the description +% for top-level entries. Sub-level entries use the +% \glostyle{listdottedstyle}. +% +%The other list styles would be easier to adapt if the space +%before the number list wasn't hard coded. +%\changes{1.21}{2017-11-03}{modified list to remove hard coded \cs{space}} +% \begin{macrocode} +\ifdef{\@glsstyle@list} +{% +% \end{macrocode} +%\begin{macro}{\glslistprelocation} +%\changes{1.21}{2017-11-03}{new} +%Space before number list for top-level entries. +% \begin{macrocode} + \newcommand{\glslistprelocation}{\glsxtrprelocation} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslistchildprelocation} +%\changes{1.21}{2017-11-03}{new} +%Space before number list for child entries. +% \begin{macrocode} + \newcommand{\glslistchildprelocation}{\glslistprelocation} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslistchildpostlocation} +%\changes{1.21}{2017-11-03}{new} +%Full stop after number list. +% \begin{macrocode} + \newcommand{\glslistchildpostlocation}{.} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslistdesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glslistdesc}[1]{\glossentrydesc{#1}\glspostdescription} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslistgroupskip} +%\changes{1.41}{2019-04-09}{new} +% \begin{macrocode} + \newcommand{\glslistgroupskip}{\nobreak\indexspace\nobreak} +% \end{macrocode} +%\end{macro} +%Redefine \glostyle{list} to use these commands. +% \begin{macrocode} + \renewglossarystyle{list}{% + \renewenvironment{theglossary}% + {\begin{description}}{\end{description}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glslistdesc{##1}\glslistprelocation ##2}% + \renewcommand*{\subglossentry}[3]{% + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\space + \glslistdesc{##2}% + \glslistchildprelocation ##3\glslistchildpostlocation}% + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\glslistgroupskip\fi}% + } +} +{} +% \end{macrocode} +%Similarly for \glostyle{altlist}. Since it requires \glostyle{list}, +%the new commands should have been defined above. +% \begin{macrocode} +\ifdef{\@glsstyle@altlist} +{% + \renewglossarystyle{altlist}{% + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}]% + \mbox{}\par\nobreak\@afterheading + \glslistdesc{##1}\glslistprelocation ##2}% + \renewcommand{\subglossentry}[3]{% + \par + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glslistdesc{##2}% + \glslistchildprelocation ##3}% + } +} +{} +% \end{macrocode} +%Redefine \glostyle{listgroup} so that it discourages a break +%after group headings. +%\changes{1.21}{2017-11-03}{redefined \texttt{listgroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@listgroup} +{% + \renewglossarystyle{listgroup}{% + \setglossarystyle{list}% + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]% + \mbox{}\par\nobreak\@afterheading + }% + } +} +{} +% \end{macrocode} +%Similarly for \glostyle{listhypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{listhypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@listhypergroup} +{% + \renewglossarystyle{listhypergroup}{% + \setglossarystyle{list}% + \renewcommand*{\glossaryheader}{% + \glslistnavigationitem{\glsnavigation}}% + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]% + \mbox{}\par\nobreak\@afterheading + }% + } +} +{} +% \end{macrocode} +%Similarly for \glostyle{altlistgroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{altlistgroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@altlistgroup} +{% + \renewglossarystyle{altlistgroup}{% + \setglossarystyle{altlist}% + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]% + \mbox{}\par\nobreak\@afterheading + }% + } +} +{} +% \end{macrocode} +%Similarly for \glostyle{altlisthypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{altlisthypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@altlisthypergroup} +{% + \renewglossarystyle{altlisthypergroup}{% + \setglossarystyle{altlist}% + \renewcommand*{\glossaryheader}{% + \glslistnavigationitem{\glsnavigation}}% + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]% + \mbox{}\par\nobreak\@afterheading + }% + } +} +{} +% \end{macrocode} +% +%\section{Longtable Styles} +% The three and four column styles require adjustment to add the +% post-description hook. The two column styles need the hard-coded +% \cs{space} changed to \cs{glsxtrprelocation}. +% \begin{macrocode} +\ifcsdef{@glsstyle@long} +{% + \renewglossarystyle{long}{% + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}}}% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription + \glsxtrprelocation ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription + \glsxtrprelocation ##3\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & \tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +%Three column style: +% \begin{macrocode} +\ifcsdef{@glsstyle@long3col} +{% + \renewglossarystyle{long3col}{% + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}p{\glspagelistwidth}}}% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + ##3\tabularnewline + }% +% \end{macrocode} +%Conditional needs to be outside of \cs{glsgroupskip} otherwise it +%can cause \qt{Incomplete \cs{iftrue}} errors. +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% Four column style: +% \begin{macrocode} +\ifcsdef{@glsstyle@long4col} +{% + \renewglossarystyle{long4col}{% + \renewenvironment{theglossary}% + {\begin{longtable}{llll}}% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & + \glossentrysymbol{##1} & + ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% +%The styles in \sty{glossary-longbooktabs} are all based on the +%styles in \sty{glossary-long}, so no adjustments are needed for +%that package. +% +%\section{Long Ragged Styles} +% The three and four column styles require adjustment for the +% post-description hook, but not the two column styles. However, the +% two-column styles need to have \cs{space} replaced with +% \cs{glsxtrprelocation}. +% \begin{macrocode} +\ifcsdef{@glsstyle@longragged} +{% + \renewglossarystyle{longragged}{% + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription\glsxtrprelocation ##2% + \tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}% + \glspostdescription\glsxtrprelocation ##3% + \tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & \tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +%Three and four column styles don't use \cs{glsxtrprelocation} since the number +%list is in its own column. +% \begin{macrocode} +\ifcsdef{@glsstyle@longragged3col} +{% + \renewglossarystyle{longragged3col}{% + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + ##3\tabularnewline + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% Four column style: +% \begin{macrocode} +\ifcsdef{@glsstyle@altlongragged4col} +{% + \renewglossarystyle{altlongragged4col}{% + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & \glossentrysymbol{##1} & + ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% +%\section{Supertabular Styles} +% The three and four column styles require adjustment to add the +% post-description hook. The two column styles need the hard-coded +% \cs{space} changed to \cs{glsxtrprelocation}. +% \begin{macrocode} +\ifcsdef{@glsstyle@super} +{% + \renewglossarystyle{super}{% + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}}}% + {\end{supertabular}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription + \glsxtrprelocation ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription + \glsxtrprelocation ##3\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& \tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +%Three column style: +% \begin{macrocode} +\ifcsdef{@glsstyle@super3col} +{% + \renewglossarystyle{super3col}{% + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}% + {\end{supertabular}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + ##3\tabularnewline + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% Four column styles: +% \begin{macrocode} +\ifcsdef{@glsstyle@super4col} +{% + \renewglossarystyle{super4col}{% + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{llll}}{% + \end{supertabular}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & + \glossentrysymbol{##1} & ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% +%\section{Super Ragged Styles} +% The three and four column styles require adjustment for the +% post-description hook, but not the two column styles. However, the +% two-column styles need to have \cs{space} replaced with +% \cs{glsxtrprelocation}. +% \begin{macrocode} +\ifcsdef{@glsstyle@superragged} +{% + \renewglossarystyle{superragged}{% + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}% + {\end{supertabular}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription\glsxtrprelocation ##2% + \tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription + \glsxtrprelocation ##3% + \tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& \tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +%Three column style: +% \begin{macrocode} +\ifcsdef{@glsstyle@superragged3col} +{% + \renewglossarystyle{superragged3col}{% + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{supertabular}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & + ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + ##3\tabularnewline + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% Four columns: +% \begin{macrocode} +\ifcsdef{@glsstyle@altsuperragged4col} +{% + \renewglossarystyle{altsuperragged4col}{% + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{supertabular}}% + \renewcommand*{\glossaryheader}{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription & + \glossentrysymbol{##1} & ##2\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +%\changes{1.21}{2017-11-03}{moved conditional outside of \cs{glsgroupskip}} +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & &\tabularnewline}% + \fi + } +} +{} +% \end{macrocode} +% +%\section{Inline Style} +% The \glostyle{inline} style is dealt with slightly differently. +% The \cs{glspostdescription} hook is actually in +% \cs{glspostinline}, which is called at the end of the glossary. +% The original definition of \cs{glspostinline} also includes a +% space, which is unnecessary. Here, instead of redefining the +% \glostyle{inline} style, just redefine \cs{glspostinline} and +% \cs{glsinlinedescformat}. +% \begin{macrocode} +\ifdef{\@glsstyle@inline} +{% + \renewcommand*{\glspostinline}{.\spacefactor\sfcode`\.} +% \end{macrocode} +% Just use \cs{glsxtrpostdescription} instead of +% \cs{glspostdescription}. +% \begin{macrocode} + \renewcommand*{\glsinlinedescformat}[3]{% + \space#1\glsxtrpostdescription} + \renewcommand*{\glsinlinesubdescformat}[3]{% + #1\glsxtrpostdescription} +% \end{macrocode} +% The default settings don't show the location lists, so there's no +% adjustment for \cs{glsxtrprelocation}. +% \begin{macrocode} +} +{} +% \end{macrocode} +% +%\section{Tree Styles} +% Redefine both \cs{glstreenamefmt} and \cs{glstreegroupheaderfmt} +% in terms of \cs{glstreedefaultnamefmt} to make it easier to change +% both at the same time or only change one without affecting the +% other. +% \begin{macrocode} +\ifdef\glstreenamefmt +{ +% \end{macrocode} +%\begin{macro}{\glstreedefaultnamefmt} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreedefaultnamefmt}[1]{\textbf{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreenamefmt} +%\changes{1.31}{2018-05-09}{added redefinition} +% \begin{macrocode} + \renewcommand{\glstreenamefmt}[1]{\glstreedefaultnamefmt{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreegroupheaderfmt} +%\changes{1.31}{2018-05-09}{added redefinition} +%This command was only introduced to \sty{glossary-tree} v4.22, so +%it may not be defined. +% \begin{macrocode} + \def\glstreegroupheaderfmt#1{\glstreedefaultnamefmt{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreenavigationfmt} +%\changes{1.31}{2018-05-09}{added redefinition} +%This command was only introduced to \sty{glossary-tree} v4.22, so +%it may not be defined. +% \begin{macrocode} + \def\glstreenavigationfmt#1{\glstreedefaultnamefmt{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreePreHeader} +%\changes{1.41}{2019-04-09}{new} +%Takes the label as the first argument and title as the second +%argument so this can be modified to add a bookmark. +% \begin{macrocode} + \newcommand{\glstreePreHeader}[2]{} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} +% The \glostyle{index} style is redefined so that the space before +% the number list isn't hard coded. +%\changes{1.21}{2017-11-03}{modified index to remove hard coded \cs{space}} +% \begin{macrocode} +\ifdef{\@glsstyle@index} +{ +% \end{macrocode} +%\begin{macro}{\glstreeprelocation} +%\changes{1.21}{2017-11-03}{new} +%The space before the number list for top-level entries. This is +%shared by the other tree styles. +% \begin{macrocode} + \newcommand*{\glstreeprelocation}{\glsxtrprelocation} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreechildprelocation} +%\changes{1.21}{2017-11-03}{new} +%The space before the number list for child entries. This is +%shared by the other tree styles. +% \begin{macrocode} + \newcommand*{\glstreechildprelocation}{\glstreeprelocation} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreegroupskip} +%\changes{1.41}{2019-04-09}{new} +% \begin{macrocode} + \newcommand{\glstreegroupskip}{\nopagebreak\indexspace\nobreak} +% \end{macrocode} +%\end{macro} +%Modify the \glostyle{index} style. +% \begin{macrocode} + \renewglossarystyle{index}{% + \renewenvironment{theglossary}% + {\setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + \let\item\glstreeitem + \let\subitem\glstreesubitem + \let\subsubitem\glstreesubsubitem + }% + {\par}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand*{\glossentry}[2]{% + \item\glsentryitem{##1}% + \glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% + \glstreesymbol{##1}% + \glstreeDescLoc{##1}{##2}% + }% + \renewcommand{\subglossentry}[3]{% + \ifcase##1\relax + \item + \or + \subitem + \glssubentryitem{##2}% + \else + \subsubitem + \fi + \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}% + \glstreechildsymbol{##2}% + \glstreeChildDescLoc{##2}{##3}% + }% + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\glstreegroupskip\fi}% + } +} +{} +% \end{macrocode} +% +% The \glostyle{indexgroup} style is redefined to discourage a page +% break after the heading. +%\changes{1.21}{2017-11-03}{redefined \texttt{indexgroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@indexgroup} +{% + \renewglossarystyle{indexgroup}{% + \setglossarystyle{index}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \item\glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip\@afterheading + }% + } +} +{} +% \end{macrocode} +% +%Similarly for \glostyle{indexhypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{indexhypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@indexhypergroup} +{% + \renewglossarystyle{indexhypergroup}{% + \setglossarystyle{index}% + \renewcommand*{\glossaryheader}{% + \item\glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip\@afterheading}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \item\glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading}% + }% +} +{} +% \end{macrocode} +% +%Adjust \glostyle{tree} style to remove hard coded space before +%number list. +% \begin{macrocode} +\ifdef{\@glsstyle@tree} +{% +% \end{macrocode} +%Provide a command for use with the \glostyle{tree} styles that displays +%the pre-description separator, the +%description and post-description hook. +%\begin{macro}{\glstreedesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreedesc}[1]{% + \glstreepredesc\glossentrydesc{#1}\glspostdescription + } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreeDescLoc} +%\changes{1.41}{2019-04-09}{new} +%\begin{definition} +%\cs{glstreeDescLoc}\marg{label}\marg{location} +%\end{definition} +%This checks for the description and symbol. If both are missing, +%don't want a space at the start of the location list. (For example, +%the entry may just have a cross-reference.) +% \begin{macrocode} + \newcommand{\glstreeDescLoc}[2]{% + \ifglshasdesc{#1}% + {\glstreedesc{#1}\glstreeprelocation}% + {\ifglshassymbol{#1}{\glstreeprelocation}{}}% + #2% + } +% \end{macrocode} +%\end{macro} +%Similarly for the symbol. +%\begin{macro}{\glstreesymbol} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreesymbol}[1]{% + \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}% + }% +% \end{macrocode} +%\end{macro} +%And for the child entries: +%\begin{macro}{\glstreechilddesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreechilddesc}[1]{% + \glstreechildpredesc\glossentrydesc{#1}\glspostdescription + }% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreeChildDescLoc} +%\changes{1.41}{2019-04-09}{new} +% \begin{macrocode} + \newcommand{\glstreeChildDescLoc}[2]{% + \ifglshasdesc{#1}% + {\glstreechilddesc{#1}\glstreechildprelocation}% + {\ifglshassymbol{#1}{\glstreechildprelocation}{}}% + #2% + }% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreechildsymbol} +%\changes{1.31}{2018-05-09}{new} +%This just behaves in the same way as the top-level. +% \begin{macrocode} + \newcommand{\glstreechildsymbol}[1]{% + \glstreesymbol{#1}% + }% +% \end{macrocode} +%\end{macro} +% \begin{macrocode} + \renewglossarystyle{tree}{% + \renewenvironment{theglossary}% + {\setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}}% + {}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \hangindent0pt\relax + \parindent0pt\relax + \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% + \glstreesymbol{##1}% + \glstreeDescLoc{##1}{##2}\par + }% + \renewcommand{\subglossentry}[3]{% + \hangindent##1\glstreeindent\relax + \parindent##1\glstreeindent\relax + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi + \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}% + \glstreechildsymbol{##2}% + \glstreeChildDescLoc{##2}{##3}\par + }% + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\glstreegroupskip\fi}% + }% +} +{} +% \end{macrocode} +% +% The \glostyle{treegroup} style is redefined to discourage a page +% break after the heading. +%\changes{1.21}{2017-11-03}{redefined \texttt{treegroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@treegroup} +{% + \renewglossarystyle{treegroup}{% + \setglossarystyle{tree}% + \renewcommand{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent\glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip\@afterheading}% + } +} +{} +% \end{macrocode} +% +%Similarly for \glostyle{treehypergroup} +%\changes{1.21}{2017-11-03}{redefined \texttt{treehypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@treehypergroup} +{% + \renewglossarystyle{treehypergroup}{% + \setglossarystyle{tree}% + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip\@afterheading}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent + \glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading}% + } +} +{} +% \end{macrocode} +% +%Adjust \glostyle{treenoname} style to remove hard coded space before +%number list. +% \begin{macrocode} +\ifdef{\@glsstyle@treenoname} +{% +% \end{macrocode} +%Provide a command for use with the \glostyle{treenoname} styles that displays +%the pre-description separator, the +%description and post-description hook. +%\begin{macro}{\glstreenonamedesc} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreenonamedesc}[1]{% + \glstreepredesc\glossentrydesc{#1}\glspostdescription + }% +% \end{macrocode} +%\end{macro} +%Similarly for the symbol. +%\begin{macro}{\glstreenonamesymbol} +%\changes{1.31}{2018-05-09}{new} +% \begin{macrocode} + \newcommand{\glstreenonamesymbol}[1]{% + \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}% + }% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreenonamechilddesc} +%\changes{1.31}{2018-05-09}{new} +%The child entry doesn't have the pre-description separator as the +%name isn't displayed. +% \begin{macrocode} + \newcommand{\glstreenonamechilddesc}[1]{% + \glossentrydesc{#1}\glspostdescription + }% +% \end{macrocode} +%\end{macro} +% \begin{macrocode} + \renewglossarystyle{treenoname}{% + \renewenvironment{theglossary}% + {\setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}}% + {}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand{\glossentry}[2]{% + \hangindent0pt\relax + \parindent0pt\relax + \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% + \glstreenonamesymbol{##1}% + \glstreenonamedesc{##1}% + \glstreeprelocation##2\par + }% + \renewcommand{\subglossentry}[3]{% + \hangindent##1\glstreeindent\relax + \parindent##1\glstreeindent\relax + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi + \glstarget{##2}{\strut}% + \glstreenonamechilddesc{##2}% + \glstreechildprelocation##3\par + }% + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\glstreegroupskip\fi}% + } +} +{} +% \end{macrocode} +% +% The \glostyle{treenonamegroup} style is redefined to discourage a page +% break after the heading. +%\changes{1.21}{2017-11-03}{redefined \texttt{treenonamegroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@treenonamegroup} +{% + \renewglossarystyle{treenonamegroup}{% + \setglossarystyle{treenoname}% + \renewcommand{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent\glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip\@afterheading + }% + } +} +{} +% \end{macrocode} +% +%Similarly for \glostyle{treenonamehypergroup} +%\changes{1.21}{2017-11-03}{redefined \texttt{treenonamehypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@treenonamehypergroup} +{% + \renewglossarystyle{treenonamehypergroup}{% + \setglossarystyle{treenoname}% + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip\@afterheading}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading}% + } +} +{} +% \end{macrocode} +% +% The \glostyle{alttree} style is redefined to make it easier to +% made minor adjustments. +% \begin{macrocode} +\ifdef{\@glsstyle@alttree} +{% +% \end{macrocode} +% Only redefine this style if it's already been defined. +% +%\begin{macro}{\glsxtralttreeSymbolDescLocation} +%\changes{1.05}{2016-06-10}{new} +%\begin{definition} +%\cs{glsxtralttreeSymbolDescLocation}\marg{label}\marg{location +%list} +%\end{definition} +%Layout the symbol, description and location for top-level entries. +% \begin{macrocode} + \newcommand{\glsxtralttreeSymbolDescLocation}[2]{% + {% + \let\par\glsxtrAltTreePar + \ifglshassymbol{#1}{(\glossentrysymbol{#1})\space}{}% +% \end{macrocode} +%\changes{1.41}{2019-04-09}{added check for description} +% \begin{macrocode} + \ifglshasdesc{#1}% + {\glossentrydesc{#1}\glspostdescription\glstreeprelocation}{}% + #2\par + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrAltTreeIndent} +%\changes{1.05}{2016-06-10}{new} +% Paragraph indent for subsequent paragraphs in multi-paragraph +% descriptions. +% \begin{macrocode} + \newlength\glsxtrAltTreeIndent +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrAltTreePar} +%\changes{1.05}{2016-06-10}{new} +%Multi-paragraph descriptions need to keep the hanging indent. +% \begin{macrocode} + \newcommand{\glsxtrAltTreePar}{% + \@@par + \glsxtrAltTreeSetHangIndent + \setlength{\parindent}{\dimexpr\hangindent+\glsxtrAltTreeIndent}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtralttreeSubSymbolDescLocation} +%\changes{1.05}{2016-06-10}{new} +%\begin{definition} +%\cs{glsxtralttreeSubSymbolDescLocation}\marg{level}\marg{label}\marg{location +%list} +%\end{definition} +%Layout the symbol, description and location for sub-entries. +% Defaults to the same as the top-level. +% \begin{macrocode} + \newcommand{\glsxtralttreeSubSymbolDescLocation}[3]{% + \glsxtralttreeSymbolDescLocation{#2}{#3}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtreetopindent} +%\changes{1.05}{2016-06-10}{new} +% The original style has to keep computing the width of the name at +% each entry. This register allows the style to compute it once for +% the top-level at the start of the glossary. +% \begin{macrocode} + \newlength\glsxtrtreetopindent +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtralttreeInit} +%\changes{1.05}{2016-06-10}{new} +% User-level initialisation for the \glostyle{alttree} style. +% \begin{macrocode} + \newcommand*{\glsxtralttreeInit}{% + \settowidth{\glsxtrtreetopindent}{\glstreenamefmt{\glsgetwidestname\space}}% + \glsxtrAltTreeIndent=\parindent + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gglssetwidest} +%\changes{1.21}{2017-11-03}{new} +% The original \cs{glssetwidest} only uses \cs{def}. This uses +% \cs{gdef}. +% \begin{macrocode} + \newcommand*{\gglssetwidest}[2][0]{% + \csgdef{@glswidestname\romannumeral#1}{#2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\eglssetwidest} +%\changes{1.05}{2016-06-10}{new} +% The original \cs{glssetwidest} only uses \cs{def}. This uses +% \cs{protected@csedef}. +% \begin{macrocode} + \newcommand*{\eglssetwidest}[2][0]{% + \protected@csedef{@glswidestname\romannumeral#1}{#2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\xglssetwidest} +%\changes{1.05}{2016-06-10}{new} +%Like the above but uses \cs{protected@csxdef}. +% \begin{macrocode} + \newcommand*{\xglssetwidest}[2][0]{% + \protected@csxdef{@glswidestname\romannumeral#1}{#2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsupdatewidest} +%\changes{1.23}{2017-11-12}{new} +%Only sets if new value is wider than old value. +% \begin{macrocode} + \newcommand*{\glsupdatewidest}[2][0]{% + \ifcsundef{@glswidestname\romannumeral#1}% + {\csdef{@glswidestname\romannumeral#1}{#2}}% + {% + \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}% + \settowidth{\dimen@ii}{#2}% + \ifdim\dimen@ii>\dimen@ + \csdef{@glswidestname\romannumeral#1}{#2}% + \fi + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gglsupdatewidest} +%\changes{1.23}{2017-11-12}{new} +%As above but global definition. +% \begin{macrocode} + \newcommand*{\gglsupdatewidest}[2][0]{% + \ifcsundef{@glswidestname\romannumeral#1}% + {\csgdef{@glswidestname\romannumeral#1}{#2}}% + {% + \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}% + \settowidth{\dimen@ii}{#2}% + \ifdim\dimen@ii>\dimen@ + \csgdef{@glswidestname\romannumeral#1}{#2}% + \fi + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\eglsupdatewidest} +%\changes{1.23}{2017-11-12}{new} +%As \cs{glsupdatewidest} but expands value. +% \begin{macrocode} + \newcommand*{\eglsupdatewidest}[2][0]{% + \ifcsundef{@glswidestname\romannumeral#1}% + {\protected@csedef{@glswidestname\romannumeral#1}{#2}}% + {% + \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}% + \settowidth{\dimen@ii}{#2}% + \ifdim\dimen@ii>\dimen@ + \protected@csedef{@glswidestname\romannumeral#1}{#2}% + \fi + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\xglsupdatewidest} +%\changes{1.23}{2017-11-12}{new} +%As above but global. +% \begin{macrocode} + \newcommand*{\xglsupdatewidest}[2][0]{% + \ifcsundef{@glswidestname\romannumeral#1}% + {\protected@csxdef{@glswidestname\romannumeral#1}{#2}}% + {% + \settowidth{\dimen@}{\csuse{@glswidestname\romannumeral#1}}% + \settowidth{\dimen@ii}{#2}% + \ifdim\dimen@ii>\dimen@ + \protected@csxdef{@glswidestname\romannumeral#1}{#2}% + \fi + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgetwidestname} +%\changes{1.05}{2016-06-10}{new} +% Provide a user-level macro to obtain the widest top-level name. +% \begin{macrocode} + \newcommand*{\glsgetwidestname}{\@glswidestname} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgetwidestsubname} +%\changes{1.05}{2016-06-10}{new} +% Provide a user-level macro to obtain the widest sub-entry name. +% \begin{macrocode} + \newcommand*{\glsgetwidestsubname}[1]{% + \ifcsundef{@glswidestname\romannumeral#1}% + {\@glswidestname}% + {\csuse{@glswidestname\romannumeral#1}}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestTopLevelName} +%CamelCase is easier for long command names. Provide a CamelCase +%synonym of \ics{glsfindwidesttoplevelname}. +% \begin{macrocode} + \let\glsFindWidestTopLevelName\glsfindwidesttoplevelname +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestUsedTopLevelName} +%\changes{1.05}{2016-06-10}{new} +% Like \cs{glsfindwidesttoplevelname} but has an additional check +% that the entry has been used. Only useful if the glossaries occur +% at the end of the document, in which case this command should go +% at the start of the glossary. Alternatively, place at the end of +% the document and save for the next run. +% \begin{macrocode} + \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 + }% + }% + {}% + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestUsedAnyName} +%\changes{1.05}{2016-06-10}{new} +% Like the above but doesn't check the parent key. Useful if all +% levels should have the same width for the name. +% \begin{macrocode} + \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 + }% + {}% + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestAnyName} +%\changes{1.05}{2016-06-10}{new} +% Like the above but doesn't check is the entry has been used. +% \begin{macrocode} + \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 + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestUsedLevelTwo} +%\changes{1.05}{2016-06-10}{new} +% This is like \cs{glsFindWidestUsedTopLevelName} but also sets the +% first two sub-levels as well. Any entry that has a +% great-grandparent is ignored. +% \begin{macrocode} + \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 + }% + }% + {}% + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestLevelTwo} +%\changes{1.05}{2016-06-10}{new} +% This is like \cs{glsFindWidestUsedLevelTwo} but doesn't check if the +% entry has been used. +% \begin{macrocode} + \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 + }% + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestUsedAnyNameSymbol} +%\changes{1.05}{2016-06-10}{new} +% Like the \cs{glsFindWidestUsedAnyName} but also measures the +% symbol. The length of the widest symbol is stored in the second argument +% should be a length register. +% \begin{macrocode} + \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 + }% + {}% + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestAnyNameSymbol} +%\changes{1.05}{2016-06-10}{new} +% Like the above but doesn't check if the entry has been used. +% \begin{macrocode} + \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 + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestUsedAnyNameSymbolLocation} +%\changes{1.05}{2016-06-10}{new} +% Like the \cs{glsFindWidestUsedAnyNameSymbol} but also measures the +% location list. This requires \ics{glsentrynumberlist}. +% The length of the widest symbol is stored in the second argument +% should be a length register. The length of the widest location +% list is stored in the third argument, which should also be a +% length register. +% \begin{macrocode} + \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 + }% + {}% + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestAnyNameSymbolLocation} +%\changes{1.05}{2016-06-10}{new} +% Like the \cs{glsFindWidestUsedAnyNameSymbol} but doesn't check if +% the entry has been used. +% \begin{macrocode} + \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 + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestUsedAnyNameLocation} +%\changes{1.05}{2016-06-10}{new} +% Like the \cs{glsFindWidestUsedAnyNameSymbolLocation} but doesn't +% measure the symbol. The length of the widest location +% list is stored in the second argument, which should be a +% length register. +% \begin{macrocode} + \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 + }% + {}% + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsFindWidestAnyNameLocation} +%\changes{1.05}{2016-06-10}{new} +% Like the \cs{glsFindWidestAnyNameLocation} but doesn't +% check the \gls{firstuse} flag. +% \begin{macrocode} + \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 + }% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrComputeTreeIndent} +%\changes{1.05}{2016-06-10}{new} +% Compute the value of \cs{glstreeindent}. Argument is the entry label. +% (Ignored in default definition, but this command may be redefined +% to take the particular entry into account.) Note that the +% sub-levels modify \cs{glstreeindent}. +% \begin{macrocode} + \newcommand*{\glsxtrComputeTreeIndent}[1]{% + \glstreeindent=\glsxtrtreetopindent\relax + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrComputeTreeSubIndent} +%\changes{1.05}{2016-06-10}{new} +%\begin{definition} +%\cs{glsxtrComputeTreeSubIndent}\marg{level}\marg{label}\marg{register} +%\end{definition} +% Compute the indent for the sub-entries. The first argument is the +% level, the second argument is the entry label and the third +% argument is the length register used to store the computed indent. +% \begin{macrocode} + \newcommand*{\glsxtrComputeTreeSubIndent}[3]{% + \ifcsundef{@glswidestname\romannumeral#1}% + {% + \settowidth{#3}{\glstreenamefmt{\@glswidestname\space}}% + }% + {% + \settowidth{#3}{\glstreenamefmt{% + \csname @glswidestname\romannumeral#1\endcsname\space}}% + }% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrAltTreeSetHangIndent} +%\changes{1.05}{2016-06-10}{new} +% Set \cs{hangindent} for top-level entries: +% \begin{macrocode} + \newcommand*{\glsxtrAltTreeSetHangIndent}{\hangindent\glstreeindent} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrAltTreeSetSubHangIndent} +%\changes{1.05}{2016-06-10}{new} +% Set \cs{hangindent} for sub-entries: +% \begin{macrocode} + \newcommand*{\glsxtrAltTreeSetSubHangIndent}[1]{\hangindent\glstreeindent} +% \end{macrocode} +%\end{macro} +% +% Redefine \glostyle{alttree}: +% \begin{macrocode} + \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\glstreegroupskip\fi}% + } +}% +{% +} +% \end{macrocode} +%Redefine \glostyle{alttreegroup} so that it discourages a break +%after group headings. +%\changes{1.21}{2017-11-03}{redefined \texttt{alttreegroup} to discourage +%breaks after group headings} +%Can't use \cs{@afterheading} here as it messes with the first item +%of the group. +% \begin{macrocode} +\ifdef{\@glsstyle@alttreegroup} +{% + \renewglossarystyle{alttreegroup}{% + \setglossarystyle{alttree}% + \renewcommand{\glsgroupheading}[1]{\par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip + }% + }% +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{alttreehypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{alttreehypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@alttreehypergroup} +{% + \renewglossarystyle{alttreehypergroup}{% + \setglossarystyle{alttree}% + \renewcommand*{\glossaryheader}{% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip + }% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip + }% + } +}% +{% +} +% \end{macrocode} +% +%\section{Multicolumn Styles} +%Adjust \glostyle{mcolindexgroup} to discourage page breaks after +%the group headings. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcolindexgroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcolindexgroup} +{% + \renewglossarystyle{mcolindexgroup}{% + \setglossarystyle{mcolindex}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \item\glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip\@afterheading + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcolindexhypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcolindexhypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcolindexhypergroup} +{% + \renewglossarystyle{mcolindexhypergroup}{% + \setglossarystyle{mcolindex}% + \renewcommand*{\glossaryheader}{% + \item\glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip + }% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \item\glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcolindexspannav}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcolindexspannav} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcolindexspannav} +{% + \renewglossarystyle{mcolindexspannav}{% + \setglossarystyle{index}% + \renewenvironment{theglossary}% + {% + \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}]% + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + \let\item\glstreeitem}% + {\end{multicols}}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \item\glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcoltreegroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreegroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcoltreegroup} +{% + \renewglossarystyle{mcoltreegroup}{% + \setglossarystyle{mcoltree}% + \renewcommand{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent\glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip\@afterheading + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcoltreehypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreehypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcoltreehypergroup} +{% + \renewglossarystyle{mcoltreehypergroup}{% + \setglossarystyle{mcoltree}% + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip + }% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcoltreespannav}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreespannav} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcoltreespannav} +{% + \renewglossarystyle{mcoltreespannav}{% + \setglossarystyle{tree}% + \renewenvironment{theglossary}% + {% + \begin{multicols}{\glsmcols}% + [\noindent\glstreenavigationfmt{\glsnavigation}]% + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + }% + {\end{multicols}}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcoltreenonamegroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreenonamegroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcoltreenonamegroup} +{% + \renewglossarystyle{mcoltreenonamegroup}{% + \setglossarystyle{mcoltreenoname}% + \renewcommand{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent\glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip\@afterheading + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcoltreenonamehypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreenonamehypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcoltreenonamehypergroup} +{% + \renewglossarystyle{mcoltreenonamehypergroup}{% + \setglossarystyle{mcoltreenoname}% + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip + }% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading}% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcoltreenonamespannav}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcoltreenonamespannav} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcoltreenonamespannav} +{% + \renewglossarystyle{mcoltreenonamespannav}{% + \setglossarystyle{treenoname}% + \renewenvironment{theglossary}% + {% + \begin{multicols}{\glsmcols}% + [\noindent\glstreenavigationfmt{\glsnavigation}]% + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + }% + {\end{multicols}}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip\@afterheading}% + } +}% +{% +} +% \end{macrocode} +%\glostyle{mcolalttree} needs adjusting so that it uses \cs{glsxtralttreeInit} +%This doesn't use \verb|\mbox{}\par| which would unbalance the top +%of the columns. +%\changes{1.21}{2017-11-03}{adjusted mcolalttree} +% \begin{macrocode} +\ifdef{\@glsstyle@mcolalttree} +{% + \renewglossarystyle{mcolalttree}{% + \setglossarystyle{alttree}% + \renewenvironment{theglossary}% + {% + \glsxtralttreeInit + \def\@gls@prevlevel{-1}% + \begin{multicols}{\glsmcols}% + }% + {\par\end{multicols}}% + } +}% +{% +} +% \end{macrocode} +%Redefine \glostyle{mcolalttreegroup} to discourage page breaks +%after the group headings. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcolalttreegroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcolalttreegroup} +{% + \renewglossarystyle{mcolalttreegroup}{% + \setglossarystyle{mcolalttree}% + \renewcommand{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsxtr@grptitle}% + \glstreegroupskip + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcolalttreehypergroup}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcolalttreehypergroup} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcolalttreehypergroup} +{% + \renewglossarystyle{mcolalttreehypergroup}{% + \setglossarystyle{mcolalttree}% + \renewcommand*{\glossaryheader}{% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreenavigationfmt{\glsnavigation}% + \glstreegroupskip + }% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip + }% + } +}% +{% +} +% \end{macrocode} +%Similarly for \glostyle{mcolalttreespannav}. +%\changes{1.21}{2017-11-03}{redefined \texttt{mcolalttreespannav} to discourage +%breaks after group headings} +% \begin{macrocode} +\ifdef{\@glsstyle@mcolalttreespannav} +{% + \renewglossarystyle{mcolalttreespannav}{% + \setglossarystyle{alttree}% + \renewenvironment{theglossary}% + {% + \glsxtralttreeInit + \def\@gls@prevlevel{-1}% + \begin{multicols}{\glsmcols}% + [\noindent\glstreenavigationfmt{\glsnavigation}]% + }% + {\par\end{multicols}}% + \renewcommand*{\glsgroupheading}[1]{% + \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}% + \glstreePreHeader{##1}{\glsxtr@grptitle}% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsxtr@grptitle}}% + \glstreegroupskip + }% + } +}% +{% +} +% \end{macrocode} +% +% Reset the default style +% \begin{macrocode} +\ifx\@glossary@default@style\relax +\else + \setglossarystyle{\@glsxtr@current@style} +\fi +% \end{macrocode} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-bookindex.sty> +% \end{macrocode} +%\fi +%\chapter{bookindex style (\styfmt{glossary-bookindex.sty})} +%\changes{1.21}{2017-11-03}{new} +%\section{Package Initialisation and Options} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossary-bookindex}[2019/04/09 v1.41 (NLCT)] +% \end{macrocode} +%Load required packages. +% \begin{macrocode} +\RequirePackage{multicol} +\RequirePackage{glossary-tree} +% \end{macrocode} +%\begin{macro}{\glsxtrbookindexcols} +%\changes{1.21}{2017-11-03}{new} +% Number of columns. +% \begin{macrocode} +\newcommand{\glsxtrbookindexcols}{2} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexname} +%\changes{1.21}{2017-11-03}{new} +%Format used for top-level entries. +% (Argument is the label.) +% \begin{macrocode} +\newcommand*{\glsxtrbookindexname}[1]{\glossentryname{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexsubname} +%\changes{1.21}{2017-11-03}{new} +%Format used for sub entries. +% \begin{macrocode} +\newcommand*{\glsxtrbookindexsubname}[1]{\glsxtrbookindexname{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrprelocation} +%\changes{1.21}{2017-11-03}{new} +%Provide in case \sty{glossaries-stylemods} isn't loaded. +% \begin{macrocode} +\providecommand*{\glsxtrprelocation}{\space} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\glsxtrbookindexprelocation} +%\changes{1.21}{2017-11-03}{new} +%Separator used before location list for top-level entries. +%Version 1.22 has removed the \cs{ifglsnopostdot} check +%since this style doesn't display the description. +%\changes{1.22}{2017-11-08}{removed check for no post dot} +% \begin{macrocode} +\newcommand*{\glsxtrbookindexprelocation}[1]{% + \glsxtrifhasfield{location}{#1}% + {,\glsxtrprelocation}% + {\glsxtrprelocation}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexsubprelocation} +%\changes{1.21}{2017-11-03}{new} +%Separator used before location list for sub-entries. +% \begin{macrocode} +\newcommand*{\glsxtrbookindexsubprelocation}[1]{% + \glsxtrbookindexprelocation{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexlocation} +%\changes{1.39}{2019-03-22}{new} +%\begin{definition} +%\cs{glsxtrbookindexlocation}\marg{label}\marg{location} +%\end{definition} +%Displays the location. +% \begin{macrocode} +\newcommand*{\glsxtrbookindexlocation}[2]{#2} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexsublocation} +%\changes{1.39}{2019-03-22}{new} +%\begin{definition} +%\cs{glsxtrbookindexlocation}\marg{label}\marg{location} +%\end{definition} +%Displays the location for sub-entries. +% \begin{macrocode} +\newcommand*{\glsxtrbookindexsublocation}{\glsxtrbookindexlocation} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexparentchildsep} +%\changes{1.21}{2017-11-03}{new} +%Separator used between top-level parent and child entry. +% \begin{macrocode} +\newcommand{\glsxtrbookindexparentchildsep}{\nopagebreak} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexparentsubchildsep} +%\changes{1.21}{2017-11-03}{new} +%Separator used between sub-level parent and child entry. +% \begin{macrocode} +\newcommand{\glsxtrbookindexparentsubchildsep}{\glsxtrbookindexparentchildsep} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexbetween} +%\changes{1.21}{2017-11-03}{new} +%Between two top-level entries identified by the labels in the +%arguments. +% \begin{macrocode} +\newcommand{\glsxtrbookindexbetween}[2]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexsubbetween} +%\changes{1.21}{2017-11-03}{new} +%Between two level~1 entries identified by the labels in the +%arguments. +% \begin{macrocode} +\newcommand{\glsxtrbookindexsubbetween}[2]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexsubsubbetween} +%\changes{1.21}{2017-11-03}{new} +%Between two level~2 entries identified by the labels in the +%arguments. +% \begin{macrocode} +\newcommand{\glsxtrbookindexsubsubbetween}[2]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexatendgroup} +%\changes{1.21}{2017-11-03}{new} +%At the end of a letter group. The argument is the index of the last +%top-level entry. +% \begin{macrocode} +\newcommand{\glsxtrbookindexatendgroup}[1]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexsubatendgroup} +%\changes{1.21}{2017-11-03}{new} +%At the end of a letter group. The argument is the index of the last +%level~1 entry. +% \begin{macrocode} +\newcommand{\glsxtrbookindexsubatendgroup}[1]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexsubsubatendgroup} +%\changes{1.21}{2017-11-03}{new} +%At the end of a letter group. The argument is the index of the last +%level~2 entry. +% \begin{macrocode} +\newcommand{\glsxtrbookindexsubsubatendgroup}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexgroupskip} +%\changes{1.21}{2017-11-03}{new} +%Group separator. +% \begin{macrocode} +\newcommand{\glsxtrbookindexgroupskip}{\ifglsnogroupskip\else\indexspace\fi} +% \end{macrocode} +%\end{macro} +% +%Format group title. +%\begin{macro}{\glsxtrbookindexformatheader} +%\changes{1.21}{2017-11-03}{new} +%Group separator. +% \begin{macrocode} +\newcommand*{\glsxtrbookindexformatheader}[1]{% + \par{\centering\glstreegroupheaderfmt{#1}\par}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexbookmark} +%\changes{1.21}{2017-11-03}{new} +%Book mark group heading if supported. +% \begin{macrocode} +\ifdef\pdfbookmark +{% + \newcommand*{\glsxtrbookindexbookmark}[2]{% + \ifdefstring{\@@glossarysec}{chapter}% + {\pdfbookmark[1]{#1}{#2}}% + {\pdfbookmark[2]{#1}{#2}}% + } +} +{% + \newcommand*{\glsxtrbookindexbookmark}[2]{} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexcolspread} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrbookindexcolspread}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexmulticolsenv} +%\changes{1.25}{2017-11-14}{new} +% \begin{macrocode} +\newcommand*{\glsxtrbookindexmulticolsenv}{multicols} +% \end{macrocode} +%\end{macro} +% +%Define the style. +% \begin{macrocode} +\newglossarystyle{bookindex}{% + \setglossarystyle{index}% + \renewenvironment{theglossary}% + {% + \ifnum\glsxtrbookindexcols>1\relax + \ifdefempty\glsxtrbookindexcolspread + {% + \edef\glsxtr@beginbookindex{% + \noexpand\begin{\glsxtrbookindexmulticolsenv} + {\glsxtrbookindexcols}% + }% + }% + {% + \edef\glsxtr@beginbookindex{% + \noexpand\begin{\glsxtrbookindexmulticolsenv}% + {\glsxtrbookindexcols}[\glsxtrbookindexcolspread]% + }% + }% + \else + \def\glsxtr@beginbookindex{}% + \fi + \glsxtr@beginbookindex + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + \let\@glsxtr@bookindex@sep\glsxtrbookindexparentchildsep + \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep + \let\@glsxtr@bookindex@between\@gobble + \let\@glsxtr@bookindex@subbetween\@gobble + \let\@glsxtr@bookindex@subsubbetween\@gobble + \let\@glsxtr@bookindex@atendgroup\relax + \let\@glsxtr@bookindex@subatendgroup\relax + \let\@glsxtr@bookindex@subsubatendgroup\relax + \let\@glsxtr@bookindexgroupskip\relax + }% + {% +% \end{macrocode} +% Do end group hooks. +% \begin{macrocode} + \@glsxtr@bookindex@subsubatendgroup + \@glsxtr@bookindex@subatendgroup + \@glsxtr@bookindex@atendgroup +% \end{macrocode} +%End \env{multicols} environment. +% \begin{macrocode} + \ifnum\glsxtrbookindexcols>1\relax + \edef\glsxtr@endbookindex{% + \noexpand\end{\glsxtrbookindexmulticolsenv}% + }% + \else + \def\glsxtr@endbookindex{}% + \fi + \glsxtr@endbookindex + }% +% \end{macrocode} +%Use ragged right as columns are likely to be narrow and +%indexes tend not to be fully justified. +% \begin{macrocode} + \renewcommand*{\glossaryheader}{\raggedright}% +% \end{macrocode} +%Top level entry format. +% \begin{macrocode} + \renewcommand*{\glossentry}[2]{% +% \end{macrocode} +%Do separator. +% \begin{macrocode} + \@glsxtr@bookindex@between{##1}% +% \end{macrocode} +%Update separators. +% \begin{macrocode} + \let\@glsxtr@bookindex@sep\glsxtrbookindexparentchildsep + \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep + \let\@glsxtr@bookindex@subbetween\@gobble + \let\@glsxtr@bookindex@subsubbetween\@gobble + \edef\@glsxtr@bookindex@between{% + \noexpand\glsxtrbookindexbetween{##1}% + }% + \edef\@glsxtr@bookindex@atendgroup{% + \noexpand\glsxtrbookindexatendgroup{##1}% + }% + \let\@glsxtr@bookindex@subatendgroup\relax + \let\@glsxtr@bookindex@subsubatendgroup\relax +% \end{macrocode} +%Format entry. +% \begin{macrocode} + \glstreeitem + \glsentryitem{##1}% + \glstarget{##1}{\glsxtrbookindexname{##1}}% + \glsxtrbookindexprelocation{##1}% + \glsxtrbookindexlocation{##1}{##2}% + }% + \renewcommand{\subglossentry}[3]{% + \ifcase##1\relax +% \end{macrocode} +% Level 0 (shouldn't happen as that's formatted with \cs{glossentry}). +% \begin{macrocode} + \glstreeitem + \or +% \end{macrocode} +% Level 1. +% \begin{macrocode} + \@glsxtr@bookindex@sep + \@glsxtr@bookindex@subbetween{##2}% + \let\@glsxtr@bookindex@sep\relax +% \end{macrocode} +% Update separators. +% \begin{macrocode} + \let\@glsxtr@bookindex@subsubbetween\@gobble + \let\@glsxtr@bookindex@subsep\glsxtrbookindexparentsubchildsep + \edef\@glsxtr@bookindex@subbetween{% + \noexpand\glsxtrbookindexsubbetween{##2}% + }% + \edef\@glsxtr@bookindex@atsubendgroup{% + \noexpand\glsxtrbookindexatsubendgroup{##1}% + }% +% \end{macrocode} +% Start sub-item. +% \begin{macrocode} + \glstreesubitem + \glssubentryitem{##2}% + \else +% \end{macrocode} +% All other levels. +% \begin{macrocode} + \@glsxtr@bookindex@subsep + \@glsxtr@bookindex@subsubbetween{##2}% +% \end{macrocode} +% Update separators. +% \begin{macrocode} + \let\@glsxtr@bookindex@subsep\relax + \edef\@glsxtr@bookindex@subsubbetween{% + \noexpand\glsxtrbookindexsubsubbetween{##2}% + }% + \edef\@glsxtr@bookindex@atsubsubendgroup{% + \noexpand\glsxtrbookindexatsubsubendgroup{##1}% + }% +% \end{macrocode} +% Start sub-sub-item. +% \begin{macrocode} + \glstreesubsubitem + \fi +% \end{macrocode} +% Format entry. +% \begin{macrocode} + \glstarget{##2}{\glsxtrbookindexsubname{##2}}% + \glsxtrbookindexsubprelocation{##2}% + \glsxtrbookindexsublocation{##2}{##3}% + }% +% \end{macrocode} +% The group skip is moved to the group heading to avoid interfering +% with the end letter group hooks. +% \begin{macrocode} + \renewcommand*{\glsgroupskip}{}% +% \end{macrocode} +% Group heading format. +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% +% \end{macrocode} +% Do end group hooks. +% \begin{macrocode} + \@glsxtr@bookindex@subsubatendgroup + \@glsxtr@bookindex@subatendgroup + \@glsxtr@bookindex@atendgroup + \@glsxtr@bookindexgroupskip +% \end{macrocode} +% Update separators. +% \begin{macrocode} + \let\@glsxtr@bookindexgroupskip\glsxtrbookindexgroupskip + \let\@glsxtr@bookindex@between\@gobble + \let\@glsxtr@bookindex@atendgroup\relax + \let\@glsxtr@bookindex@subatendgroup\relax + \let\@glsxtr@bookindex@subsubatendgroup\relax +% \end{macrocode} +% Fetch the group title from the label supplied in \verb|#1|. +%\changes{1.41}{2019-04-09}{changed \cs{thisgrptitle} to +%\cs{glsxtrcurrentgrptitle}}% +% \begin{macrocode} + \glsxtrgetgrouptitle{##1}{\glsxtrcurrentgrptitle}% +% \end{macrocode} +% Do the PDF bookmark if supported. +% \begin{macrocode} + \glsxtrbookindexbookmark{\glsxtrcurrentgrptitle}{index.##1}% +% \end{macrocode} +% Format the group title. +% \begin{macrocode} + \glsxtrbookindexformatheader{\glsxtrcurrentgrptitle}% + \nopagebreak\indexspace\nopagebreak\@afterheading + }% +} +% \end{macrocode} +% Some supplementary commands that may be useful. +% These store the entry label for the current page. Since the page +% number is needed in the control sequence, this uses +% \cs{glsxtrbookindexthepage} instead of \cs{thepage} in case +% the page numbering has been set to something that contains +% formatting commands. +%\begin{macro}{\glsxtrbookindexthepage} +%\changes{1.21}{2017-11-03}{new} +%The \cs{@printglossary} sets \cs{currentglossary} to the current +%glossary label. This is used as a prefix in case the page number is +%reset. +% \begin{macrocode} +\newcommand{\glsxtrbookindexthepage}{% + \ifdef\currentglossary{\currentglossary.\arabic{page}}{\arabic{page}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexmarkentry} +%\changes{1.21}{2017-11-03}{new} +%Writes entry information to the \texttt{.aux} file. The argument is +%the entry label. +% \begin{macrocode} +\newcommand*{\glsxtrbookindexmarkentry}[1]{% + \protected@write\@auxout + {\let\glsxtrbookindexthepage\relax}% + {\string\glsxtr@setbookindexmark{\glsxtrbookindexthepage}{#1}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtr@setbookindexmark} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtr@setbookindexmark}[2]{% + \ifcsundef{glsxtr@idxfirstmark@#1}% + {\csgdef{glsxtr@idxfirstmark@#1}{#2}}% + {}% + \csgdef{glsxtr@idxlastmark@#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexfirstmarkfmt} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrbookindexfirstmarkfmt}[1]{% + \glsentryname{#1}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexfirstmark} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrbookindexfirstmark}{% + \letcs{\glsxtr@label}{glsxtr@idxfirstmark@\glsxtrbookindexthepage}% + \ifdef\glsxtr@label + {\glsxtrbookindexfirstmarkfmt{\glsxtr@label}}% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrbookindexlastmarkfmt} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrbookindexlastmarkfmt}[1]{% + \glsentryname{#1}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrbookindexlastmark} +%\changes{1.21}{2017-11-03}{new} +% \begin{macrocode} +\newcommand*{\glsxtrbookindexlastmark}{% + \letcs{\glsxtr@label}{glsxtr@idxlastmark@\glsxtrbookindexthepage}% + \ifdef\glsxtr@label + {\glsxtrbookindexlastmarkfmt{\glsxtr@label}}% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-longextra.sty> +% \end{macrocode} +%\fi +%\chapter{longextra styles (\styfmt{glossary-longextra.sty})} +%\changes{1.37}{2018-11-30}{new} +%\section{Package Initialisation and Options} +%Provides additional long styles. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossary-longextra}[2019/04/09 v1.41 (NLCT)] +% \end{macrocode} +%Load required packages. +% \begin{macrocode} +\RequirePackage{glossary-longbooktabs} +% \end{macrocode} +% +%\begin{macro}{\glslongextraNameFmt} +%\changes{1.37}{2018-11-30}{new} +%\changes{1.38}{2018-12-01}{bug fix: removed double param} +%\begin{definition} +%\cs{glslongextraNameFmt}\marg{label} +%\end{definition} +%Governs the way the name is displayed. +% \begin{macrocode} +\newcommand{\glslongextraNameFmt}[1]{% + \glsentryitem{#1}\glstarget{#1}{\glossentryname{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraDescFmt} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraDescFmt}\marg{label} +%\end{definition} +%Governs the way the description is displayed. +% \begin{macrocode} +\newcommand{\glslongextraDescFmt}[1]{% + \glossentrydesc{#1}\glspostdescription +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSymbolFmt} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraSymbolFmt}\marg{label} +%\end{definition} +%Governs the way the symbol is displayed. +% \begin{macrocode} +\newcommand{\glslongextraSymbolFmt}[1]{\glossentrysymbol{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationFmt} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraLocationFmt}\marg{label}\marg{location list} +%\end{definition} +%Governs the way the location is displayed. +% \begin{macrocode} +\newcommand{\glslongextraLocationFmt}[2]{#2} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSubNameFmt} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraSubNameFmt}\marg{level}\marg{label} +%\end{definition} +%Governs the way the child name is displayed. Just does the +%sub-entry counter, if enabled, and the target. +% \begin{macrocode} +\newcommand{\glslongextraSubNameFmt}[2]{% + \glssubentryitem{#2}\glstarget{#2}{\strut}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSubDescFmt} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraSubDescFmt}\marg{level}\marg{label} +%\end{definition} +%Governs the way the child description is displayed. +% \begin{macrocode} +\newcommand{\glslongextraSubDescFmt}[2]{% + \glslongextraDescFmt{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSubSymbolFmt} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraSubSymbolFmt}\marg{level}\marg{label} +%\end{definition} +%Governs the way the child symbol is displayed. +% \begin{macrocode} +\newcommand{\glslongextraSubSymbolFmt}[2]{% + \glslongextraSymbolFmt{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSubLocationFmt} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraSubLocationFmt}\marg{level}\marg{label}\marg{location list} +%\end{definition} +%Governs the way the child location list is displayed. +% \begin{macrocode} +\newcommand{\glslongextraSubLocationFmt}[3]{#3} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameAlign} +%\changes{1.37}{2018-11-30}{new} +%Alignment for the name column. +% \begin{macrocode} +\newcommand{\glslongextraNameAlign}{l} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraDescAlign} +%\changes{1.37}{2018-11-30}{new} +%Alignment for the description column. +% \begin{macrocode} +\newcommand{\glslongextraDescAlign}{>{\raggedright}p{\glsdescwidth}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSymbolAlign} +%\changes{1.37}{2018-11-30}{new} +%Alignment for the symbol column. +% \begin{macrocode} +\newcommand{\glslongextraSymbolAlign}{c} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationAlign} +%\changes{1.37}{2018-11-30}{new} +%Alignment for the location column. +% \begin{macrocode} +\newcommand{\glslongextraLocationAlign}{>{\raggedright}p{\glspagelistwidth}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraGroupHeading} +%\changes{1.37}{2018-11-30}{new} +%Used to format the letter group headings. The first argument is the +%number of columns in the table. The second is the group +%\emph{label} (not the title). +% \begin{macrocode} +\newcommand{\glslongextraGroupHeading}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraHeaderFormat} +%\changes{1.37}{2018-11-30}{new} +%Format for the column headers. +% \begin{macrocode} +\newcommand{\glslongextraHeaderFmt}[1]{\textbf{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescHeader}{% + \glslongextraNameDescTabularHeader\endhead + \glslongextraNameDescTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescTabularHeader}{% + \toprule + \glslongextraHeaderFmt\entryname & + \glslongextraHeaderFmt\descriptionname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%Unlike the \glostyle{alttree} style, there aren't different widths +%for the hierarchical levels. +%\begin{macro}{\glslongextraSetWidest} +%\changes{1.37}{2018-11-30}{new} +%Provide in case the tree styles haven't been loaded. +% \begin{macrocode} +\newcommand*{\glslongextraSetWidest}[1]{% + \def\@glslongextrawidestname{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslongextrawidestname} +%\changes{1.37}{2018-11-30}{new} +%Pick up the widest name from the \glostyle{alttree} style if it has +%been set. (Will expand to nothing otherwise.) +% \begin{macrocode} +\newcommand*{\@glslongextrawidestname}{\csuse{@glswidestname}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraUpdateWidest} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand*{\glslongextraUpdateWidest}[1]{% + \ifundef\@glslongextrawidestname + {\def\@glslongextrawidestname{#1}}% + {% + \settowidth{\dimen@}{\@glslongextrawidestname}% + \settowidth{\dimen@ii}{#1}% + \ifdim\dimen@ii>\dimen@ + \def\@glslongextrawidestname{#1}% + \fi + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraUpdateWidestChild} +%\changes{1.37}{2018-11-30}{new} +%\begin{definition} +%\cs{glslongextraUpdateWidestChild}\marg{level}\marg{text} +%\end{definition} +%Used by \cs{glsxtrSetWidest} in \sty{glossaries-extra-bib2gls}. +%Does nothing by default, since the default action in these styles +%is to omit the child name. If the child name should be displayed, +%then this needs to be redefined to use +%\cs{glslongextraUpdateWidest}. +% \begin{macrocode} +\newcommand*{\glslongextraUpdateWidestChild}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSetDescWidth} +%\changes{1.37}{2018-11-30}{new} +% Computes the value of \cs{glsdescwidth} for the styles that only +% have name and description columns. +% \begin{macrocode} +\newcommand{\glslongextraSetDescWidth}{% + \settowidth{\gls@tmplen}{\glslongextraHeaderFmt\entryname}% +% \end{macrocode} +% Has the widest name been set. +% \begin{macrocode} + \settowidth{\dimen@}{\glsnamefont{\@glslongextrawidestname}}% + \ifdim\dimen@>\gls@tmplen + \gls@tmplen=\dimen@ + \fi +% \end{macrocode} +% Description width is \cs{linewidth} less 4\cs{tabcolsep} less the +% width of the name column. +% \begin{macrocode} + \setlength{\glsdescwidth}{\dimexpr\linewidth-4\tabcolsep-\gls@tmplen}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSymSetDescWidth} +%\changes{1.37}{2018-11-30}{new} +% Computes the value of \cs{glsdescwidth} for the styles that only +% have name, symbol and description columns. +% \begin{macrocode} +\newcommand{\glslongextraSymSetDescWidth}{% +% \end{macrocode} +% Work out the size for just the name and description style. +% \begin{macrocode} + \glslongextraSetDescWidth +% \end{macrocode} +% Now work out the symbol column width. This is assuming that the +% column title will be the widest text in the column. +% \begin{macrocode} + \settowidth{\gls@tmplen}{\glslongextraHeaderFmt\symbolname}% +% \end{macrocode} +% Subtract 2\cs{tabcolsep} and the symbol header width. +% \begin{macrocode} + \setlength{\glsdescwidth}{\dimexpr\glsdescwidth-2\tabcolsep-\gls@tmplen}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocSetDescWidth} +%\changes{1.37}{2018-11-30}{new} +% Computes the value of \cs{glsdescwidth} for the styles that only +% have name, location and description columns. +% \begin{macrocode} +\newcommand{\glslongextraLocSetDescWidth}{% +% \end{macrocode} +% Work out the size for just the name and description style. +% \begin{macrocode} + \glslongextraSetDescWidth +% \end{macrocode} +% Subtract 2\cs{tabcolsep} and the location list column width. +% \begin{macrocode} + \setlength{\glsdescwidth}{\dimexpr\glsdescwidth-2\tabcolsep-\glspagelistwidth}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSymLocSetDescWidth} +%\changes{1.37}{2018-11-30}{new} +% Computes the value of \cs{glsdescwidth} for the styles that +% have name, symbol, location and description columns. +% \begin{macrocode} +\newcommand{\glslongextraSymLocSetDescWidth}{% +% \end{macrocode} +% Work out the size for just the name, symbol and description style. +% \begin{macrocode} + \glslongextraSymSetDescWidth +% \end{macrocode} +% Subtract 2\cs{tabcolsep} and the location list column width. +% \begin{macrocode} + \setlength{\glsdescwidth}{\dimexpr\glsdescwidth-2\tabcolsep-\glspagelistwidth}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifGlsLongExtraUseTabular} +%\changes{1.37}{2018-11-30}{new} +%If true use \env{tabular} instead of \env{longtable}. Obviously +%only intended for short glossaries that can fit into a single page. +% \begin{macrocode} +\newif\ifGlsLongExtraUseTabular +\GlsLongExtraUseTabularfalse +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraTabularVAlign} +%\changes{1.37}{2018-11-30}{new} +%Only used with the \env{tabular} setting. +% \begin{macrocode} +\newcommand*{\glslongextraTabularVAlign}{c} +% \end{macrocode} +%\end{macro} +%\begin{abbrvstyle}{long-name-desc} +%\changes{1.37}{2018-11-30}{new} +%Two column style with multi-lined descriptions and header. +%This is similar to the \glostyle{longragged-booktabs} style. +% \begin{macrocode} +\newglossarystyle{long-name-desc}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign}}% + \@glslongextra@begintab + }% + {% + \glslongextraNameDescTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraNameDescTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign}}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraNameDescHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{2}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraNameFmt{##1} & + \glslongextraDescFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubNameFmt{##1}{##2} + & + \glslongextraSubDescFmt{##1}{##2}% + \tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraNameDescLocationHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescLocationHeader}{% + \glslongextraNameDescLocationTabularHeader\endhead + \glslongextraNameDescLocationTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescLocationTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescLocationTabularHeader}{% + \toprule + \glslongextraHeaderFmt\entryname & + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\pagelistname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescLocationTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescLocationTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-name-desc-loc} +%\changes{1.37}{2018-11-30}{new} +%Three columns: name, description and location list. +% \begin{macrocode} +\newglossarystyle{long-name-desc-loc}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraLocationAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraNameDescLocationTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraNameDescLocationTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraLocationAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraNameDescLocationHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{3}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraNameFmt{##1} & + \glslongextraDescFmt{##1} & + \glslongextraLocationFmt{##1}{##2}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubNameFmt{##1}{##2}& + \glslongextraSubDescFmt{##1}{##2}& + \glslongextraSubLocationFmt{##1}{##2}{##3}% + \tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraDescNameHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraDescNameHeader}{% + \glslongextraDescNameTabularHeader\endhead + \glslongextraDescNameTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraDescNameTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraDescNameTabularHeader}{% + \toprule + \glslongextraHeaderFmt\descriptionname& + \glslongextraHeaderFmt\entryname \tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraDescNameTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraDescNameTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-desc-name} +%\changes{1.37}{2018-11-30}{new} +%Like \glostyle{name-desc} but swaps the columns. +% \begin{macrocode} +\newglossarystyle{long-desc-name}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign}}% + \@glslongextra@begintab + }% + {% + \glslongextraDescNameTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraDescNameTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign}}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraDescNameHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{2}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraDescFmt{##1} & + \glslongextraNameFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubNameFmt{##1}{##2}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraLocationDescNameHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationDescNameHeader}{% + \glslongextraLocationDescNameTabularHeader\endhead + \glslongextraLocationDescNameTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationDescNameTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationDescNameTabularHeader}{% + \toprule + \glslongextraHeaderFmt\pagelistname& + \glslongextraHeaderFmt\descriptionname& + \glslongextraHeaderFmt\entryname \tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationDescNameTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationDescNameTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-loc-desc-name} +%\changes{1.37}{2018-11-30}{new} +%Three columns: location, description and name. +% \begin{macrocode} +\newglossarystyle{long-loc-desc-name}% +{% + \ifGlsLongExtraUseTabular + {% + \glslongextraLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraLocationAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign}}% + \@glslongextra@begintab + }% + {% + \glslongextraLocationDescNameTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraLocationDescNameTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraLocationAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign}}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraLocationDescNameHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{3}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraLocationFmt{##1}{##2} & + \glslongextraDescFmt{##1} & + \glslongextraNameFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubLocationFmt{##1}{##2}{##3} & + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubNameFmt{##1}{##2}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraNameDescSymHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescSymHeader}{% + \glslongextraNameDescSymTabularHeader\endhead + \glslongextraNameDescSymTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescSymTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescSymTabularHeader}{% + \toprule + \glslongextraHeaderFmt\entryname & + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\symbolname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescSymTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescSymTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-name-desc-sym} +%\changes{1.37}{2018-11-30}{new} +%Three column style with symbol in the third column. +% \begin{macrocode} +\newglossarystyle{long-name-desc-sym}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraNameDescSymTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraNameDescSymTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraNameDescSymHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{3}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraNameFmt{##1} & + \glslongextraDescFmt{##1} & + \glslongextraSymbolFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubNameFmt{##1}{##2} & + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubSymbolFmt{##1}{##2}% + \tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraNameDescSymLocationHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescSymLocationHeader}{% + \glslongextraNameDescSymLocationTabularHeader\endhead + \glslongextraNameDescSymLocationTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescSymLocationTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescSymLocationTabularHeader}{% + \toprule + \glslongextraHeaderFmt\entryname & + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\symbolname & + \glslongextraHeaderFmt\pagelistname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameDescSymLocationTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameDescSymLocationTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-name-desc-sym-loc} +%\changes{1.37}{2018-11-30}{new} +%Four columns: name, description and location +% \begin{macrocode} +\newglossarystyle{long-name-desc-sym-loc}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraLocationAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraNameDescSymLocationTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraNameDescSymLocationTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraLocationAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraNameDescSymLocationHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{4}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraNameFmt{##1} & + \glslongextraDescFmt{##1} & + \glslongextraSymbolFmt{##1}& + \glslongextraLocationFmt{##1}{##2}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubNameFmt{##1}{##2} & + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubSymbolFmt{##1}{##2}& + \glslongextraSubLocationFmt{##1}{##2}{##3}% + \tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraNameSymDescHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameSymDescHeader}{% + \glslongextraNameSymDescTabularHeader\endhead + \glslongextraNameSymDescTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameSymDescTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameSymDescTabularHeader}{% + \toprule + \glslongextraHeaderFmt\entryname & + \glslongextraHeaderFmt\symbolname & + \glslongextraHeaderFmt\descriptionname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameSymDescTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameSymDescTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-name-sym-desc} +%\changes{1.37}{2018-11-30}{new} +%Three column style with symbol in the second column. +% \begin{macrocode} +\newglossarystyle{long-name-sym-desc}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraNameSymDescTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraNameSymDescTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraNameSymDescHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{3}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraNameFmt{##1} & + \glslongextraSymbolFmt{##1} & + \glslongextraDescFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubNameFmt{##1}{##2} & + \glslongextraSubSymbolFmt{##1}{##2} & + \glslongextraSubDescFmt{##1}{##2}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraNameSymDescLocationHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameSymDescLocationHeader}{% + \glslongextraNameSymDescLocationTabularHeader\endhead + \glslongextraNameSymDescLocationTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameSymDescLocationTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameSymDescLocationTabularHeader}{% + \toprule + \glslongextraHeaderFmt\entryname & + \glslongextraHeaderFmt\symbolname & + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\pagelistname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraNameSymDescLocationTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraNameSymDescLocationTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-name-sym-desc-loc} +%\changes{1.37}{2018-11-30}{new} +%Four column style with symbol in the second column. +% \begin{macrocode} +\newglossarystyle{long-name-sym-desc-loc}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraLocationAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraNameSymDescLocationTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraNameSymDescLocationTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraNameAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraLocationAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraNameSymDescLocationHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{4}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraNameFmt{##1} & + \glslongextraSymbolFmt{##1} & + \glslongextraDescFmt{##1} & + \glslongextraLocationFmt{##1}{##2}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubNameFmt{##1}{##2} & + \glslongextraSubSymbolFmt{##1}{##2} & + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubLocationFmt{##1}{##2}{##3}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraSymDescNameHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraSymDescNameHeader}{% + \glslongextraSymDescNameTabularHeader\endhead + \glslongextraSymDescNameTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSymDescNameTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraSymDescNameTabularHeader}{% + \toprule + \glslongextraHeaderFmt\symbolname & + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\entryname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraSymDescNameTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraSymDescNameTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-sym-desc-name} +%\changes{1.37}{2018-11-30}{new} +%Three column style with symbol in the first column, description in +%the second and name in the third. +% \begin{macrocode} +\newglossarystyle{long-sym-desc-name}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraSymDescNameTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraSymDescNameTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraSymDescNameHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{3}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraSymbolFmt{##1} & + \glslongextraDescFmt{##1} & + \glslongextraNameFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubSymbolFmt{##1}{##2} & + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubNameFmt{##1}{##2}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraLocationSymDescNameHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationSymDescNameHeader}{% + \glslongextraLocationSymDescNameTabularHeader\endhead + \glslongextraLocationSymDescNameTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationSymDescNameTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationSymDescNameTabularHeader}{% + \toprule + \glslongextraHeaderFmt\pagelistname & + \glslongextraHeaderFmt\symbolname & + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\entryname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationSymDescNameTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationSymDescNameTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-loc-sym-desc-name} +%\changes{1.37}{2018-11-30}{new} +%Four column style with location list, symbol, description and name. +% \begin{macrocode} +\newglossarystyle{long-loc-sym-desc-name}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraLocationAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraLocationSymDescNameTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraLocationSymDescNameTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraLocationAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraLocationSymDescNameHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{4}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraLocationFmt{##1}{##2} & + \glslongextraSymbolFmt{##1} & + \glslongextraDescFmt{##1} & + \glslongextraNameFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubLocationFmt{##1}{##2}{##3} & + \glslongextraSubSymbolFmt{##1}{##2} & + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubNameFmt{##1}{##2}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraDescSymNameHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraDescSymNameHeader}{% + \glslongextraDescSymNameTabularHeader\endhead + \glslongextraDescSymNameTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraDescSymNameTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraDescSymNameTabularHeader}{% + \toprule + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\symbolname & + \glslongextraHeaderFmt\entryname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraDescSymNameTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraDescSymNameTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-desc-sym-name} +%\changes{1.37}{2018-11-30}{new} +%Three column style with description in the first column, symbol in +%the second and name in the third. +% \begin{macrocode} +\newglossarystyle{long-desc-sym-name}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraDescSymNameTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraDescSymNameTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraDescSymNameHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{3}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraDescFmt{##1} & + \glslongextraSymbolFmt{##1} & + \glslongextraNameFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubSymbolFmt{##1}{##2} & + \glslongextraSubNameFmt{##1}{##2}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{macro}{\glslongextraLocationDescSymNameHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationDescSymNameHeader}{% + \glslongextraLocationDescSymNameTabularHeader\endhead + \glslongextraLocationDescSymNameTabularFooter\endfoot +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationDescSymNameTabularHeader} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationDescSymNameTabularHeader}{% + \toprule + \glslongextraHeaderFmt\pagelistname & + \glslongextraHeaderFmt\descriptionname & + \glslongextraHeaderFmt\symbolname & + \glslongextraHeaderFmt\entryname\tabularnewline + \midrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongextraLocationDescSymNameTabularFooter} +%\changes{1.37}{2018-11-30}{new} +% \begin{macrocode} +\newcommand{\glslongextraLocationDescSymNameTabularFooter}{% + \bottomrule +} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-loc-desc-sym-name} +%\changes{1.37}{2018-11-30}{new} +%Four column style with location list, description, symbol and name. +% \begin{macrocode} +\newglossarystyle{long-loc-desc-sym-name}% +{% + \ifGlsLongExtraUseTabular + \renewenvironment{theglossary}% + {% + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{tabular}[\glslongextraTabularVAlign]{% + \expandonce\glslongextraLocationAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {% + \glslongextraLocationDescSymNameTabularFooter + \end{tabular}% + }% + \renewcommand*{\glossaryheader}{\glslongextraLocationDescSymNameTabularHeader}% + \else + \renewenvironment{theglossary}% + {% + \glspatchLToutput + \glslongextraSymLocSetDescWidth + \edef\@glslongextra@begintab{% + \noexpand\begin{longtable}{% + \expandonce\glslongextraLocationAlign + \expandonce\glslongextraDescAlign + \expandonce\glslongextraSymbolAlign + \expandonce\glslongextraNameAlign + }}% + \@glslongextra@begintab + }% + {\end{longtable}}% + \renewcommand*{\glossaryheader}{\glslongextraLocationDescSymNameHeader}% + \fi + \renewcommand*{\glsgroupheading}[1]{\glslongextraGroupHeading{4}{##1}}% + \renewcommand{\glossentry}[2]{% + \glslongextraLocationFmt{##1}{##2} & + \glslongextraDescFmt{##1} & + \glslongextraSymbolFmt{##1} & + \glslongextraNameFmt{##1}\tabularnewline + }% + \renewcommand{\subglossentry}[3]{% + \glslongextraSubLocationFmt{##1}{##2}{##3} & + \glslongextraSubDescFmt{##1}{##2} & + \glslongextraSubSymbolFmt{##1}{##2} & + \glslongextraSubNameFmt{##1}{##2}\tabularnewline + }% + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-topic.sty> +% \end{macrocode} +%\fi +%\chapter{topic styles (\styfmt{glossary-topic.sty})} +%\changes{1.40}{2019-03-22}{new} +%\section{Package Initialisation and Options} +%Provides \qt{topic} styles where top-level entries are considered a +%topic. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossary-topic}[2019/04/09 v1.41 (NLCT)] +% \end{macrocode} +%Load required package. +% \begin{macrocode} +\RequirePackage{multicol} +% \end{macrocode} +%The top-level entries act like headers. If the top-level entry has a +%description it's placed below the name. +%\begin{style}{topic} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newglossarystyle{topic}{% + \renewenvironment{theglossary}% + {% + \glstopicInit + \def\glstopic@prechildren{}% + \def\glstopic@prevlevel{-1}% + }% + {\par}% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{% + \def\glstopic@prevlevel{-1}% + \glstopicGroupHeading{##1}% + }% + \renewcommand{\glossentry}[2]{% + \hangindent0pt\relax + \parindent\glstopicParIndent\relax + \glstopicItem{##1}{##2}% +% \end{macrocode} +%\changes{1.41}{2019-04-09}{added penalty if no description} +%If there isn't a description, penalise a page break. +% \begin{macrocode} + \ifglshasdesc{##1}% + {% + \def\glstopic@prechildren{}% + }% + {% + \def\glstopic@prechildren{\nopagebreak}% + }% + }% + \renewcommand{\subglossentry}[3]{% + \ifnum\glstopic@prevlevel=0\relax\glstopic@prechildren\fi + \def\glstopic@prevlevel{##1}% + \glstopicAssignSubIndent{##1}% + \glstopicSubItem{##1}{##2}{##3}% + }% + \renewcommand*{\glsgroupskip}{}% +} +% \end{macrocode} +%\end{style} +%\begin{macro}{\glstopicGroupHeading} +%\changes{1.40}{2019-03-22}{new} +%\begin{definition} +%\cs{glstopicGroupHeading}\marg{group label} +%\end{definition} +%May be redefined if letter group headings are required. For +%example: +%\begin{verbatim} +%\renewcommand*{\glstopicGroupHeading}[1]{% +% \glsxtrgetgrouptitle{#1}{\thisgrptitle}% +% \section*{\thisgrptitle}% +%} +%\end{verbatim} +% \begin{macrocode} +\newcommand*{\glstopicGroupHeading}[1]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicItem} +%\changes{1.40}{2019-03-22}{new} +%\begin{definition} +%\cs{glstopicItem}\marg{label}\marg{location list} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glstopicItem}[2]{% + \glspar\glstopicPreSkip\glspar\noindent + \glstopicMarker{#1}% + \glstopicTitleFont + {% + \glsentryitem{#1}\glstarget{#1}{\glstopicTitle{#1}}% + }% + \ifglshasdesc{#1}% + {\glspar\nobreak\glstopicMidSkip\glspar\nobreak + \@afterheading\glstopicDesc{#1}\glspar\glstopicPostSkip}% + {\glspar\nobreak\glstopicPostSkip}% + \glstopicLoc{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicMarker} +%\changes{1.40}{2019-03-22}{new} +% May be used to insert a bookmark etc if required. +% \begin{macrocode} +\newcommand*{\glstopicMarker}[1]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicName} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicTitle}[1]{\Glossentryname{#1}% + \ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicTitleFont} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicTitleFont}[1]{\textbf{\large #1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicDesc} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicDesc}[1]{\Glossentrydesc{#1}\glspostdescription} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicLoc} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicLoc}[2]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicParIndent} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newlength\glstopicParIndent +\setlength\glstopicParIndent{20pt} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicSubIndent} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newlength\glstopicSubIndent +\setlength\glstopicSubIndent{20pt} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicInit} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand{\glstopicInit}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicAssignSubIndent} +%\changes{1.40}{2019-03-22}{new} +%\begin{definition} +%\cs{glstopicAssignSubIndent}\marg{level} +%\end{definition} +%Used to set the indentation for sub-levels. +% \begin{macrocode} +\newcommand*{\glstopicAssignSubIndent}[1]{% +% \end{macrocode} +%\changes{1.41}{2019-04-09}{moved \cs{par} from \cs{glstopicSubItem}} +% \begin{macrocode} + \par + \parindent\dimexpr#1\glstopicSubIndent-\glstopicSubIndent\relax + \glstopicAssignWidest{#1}% + \hangindent\dimexpr\parindent+\glstopicwidest\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstopicwidest} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newlength\glstopicwidest +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstopicAssignWidest} +%\changes{1.40}{2019-03-22}{new} +%\begin{definition} +%\cs{glstopicAssignWidest}\marg{level} +%\end{definition} +%Used in the definition of \cs{glstopicAssignSubIndent} +%to set the indentation from the widest name for the given +%level. This will require \sty{glossary-tree} to set the values. +% \begin{macrocode} +\newcommand*{\glstopicAssignWidest}[1]{% + \ifcsundef{@glswidestlength\romannumeral#1}% + {% + \ifcsdef{@glswidestname\romannumeral#1}% + {% + \settowidth{\glstopicwidest}{% + \glstopicSubNameFont{\csuse{@glswidestname\romannumeral#1}}% + \glstopicSubItemSep + }% + }% + {\setlength{\glstopicwidest}{0pt}}% +% \end{macrocode} +%Save the value so that it doesn't have to keep being recalculated. +% \begin{macrocode} + \csedef{@glswidestlength\romannumeral#1}{\the\glstopicwidest}% + }% + {\setlength{\glstopicwidest}{\csuse{@glswidestlength\romannumeral#1}}}% +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\glstopicPreSkip} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicPreSkip}{\medskip} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicMidSkip} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicMidSkip}{\smallskip} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicPostSkip} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicPostSkip}{\smallskip} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicSubItem} +%\changes{1.40}{2019-03-22}{new} +%\begin{definition} +%\cs{glstopicSubItem}\marg{level}\marg{label}\marg{location list} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glstopicSubItem}[3]{% +% \end{macrocode} +%\changes{1.41}{2019-04-09}{moved \cs{par} to \cs{glstopicAssignSubIndent}} +% \begin{macrocode} + \glstopicSubItemBox{#1}{\glstopicSubNameFont{\glsentryitem{#2}% + \glstarget{#2}{\glossentryname{#2}}}% + \glstopicSubItemSep + }% + \ifglshassymbol{#2}{(\glossentrysymbol{#2})\space}{}% +% \end{macrocode} +%\changes{1.41}{2019-04-09}{added check for description} +% \begin{macrocode} + \ifglshasdesc{#2}% + {\glossentrydesc{#2}\glspostdescription\glstopicSubPreLocSep}{}% + \glstopicSubLoc{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicSubItemSep} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicSubItemSep}{\quad} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicSubItemBox} +%\changes{1.40}{2019-03-22}{new} +%\begin{definition} +%\cs{glstopicSubItemBox}\marg{level}\marg{text} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glstopicSubItemBox}[2]{% + \ifdim\glstopicwidest>0pt\relax\makebox[\glstopicwidest][l]{#2}\else#2\fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicSubNameFont} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicSubNameFont}[1]{\textbf{#1}} +% \end{macrocode} +%\end{macro} +%\changes{1.41}{2019-04-09}{new} +% \begin{macrocode} +\newcommand*{\glstopicSubPreLocSep}{\space} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstopicSubLoc} +%\changes{1.40}{2019-03-22}{new} +%\changes{1.41}{2019-04-09}{moved \cs{space} to \cs{glstopicSubPreLocSep}} +% \begin{macrocode} +\newcommand*{\glstopicSubLoc}[2]{#2} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstopicCols} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicCols}{2} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstopicColsEnv} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newcommand*{\glstopicColsEnv}{multicols} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{topicmcols} +%\changes{1.40}{2019-03-22}{new} +% \begin{macrocode} +\newglossarystyle{topicmcols}{% + \renewenvironment{theglossary}% + {% + \glstopicInit + \def\glstopic@prechildren{}% + \def\glstopic@postchildren{}% + \def\glstopic@prevlevel{-1}% + }% + {% + \ifnum\glstopic@prevlevel>0\relax\glstopic@postchildren\fi + \par + }% + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{% + \ifnum\glstopic@prevlevel>0\relax\glstopic@postchildren\fi + \def\glstopic@prevlevel{-1}% + \glstopicGroupHeading{##1}% + }% + \renewcommand{\glossentry}[2]{% + \ifnum\glstopic@prevlevel>0\relax\glstopic@postchildren\fi + \def\glstopic@prevlevel{0}% + \hangindent0pt\relax + \parindent\glstopicParIndent\relax + \glstopicItem{##1}{##2}% + \ifnum\glstopicCols>1\relax +% \end{macrocode} +%\changes{1.41}{2019-04-09}{added penalty if no description} +%If there isn't a description, penalise a page break. +% \begin{macrocode} + \ifglshasdesc{##1}% + {% + \edef\glstopic@prechildren{% + \noexpand\begin{\glstopicColsEnv}{\glstopicCols}}% + }% + {% + \edef\glstopic@prechildren{% + \noexpand\nopagebreak + \noexpand\begin{\glstopicColsEnv}{\glstopicCols}}% + }% + \edef\glstopic@postchildren{\noexpand\end{\glstopicColsEnv}}% + \fi + }% + \renewcommand{\subglossentry}[3]{% + \ifnum\glstopic@prevlevel=0\relax\glstopic@prechildren\fi + \def\glstopic@prevlevel{##1}% + \glstopicAssignSubIndent{##1}% + \glstopicSubItem{##1}{##2}{##3}% + }% + \renewcommand*{\glsgroupskip}{}% +} +% \end{macrocode} +%\end{style} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-xr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-acronym-desc.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-acronym.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-acronyms-lang.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-brief.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-childnoname.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-cite.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-images.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-long.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-multipar.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-parent.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-symbolnames.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% Encoding: UTF-8 +@entry{sym.alpha, + name = {\ensuremath{\alpha}}, + description = {Quisque ullamcorper placerat ipsum.} +} + +@entry{sym.beta, + name = {\ensuremath{\beta}}, + description = {Cras nibh.} +} + +@entry{sym.gamma, + name = {\ensuremath{\gamma}}, + description = {Morbi vel justo vitae lacus tincidunt ultrices.} +} + +@entry{sym.delta, + name = {\ensuremath{\delta}}, + description = {Lorem ipsum dolor sit amet, consectetuer adipiscing +elit.} +} + +@entry{sym.epsilon, + name = {\ensuremath{\epsilon}}, + description = {In hac habitasse platea dictumst.} +} + +@entry{sym.zeta, + name = {\ensuremath{\zeta}}, + description = {Integer tempus convallis augue.} +} + +@entry{sym.eta, + name = {\ensuremath{\eta}}, + description = {Etiam facilisis.} +} + +@entry{sym.theta, + name = {\ensuremath{\theta}}, + description = {Nunc elementum fermentum wisi.} +} + +@entry{sym.iota, + name = {\ensuremath{i}}, + description = {Aenean placerat.} +} + +@entry{sym.kappa, + name = {\ensuremath{\kappa}}, + description = {Ut imperdiet, enim sed gravida sollicitudin, felis odio +placerat quam, ac pulvinar elit purus eget enim.} +} + +@entry{sym.lambda, + name = {\ensuremath{\lambda}}, + description = {Nunc vitae tortor.} +} + +@entry{sym.mu, + name = {\ensuremath{\mu}}, + description = {Proin tempus nibh sit amet nisl.} +} + +@entry{sym.nu, + name = {\ensuremath{\nu}}, + description = {Vivamus quis tortor vitae risus porta vehicula.} +} + +@entry{sym.xi, + name = {\ensuremath{\xi}}, + description = {Fusce mauris.} +} + +@entry{sym.pi, + name = {\ensuremath{\pi}}, + description = {Vestibulum luctus nibh at lectus.} +} + +@entry{sym.rho, + name = {\ensuremath{\rho}}, + description = {Sed bibendum, nulla a faucibus semper, leo velit +ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam.} +} + +@entry{sym.sigma, + name = {\ensuremath{\sigma}}, + description = {Aliquam pellentesque, augue quis sagittis posuere, +turpis lacus congue quam, in hendrerit risus eros eget felis.} +} + +@entry{sym.tau, + name = {\ensuremath{\tau}}, + description = {Maecenas eget erat in sapien mattis porttitor.} +} + +@entry{sym.upsilon, + name = {\ensuremath{\upsilon}}, + description = {Vestibulum porttitor.} +} + +@entry{sym.phi, + name = {\ensuremath{\phi}}, + description = {Nulla facilisi.} +} + +@entry{sym.chi, + name = {\ensuremath{\chi}}, + description = {Sed a turpis eu lacus commodo facilisis.} +} + +@entry{sym.psi, + name = {\ensuremath{\psi}}, + description = {Morbi fringilla, wisi in dignissim interdum, justo +lectus sagittis dui, et vehicula libero dui cursus dui.} +} + +@entry{sym.omega, + name = {\ensuremath{\omega}}, + description = {Mauris tempor ligula sed lacus.} +} + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-symbols.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-url.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-xr.bib> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< +% \end{macrocode} +%\fi +%\Finale +\endinput diff --git a/macros/latex/contrib/glossaries-extra/glossaries-extra.ins b/macros/latex/contrib/glossaries-extra/glossaries-extra.ins new file mode 100644 index 0000000000..e8bd0d99db --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/glossaries-extra.ins @@ -0,0 +1,57 @@ +% glossaries-extra.ins generated using makedtx version 1.2 2019/4/9 21:59 +\input docstrip + +\preamble + + glossaries-extra.dtx + Copyright 2019 Nicola Talbot + + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either version 1.3 + 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 + version 2005/12/01 or later. + + This work has the LPPL maintenance status `maintained'. + + The Current Maintainer of this work is Nicola Talbot. + + This work consists of the files glossaries-extra.dtx and glossaries-extra.ins and the derived files glossaries-extra.sty, glossaries-extra-bib2gls.sty, glossaries-extra-stylemods.sty, glossary-bookindex.sty, glossary-longextra.sty, glossary-topic.sty, example-glossaries-xr.tex, example-glossaries-acronym-desc.bib, example-glossaries-acronym.bib, example-glossaries-acronyms-lang.bib, example-glossaries-brief.bib, example-glossaries-childnoname.bib, example-glossaries-cite.bib, example-glossaries-images.bib, example-glossaries-long.bib, example-glossaries-multipar.bib, example-glossaries-parent.bib, example-glossaries-symbolnames.bib, example-glossaries-symbols.bib, example-glossaries-url.bib, example-glossaries-xr.bib. + +\endpreamble + +\askforoverwritefalse + +\generate{\file{glossaries-extra.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{glossaries-extra.sty,package}} +\file{glossaries-extra-bib2gls.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{glossaries-extra-bib2gls.sty,package}} +\file{glossaries-extra-stylemods.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{glossaries-extra-stylemods.sty,package}} +\file{glossary-bookindex.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{glossary-bookindex.sty,package}} +\file{glossary-longextra.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{glossary-longextra.sty,package}} +\file{glossary-topic.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{glossary-topic.sty,package}} +\file{example-glossaries-xr.tex}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{example-glossaries-xr.tex,package}} +\file{example-glossaries-acronym-desc.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-acronym-desc.bib}} +\file{example-glossaries-acronym.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-acronym.bib}} +\file{example-glossaries-acronyms-lang.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-acronyms-lang.bib}} +\file{example-glossaries-brief.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-brief.bib}} +\file{example-glossaries-childnoname.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-childnoname.bib}} +\file{example-glossaries-cite.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-cite.bib}} +\file{example-glossaries-images.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-images.bib}} +\file{example-glossaries-long.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-long.bib}} +\file{example-glossaries-multipar.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-multipar.bib}} +\file{example-glossaries-parent.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-parent.bib}} +\file{example-glossaries-symbolnames.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-symbolnames.bib}} +\file{example-glossaries-symbols.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-symbols.bib}} +\file{example-glossaries-url.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-url.bib}} +\file{example-glossaries-xr.bib}{\nopreamble\nopostamble\from{glossaries-extra.dtx}{example-glossaries-xr.bib}} +} + +\endbatchfile diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.pdf new file mode 100644 index 0000000000..7d04e01e7a Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.tex b/macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.tex new file mode 100644 index 0000000000..e123813d21 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-abbr-styles.tex @@ -0,0 +1,430 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex + +\documentclass{report} + +\usepackage[T1]{fontenc} +\usepackage{relsize} +\usepackage{etoolbox} +\usepackage[colorlinks,linkcolor=magenta]{hyperref} +\usepackage{glossaries-extra} + +% If you get any undefined control sequences or undefined +% style errors, make sure you have the latest versions of +% glossaries-extra.sty and glossaries.sty + +\makeglossaries + +% This command is used for short forms for styles +% that don't have a designated command: +\renewcommand{\glsabbrvdefaultfont}[1]{\textsf{#1}} + +% This command is used on first use for short forms +% for styles that don't have a designated command: +%\renewcommand{\glsfirstabbrvdefaultfont}[1]{\textsf{#1}} + +% This command is used for long forms for styles +% that don't have a designated command: +\renewcommand{\glslongdefaultfont}[1]{\textsf{#1}} + +% This command is used on first use for long forms +% for styles that don't have a designated command: +%\renewcommand{\glsfirstlongdefaultfont}[1]{\textsf{#1}} + +% These commands are used by the '-hyphen' styles. +% For example, to switch to small-caps for the short form: +%\renewcommand{\glsabbrvhyphenfont}{\glsabbrvscfont} +%\renewcommand{\glsxtrhyphensuffix}{\glsxtrscsuffix} +% and emphasize the long form +%\renewcommand{\glslonghyphenfont}{\emph} + +\renewcommand{\glsxtrabbrvfootnote}[2]{% + \footnote{\glshyperlink[\glsfmtshort{#1}]{#1}: #2}% +} + +\glssetcategoryattribute{long-hyphen-short-hyphen}{markwords}{true} +\glssetcategoryattribute{long-hyphen-postshort-hyphen}{markwords}{true} +\glssetcategoryattribute{long-hyphen-short-hyphen-desc}{markwords}{true} +\glssetcategoryattribute{long-hyphen-postshort-hyphen-desc}{markwords}{true} +\glssetcategoryattribute{short-hyphen-long-hyphen}{markwords}{true} +\glssetcategoryattribute{short-hyphen-postlong-hyphen}{markwords}{true} +\glssetcategoryattribute{short-hyphen-long-hyphen-desc}{markwords}{true} +\glssetcategoryattribute{short-hyphen-postlong-hyphen-desc}{markwords}{true} +\glssetcategoryattribute{long-hyphen-noshort-desc-noreg}{markwords}{true} +\glssetcategoryattribute{long-hyphen-noshort-noreg}{markwords}{true} + +\newcommand{\stylelist}{} + +\newcommand{\teststyle}[1]{% + \listadd{\stylelist}{#1}% + \setabbreviationstyle[#1]{#1}% + \newabbreviation[category=#1,% + %sort={#1},% order by style name + user1={user text}% + ]{sample-#1}{short}{long form}% + \csdef{glsxtrpostdesc#1}{ [style: #1]}% +} + +\newcommand{\testdescstyle}[1]{% + \listadd{\stylelist}{#1}% + \setabbreviationstyle[#1]{#1}% + \newabbreviation[category=#1,% + %sort={#1},% order by style name + user1={user text},% + description={sample description}]{sample-#1}{short}{long form}% + \csdef{glsxtrpostdesc#1}{ [style: #1]}% +} + +\teststyle{long-short} +\teststyle{short-long} +%\teststyle{footnote}% synonym: short-footnote +\teststyle{short-footnote} +%\teststyle{postfootnote}% synonym: short-postfootnote +\teststyle{short-postfootnote} +%\teststyle{short}% synonym: short-nolong +\teststyle{short-nolong} +\teststyle{short-nolong-noreg} +\teststyle{nolong-short} +\teststyle{nolong-short-noreg} +%\teststyle{long}% synonym: long-noshort +\teststyle{long-noshort} +\teststyle{long-noshort-noreg} +\teststyle{long-only-short-only} +\teststyle{long-short-sc} +\teststyle{short-sc-long} +%\teststyle{short-sc}% synonym: short-sc-nolong +\teststyle{short-sc-nolong} +\teststyle{nolong-short-sc} +\teststyle{long-noshort-sc} +%\teststyle{long-sc}% deprecated synonym of long-noshort-sc +\teststyle{short-sc-footnote} +%\teststyle{footnote-sc}% deprecated synonym of short-sc-footnote +\teststyle{short-sc-postfootnote} +%\teststyle{postfootnote-sc}% deprecated synonym of short-sc-postfootnote +\teststyle{long-short-sm} +\teststyle{short-sm-long} +%\teststyle{short-sm}% synonym: short-sm-nolong +\teststyle{short-sm-nolong} +\teststyle{nolong-short-sm} +%\teststyle{long-sm}% deprecated synonym of long-noshort-sm +\teststyle{long-noshort-sm} +\teststyle{short-sm-footnote} +%\teststyle{footnote-sm}% deprecated synonym of short-sm-footnote +\teststyle{short-sm-postfootnote} +%\teststyle{postfootnote-sm}% deprecated synonym of short-sm-postfootnote +\teststyle{long-short-em} +\teststyle{long-em-short-em} +\teststyle{short-em-long} +\teststyle{short-em-long-em} +\teststyle{short-em-nolong} +%\teststyle{short-em}% synonym: short-em-nolong +\teststyle{nolong-short-em} +\teststyle{long-noshort-em} +%\teststyle{long-em}% deprecated synonym of long-noshort-em +\teststyle{long-em-noshort-em} +\teststyle{long-em-noshort-em-noreg} +\teststyle{short-em-footnote} +%\teststyle{footnote-em}% deprecated synonym of short-em-footnote +\teststyle{short-em-postfootnote} +%\teststyle{postfootnote-em}% deprecated synonym of short-em-postfootnote +\teststyle{long-short-user} +\teststyle{long-postshort-user} +\teststyle{short-long-user} +\teststyle{short-postlong-user} +\teststyle{long-hyphen-short-hyphen} +\teststyle{long-hyphen-postshort-hyphen} +\teststyle{short-hyphen-long-hyphen} +\teststyle{short-hyphen-postlong-hyphen} +\teststyle{long-hyphen-noshort-noreg} + +\testdescstyle{long-short-desc} +\testdescstyle{short-long-desc} +%\testdescstyle{short-desc}% synonym: short-nolong-desc +\testdescstyle{short-nolong-desc} +\testdescstyle{short-nolong-desc-noreg} +%\testdescstyle{long-desc}% synonym: long-noshort-desc +\testdescstyle{long-noshort-desc} +\testdescstyle{long-noshort-desc-noreg} +\testdescstyle{long-only-short-only-desc} +\testdescstyle{long-short-sc-desc} +\testdescstyle{short-sc-long-desc} +%\testdescstyle{short-sc-desc}% synonym: short-sc-nolong-desc +\testdescstyle{short-sc-nolong-desc} +\testdescstyle{long-noshort-sc-desc} +%\testdescstyle{long-desc-sc}% deprecated synonym of long-noshort-sc-desc +\testdescstyle{long-short-sm-desc} +\testdescstyle{short-sm-long-desc} +%\testdescstyle{short-sm-desc}% synonym: short-sm-nolong-desc +\testdescstyle{short-sm-nolong-desc} +\testdescstyle{long-noshort-sm-desc} +%\testdescstyle{long-desc-sm}% deprecated synonym of long-noshort-sm-desc +\testdescstyle{long-short-em-desc} +\testdescstyle{long-em-short-em-desc} +\testdescstyle{short-em-long-desc} +\testdescstyle{short-em-long-em-desc} +%\testdescstyle{short-em-desc}% synonym: short-em-nolong-desc +\testdescstyle{short-em-nolong-desc} +\testdescstyle{long-noshort-em-desc} +%\testdescstyle{long-desc-em}% deprecated synonym of long-noshort-em-desc +\testdescstyle{long-em-noshort-em-desc} +\testdescstyle{long-em-noshort-em-desc-noreg} +\testdescstyle{long-short-user-desc} +\testdescstyle{long-postshort-user-desc} +\testdescstyle{short-long-user-desc} +\testdescstyle{short-postlong-user-desc} +\testdescstyle{long-hyphen-short-hyphen-desc} +\testdescstyle{long-hyphen-postshort-hyphen-desc} +\testdescstyle{short-hyphen-long-hyphen-desc} +\testdescstyle{short-hyphen-postlong-hyphen-desc} +\testdescstyle{long-hyphen-noshort-desc-noreg} + +\newcommand{\marg}[1]{\{\textnormal{\emph{#1}}\}} +\pagestyle{headings} + +\makeatletter +\renewcommand{\l@section}{\@dottedtocline {1}{1.5em}{3.3em}} +\makeatother + +\begin{document} +\pagenumbering{roman} +This is a test document demonstrating abbreviation styles +provided by the \textsf{glossaries-extra} package. Hyperlinks +are shown in +\makeatletter +\textcolor{\@linkcolor}{\@linkcolor}. +\makeatother + +Some of the styles just use the default formatting commands (which don't +change the font). To make the default setting clearer, this document has done: +\begin{verbatim} +\renewcommand{\glslongdefaultfont}[1]{\textsf{#1}} +\renewcommand{\glsabbrvdefaultfont}[1]{\textsf{#1}} +\end{verbatim} +So any text in this document that's rendered in sans-serif would normally not have any font +change implemented. + +Each test entry is defined using +\begin{verbatim} + \newabbreviation[category=#1,user1={user text}]% + {sample-#1}{short}{long form}% +\end{verbatim} +for the non\texttt{-desc} styles or +\begin{verbatim} + \newabbreviation[category=#1,user1={user text},% + description={sample description}]% + {sample-#1}{short}{long form}% +\end{verbatim} +for the \texttt{-desc} styles (where \verb|#1| is the style label). +Note that many of the entries will have duplicate sort values, so +don't build this with \texttt{xindy}. You can change the ordering +in the glossary to that it's sorted according to the style name +by changing the above definitions to: +\begin{verbatim} + \newabbreviation[category=#1,user1={user text},sort={#1}]% + {sample-#1}{short}{long form}% + \newabbreviation[category=#1,user1={user text},sort={#1},% + description={sample description}]% + {sample-#1}{short}{long form}% +\end{verbatim} + +To assist with distinguishing between the various styles, +the post-description hook (used after displaying the description in +the glossary) is set to \verb*| [style: #1]| for all categories, +and the footnote command \verb|\glsxtrabbrvfootnote| has been +redefined to include the short form hyperlinked to the glossary. + +The test entries that use the \texttt{-hyphen} styles have had the +\texttt{markwords} attribute set. This is designed to trigger +compound word hyphenation if the inserted text (through the final +optional argument of \verb|\gls|) starts with a hyphen. + +\tableofcontents + +\pagenumbering{arabic} +\chapter{First Use} +First use of \verb|\gls|. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\gls{\thislabel}.\glspar} + +\chapter{Next Use} +Next use of \verb|\gls|. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\gls{\thislabel}.\glspar} + +\chapter{First Use With Insert} +First use of \texttt{\string\gls\marg{label}[-insert]}. The conditional +\verb|\ifglsxtrinsertinside| is used by some styles to +determine whether or not to include the inserted material +inside the font changing command used by the style. +The default is: \ifglsxtrinsertinside true\else false\fi. + +In this test chapter, each entry is reset, then displayed with +\begin{verbatim} +\glsxtrinsertinsidefalse +\end{verbatim} +then reset and displayed with +\begin{verbatim} +\glsxtrinsertinsidetrue +\end{verbatim} +(following the semi-colon). Some styles may only obey this +conditional for particular commands. (For example, the inline +commands like \verb|\glsxtrfull| may behave differently to +commands like \verb|\gls|.) + +Some of the styles just use the default font commands (which don't +change the font) so there's no noticeable difference. To make the +differences more noticeable this document has done: +\begin{verbatim} +\renewcommand{\glslongdefaultfont}[1]{\textsf{#1}} +\renewcommand{\glsabbrvdefaultfont}[1]{\textsf{#1}} +\end{verbatim} + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsreset{\thislabel}\glsxtrinsertinsidefalse +\gls{\thislabel}[-insert]; +\glsreset{\thislabel}\glsxtrinsertinsidetrue +\gls{\thislabel}[-insert].\glspar} + +\chapter{Next Use With Insert} +Next use of \texttt{\string\gls\marg{label}[-insert]}. + +In this test chapter, each entry is displayed +with \verb|\glsxtrinsertinsidefalse| and then displayed with +\verb|\glsxtrinsertinsidetrue| +(following the semi-colon). Some styles don't check this +conditional. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsxtrinsertinsidefalse +\gls{\thislabel}[-insert]; +\glsxtrinsertinsidetrue +\gls{\thislabel}[-insert].\glspar} + +\chapter{Full Form} +Full form using \verb|\glsxtrfull| (inline full style). +This may differ from the display form used by \verb|\gls| +on first use, depending on the style. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsxtrfull{\thislabel}.\glspar} + +\chapter{Short Form} +Short form using \verb|\glsxtrshort|. +This may differ from the display form used by \verb|\gls| +on subsequent use, depending on the style. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsxtrshort{\thislabel}.\glspar +} + +\chapter{Long Form} +Long form using \verb|\glsxtrlong|. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsxtrlong{\thislabel}.\glspar} + +\chapter{Full Form With Insert} +Full form using \texttt{\string\glsxtrfull\marg{label}[-insert]} (inline full style). +In this test chapter, each entry is displayed +with \verb|\glsxtrinsertinsidefalse| and then displayed with +\verb|\glsxtrinsertinsidetrue| +(following the semi-colon). + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsxtrinsertinsidefalse +\glsxtrfull{\thislabel}[-insert]; +\glsxtrinsertinsidetrue +\glsxtrfull{\thislabel}[-insert].\glspar} + +\chapter{Short Form With Insert} +Short form using \texttt{\string\glsxtrshort\marg{label}[-insert]}. + +In this test chapter, each entry is displayed +with \verb|\glsxtrinsertinsidefalse| and then displayed with +\verb|\glsxtrinsertinsidetrue| +(following the semi-colon). + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsxtrinsertinsidefalse +\glsxtrshort{\thislabel}[-insert]; +\glsxtrinsertinsidetrue +\glsxtrshort{\thislabel}[-insert].\glspar} + +\chapter{Long Form With Insert} +Long form using \texttt{\string\glsxtrlong\marg{label}[-insert]}. +Note that the \texttt{hyphen} styles with the \texttt{markwords} +attribute don't adjust in this case. + +In this test chapter, each entry is displayed +with \verb|\glsxtrinsertinsidefalse| and then displayed with +\verb|\glsxtrinsertinsidetrue| +(following the semi-colon). + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsxtrinsertinsidefalse +\glsxtrlong{\thislabel}[-insert]; +\glsxtrinsertinsidetrue +\glsxtrlong{\thislabel}[-insert].\glspar} + +\chapter{First Form} +First form using \verb|\glsfirst|. This may be different +from the first use of \verb|\gls| depending on the style. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsfirst{\thislabel}.\glspar} + +\chapter{Text Form} +Text form using \verb|\glstext|. This may be different +from the subsequent use of \verb|\gls| depending on the style. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glstext{\thislabel}.\glspar} + +\chapter{First Form With Insert} +First form using \texttt{\string\glsfirst\marg{label}[-insert]}. +This is different from the first use of \verb|\gls| +as can be seen by the location of the inserted material. +(There's no check for the conditional +\verb|\ifglsxtrinsertinside|.) In general it's best not +to use \verb|\glsfirst| with abbreviations. Use either +\verb|\gls| (possibly with a reset) or \verb|\glsxtrfull|. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glsfirst{\thislabel}[-insert].\glspar} + +\chapter{Text Form With Insert} +Text form using \texttt{\string\glstext\marg{label}[-insert]}. +This doesn't check for the conditional +\verb|\ifglsxtrinsertinside|. + +\forglsentries{\thislabel}{\glscategory{\thislabel}: +\glstext{\thislabel}[-insert].\glspar} + +\chapter{Summary} + +\renewcommand{\do}[1]{\section{#1} +First use \texttt{\string\gls\marg{label}}: +\glsreset{sample-#1}\gls{sample-#1}.\par\noindent +Next use \texttt{\string\gls\marg{label}}: \gls{sample-#1}.\par\noindent +First use \texttt{\string\gls\marg{label}[-insert]}: +\glsreset{sample-#1}\gls{sample-#1}[-insert].\par\noindent +Next use \texttt{\string\gls\marg{label}[-insert]}: +\gls{sample-#1}[-insert].\par\noindent +\texttt{\string\glsxtrfull\marg{label}[-insert]}: +\glsxtrfull{sample-#1}[-insert].\par\noindent +\texttt{\string\glsxtrshort\marg{label}[-insert]}: +\glsxtrshort{sample-#1}[-insert].\par\noindent +\texttt{\string\glsxtrlong\marg{label}[-insert]}: +\glsxtrlong{sample-#1}[-insert].\par\noindent +Name: \glsentryname{sample-#1}.\par\noindent +Sort: \texttt{\glsentrysort{sample-#1}}.\par\noindent +Description: \glsentrydesc{sample-#1}.\par +} + +\dolistloop{\stylelist} +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-abbrv.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-abbrv.pdf new file mode 100644 index 0000000000..e85508041d Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-abbrv.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-abbrv.tex b/macros/latex/contrib/glossaries-extra/samples/sample-abbrv.tex new file mode 100644 index 0000000000..9d598f408f --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-abbrv.tex @@ -0,0 +1,36 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\newabbreviation{html}{HTML}{hypertext markup language} +\newabbreviation{xml}{XML}{extensible markup language} +\newabbreviation{svg}{SVG}{scalable vector graphics} + +\begin{document} +\tableofcontents + +\chapter{Sample} + +First use: \gls{html}, \gls{xml} and \gls{svg}. + +Next use: \gls{html}, \gls{xml} and \gls{svg}. + +Resetting. +\glsresetall + +Provide specific text (no first use trigger): \glslink{html}{SHTML}. +(Has been used? \ifglsused{html}{Yes}{No}.) + +Provide specific text (first use trigger): \glsdisp{html}{SHTML}. +(Has been used? \ifglsused{html}{Yes}{No}.) + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-accsupp.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-accsupp.pdf new file mode 100644 index 0000000000..51d427f7ca Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-accsupp.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-accsupp.tex b/macros/latex/contrib/glossaries-extra/samples/sample-accsupp.tex new file mode 100644 index 0000000000..85d24a8059 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-accsupp.tex @@ -0,0 +1,124 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage{cmap} + +\usepackage[accsupp,% use glossaries-accsupp + %nonumberlist,% suppress location list in glossary + nopostdot=false% insert dot after description in glossary +]{glossaries-extra} + +\makeglossaries + +% Change the format of the location lists: +\renewcommand{\GlsXtrFormatLocationList}[1]{Page list: #1.} + +% Default uses "ActualText" instead of "E". Redefine if required. +% Support in PDF viewers is variable. +%\renewcommand*{\glsaccsupp}[2]{% +% \BeginAccSupp{E=#1}#2\EndAccSupp{}% +%} + +\newabbreviation + [% add accessibility information: + %shortaccess={specific learning difference},% short access + %access={specific learning difference},% name access + textaccess={specific learning difference},% text access + ] + {spld}{SpLD}{specific learning difference} + +\glssetcategoryattribute{initialism}{accessinsertdots}{true} +\glssetcategoryattribute{initialism}{nameshortaccess}{true} + +\newabbreviation[category=initialism]{pi}{PI}{Private Investigator} + +% \ensuremath is required in the following as the +% accessibility support clashes with math-mode. + +% The firstaccess key defaults to the access key if omitted. +% This means that on first use if firstaccess hasn't been +% set but access has been set it will use the access text +% that's used for the name field in the glossary (not the +% value of the textaccess field). If this is inappropriate +% you need to explicitly add the firstaccess key. + +\newglossaryentry{R}{name={\ensuremath{\Re}}, + access={set of real numbers symbol},% name access + textaccess={set of real numbers},% text access + %firstaccess={set of real numbers},% first access + description={set of real numbers}} + +\newglossaryentry{in}{name={\ensuremath{\in}}, + access={is element of set symbol},% name access + textaccess={in},% text access + %firstaccess={in},% first access + description={is an element of}} + +\begin{document} +This is a sample document testing the accsupp option. +If your PDF viewer doesn't provide a text-to-speech facility +try copying the text on this page and pasting to a text file +to see the difference. + +\section{An Abbreviation} + +First use: \gls{spld}. +Next use: \gls{spld}. + +Access name: \glsentryaccess{spld}. + +Access text: \glsentrytextaccess{spld}. + +Access short: \glsentryshortaccess{spld}. + +If the access field isn't set in the above, no replacement text +is used in the corresponding \verb|\glstext|, \verb|\glsaccesstext| etc commands. + +Text field: \glstext{spld} [no-index/link version: \glsaccesstext{spld}]. +Short field: \glsxtrshort{spld} [no-index/link version: \glsaccessshort{spld}]. + +\section{An Initialism} + +The short form should be read as two letters: P I (not as the word +pi). + +First use: \gls{pi}. +Next use: \gls{pi}. + +Access short: \glsentryshortaccess{pi}. +Actual short value: \glsentryshort{pi}. +Access (name): \glsentryaccess{pi}. + +\section{A Symbol} + +First use: \gls{R}. Next use: \gls{R}. +Text field: \glstext{R}. Name field: \glsname{R}. + +First use: \gls{in}. Next use: \gls{in}. +Text field: \glstext{in}. Name field: \glsname{in}. + +Now test in math-mode: +\[ +x \gls{in} \gls{R} +\] + +The ``firstaccess'' field is used on first use. If this hasn't +been set the ``access'' field is used instead. The ``textaccess'' +field is used on subsequent use. If this hasn't been set the +``access'' field is used instead. The ``access'' field is used +for the entry name in the glossary list. + +Access (name) field: \glsentryaccess{R}. +First Access field: \glsentryfirstaccess{R}. +Text Access field: \glsentrytextaccess{R}. + +Access (name) field: \glsentryaccess{in}. +First Access field: \glsentryfirstaccess{in}. +Text Access field: \glsentrytextaccess{in}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.pdf new file mode 100644 index 0000000000..a792bef02b Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.tex b/macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.tex new file mode 100644 index 0000000000..f3c85c8c94 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-acronym-desc.tex @@ -0,0 +1,43 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[nopostdot=false]{glossaries-extra} + +\makeglossaries + +\renewcommand*{\glsxtrpostdescacronym}{% + \space(\textsc{origin:} \glsentrylong{\glscurrententrylabel})% +} + +\newacronym[description={a device that emits a narrow intense +beam of light}]{laser}{laser}{light amplification by stimulated +emission of radiation} + +\newacronym[description={a form of \gls{laser} generating a beam of +microwaves}]{maser}{maser}{microwave amplification by stimulated +emission of radiation} + +\newacronym[description={a system for detecting the location and +speed of ships, aircraft, etc, through the use of radio waves}]{radar}{radar}{radio detection and ranging} + +\newacronym[description={portable breathing apparatus for divers}]{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\begin{document} +\tableofcontents + +\chapter{Sample} + +An acronym is a word formed from the initial letters of other words. +Since it's a word, an acronym is pronounced as a word rather than as +a series of letters. Examples of acronyms: \gls{laser}, \gls{maser}, +\gls{radar} and \gls{scuba}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-acronym.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-acronym.pdf new file mode 100644 index 0000000000..748c73c9cb Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-acronym.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-acronym.tex b/macros/latex/contrib/glossaries-extra/samples/sample-acronym.tex new file mode 100644 index 0000000000..1301d14cc4 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-acronym.tex @@ -0,0 +1,30 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + +\newacronym{maser}{maser}{microwave amplification by stimulated +emission of radiation} + +\newacronym{radar}{radar}{radio detection and ranging} + +\newacronym{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\begin{document} +An acronym is a word formed from the initial letters of other words. +Since it's a word, an acronym is pronounced as a word rather than as +a series of letters. Examples of acronyms: \gls{laser}, \gls{maser}, +\gls{radar} and \gls{scuba}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alias.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-alias.pdf new file mode 100644 index 0000000000..7254b52a70 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-alias.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alias.tex b/macros/latex/contrib/glossaries-extra/samples/sample-alias.tex new file mode 100644 index 0000000000..dd14470fbc --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-alias.tex @@ -0,0 +1,48 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\newglossaryentry{numberlist}{name={number list}, + description={\nopostdesc}, + alias={locationlist}} + +\newglossaryentry{locationlist}{name={location list}, + description={list of locations} +} + +\renewcommand{\glsxtrsetaliasnoindex}{% + \ifglshasfield{alias}{\glslabel}% + {% + \setkeys{glslink}{noindex}% + \glsxtrindexaliased + }% + {}% +} + +\newglossaryentry{sample}{name={sample}, +description={an example}} + +\newglossaryentry{sample-alias}{name={sample-alias}, +description={\nopostdesc}, +alias={sample} +} + +\begin{document} + +\gls{numberlist} or \gls{locationlist}. + +\gls{sample} or \gls{sample-alias}. + +\newpage +\gls{numberlist} + +\gls{sample-alias} +\newpage +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.pdf new file mode 100644 index 0000000000..e0776db2de Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.tex b/macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.tex new file mode 100644 index 0000000000..201c55c26f --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-altmodifier.tex @@ -0,0 +1,32 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +% Don't use with indexonlyfirst setting! + +\GlsXtrSetDefaultGlsOpts{noindex} +\GlsXtrSetAltModifier{>}{noindex=false} + +\newglossaryentry{sample}{name={sample},description={an example}} + +\begin{document} +This is a sample document. +The \gls{sample} entry is used on this page but isn't indexed. + +\newpage +The \gls>{sample} entry is used on this page and is indexed. + +\newpage +The \gls{sample} entry is used on this page but isn't indexed. + +\newpage +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.pdf new file mode 100644 index 0000000000..ab853285b4 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.tex b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.tex new file mode 100644 index 0000000000..261e878f73 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-marginpar.tex @@ -0,0 +1,100 @@ +% arara: pdflatex +% arara: makeglossaries if found("aux", "@istfilename") +% arara: pdflatex +\documentclass[12pt]{book} + +\usepackage[T1]{fontenc} +\usepackage{tgtermes} +\usepackage[dvipsnames]{xcolor} +\usepackage{pifont} +\usepackage{tikz} + +\usepackage[colorlinks]{hyperref} +\usepackage[stylemods=tree,style=alttree,savenumberlist]{glossaries-extra} + +\makeglossaries + +\loadglsentries{example-glossaries-multipar} + +\glssetcategoryattribute{general}{glossname}{firstuc} + +\renewcommand*{\GlsXtrFormatLocationList}[1]{% + {% + \hypersetup{hidelinks}% + \textcolor{Plum}{\ding{230}}~\textbf{#1}% + }% +} + +% Suppress hanging paragraphs: +%\renewcommand*{\glsxtrAltTreeSetHangIndent}{} + +\newlength\maxlocwidth + +\renewcommand*{\glsxtralttreeInit}{% +% setup lengths + \glsFindWidestAnyNameLocation[\currentglossary]% + {\maxlocwidth}% + \settowidth + {\glsxtrtreetopindent}% + {\glstreenamefmt{\glsgetwidestname}}% + \addtolength{\glsxtrtreetopindent}% + {\dimexpr1em+2\nameinnersep+2\nameoutersep}% + \addtolength{\maxlocwidth}{1em}% + \glsxtrAltTreeIndent=\parindent +} + +\newlength\nameinnersep +\nameinnersep=4pt +\newlength\nameoutersep +\nameoutersep=2pt + +\renewcommand*{\glstreenamebox}[2]{% + \makebox[#1][l]% + {% + \begin{tikzpicture}[baseline=(X.base)] + \node[fill=Orchid, + align=center, + text width=\dimexpr#1-2\nameinnersep-2\nameoutersep, + inner sep=\nameinnersep, + outer sep=\nameoutersep + ] (X) {#2}; + \end{tikzpicture}% + }% +} + +\newcommand*{\locbox}[1]{% + \begin{tikzpicture}[baseline=(X.base)] + \node[text width=\maxlocwidth, + draw=CadetBlue, + fill=CornflowerBlue, + double, + thick, + align=center, + rounded corners] + (X) {#1}; + \end{tikzpicture}% +} + +\renewcommand{\glsxtralttreeSymbolDescLocation}[2]{% + \marginpar[\hfill\locbox{#2}]{\locbox{#2}}% + % scope \par change + {% + \let\par\glsxtrAltTreePar + \glossentrydesc{#1}\glspostdescription\par + }% +} + +\begin{document} + +\frontmatter +\chapter{Front Matter Test} +\forallglsentries{\thislabel}{\gls{\thislabel}.\newpage} + +\mainmatter + +\chapter{Main Matter Test} +\forallglsentries{\thislabel}{\gls{\thislabel}.\newpage} + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.pdf new file mode 100644 index 0000000000..56d3b3e27d Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.tex b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.tex new file mode 100644 index 0000000000..c328aee923 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-alttree-sym.tex @@ -0,0 +1,60 @@ +% arara: pdflatex +% arara: makeglossaries if found("aux", "@istfilename") +% arara: pdflatex +\documentclass{book} + +\usepackage[stylemods=tree,style=alttree,savenumberlist]{glossaries-extra} + +\makeglossaries + +\loadglsentries{example-glossaries-symbols} + +\newlength\maxsymbolwidth +\newlength\maxlocwidth +\newlength\fieldsep +\setlength{\fieldsep}{10pt} +\newlength\midfield +\newlength\rightfield + +\renewcommand*{\glsxtralttreeInit}{% +% setup lengths + \glsFindWidestAnyNameSymbolLocation[\currentglossary]% + {\maxsymbolwidth}{\maxlocwidth}% + \settowidth + {\glsxtrtreetopindent}% + {\glstreenamefmt{\glsgetwidestname}}% + \addtolength{\glsxtrtreetopindent}{\fieldsep}% + \ifdim\maxsymbolwidth>\maxlocwidth + \setlength{\rightfield}{\maxsymbolwidth}% + \else + \setlength{\rightfield}{\maxlocwidth}% + \fi + \addtolength{\rightfield}{\fieldsep}% + \setlength + {\midfield}% + {\dimexpr\linewidth-\glsxtrtreetopindent-\rightfield}% +} + +\renewcommand{\glsxtralttreeSymbolDescLocation}[2]{% + \parbox[t]{\midfield}{\raggedright + \glossentrydesc{#1}\glspostdescription\strut\par}% + \parbox[t]{\rightfield}{\raggedleft + \glossentrysymbol{#1}\par + \sffamily#2\strut\par + }% + \par +} + +\begin{document} + +\frontmatter +\setcounter{page}{37}% test wide page number +Test document. +\newpage +Indexing all entries here. +\glsaddall + +\mainmatter +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alttree.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-alttree.pdf new file mode 100644 index 0000000000..36df4991dd Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-alttree.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-alttree.tex b/macros/latex/contrib/glossaries-extra/samples/sample-alttree.tex new file mode 100644 index 0000000000..986828ecc4 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-alttree.tex @@ -0,0 +1,23 @@ +% arara: pdflatex +% arara: makeglossaries if found("aux", "@istfilename") +% arara: pdflatex +\documentclass{article} + +\usepackage[symbols,stylemods=tree,style=alttree]{glossaries-extra} + +\makeglossaries + +\loadglsentries{example-glossaries-parent.tex} +\loadglsentries[symbols]{example-glossaries-symbols} + +\begin{document} +\glsaddall +\glsunsetall + +%\glsFindWidestUsedLevelTwo +\preto{\glsxtralttreeInit}{% + \glsFindWidestUsedLevelTwo[\currentglossary]% +} +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.pdf new file mode 100644 index 0000000000..59a5978d4f Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.tex b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.tex new file mode 100644 index 0000000000..2aeac3b5f4 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex-hyp.tex @@ -0,0 +1,129 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: makeindex +% arara: pdflatex +\documentclass[index=totoc]{scrreprt} + +\usepackage[T1]{fontenc} + +\usepackage{makeidx} +\usepackage[colorlinks, + hyperindex=false% necessary for the encap entry + ]{hyperref} +\usepackage[abbreviations]{glossaries-extra} + +\renewcommand{\abbreviationsname}{List of Abbreviations} + +\makeindex +\makeglossaries + +% Provided by koma classes: +\setindexpreamble{Page numbers in bold indicate an entry +in the glossary or list of abbreviations.\par\medskip} + +% Automatically index the location of entry in the glossary +% for those entries that are in the "general" category and +% use "htextbf" as the encap value: + +% (Without the troublesome "encap" entry, hyperref's default +% hyperindex=true option could've been used and the attribute +% could simply be set to "textbf" and there'd be no need +% to define "htextbf".) + +\glssetcategoryattribute{general}{indexname}{htextbf} +\glssetcategoryattribute{general}{dualindex}{hyperpage} + +% Automatically index the location of entry in the glossary +% for those entries that are in the "abbreviation" category +% and use "htextbf" as the encap value: + +\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}} +\glssetcategoryattribute{abbreviation}{indexname}{htextbf} +\glssetcategoryattribute{abbreviation}{dualindex}{hyperpage} + +% Allow "format" key to override "dualindex" attribute. +\GlsXtrEnableIndexFormatOverride + +% Convert the first letter of the name to upper case in the +% glossary for general entries: +\glssetcategoryattribute{general}{glossname}{firstuc} + +% Convert the name to upper case in the glossary for +% abbreviations: +\glssetcategoryattribute{abbreviation}{glossname}{uc} + +% Define general entries: + +\newglossaryentry{duck}{name=duck,% + description={a waterbird with webbed feet}} + +\newglossaryentry{parrot}{name=parrot,% + description={mainly tropical bird with bright plumage}} + +\newglossaryentry{at}{name={@},% + description={makeindex's default for the ``actual value''}} + +\newglossaryentry{level}{name={!},% + description={makeindex's default for the ``level value''}} + +\newglossaryentry{esc}{name={"},% + description={makeindex's default for the ``escape value''}} + +\newglossaryentry{encap}{name={|},% + description={makeindex's default for the ``encap value''}} + +% Set abbreviation style: + +\setabbreviationstyle{long-short-sc} + +% Define abbreviations: + +\newabbreviation + {html}% identifying label + {html}% short form + {hypertext markup language}% long form + +\newabbreviation + {xml}% identifying label + {xml}% short form + {extensible markup language}% long form + +\title{Sample document testing the glossaries-extra package} +\author{Nicola Talbot} + +\begin{document} +\maketitle + +\tableofcontents + +\chapter{Introduction} + +% If hyperref's default hyperindex=true option is in use +% the indexed term here won't need the |hyperpage bit. +This is a sample\index{sample|hyperpage} document testing the +\texttt{glossaries-extra} package. + +\chapter{General Entries} + +Sample entries: \gls{duck} and \gls{parrot}. + +Test makeindex's special characters: \gls{at} (actual) +\gls{esc} (escape) \gls{level} (level) and \gls{encap} (encap). + +\newpage + +Use some entries again: \gls{duck} and \gls[format=hyperit]{parrot}. + +\chapter{Abbreviations} + +First use: \gls{html} and \gls{xml}. + +Next use: \gls{html} and \gls{xml}. + +\printglossaries + +\printindex + +\end{document} + diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-autoindex.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex.pdf new file mode 100644 index 0000000000..93a8d36a55 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-autoindex.tex b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex.tex new file mode 100644 index 0000000000..da2b32d6d9 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-autoindex.tex @@ -0,0 +1,127 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: makeindex +% arara: pdflatex +\documentclass{report} + +\usepackage[T1]{fontenc} + +\usepackage{makeidx} +\usepackage[abbreviations,counter=chapter,nopostdot=false]{glossaries-extra} + +\renewcommand*{\abbreviationsname}{List of Abbreviations} +\renewcommand*{\glossarypreamble}{\emph{Numbers refer to the +\textbf{chapter} where the entry was referenced.}} + +\makeindex +\makeglossaries + +% Automatically index the location of entry in the glossary +% for those entries that are in the "general" category: + +\glssetcategoryattribute{general}{indexname}{textbf} +\glssetcategoryattribute{general}{dualindex}{true} + +% Only index first use for the glossary location lists +% (doesn't affect the indexing from "dualindex" attribute): +%\glssetcategoryattribute{general}{indexonlyfirst}{true} + +% Automatically index the location of entry in the glossary +% for those entries that are in the "abbreviation" category +% and use "textbf" as the encap: + +\glssetcategoryattribute{abbreviation}{indexname}{textbf} +\glssetcategoryattribute{abbreviation}{dualindex}{true} + +% Only index first use for the glossary location lists +% (doesn't affect the indexing from "dualindex" attribute): +%\glssetcategoryattribute{abbreviation}{indexonlyfirst}{true} + +% Convert the first letter of the name to upper case in the +% glossary for general entries: +\glssetcategoryattribute{general}{glossname}{firstuc} + +% Allow "format" key to override "dualindex" attribute. +\GlsXtrEnableIndexFormatOverride + +% use first field instead of name field +\renewcommand*{\glsxtrautoindexentry}[1]{\string\glsentryfirst{#1}} + +% use long form for the sort value, if provided: +\renewcommand*{\glsxtrautoindexassignsort}[2]{% + \ifglshaslong{#2}% + {\glsletentryfield{#1}{#2}{long}}% + {\glsletentryfield{#1}{#2}{sort}}% +} + +% Define general entries: + +\newglossaryentry{duck}{name=duck,% + description={a waterbird with webbed feet}} + +\newglossaryentry{parrot}{name=parrot,% + description={mainly tropical bird with bright plumage}} + +\newglossaryentry{at}{name={@},% + description={makeindex's default for the ``actual value''}} + +\newglossaryentry{esc}{name={"},% + description={makeindex's default for the ``escape value''}} + +\newglossaryentry{level}{name={!},% + description={makeindex's default for the ``level value''}} + +\newglossaryentry{encap}{name={|},% + description={makeindex's default for the ``encap value''}} + +% Set abbreviation style: + +\setabbreviationstyle{long-short-sc} + +% Define abbreviations: + +\newabbreviation + {html}% identifying label + {html}% short form + {hypertext markup language}% long form + +\newabbreviation + {xml}% identifying label + {xml}% short form + {extensible markup language}% long form + +\title{Sample document testing the glossaries-extra package} +\author{Nicola Talbot} + +\begin{document} +\maketitle + +\chapter{Introduction} + +This is a sample\index{sample} document testing the +\texttt{glossaries-extra} package. + +\chapter{General Entries} + +Sample entries: \gls{duck} and \gls{parrot}. + +Test makeindex's special characters: \gls{at} (actual) +\gls{esc} (escape) \gls{level} (level) and \gls{encap} (encap). + +\chapter{Abbreviations} + +First use: \gls{html} and \gls{xml}. + +Next use: \gls{html} and \gls{xml}. + +\newpage + +Uses some entries again: \gls{duck} and \gls[format=textit]{parrot}. + +\printglossaries + +\printindex + +\end{document} + diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-crossref.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-crossref.pdf new file mode 100644 index 0000000000..8429430c25 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-crossref.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-crossref.tex b/macros/latex/contrib/glossaries-extra/samples/sample-crossref.tex new file mode 100644 index 0000000000..4216b7f611 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-crossref.tex @@ -0,0 +1,22 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\newglossaryentry{sample1}{name={sample 1},description={an example}} +\newglossaryentry{sample2}{name={sample 2},description={an +example},see={sample1}} +\newglossaryentry{sample3}{name={sample 3},description={an +example},seealso={sample2}} + +\begin{document} +\gls{sample3}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-crossref2.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-crossref2.pdf new file mode 100644 index 0000000000..be4f0703ab Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-crossref2.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-crossref2.tex b/macros/latex/contrib/glossaries-extra/samples/sample-crossref2.tex new file mode 100644 index 0000000000..abadf2b850 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-crossref2.tex @@ -0,0 +1,32 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[nonumberlist]{glossaries-extra} + +\makeglossaries + +\renewcommand*{\glsxtrpostdescgeneral}{% + \ifglshasfield{see}{\glscurrententrylabel} + {, \glsxtrusesee{\glscurrententrylabel}}% + {}% + \ifglshasfield{seealso}{\glscurrententrylabel} + { (\glsxtruseseealso{\glscurrententrylabel})}% + {}% +} + +\newglossaryentry{sample1}{name={sample 1},description={an example}} +\newglossaryentry{sample2}{name={sample 2},description={an +example},see={sample1}} +\newglossaryentry{sample3}{name={sample 3},description={an +example},see={sample2}} +\newglossaryentry{sample4}{name={sample 4},description={an +example},seealso={sample2,sample3}} + +\begin{document} +\gls{sample4}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-docdef.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-docdef.pdf new file mode 100644 index 0000000000..418419a652 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-docdef.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-docdef.tex b/macros/latex/contrib/glossaries-extra/samples/sample-docdef.tex new file mode 100644 index 0000000000..8271b488fa --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-docdef.tex @@ -0,0 +1,28 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[docdef]{glossaries-extra} + +\makeglossaries + +\begin{document} + +\printglossaries + +This is a sample document testing the use of document definitions +for those who are happy to accept all the associated drawbacks +of not following the advice in the glossaries manual about +defining all your entries in the preamble. Use it at your own +peril. + +\newglossaryentry{sample}{name=sample,description={an example}} +\newglossaryentry{sample2}{name={another sample}, + description={another example},see={sample}} +\newabbreviation{ab}{AB}{sample abbreviation} + +Use \gls{sample2}. + +Use \gls{ab}. +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-entrycount.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-entrycount.pdf new file mode 100644 index 0000000000..0b032a464c Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-entrycount.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-entrycount.tex b/macros/latex/contrib/glossaries-extra/samples/sample-entrycount.tex new file mode 100644 index 0000000000..739cf1061e --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-entrycount.tex @@ -0,0 +1,44 @@ +% arara: pdflatex +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\GlsXtrEnableEntryCounting + {abbreviation}% list of categories to use entry counting + {2}% trigger value + +\newabbreviation{html}{HTML}{hypertext markup language} +\newabbreviation{xml}{XML}{extensible markup language} +\newabbreviation{css}{CSS}{cascading style sheet} + +\newglossaryentry{sample}{name={sample},description={sample}} + +\begin{document} +This is a sample document that uses entry counting. The entry counting +has been enabled on the \texttt{abbreviation} category. +This means that abbreviations will only be added to the glossary +if they have been used more than $n$ times, where in this +document $n$ has been set to +\glsgetcategoryattribute{abbreviation}{entrycount}. +Entries in other categories behave as normal. + + +Used once: \gls{html}. + +Used twice: \gls{xml} and \gls{xml}. + +Used three times: \gls{css} and \gls{css} and \gls{css}. + +Used once but this entry is in the ``general'' category +which doesn't have the ``entrycount'' attribute set: +\gls{sample}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-external.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-external.pdf new file mode 100644 index 0000000000..b598bbe672 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-external.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-external.tex b/macros/latex/contrib/glossaries-extra/samples/sample-external.tex new file mode 100644 index 0000000000..e3e5fda1d3 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-external.tex @@ -0,0 +1,38 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\newignoredglossary*{external} + +\glssetcategoryattribute{external}{targeturl}{\glsentryuseri{\glslabel}} + +\makeglossaries + +\newglossaryentry{sample}{name={sample},description={an example}} + +\newcommand*{\newexternalentry}[3]{% + \newglossaryentry{#1}{type={external},category={external},user1={#2},#3}% +} + +\newcommand*{\glsxtrpostlinkexternal}{% + \glsxtrpostlinkAddDescOnFirstUse +} + +\newexternalentry{bib2gls}{https://github.com/nlct/bib2gls} +{name={bib2gls}, + description={command line application to convert from .bib to .glstex} +} + + +\begin{document} +An internal example: \gls{sample}. + +An external example: \gls{bib2gls}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-fmt.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-fmt.pdf new file mode 100644 index 0000000000..44b0b88aba Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-fmt.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-fmt.tex b/macros/latex/contrib/glossaries-extra/samples/sample-fmt.tex new file mode 100644 index 0000000000..2c96d8a1fb --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-fmt.tex @@ -0,0 +1,58 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[postdot,style=index]{glossaries-extra} + +\makeglossaries + +\newcommand*{\mtx}[1]{\boldsymbol{#1}} +\newcommand*{\mtxinv}[1]{\mtx{#1}\sp{-1}} + +\newglossaryentry{matrix}{% + name={matrix}, + symbol={\ensuremath{\mtx{M}}}, + plural={matrices}, + user1={mtx}, + description={rectangular array of values} +} + +\newglossaryentry{identitymatrix}{% + name={identity matrix}, + symbol={\ensuremath{\mtx{I}}}, + plural={identity matrices}, + description={a diagonal matrix with all diagonal elements equal to +1 and all other elements equal to 0} +} + +\newglossaryentry{matrixinv}{% + name={matrix inverse}, + symbol={\ensuremath{\mtxinv{M}}}, + user1={mtxinv}, + description={a square \gls{matrix} such that + $\mtx{M}\mtxinv{M}=\glssymbol{identitymatrix}$} +} + +\renewcommand{\GlsXtrFmtDefaultOptions}{hyper=false,noindex} + +\begin{document} +A \gls{matrix} is denoted \glssymbol{matrix}. +The inverse is denoted \glssymbol{matrixinv}. + +\newpage + +\[ + \glsxtrfmt{matrix}{A} + \glsxtrfmt{matrixinv}{A} + = + \glssymbol{identitymatrix} +\] + +\newpage + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-footnote.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-footnote.pdf new file mode 100644 index 0000000000..ddd2da6376 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-footnote.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-footnote.tex b/macros/latex/contrib/glossaries-extra/samples/sample-footnote.tex new file mode 100644 index 0000000000..eed767a5c0 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-footnote.tex @@ -0,0 +1,30 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +%\setabbreviationstyle{footnote}% similar to glossaries.sty acronym style of the same name +\setabbreviationstyle{postfootnote}% put the footnote after following punctuation if present + +\newabbreviation{html}{HTML}{hypertext markup language} +\newabbreviation{xml}{XML}{extensible markup language} + +\begin{document} +\chapter{Sample} + +First use: \gls{xml} and \gls{html}. + +\chapter{Another Sample} + +Next use: \gls{xml} and \gls{html}. + +Short form: \glsxtrshort{xml}\@. Long form: \glsxtrlong{html}. +Full form: \glsxtrfull{xml}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-header.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-header.pdf new file mode 100644 index 0000000000..d14b7ac990 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-header.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-header.tex b/macros/latex/contrib/glossaries-extra/samples/sample-header.tex new file mode 100644 index 0000000000..4b004c0245 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-header.tex @@ -0,0 +1,73 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex +\documentclass{report} + +\usepackage[T1]{fontenc}% provide bold small caps +\usepackage[utf8]{inputenc} +\usepackage{slantsc}% provide slanted small caps +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\setabbreviationstyle{long-short-sc} +\newabbreviation{html}{html}{hypertext markup language} + +\newglossaryentry{sample}{name=sample, + description={an example}} + +\pagestyle{headings} + +% entries with the headuc attribute set to "true" +% will ensure the \glsfmttext etc commands use the +% upper case version in page headers. +\glssetcategoryattribute{general}{headuc}{true} + +% This attribute isn't set for the "abbreviation" category +% which keeps the abbreviation as small caps in the header. + +% Uncomment the following to set the attribute for the +% abbreviations as well: +%\glssetcategoryattribute{abbreviation}{headuc}{true} + +\begin{document} +\begin{abstract} +This is a sample document that tests the use of entries +in sectioning commands through commands like \verb|\glsfmtshort| +and \verb|\glsfmttext|. +\end{abstract} + +\tableofcontents + +\chapter{\Glsfmttext{sample} Chapter with \glsfmtshort{html} Abbreviation} +\label{ch:sample} + +First use: \gls{html}. Next use: \gls{html}. +Note that the \gls{sample} entry that occurs at the start of +the chapter title appears in lower case in the PDF bookmarks, since +the case-changing command can't be used there. + +\newpage + +Page break to test header. + +\chapter{Another + \texorpdfstring{\Glsfmttext{sample}}{Sample} + Chapter with \glsfmtshort{html} Abbreviation} + +The case-changing commands can't be used in PDF bookmarks, +so this chapter has used \verb|\texorpdfstring| to provide +an alternative for the PDF bookmark. The first chapter +(\nameref{ch:sample}) +didn't do this so ``\Gls{sample}'' appeared in lower case in +the PDF bookmark. + +\newpage + +Page break to test header. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-indexhook.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-indexhook.pdf new file mode 100644 index 0000000000..6862cdf5af Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-indexhook.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-indexhook.tex b/macros/latex/contrib/glossaries-extra/samples/sample-indexhook.tex new file mode 100644 index 0000000000..459888c0b4 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-indexhook.tex @@ -0,0 +1,42 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage{etoolbox} +\usepackage + [ + indexcrossrefs=false% cross-ref indexing performed explicitly + ] + {glossaries-extra} + +\makeglossaries + +% Keep a list of entries that have been indexed +\newcommand*{\indexedlist}{} +\renewcommand*{\glsxtrdowrglossaryhook}[1]{% + \xifinlist{#1}{\indexedlist}{}{\listxadd{\indexedlist}{#1}}% +} + +\newglossaryentry{sample1}{name={sample 1},description={an example}} +\newglossaryentry{sample2}{name={sample 2},description={an +example},see={sample1}} +\newglossaryentry{sample3}{name={sample 3},description={an +example},see={sample2}} + +\newglossaryentry{sample4}{name={sample 4},description={an example}} + +\begin{document} +This is sample document. + +\gls{sample3}. + +\printglossaries + +% index all the cross-referenced entries that haven't been used: +\glsxtraddallcrossrefs + +Entries that haven't been indexed: +\forglsentries{\thislabel}{\xifinlist{\thislabel}{\indexedlist}{}{\space\thislabel}}. + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-initialisms.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-initialisms.pdf new file mode 100644 index 0000000000..70a828f297 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-initialisms.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-initialisms.tex b/macros/latex/contrib/glossaries-extra/samples/sample-initialisms.tex new file mode 100644 index 0000000000..39aa4e905f --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-initialisms.tex @@ -0,0 +1,70 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +% set up the styles: +\setabbreviationstyle{long-short-sc} + +\setabbreviationstyle[initialism]{short-long} +\glssetcategoryattribute{initialism}{insertdots}{true} +\glssetcategoryattribute{initialism}{discardperiod}{true} +\glssetcategoryattribute{initialism}{retainfirstuseperiod}{true} + +% define the entries: + +\newabbreviation{html}{html}{hypertext markup language} + +\newabbreviation[category=initialism]{eg}{eg}{for example} +\newabbreviation[category=initialism]{si}{SI}{sample initials} + +\begin{document} +\section{Examples} + +Abbreviations with dots \gls{eg} and \gls{si} and abbreviation +without dots \gls{html} and the end of the sentence. + +(Next use.) Abbreviations with dots \gls{eg} and \gls{si} and abbreviation +without dots \gls{html} and the end of the sentence. + +Plural: \glspl{si} and at the end of a sentence \glspl{si}. + +Reset\glsresetall. First use end of sentence: +\gls{eg}. \gls{si}. \gls{html}. + +Next use end of sentence: +\gls{eg}. \gls{si}. \gls{html}. + +\section{Space Factors} + +Test the space factors. (More visible if we switch to a monospaced +font.) + +\begin{ttfamily} +Initialisms in the middle \gls{eg} and \gls{si} of a sentence. + +Initialism at the end of a sentence \gls{eg}. +Initialism at the end of a sentence \gls{si}. +Another sentence. +\end{ttfamily} + +Compare with explicitly writing the text without \verb|\gls| +and judicious use of \verb*|\ | and \verb|\@|: + +\begin{ttfamily} +Initialisms in the middle e.g.\ and S.I. of a sentence. + +Initialism at the end of a sentence e.g. +Initialism at the end of a sentence S.I\@. +Another sentence. +\end{ttfamily} + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-linkcount.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-linkcount.pdf new file mode 100644 index 0000000000..6ecfa45889 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-linkcount.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-linkcount.tex b/macros/latex/contrib/glossaries-extra/samples/sample-linkcount.tex new file mode 100644 index 0000000000..d8375eaabf --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-linkcount.tex @@ -0,0 +1,44 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\renewcommand*{\glslinkpostsetkeys}{% + \ifnum\GlsXtrLinkCounterValue{\glslabel}>1 + \setkeys{glslink}{hyper=false}% + \fi +} + +%\GlsXtrEnableLinkCounting[section]{general} +\GlsXtrEnableLinkCounting{general} + +\newglossaryentry{sample1}{name={sample1},description={an example}} +\newglossaryentry{sample2}{name={sample2},description={another example}} + +\newabbreviation{ex}{ex}{example} + +\begin{document} + +\section{Sample Section} + +\Gls{sample1}, \gls{sample2} and \gls{ex}. +\Glstext{sample1} and \gls{ex} again. +Link count: \GlsXtrTheLinkCounter{sample1} (sample1), +\GlsXtrTheLinkCounter{sample2} (sample2) and +\GlsXtrTheLinkCounter{ex} (ex). + +\section{Another Sample Section} + +\Gls{sample1}, \gls{sample2} and \gls{ex}. +Link count: \GlsXtrTheLinkCounter{sample1} (sample1), +\GlsXtrTheLinkCounter{sample2} (sample2) and +\GlsXtrTheLinkCounter{ex} (ex). + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.pdf new file mode 100644 index 0000000000..ed38e87d42 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.tex b/macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.tex new file mode 100644 index 0000000000..421a5af0ba --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-mixed-abbrv-styles.tex @@ -0,0 +1,25 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage{glossaries-extra} + +\makeglossaries + +\setabbreviationstyle[inline]{long-short} +\setabbreviationstyle[footer]{footnote} + +\newabbreviation[category=inline]{html}{HTML}{hypertext markup language} + +\newabbreviation[category=footer]{shtml}{SHTML}{server-parsed HTML} + +\begin{document} + +First use: \gls{shtml} and \gls{html}. + +Next use: \gls{shtml} and \gls{html}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.pdf new file mode 100644 index 0000000000..47a2626b99 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.tex b/macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.tex new file mode 100644 index 0000000000..a85c7c6b9b --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-mixedsort.tex @@ -0,0 +1,35 @@ +\documentclass{article} + +\usepackage[symbols,automake]{glossaries-extra} +\usepackage{glossary-mcols} + +\makeglossaries[main] + +\newglossaryentry{duck}{name=duck,% + description={a waterbird with webbed feet}} + +\newglossaryentry{parrot}{name=parrot,% + description={mainly tropical bird with bright plumage}} + +\newglossaryentry{zebra}{name=zebra,% + description={black and white striped African wild horse}} + +\newglossaryentry{aardvark}{name=aardvark,% + description={African ant-eating mammal}} + +\glsxtrnewsymbol[description={zeta}]{zeta}{$\zeta$} +\glsxtrnewsymbol[description={beta}]{beta}{$\beta$} +\glsxtrnewsymbol[description={alpha}]{alpha}{$\alpha$} +\glsxtrnewsymbol[description={gamma}]{gamma}{$\gamma$} + +\begin{document} + +General terms: \gls{duck}, \gls{zebra}, \gls{aardvark}, +\gls{parrot}. + +Symbols: \gls{beta}, \gls{gamma}, \gls{alpha}, \gls{zeta}. + +\printglossary[style=mcolindexgroup] +\printnoidxglossary[type=symbols,sort=use,style=index] + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-mixture.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-mixture.pdf new file mode 100644 index 0000000000..3c9208ba08 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-mixture.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-mixture.tex b/macros/latex/contrib/glossaries-extra/samples/sample-mixture.tex new file mode 100644 index 0000000000..352200311e --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-mixture.tex @@ -0,0 +1,344 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{report} + +\usepackage[T1]{fontenc} +\usepackage[colorlinks]{hyperref} +\usepackage[nopostdot=false]{glossaries-extra} + +\makeglossaries + +% regular terms: + +% (Version 1.04+) The following will make regular terms appear +% in sans-serif when used with \gls etc but won't affect the +% abbreviations: + +%\renewcommand*{\glsxtrregularfont}[1]{\textsf{#1}} + +% or limit to just the "general" category: +%\renewcommand*{\glsxtrregularfont}[1]{% +% \glsifcategory{\glslabel}{general}{\textsf{#1}}{#1}} + +% or limit to a particular attribute: + +%\glssetcategoryattribute{general}{font}{sf} +%\glssetcategoryattribute{acronym}{font}{sf} + +%\renewcommand*{\glsxtrregularfont}[1]{% +% \glsifattribute{\glslabel}{font}{sf}{\textsf{#1}}{#1}} + +% or use the attribute to store the font control sequence name: + +%\glssetcategoryattribute{general}{font}{textsf} +%\glssetcategoryattribute{acronym}{font}{emph} +% +%\renewcommand*{\glsxtrregularfont}[1]{% +% \glshasattribute{\glslabel}{font}% +% {\csuse{\glsgetattribute{\glslabel}{font}}{#1}}% +% {#1}% +%} + +% The following will make the first letter of the name upper case +% in the glossary for the general entries: +\glssetcategoryattribute{general}{glossname}{firstuc} + +% The following will make the first letter of the description upper case +% in the glossary for the general entries: +\glssetcategoryattribute{general}{glossdesc}{firstuc} + +% (version 1.04+) The following will make the description +% appear in italic in the glossary for general entries: + +%\glssetcategoryattribute{general}{glossdescfont}{emph} + +% (version 1.04+) The following will make the name +% appear in italic in the glossary for general entries: + +%\glssetcategoryattribute{general}{glossnamefont}{emph} + +\newglossaryentry{duck}{name=duck,% + description={a waterbird with webbed feet}} + +\newglossaryentry{parrot}{name=parrot,% + description={mainly tropical bird with bright plumage}} + +% acronyms: + +% The following redefinition will add the provided text to the end of the +% description in the glossary. + +\renewcommand*{\glsxtrpostdescacronym}{% + \space(\textsc{acronym:} \glsentrylong{\glscurrententrylabel})% +} + +% The following will make the first letter of the name upper case +% in the glossary for the acronym entries: +\glssetcategoryattribute{acronym}{glossname}{firstuc} + +% The following will make the first letter of the description upper case +% in the glossary for the acronym entries: +\glssetcategoryattribute{acronym}{glossdesc}{firstuc} + +% Enable tagging of initials. The second argument is the name of +% the command you want to use to tag initial letters. The +% command will be defined robustly and will only be activated +% in the glossary for the categories listed in the first +% argument. +% If the specified tagging command (\itag here) is used +% anywhere else it will just do its argument. +\GlsXtrEnableInitialTagging{acronym,abbreviation}{\itag} + +\newacronym[description={a device that emits a narrow intense +beam of light}]{laser}{laser} +{\itag{l}ight \itag{a}mplification by \itag{s}timulated +\itag{e}mission of \itag{r}adiation} + +\newacronym[description={a form of \gls{laser} generating a beam of +microwaves}]{maser}{maser} +{\itag{m}icrowave \itag{a}mplification by \itag{s}timulated +\itag{e}mission of \itag{r}adiation} + +\newacronym[description={a system for detecting the location and +speed of ships, aircraft, etc, through the use of radio waves}]{radar}{radar} +{\itag{ra}dio \itag{d}etection \itag{a}nd \itag{r}anging} + +\newacronym[description={portable breathing apparatus for divers}]{scuba}{scuba} +{\itag{s}elf-\itag{c}ontained \itag{u}nderwater +\itag{b}reathing \itag{a}pparatus} + +% The following redefinition will add the provided text to the end of the +% description in the glossary. + +\renewcommand*{\glsxtrpostdescabbreviation}{% + \space (abbreviation)% +} + +% The following will set the description in title case +% in the glossary for the abbreviations: +\glssetcategoryattribute{abbreviation}{glossdesc}{title} + +% The following will convert the abbreviations to all capitals +% in the glossary: +\glssetcategoryattribute{abbreviation}{glossname}{uc} + +% Use \textsc in the abbreviations: +\setabbreviationstyle{long-short-sc} + +% Some other attributes you might want to try: + +% Use 's (apostrophe s) for the plural suffix +% (only affects the short plural not the long plural) +%\glssetcategoryattribute{abbreviation}{aposplural}{true} + +% Suppress the default suffix for the short plural. +% (Don't use with the above for the same category.) +%\glssetcategoryattribute{abbreviation}{noshortplural}{true} + +% abbreviations: + +\newabbreviation + {html}% identifying label + {html}% short form + {\itag{h}yper\itag{t}ext \itag{m}arkup \itag{l}anguage}% long form + +\newabbreviation + {xml}% identifying label + {xml}% short form + {e\itag{x}tensible \itag{m}arkup \itag{l}anguage}% long form + +\newabbreviation + {svg}% identifying label + {svg}% short form + {\itag{s}calable \itag{v}ector \itag{g}raphics}% long form + +\newabbreviation + {svm}% identifying label + {svm}% short form + {\itag{s}upport \itag{v}ector \itag{m}achine}% long form + +\title{Sample Document Illustrating the glossaries-extra Package} +\author{Nicola Talbot} + +\begin{document} +\pagenumbering{alph} +\maketitle + +\pagenumbering{roman} +\tableofcontents + +\pagenumbering{arabic} +\chapter{Categories} + +The \texttt{glossaries-extra} package provides an extra key called +\texttt{category}, which is used to assign a category to each entry. +For example, the category for the ``duck'' entry is: +\glscategory{duck}. + +The category value is just a label, which needs to be expandable, so +make sure you avoid problematic characters in it. You can test the +category with \verb|\glsifcategory|. + +The entry ``duck'' \glsifcategory{duck}{general}{is}{isn't} a +general entry. +The entry ``laser'' \glsifcategory{laser}{general}{is}{isn't} a +general entry. + +A category can have attributes set. For example, both the +``general'' category and the ``acronym'' category have the attribute +``regular'' set to ``true''. + +You can obtain the value of an attribute for a given category with +\begin{verbatim} +\glsgetcategoryattribute{category}{attribute} +\end{verbatim} +This does nothing if the category +or attribute aren't defined. + +Category ``general'' has the attribute ``regular'' set to +``\glsgetcategoryattribute{general}{regular}''. +Category ``acronym'' has the attribute ``regular'' set to +``\glsgetcategoryattribute{acronym}{regular}''. +Category ``abbreviation'' has the attribute ``regular'' set to +``\glsgetcategoryattribute{abbreviation}{regular}''. + +You can test if a category has an attribute set to a given value +with +\begin{verbatim} +\glsifcategoryattribute{category}{attribute}{value}{true code}{false +code} +\end{verbatim} + +Category ``general'' +\glsifcategoryattribute{general}{regular}{true}{has}{doesn't have} +the ``regular'' attribute set to ``true''. +Category ``acronym'' +\glsifcategoryattribute{acronym}{regular}{true}{has}{doesn't have} +the ``regular'' attribute set to ``true''. +Category ``abbreviation'' +\glsifcategoryattribute{abbreviation}{regular}{true}{has}{doesn't have} +the ``regular'' attribute set to ``true''. + +\chapter{Regular Terms} + +By default glossary entries have the category ``general''. +For +example\glsforeachincategory{general}{\thistype}{\thislabel}{, +\gls{\thislabel}} have the category field set to ``general''. + +Commands like \verb|\newabbreviation| and \verb|\newacronym| +override this. + +Regular terms are those entries whose category has the ``regular'' +attribute set to ``true''. There's a convenient shortcut to +determine if an entry has a category with the ``regular'' attribute +set: +\begin{verbatim} +\glsifregular{entry-label}{true code}{false code} +\end{verbatim} + +For example: \gls{duck} \glsifregular{duck}{is}{isn't} a regular +term; +\gls{laser} \glsifregular{laser}{is}{isn't} a regular +term. + +The regular attribute determines what \verb|\gls| (and plural and +case-changing variants) should do. A regular entry (even if +it's been defined using \verb|\newacronym| or +\verb|\newabbreviation|) uses the \texttt{first} (or +\texttt{firstplural}) key on first use and the \texttt{text} +(or \texttt{plural}) key on subsequent use. + +An abbreviation whose category doesn't have the regular attribute +set to ``true'' will use the abbreviation style assigned +to that category for first and subsequent use, which will use +the values of the \texttt{long} (or \texttt{longplural}) +and \texttt{short} (or \texttt{shortplural}) keys. +The first use of \verb|\gls| may or may not match \verb|\glsfirst| +for non-regular entries, depending on the abbreviation style. + +\chapter{Abbreviations} + +Abbreviations include acronyms, initialisms and contractions. +Some abbreviation styles may set category attributes. +For example, the ``short'' style sets the ``regular'' attribute for +the category used by the abbreviations with that style applied. +Whereas the ``long-short'' style will switch off the ``regular'' attribute +if it has previously been switched on. +Styles must be set before defining abbreviations, but you may set +different styles for different categories. + +For example, by default the ``short'' style is set for abbreviations +with the ``acronym'' category using: +\begin{verbatim} +\setabbreviationstyle[acronym]{short} +\end{verbatim} +whereas the ``short-long'' style is set for abbreviations with the +``abbreviation'' category: +\begin{verbatim} +\setabbreviationstyle{long-short} +\end{verbatim} +(The optional argument defaults to ``abbreviation''.) + +If no style has been set for a particular category, the style for the +``abbreviation'' category is used instead. + +\section{Acronyms} + +An acronym is a word formed from the initial letters of other words. +Since it's a word, an acronym is pronounced as a word rather than as +a series of letters. Examples of acronyms: \gls{laser}, \gls{maser}, +\gls{radar} and \gls{scuba}. + +Since acronyms are treated as words, the ``acronym'' category +has the ``regular'' attribute set to ``true''. The default +abbreviation style for acronyms is ``short'', which doesn't expand +the entry on first use. + +The description defaults to the long +form with the ``short'' style. This example document overrides +the default description by using the \texttt{description} +key in the optional argument of \verb|\newacronym|. This +document also sets the post description hook +(\verb|\glsxtrpostdescacronym|) to insert the long form in +parentheses after the description when it's displayed in the glossary. + +\section{Initialism} + +Initialisms are formed from initial letters of words where the +letters are sounded out. Examples of initialisms: +\gls{svm}, \gls{html}, \gls{svg} and \gls{xml}. + +The \texttt{glossaries-extra} package sets the default abbreviation +style to \texttt{long-short}. This document has changed it to +\texttt{long-short-sc} (use small caps). Next use: +\gls{svm}, \gls{html}, \gls{svg} and \gls{xml}. + +Note that the acronyms (like \gls{laser}) don't use small caps. +This is because the acronyms and initialisms have separate styles +applied since they are in separate categories. + +\section{Plurals} + +The default plural for the short form is obtained by appending +the abbreviation plural suffix to the singular form. You can +override this on a per-entry basis using the \texttt{shortplural} +key in the optional argument of \verb|\newabbreviation| +(or \verb|\newacronym|) or you can prevent the suffix from +being added to all entries in a particular category (or categories) +by setting the \texttt{noshortplural} attribute to ``true'' for +the relevant category (before defining the entries). + +Alternatively you can automatically insert an apostrophe before +the plural suffix by setting the \texttt{aposplural} attribute to +``true''. The \texttt{aposplural} attribute overrides the +\texttt{noshortplural} attribute. + +Plurals: \glspl{svm}, \glspl{laser}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-name-font.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-name-font.pdf new file mode 100644 index 0000000000..83b5b168d8 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-name-font.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-name-font.tex b/macros/latex/contrib/glossaries-extra/samples/sample-name-font.tex new file mode 100644 index 0000000000..169b28e9c2 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-name-font.tex @@ -0,0 +1,355 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex +\documentclass[fontsize=10pt,open=any]{scrbook} + +\usepackage[T1]{fontenc} +\usepackage{tgtermes} +\usepackage{xcolor} +\usepackage{siunitx} +\usepackage[hidelinks]{hyperref} +\usepackage[nopostdot=false,% don't suppress the post-description dot + stylemods=longragged,% load glossary-longragged.sty and glossaries-extra-stylemods.sty + style=longragged3col,% set the glossary style + nogroupskip% don't have a gap between groups +]{glossaries-extra} + +% KOMA class alterations (the default sans-serif clashes +% with the smallcaps font in the headings examples) +\setkomafont{disposition}{\normalcolor\bfseries} + +\pagestyle{headings} + +% Need a wider column for the location list: +\setlength{\glspagelistwidth}{0.12\textwidth} + +% Adjust the description column width if necessary: +%\setlength{\glsdescwidth}{0.5\textwidth} + +% Default font for name field in the glossary. This may be +% overridden by the category attributes: +\renewcommand*{\glsnamefont}[1]{\textbf{#1}} + +\makeglossaries + +% Define some semantic commands: +\newcommand*{\animalfont}[1]{\textcolor{brown}{#1}} +\newcommand*{\vegetablefont}[1]{\textcolor{teal}{#1}} +\newcommand*{\mineralfont}[1]{\textcolor{violet}{#1}} +\newcommand*{\myacronymfont}[1]{\textcolor{orange}{#1}} +\newcommand*{\bacteriafont}[1]{\textcolor{green}{#1}} +\newcommand*{\unitfont}[1]{\textcolor{blue}{#1}} +\newcommand*{\constantfont}[1]{\textcolor{magenta}{#1}} + +% Make the first letter of the name field uppercase in the glossary +% for the given categories: + +\glssetcategoryattribute{animal}{glossname}{firstuc} +\glssetcategoryattribute{mineral}{glossname}{firstuc} +\glssetcategoryattribute{vegetable}{glossname}{firstuc} + +% Make the name field in the glossary use a font changing command +% (overrides \glsnamefont). In this example, I'm using the semantic +% commands I defined above. The backslash is omitted. + +\glssetcategoryattribute{animal}{glossnamefont}{animalfont} +\glssetcategoryattribute{mineral}{glossnamefont}{mineralfont} +\glssetcategoryattribute{vegetable}{glossnamefont}{vegetablefont} +\glssetcategoryattribute{acronym}{glossnamefont}{myacronymfont} +\glssetcategoryattribute{bacteria}{glossnamefont}{bacteriafont} +\glssetcategoryattribute{unit}{glossnamefont}{unitfont} +\glssetcategoryattribute{constant}{glossnamefont}{constantfont} + +% Modify the font used for the description in the glossary: +%\glssetcategoryattribute{bacteria}{glossdescfont}{textsf} + +% Modify the way commands like \gls display regular terms according +% to attribute. + +\glssetcategoryattribute{general}{font}{textsf} +\glssetcategoryattribute{mineral}{font}{mineralfont} +\glssetcategoryattribute{animal}{font}{animalfont} +\glssetcategoryattribute{vegetable}{font}{vegetablefont} +\glssetcategoryattribute{acronym}{font}{myacronymfont} +\glssetcategoryattribute{unit}{font}{unitfont} +\glssetcategoryattribute{constant}{font}{constantfont} + +% I can't add one of the above for the "abbreviation" or "bacteria" +% category as they aren't considered regular entries. (They use +% one of the abbreviation styles that sets the "regular" attribute +% to "false".) +\glssetcategoryattribute{bacteria}{font}{bacteriafont}% ignored! +% If the abbreviation style for "bacteria" is changed to, say, +% "short-em", the attribute won't be ignored. + +% Adjust \glsxtrregularfont so that it picks up the appropriate +% command from the "font" attribute (set above). +\renewcommand*{\glsxtrregularfont}[1]{% + \glshasattribute{\glslabel}{font}% + {\csuse{\glsgetattribute{\glslabel}{font}}{#1}}% + {#1}% +} + +\newglossaryentry{duck}{name=duck, + category={animal}, + description={a waterbird with webbed feet}} + +\newglossaryentry{parrot}{name=parrot, + category={animal}, + description={mainly tropical bird with bright plumage}} + +\newglossaryentry{cabbage}{name=cabbage, + category={vegetable}, + description={vegetable with thick green or purple leaves}} + +\newglossaryentry{brocolli}{name=brocolli, + category={vegetable}, + description={vegetable with heads of small green or purple flower +buds}} + +\newglossaryentry{quartz}{name=quartz, + category=mineral, + description={hard mineral consisting of silica}} + +\newglossaryentry{corundum}{name=corundum, + category=mineral, + description={crystalline form of aluminium oxide}} + +% The following doesn't have the category explicitly set, so it +% defaults to "general": + +\newglossaryentry{loremipsum}{name={lorem ipsum}, + description={dummy text}} + +% The following set the category to "unit": + +\newglossaryentry{ohm}{name=ohm,symbol={\si{\ohm}}, +category=unit, +description=unit of electrical resistance} + +\newglossaryentry{angstrom}{name={\aa}ngstr\"om, +category=unit, +symbol={\si{\angstrom}},sort=angstrom, +description={non-SI unit of length}} + +% The selected style doesn't display the symbol +% so add it to the post-name hook: +\newcommand*{\glsxtrpostnameunit}{ (\glsentrysymbol{\glscurrententrylabel})} + +% Insert the symbol after commands like \gls but only on first use +% (and only for the "unit" category): + +\newcommand*{\glsxtrpostlinkunit}{% + \ifdefempty\glscustomtext{\glsxtrpostlinkAddSymbolOnFirstUse}{}} +% The above "post-link" hook occurs after the link-text produced by +% \gls so it's place outside the \unitfont argument. + +% Mathematic constants need the "sort" key set because the "name" +% field contains commands: +\newglossaryentry{pi}{name={\ensuremath{\pi}}, +sort=pi, +category=constant, +user1=pi, +description={ratio of a circle's circumference to its diameter}} + +% Insert the description and "user1" text after commands like \gls but only on first use +% (and only for the "constant" category): + +\newcommand*{\glsxtrpostlinkconstant}{% + \ifdefempty\glscustomtext + {\glsxtrifwasfirstuse{ (\glsentryuseri{\glslabel}, + \glsentrydesc{\glslabel})}{}}% + {}} + +% Insert the "user1" text after the description in the glossary +% but only for the "constant" category: +\newcommand*{\glsxtrpostdescconstant}{\space + (\glsentryuseri{\glscurrententrylabel})} + +% \newacronym sets the category to "acronym" by default. The +% "short-em" style makes it a regular entry. +\setabbreviationstyle[acronym]{short-em} + +\newacronym{laser}{laser}{light amplification by +stimulated emission of radiation} + +\newacronym{scuba}{scuba}{self-contained underwater breathing +apparatus} + +% \newabbreviation sets the category to "abbreviation" by default. +% The "long-short-sc" style sets the regular attribute to false. +\setabbreviationstyle{long-short-sc} + +\newabbreviation{html}{html}{hypertext markup language} + +\newabbreviation{svg}{svg}{scalable vector graphics} + +% The optional argument can be used to set a different category: +\setabbreviationstyle[bacteria]{long-em-short-em} +%\setabbreviationstyle[bacteria]{short-em} + +% An alternative approach that uses \bacteriafont in the document +% and in the glossary is to provide a custom style: +%\newabbreviationstyle{bacteria}% +%{% +% \GlsXtrUseAbbrStyleSetup{long-short}% +%}% +%{% +% \GlsXtrUseAbbrStyleFmts{long-short}% +% \renewcommand*{\glsabbrvfont}[1]{\bacteriafont{##1}}% +% \renewcommand*{\glsfirstlongfont}[1]{\bacteriafont{##1}}% +% \renewcommand*{\glslongfont}[1]{\bacteriafont{##1}}% +%} +% (the definition of \bacteriafont would need to be adjusted to +% include \emph) +%\setabbreviationstyle[bacteria]{bacteria} + +\newabbreviation[category=bacteria]% + {cbot}% label + {C.~botulinum}% short + {Clostridium botulinum}% long + +\newabbreviation[category=bacteria]% + {putida}% label + {P.~putida}% short + {Pseudomonas putida}% long + +% Abbreviations that have translations. These put the translated +% text in the "user1" field. The "-user" abbreviation styles +% insert this field (if present) into the parenthetical material +% when used with \gls. + +\setabbreviationstyle[foreign]{short-long-user} + +% The fonts used by this style can be adjusted: +\renewcommand*{\glsabbrvuserfont}[1]{\textsf{\color{red}#1}}% short-form font +\renewcommand*{\glslonguserfont}[1]{\textsf{#1}}% long-form font + +\newabbreviation[category=foreign,user1={French \TeX\ user group}] + {gutenberg}{GUTenburg}{Groupe francophone des utilisateurs de \TeX} + +% Insert the translation (user1) text after the description +% in the glossary but only for the "foreign" category: +\newcommand*{\glsxtrpostdescforeign}{\space + (Translation: \glsentryuseri{\glscurrententrylabel})} + +% Now we have an awkward one that ends with a period: +\setabbreviationstyle[foreignenddot]{short-long-user} + +% Need to discard the end of sentence period for the +% entries in this category. + +\glssetcategoryattribute{foreignenddot}{discardperiod}{true} + +% But not on first use (the user1 text doesn't end with a +% period): +\glssetcategoryattribute{foreignenddot}{retainfirstuseperiod}{true} + +\newabbreviation + [user1={German Speaking \TeX\ User Group},category=foreignenddot] + {dante}{DANTE e.V.}{Deutschsprachige Anwendervereinigung \TeX\ e.V.} + +% Insert the translation (user1) text after the description +% in the glossary but only for the "foreignenddot" category: +\newcommand*{\glsxtrpostdescforeignenddot}{\space + (Translation: \glsentryuseri{\glscurrententrylabel})} + +% Insert page/pages tag before location list: +\GlsXtrEnablePreLocationTag{Page: }{Pages: } + +\begin{document} +\tableofcontents + +\chapter{Samples in the Main Document Text} + +\section{All Entries} + +First use (\verb|\gls|): \forglsentries{\thislabel}{\gls{\thislabel}. } + +Next use (\verb|\gls|): \forglsentries{\thislabel}{\gls{\thislabel}. } + +Using \verb|\glsfirst|: \forglsentries{\thislabel}{\glsfirst{\thislabel}. } + +Using \verb|\glstext|: \forglsentries{\thislabel}{\glstext{\thislabel}. } + +\section{Abbreviations only} +Abbreviations that have the \verb|regular| attribute set are +hybrids and can have odd results. In this example, the hybrid +entries are: +\forglsentries{\thislabel}{% + \ifglshasshort{\thislabel}% + {% is an abbreviation + \glsifregular{\thislabel}% + {% is regular + \texttt{\thislabel}. + }% + {}% + } + {}% +} + +Using \verb|\glsxtrfull|: +\forglsentries{\thislabel}{% + \ifglshasshort{\thislabel}{\glsxtrfull{\thislabel}. }{}} + +Using \verb|\glsxtrshort|: +\forglsentries{\thislabel}{% + \ifglshasshort{\thislabel}{\glsxtrshort{\thislabel}. }{}} + +Using \verb|\glsxtrlong|: +\forglsentries{\thislabel}{% + \ifglshaslong{\thislabel}{\glsxtrlong{\thislabel}. }{}} + +\section{Symbols} + +Using \verb|\glssymbol|: +\forglsentries{\thislabel}{% + \ifglshassymbol{\thislabel}{\glssymbol{\thislabel}. }{}} + +\section{User Field} + +Using \verb|\glsuseri|: +\forglsentries{\thislabel}{% + \ifglshasfield{useri}{\thislabel}{\glsuseri{\thislabel}[.] }{}} + +(The full stop in the above is placed inside square brackets +to prevent the \verb|discardperiod| attribute from discarding it +since the \verb|useri| field doesn't end with a dot.) + +\chapter{Math Mode} +Inline: $\gls{pi} = \frac{C}{d}$, display: + +\[ + \gls{pi} = \frac{C}{d} +\] + +\chapter{Samples in Headings} + +Don't use commands like \verb|\gls| in section headings, but you can +use commands like \verb|\glsfmttext| or \verb|\glsfmtshort|. + +\forglsentries{\thislabel}{% + \ifglshasshort{\thislabel}% + {\section{\glsfmtshort{\thislabel}}}% + {% +% the constant entry "pi" can't be used in the PDF bookmarks, +% so use the user1 text for the bookmark + \glsifcategory{\thislabel}{constant} + {% + \section{\texorpdfstring{\glsfmttext{\thislabel}}{\glsentryuseri{\thislabel}}}% + }% + {% + \section{\glsfmttext{\thislabel}}% + }% + }% + \Glsdesc[noindex]{\thislabel}. +} + + +\renewcommand{\glossarypreamble}{\emph{This glossary uses the style +`\csuse{@glossary@default@style}' with modifications made +through categories and their attributes.}\par\medskip} +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-nested.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-nested.pdf new file mode 100644 index 0000000000..da7a9f2d44 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-nested.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-nested.tex b/macros/latex/contrib/glossaries-extra/samples/sample-nested.tex new file mode 100644 index 0000000000..a7c32a6908 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-nested.tex @@ -0,0 +1,46 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\setabbreviationstyle{long-short-sc} + +\newabbreviation{ssi}{ssi}{server side includes} +\newabbreviation{html}{html}{hypertext markup language} + +%DON'T use this with upper casing commands! +\newabbreviation{shtml}{shtml}{\gls{ssi} enabled \gls{html}} + +% Alternatively +%\newabbreviation{shtml}{shtml}{\glsxtrshort{ssi} enabled \glsxtrshort{html}} + +% Or +%\newabbreviation{shtml}{shtml}{\glsps{ssi} enabled \glsps{html}} +% (optional) enable indexing when \glsps occurs in glossary: +%\renewcommand{\glossxtrsetpopts}{\glsxtrsetpopts{noindex=false}} + +\begin{document} + +This is a sample document testing nested link text. +The \texttt{glossaries-extra} package temporarily modifies +commands like \verb|\gls| or \verb|\glsxtrshort| that occur +in fields, when any of those field is accessed through linking +commands. + +First use: \gls{shtml}. + +\newpage + +Next use: \gls{shtml}. + +\newpage + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.pdf new file mode 100644 index 0000000000..d2a571a233 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.tex b/macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.tex new file mode 100644 index 0000000000..da909b222f --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-noidx-restricteddocdefs.tex @@ -0,0 +1,33 @@ +% arara: pdflatex +% arara: pdflatex +\documentclass{article} + +\usepackage[ + docdef=restricted, + undefaction=warn + ]{glossaries-extra} + +\makenoidxglossaries + +\begin{document} +\newglossaryentry{sample}{name={sample},description={an example}} + +\gls{sample}. + +\verb|\printnoidxglossaries| follows: +\printnoidxglossaries + +Too late to define an entry with the \texttt{docdef=restricted} +setting. (Definitions must come before \verb|\printglossary|.) + +\newglossaryentry{sample2}{name={sample2},description={another +example}} + +New entry just defined: \gls{sample2}. +This will cause an error (or warning with \texttt{undefaction=warn}) +in \verb|\printnoidxglossaries|. +This missing entry will cause a missing entry marker ?? +at the start of the glossary (before the header). + + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onelink.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-onelink.pdf new file mode 100644 index 0000000000..80898cefa1 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-onelink.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onelink.tex b/macros/latex/contrib/glossaries-extra/samples/sample-onelink.tex new file mode 100644 index 0000000000..1d9a71876c --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-onelink.tex @@ -0,0 +1,49 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage{lipsum} +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\GlsXtrEnableEntryUnitCounting{general}{0}{page} + +\newglossaryentry{sample}{name={sample},description={an example}} +\newglossaryentry{sample2}{name={another sample},description={another example}} + +\renewcommand*{\glslinkcheckfirsthyperhook}{% + \ifnum\glsentrycurrcount\glslabel>0 + \setkeys{glslink}{hyper=false}% + \fi +} + +\begin{document} + +A \gls{sample} entry. \Gls{sample2}. +Next use: \gls{sample}, \gls{sample2}. + +\lipsum[1] + +\Gls{sample} and more \glspl{sample}. +\Gls{sample2} and \gls{sample2}. + +\newpage + +Next page: \gls{sample} and \gls{sample2}. + +Again: \gls{sample} and \gls{sample2}. + +\lipsum[2-5] + +Now for a \gls{sample} paragraph that spans the page break. +\lipsum*[6-7] The entry in the final sentence in this \gls{sample} paragraph +is incrementing and testing the count from the previous page. + +Another \gls{sample} paragraph. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.pdf new file mode 100644 index 0000000000..1daeb9987c Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.tex b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.tex new file mode 100644 index 0000000000..51b91b2530 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-utf8.tex @@ -0,0 +1,60 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[xindy]{glossaries-extra} + +\makeglossaries + +% The starred version will attempt to allow UTF8 characters +% in the label, but this may fail! +\GlsXtrEnableOnTheFly* + +\begin{document} +This is a \glsxtr{sample} document illustrating on-the-fly +simultaneous \glsxtr{definition} and \glsxtr{usage} +for \glsxtr[format=textbf][plural=glossaries]{glossary} +\glsxtrpl[][plural=entries]{entry}. This has +drawbacks and it's really much better to define entries in the +\glsxtr{preamble}, but you may find it useful for simple +indexing. + +\newpage + +\Glsxtr{preamble} \glsxtrpl{definition} are much better, +but here is a \glsxtr{sample} of what you can do. + +\newpage +The \glsxtrpl{glossary} must come at the end of the document +with this usage. + +\newpage +Commands can't occur in the label. The ``name'' key has to be +used instead, but the starred version of +\verb|\GlsXtrEnableOnTheFly| attempts to allow non-ASCII +characters in the label, but this may break some commands, +so take care! + +The \glsxtr{naïve} +\glsxtr[][plural={phœnixes}]{phœnix} sent +off its \glsxtr{résumé} covered in +\glsxtr{pâté} from the \glsxtr{soirée}. + +Terms that contain commands must have the ``name'' set and the +command removed from the label +\glsxtr[][name={\emph{e.g.}}]{eg} like this, but +really it's much better to define the entry in the preamble +and use the standard \verb|\gls| instead. + +\newpage +The previous page presupposes the existence of +\glsxtrpl{phœnix}. + +\newpage + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.pdf new file mode 100644 index 0000000000..98df08cb26 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.tex b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.tex new file mode 100644 index 0000000000..2ca31d1354 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly-xetex.tex @@ -0,0 +1,55 @@ +% arara: xelatex +% arara: makeglossaries +% arara: xelatex +\documentclass{article} + +\usepackage{fontspec} +\usepackage[xindy]{glossaries-extra} + +\makeglossaries + +\GlsXtrEnableOnTheFly + +\begin{document} +This is a \glsxtr{sample} document illustrating on-the-fly +simultaneous \glsxtr{definition} and \glsxtr{usage} +for \glsxtr[format=textbf][plural=glossaries]{glossary} +\glsxtrpl[][plural=entries]{entry}. This has +drawbacks and it's really much better to define entries in the +\glsxtr{preamble}, but you may find it useful for simple +indexing. + +\newpage + +\Glsxtr{preamble} \glsxtrpl{definition} are much better, +but here is a \glsxtr{sample} of what you can do. + +\newpage +The \glsxtrpl{glossary} must come at the end of the document +with this usage. + +\newpage +Commands can't occur in the label. The ``name'' key has to be +used instead, but XeTeX makes life a bit easier for non-ASCII +characters. + +The \glsxtr{naïve} +\glsxtr[][plural={phœnixes}]{phœnix} sent +off its \glsxtr{résumé} covered in +\glsxtr{pâté} from the \glsxtr{soirée}. + +Terms that contain commands must have the ``name'' set and the +command removed from the label +\glsxtr[][name={\emph{e.g.}}]{eg} like this, but +really it's much better to define the entry in the preamble +and use the standard \verb|\gls| instead. + +\newpage +The previous page presupposes the existence of +\glsxtrpl{phœnix}. + +\newpage + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onthefly.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly.pdf new file mode 100644 index 0000000000..1d60fe8175 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-onthefly.tex b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly.tex new file mode 100644 index 0000000000..8431c6abe2 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-onthefly.tex @@ -0,0 +1,50 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage{glossaries-extra} + +\makeglossaries + +\GlsXtrEnableOnTheFly + +\begin{document} +This is a \glsxtr{sample} document illustrating on-the-fly +simultaneous \glsxtr{definition} and \glsxtr{usage} +for \glsxtr[format=textbf][plural=glossaries]{glossary} +\glsxtrpl[][plural=entries]{entry}. This has +drawbacks and it's really much better to define entries in the +\glsxtr{preamble}, but you may find it useful for simple +indexing. + +\newpage + +\Glsxtr{preamble} \glsxtrpl{definition} are much better, +but here is a \glsxtr{sample} of what you can do. + +\newpage +The \glsxtrpl{glossary} must come at the end of the document +with this usage. + +\newpage +Commands can't occur in the label. The ``name'' key has to be +used instead. Isn't this fiddly and not really worth the +effort. May as well just define all the \glspl{entry} in the +\glsxtr{preamble} instead. + +The \glsxtr[][name={na\"{\i}ve}]{naive} +\glsxtr[][plural={ph\oe nixes},name={ph\oe nix}]{phoenix} sent +off its \glsxtr[][name={r\'esum\'e}]{resume} covered in +\glsxtr[][name={p\^at\'e}]{pate} from +the \glsxtr[][name={soir\'ee}]{soiree}. + +\newpage +The previous page presupposes the existence of +\glsxtrpl{phoenix}. + +\newpage + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-pages.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-pages.pdf new file mode 100644 index 0000000000..97cb891003 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-pages.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-pages.tex b/macros/latex/contrib/glossaries-extra/samples/sample-pages.tex new file mode 100644 index 0000000000..bb1722f9d7 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-pages.tex @@ -0,0 +1,34 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex +\documentclass{report} + +\usepackage[nopostdot=false]{glossaries-extra} + +\makeglossaries + +\GlsXtrEnablePreLocationTag{Page: }{Pages: } + +\newglossaryentry{sample1}{name={sample1},description={an example}} +\newglossaryentry{sample2}{name={sample2},description={another example}} +\newglossaryentry{sample3}{name={sample3},description={a third example}} + +\newglossaryentry{sample4}{name={sample4},description={a fourth example}} +\glsadd[format=glsignore]{sample4} + +\begin{document} +\chapter{First} + +Two entries: \gls{sample1}, \gls{sample2}. + +\chapter{Second} + +One entry: \gls{sample1}. + +\chapter{Third} + +All entries: \gls{sample1}, \gls{sample2}, \gls{sample3}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-postdot.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-postdot.pdf new file mode 100644 index 0000000000..5193bfe0bd Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-postdot.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-postdot.tex b/macros/latex/contrib/glossaries-extra/samples/sample-postdot.tex new file mode 100644 index 0000000000..c54e3dcede --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-postdot.tex @@ -0,0 +1,47 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +% Sample entry in the "general" category: + +\newglossaryentry{sample}{name={sample},description={an example}} + +\setabbreviationstyle[initialism]{short} + +% Set the attribute "insertdots" set to "true" to automatically +% insert periods between the letters in initialism: +\glssetcategoryattribute{initialism}{insertdots}{true} + +% This can cause a problem if any of the initialisms occur at the +% end of a sentence so set the attribute "discardperiod" set to "true": +\glssetcategoryattribute{initialism}{discardperiod}{true} + +\newabbreviation + [category=initialism,description={for example}] + {eg}{eg}{exempli gratia} + +% Now for an abbreviation without dots. This is strictly speaking +% also an initialism, but it's going to be assigned the standard +% "abbreviation" category: +\newabbreviation{html}{HTML}{hypertext markup language} +% (This will use the style currently set for the "abbreviation" +% category, which is the short-long style by default.) + +\begin{document} + +Entry occurs at the end of a sentence: \gls{eg}. +Entry occurs at the end of a sentence: \gls{sample}. +Entry occurs at the end of a sentence: \gls{html}. + +Entry \gls{eg} occurs in the middle of a sentence. +Entry \gls{sample} occurs in the middle of a sentence. +Entry \gls{html} occurs in the middle of a sentence. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-postlink.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-postlink.pdf new file mode 100644 index 0000000000..7e7448c361 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-postlink.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-postlink.tex b/macros/latex/contrib/glossaries-extra/samples/sample-postlink.tex new file mode 100644 index 0000000000..5993302b7c --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-postlink.tex @@ -0,0 +1,76 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[style=tree]{glossaries-extra} + +\makeglossaries + +% Append the description in parentheses on first use +% for entries with the "describe" category: + +\glssetregularcategory{describe} + +\newcommand*{\glsxtrpostlinkdescribe}{% + \glsxtrpostlinkAddDescOnFirstUse +} + +\newglossaryentry{sample1}{name={sample1}, + category=describe, + description={the first sample entry}} + +% Append the symbol in parentheses on first use for +% entries with the "symbol" category: + +\glssetregularcategory{symbol} + +\newcommand*{\glsxtrpostlinksymbol}{% + \glsxtrifwasfirstuse + {% + \space (denoted: \glsentrysymbol{\glslabel})% + }% + {}% +} + +\newglossaryentry{sample2}{name={sample2}, + symbol={\ensuremath{\mathcal{S}_2}}, + category=symbol, + description={the second sample entry}} + +% Append the description as a footnote for general entries +% on first use: + +%\newcommand*{\glsxtrpostlinkgeneral}{% +% \glsxtrifwasfirstuse{\footnote{\glsentrydesc{\glslabel}}}{}% +%} + +% or (defer footnote mark until after any following punctuation): + +\newcommand*{\glsxtrpostlinkgeneral}{% + \glsxtrifwasfirstuse + {\glsxtrdopostpunc{\footnote{\glsentrydesc{\glslabel}}}}% + {}% +} + +% Disable hyperlink of first use for those entries in the "general" +% category: + +\glssetcategoryattribute{general}{nohyperfirst}{true} + +\newglossaryentry{sample3}{name={sample3}, + description={the third sample entry}} + +\begin{document} + +First use: \gls{sample1}, \gls{sample2} and \gls{sample3}. + +Next use: \gls{sample1}, \gls{sample2} and \gls{sample3}. + +Value of first field (post-link hook is still used): \glsfirst{sample1}, \glsfirst{sample2} +and \glsfirst{sample3}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-prefix.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-prefix.pdf new file mode 100644 index 0000000000..196eeb389b Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-prefix.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-prefix.tex b/macros/latex/contrib/glossaries-extra/samples/sample-prefix.tex new file mode 100644 index 0000000000..7fa2f325fb --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-prefix.tex @@ -0,0 +1,24 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage{glossaries-extra} +\usepackage{glossaries-prefix} + +\makeglossaries + +\newabbreviation + [prefix={an\space}, + prefixfirst={a~}] + {svm}{SVM}{support vector machine} + +\begin{document} + +This is a sample document to test prefixes. +First use: \pgls{svm}. +Next use: \pgls{svm}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.pdf new file mode 100644 index 0000000000..23daf02f3c Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.tex b/macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.tex new file mode 100644 index 0000000000..94bce09132 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-record-nameref.tex @@ -0,0 +1,74 @@ +% arara: pdflatex +% arara: bib2gls +% arara: pdflatex +\documentclass{article} + +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[record=nameref,% use bib2gls with nameref information (requires bib2gls v1.8+) + equations,% switch to equation counter in numbered equations + floats,% switch to corresponding counter when in a float + counter=section,% use section as the default record counter + stylemods,% load glossaries-extra-stylemods.sty + style=index]{glossaries-extra} + +\GlsXtrLoadResources[ + % entries defined in example-glossaries-brief.bib and + % example-glossaries-symbols: + src={example-glossaries-brief,example-glossaries-symbols}, + sort={en-GB},% sort according to en-GB locale + %selection=all,% select all entries provided in the .bib file + loc-suffix% add default suffix (full stop) for location list + ] + +\begin{document} + +\Gls[counter=page]{dolor}. + +\section{Sample Section} + +\gls{dolor}, \gls{amet}. + +See \url{https://ctan.org/pkg/bib2gls} for converting +\texttt{.bib} to \texttt{.glstex} files. + +\section{Another Section} + +\glspl{lorem}, \gls{amet}. + +`Lorem' unused or undefined? \GlsXtrIfUnusedOrUndefined{lorem}{yes}{no}. + +\begin{figure}[hb] +\centering +X +\caption{Sample Figure \glsfmttext{lorem}} +\end{figure} + +\gls{lorem} again. + +\section{Yet Another Section} + +\Gls{lorem}, \gls{amet}, \gls{alpha}. + +\begin{equation} +\glssymbol{alpha} = 2\glssymbol[counter=page]{beta} +\end{equation} + +\gls{beta}. + +\begin{align} +\glssymbol{alpha} &= 2\glssymbol{beta}\\ +\glssymbol{gamma} &= \glssymbol{beta}[^2] = \frac{1}{4}\glssymbol{alpha}[^2] +\end{align} + +\newpage + +\Gls{lorem} and \gls[counter=page]{dolor}. + +\section{Section about \glsfmttext{lorem}} + +\Gls{lorem}. + +\printunsrtglossary + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-record.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-record.pdf new file mode 100644 index 0000000000..338bc55bb1 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-record.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-record.tex b/macros/latex/contrib/glossaries-extra/samples/sample-record.tex new file mode 100644 index 0000000000..95f7bf9811 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-record.tex @@ -0,0 +1,51 @@ +% arara: pdflatex +% arara: bib2gls +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[record,% use bib2gls + stylemods,% load glossaries-extra-stylemods.sty + style=index]{glossaries-extra} + +\GlsXtrRecordCounter{section} + +% suppress the space that normally occurs before the locations: +\renewcommand{\glsxtrprelocation}{} + +\GlsXtrLoadResources[ + src={example-glossaries-brief},% entries defined in example-glossaries-brief.bib + sort={en-GB},% sort according to en-GB locale + %selection=all,% select all entries provided in the .bib file + loc-prefix={{, page},{, pages}},% prefix for location list + loc-suffix% suffix for location list + ] + +\begin{document} + +\section{Sample Section} +\printunsrtglossaryunit[nonumberlist]{section} +% or: +%\printunsrtglossary*{\printunsrtglossaryunitsetup{section}% +% \renewcommand*{\glossarysection}[2][]{\subsection*{Summary}}% +%} + +\gls{dolor}, \gls{amet}. + +Check first use flag for `amet': \ifglsused{amet}{used}{not used}. +Check first use flag for `lorem': \ifglsused{lorem}{used}{not used}. +`Lorem' unused or undefined? \GlsXtrIfUnusedOrUndefined{lorem}{yes}{no}. + +See \url{https://ctan.org/pkg/bib2gls} for converting +\texttt{.bib} to \texttt{.glstex} files. + +\section{Another Section} +\printunsrtglossaryunit[nonumberlist]{section} + +\glspl{lorem}, \gls{amet}. + +`Lorem' unused or undefined? \GlsXtrIfUnusedOrUndefined{lorem}{yes}{no}. + +\printunsrtglossary + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.pdf new file mode 100644 index 0000000000..0662789138 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.tex b/macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.tex new file mode 100644 index 0000000000..b0ca68763b --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-restricteddocdefs.tex @@ -0,0 +1,33 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[docdef=restricted, + undefaction=warn + ]{glossaries-extra} + +\makeglossaries + +\begin{document} + +\newglossaryentry{sample}{name={sample},description={an example}} + +\gls{sample}. + +\printglossaries + +Too late to define an entry with the \texttt{docdef=restricted} +setting. (Definitions must come before \verb|\printglossary|.) + +\newglossaryentry{sample2}{name={sample2},description={another +example}} + +New entry just defined: \gls{sample2}. +This will cause an error (or warning with \texttt{undefaction=warn}) +in \verb|\printglossaries|. +This missing entry will be marked with two question marks ?? +in the glossary. + + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.pdf new file mode 100644 index 0000000000..67862dfd86 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.tex b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.tex new file mode 100644 index 0000000000..bb72a7ce1c --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-hyp.tex @@ -0,0 +1,29 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage + %[debug=showtargets]% requires glossaries.sty v4.32 + {glossaries-extra} + +%\renewcommand*{\glsshowtarget}[1]{\texttt{\small [#1]}} + +\makeglossaries + +\newglossaryentry{sample}{name={sample},description={an example}} + +\renewcommand{\thesection}{S.\arabic{section}} +\renewcommand{\theHsection}{\thepart.\thesection} + +\begin{document} +\part{Sample Part} +\section{Sample Section} + +\part{Another Part} +\section{Another Section} +\gls[counter=section]{sample}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.pdf new file mode 100644 index 0000000000..fd234df18b Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.tex b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.tex new file mode 100644 index 0000000000..e2de8bfbef --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main-hyp.tex @@ -0,0 +1,30 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\makeglossaries + +\glssetcategoryattribute{supplementary}{externallocation}{sample-suppl-hyp.pdf} + +\newglossaryentry{sample}{category={supplementary}, + name={sample},description={an example}} + +\begin{document} +\section{Sample} +Some \gls{sample} text. + +Test link: \hyperref{sample-suppl-hyp.pdf}{}{section.II.S.2}{S.2}. + +In this document, \verb|\theHsection| is in the form: \theHsection. + +In the other document, it's in the form II.S.2 so +\texttt{theHvalue} is needed to ensure the hyperlink is correct. + +\printglossaries +\glsadd[format=glsxtrsupphypernumber,thevalue={S.2},theHvalue={II.S.2},counter=section]{sample} +\end{document} + diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.pdf new file mode 100644 index 0000000000..5ca8b571c0 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.tex b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.tex new file mode 100644 index 0000000000..2945b55f81 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-suppl-main.tex @@ -0,0 +1,18 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage{glossaries-extra} + +\makeglossaries + +\newglossaryentry{sample}{name={sample},description={an example}} + +\begin{document} +Some \gls{sample} text. + +\printglossaries +\glsadd[thevalue={S.2}]{sample} +\end{document} + diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-suppl.pdf new file mode 100644 index 0000000000..a78c307b62 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-suppl.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-suppl.tex b/macros/latex/contrib/glossaries-extra/samples/sample-suppl.tex new file mode 100644 index 0000000000..6b295688fc --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-suppl.tex @@ -0,0 +1,14 @@ +% arara: pdflatex +\documentclass{article} + +\usepackage{glossaries-extra} + +\newglossaryentry{sample}{name={sample},description={an example}} + +\renewcommand{\thepage}{S.\arabic{page}} + +\begin{document} +First page. +\newpage +\gls{sample}. +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-trans.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-trans.pdf new file mode 100644 index 0000000000..c7a5afbce6 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-trans.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-trans.tex b/macros/latex/contrib/glossaries-extra/samples/sample-trans.tex new file mode 100644 index 0000000000..041dc24e48 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-trans.tex @@ -0,0 +1,54 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{article} + +\usepackage[T1]{fontenc} +\usepackage[colorlinks]{hyperref} +\usepackage[nogroupskip]{glossaries-extra} + +\makeglossaries + +\setabbreviationstyle[acronym]{long-short-user} + +% Translations are stored in the user1 key in the sample file +% (loaded below). +% This is the default for the long-short-user style so +% \glsxtruserfield doesn't need changing, but let's illustrate +% changing the font style for the short form: + +\renewcommand{\glsabbrvuserfont}[1]{\textsc{\MakeLowercase{#1}}} +\renewcommand*{\glsxtrusersuffix}{\glsxtrscsuffix} + +\loadglsentries{example-glossaries-acronyms-lang} + +% The entries in the above file are all defined using +% \newacronym, which automatically sets the category +% to "acronym" (which is why the abbreviation style needs +% to use "acronym" in the optional argument). The glossary +% can be adapted by using the post-description hook for this +% category. + +% \glscurrentfieldvalue only works with glossaries v4.23 (and above) +\renewcommand{\glsxtrpostdescacronym}{% + \ifglshasfield{\glsxtruserfield}{\glscurrententrylabel}% + { (English: \glscurrentfieldvalue)}% + {}% +} + +\begin{document} + +\section{Sample} + +First use: + +\forglsentries{\thislabel}{\gls{\thislabel}. } + +Next use: + +\forglsentries{\thislabel}{\gls{\thislabel}. } + +\printglossaries + +\end{document} + diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-undef.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-undef.pdf new file mode 100644 index 0000000000..f5ce99c373 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-undef.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-undef.tex b/macros/latex/contrib/glossaries-extra/samples/sample-undef.tex new file mode 100644 index 0000000000..194f4a4bc8 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-undef.tex @@ -0,0 +1,21 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[undefaction=warn]{glossaries-extra} + +\makeglossaries + +\newglossaryentry{sample}{name=sample,description={an example}} + +\begin{document} + +Defined entry: \gls{sample}, \glslink{sample}{text}. + +Undefined entry: \gls{undefined}, \glslink{undefined}{text}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.pdf b/macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.pdf new file mode 100644 index 0000000000..4c397377f0 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.tex b/macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.tex new file mode 100644 index 0000000000..7979120c45 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample-unitentrycount.tex @@ -0,0 +1,90 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} + +\GlsXtrEnableEntryUnitCounting{abbreviation}{2}{chapter} + +\makeglossaries + +\newabbreviation{html}{HTML}{hypertext markup language} +\newabbreviation{xml}{XML}{extensible markup language} +\newabbreviation{css}{CSS}{cascading style sheet} + +\newglossaryentry{sample}{name={sample},description={sample}} + +\newcommand*{\lastruncount}[1]{% +Overall number of times the \texttt{#1} entry is used in +this chapter: \glsentryprevcount{#1}. (Information obtained +from previous run.)% +} + +\newcommand*{\currentruncount}[1]{% +Number of times the \texttt{#1} entry has been used this +chapter so far: \glsentrycurrcount{#1}.% +} + +\newcommand*{\triggertest}[1]{% +Normal usage of \texttt{\char`\\gls} \glsxtrifcounttrigger{#1}{has}{hasn't} been +suppressed for the \texttt{#1} entry in this chapter.% +} + +\begin{document} + +This is a sample document that uses entry counting per unit. The unit entry counting +has been enabled on the \texttt{abbreviation} category. +The unit has been set to +``\glsgetcategoryattribute{abbreviation}{unitcount}''. +This means that abbreviations will only be added to the glossary if +they are used more than $n$ times per +\glsgetcategoryattribute{abbreviation}{unitcount}, +where in this document $n$ has been set to +\glsgetcategoryattribute{abbreviation}{entrycount}. +Entries in other categories behave as normal. + +\chapter{Sample} + +\lastruncount{xml} + +Used once: \gls{html}. + +Used twice: \gls{xml} and \gls{xml}. + +Used three times: \gls{css} and \gls{css} and \gls{css}. + +Used once but this entry is in the ``general'' category +which doesn't have the entry unit counting set: +\gls{sample}. + +\currentruncount{xml} + +\triggertest{xml} + +\currentruncount{css} + +\triggertest{css} + +\chapter{Another Sample} + +Used once in this chapter: \gls{xml}. + +Used twice in this chapter: \gls{css} and \gls{css}. + +\currentruncount{css} + +\triggertest{css} + +Total number of times the \texttt{css} entry was used +throughout the document on the previous run: +\glsentryprevtotalcount{css}. + +Total number of times the \texttt{xml} entry was used +throughout the document on the previous run: +\glsentryprevtotalcount{xml}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries-extra/samples/sample.pdf b/macros/latex/contrib/glossaries-extra/samples/sample.pdf new file mode 100644 index 0000000000..c5fb78f8f9 Binary files /dev/null and b/macros/latex/contrib/glossaries-extra/samples/sample.pdf differ diff --git a/macros/latex/contrib/glossaries-extra/samples/sample.tex b/macros/latex/contrib/glossaries-extra/samples/sample.tex new file mode 100644 index 0000000000..42e2f4d677 --- /dev/null +++ b/macros/latex/contrib/glossaries-extra/samples/sample.tex @@ -0,0 +1,26 @@ +% arara: pdflatex +% arara: makeglossaries +% arara: pdflatex +% arara: pdflatex +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries-extra} +\usepackage{glossary-mcols} +\setglossarystyle{mcolindex} + +\makeglossaries + +\loadglsentries{example-glossaries-brief} + +\begin{document} + +\tableofcontents + +\section{Sample} + +Entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\printglossaries + +\end{document} -- cgit v1.2.3