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/CHANGES | 1512 + macros/latex/contrib/glossaries/INSTALL | 122 + macros/latex/contrib/glossaries/README | 81 + .../latex/contrib/glossaries/glossaries-code.pdf | Bin 0 -> 1195352 bytes .../latex/contrib/glossaries/glossaries-user.html | 31130 +++++++++++++++ .../latex/contrib/glossaries/glossaries-user.pdf | Bin 0 -> 893233 bytes .../latex/contrib/glossaries/glossaries-user.tex | 13059 ++++++ macros/latex/contrib/glossaries/glossaries.dtx | 39747 +++++++++++++++++++ macros/latex/contrib/glossaries/glossaries.ins | 129 + .../latex/contrib/glossaries/glossariesbegin.html | 3949 ++ .../latex/contrib/glossaries/glossariesbegin.pdf | Bin 0 -> 186454 bytes .../latex/contrib/glossaries/glossariesbegin.tex | 2092 + .../contrib/glossaries/glossary2glossaries.html | 1882 + .../contrib/glossaries/glossary2glossaries.pdf | Bin 0 -> 143132 bytes .../contrib/glossaries/glossary2glossaries.tex | 667 + macros/latex/contrib/glossaries/makeglossaries | 1676 + .../latex/contrib/glossaries/makeglossaries-lite.1 | 235 + .../contrib/glossaries/makeglossaries-lite.lua | 559 + .../contrib/glossaries/makeglossaries-lite.pod | 120 + macros/latex/contrib/glossaries/makeglossaries.1 | 243 + .../contrib/glossaries/samples/README-samples | 52 + .../latex/contrib/glossaries/samples/database1.tex | 24 + .../latex/contrib/glossaries/samples/database2.tex | 22 + .../samples/glossary-lipsum-examples.pdf | Bin 0 -> 248669 bytes .../samples/glossary-lipsum-examples.tex | 221 + .../contrib/glossaries/samples/minimalgls.pdf | Bin 0 -> 49958 bytes .../contrib/glossaries/samples/minimalgls.tex | 87 + .../contrib/glossaries/samples/mwe-acr-desc.pdf | Bin 0 -> 37957 bytes .../contrib/glossaries/samples/mwe-acr-desc.tex | 26 + .../latex/contrib/glossaries/samples/mwe-acr.pdf | Bin 0 -> 33649 bytes .../latex/contrib/glossaries/samples/mwe-acr.tex | 25 + .../latex/contrib/glossaries/samples/mwe-gls.pdf | Bin 0 -> 29939 bytes .../latex/contrib/glossaries/samples/mwe-gls.tex | 20 + .../contrib/glossaries/samples/sample-FnDesc.pdf | Bin 0 -> 58817 bytes .../contrib/glossaries/samples/sample-FnDesc.tex | 29 + .../glossaries/samples/sample-chap-hyperfirst.pdf | Bin 0 -> 54822 bytes .../glossaries/samples/sample-chap-hyperfirst.tex | 59 + .../contrib/glossaries/samples/sample-crossref.pdf | Bin 0 -> 53456 bytes .../contrib/glossaries/samples/sample-crossref.tex | 36 + .../glossaries/samples/sample-custom-acronym.pdf | Bin 0 -> 82185 bytes .../glossaries/samples/sample-custom-acronym.tex | 152 + .../contrib/glossaries/samples/sample-dot-abbr.pdf | Bin 0 -> 52796 bytes .../contrib/glossaries/samples/sample-dot-abbr.tex | 92 + .../contrib/glossaries/samples/sample-dual.pdf | Bin 0 -> 36455 bytes .../contrib/glossaries/samples/sample-dual.tex | 33 + .../glossaries/samples/sample-entrycount.pdf | Bin 0 -> 36839 bytes .../glossaries/samples/sample-entrycount.tex | 35 + .../contrib/glossaries/samples/sample-entryfmt.pdf | Bin 0 -> 34904 bytes .../contrib/glossaries/samples/sample-entryfmt.tex | 28 + .../glossaries/samples/sample-font-abbr.pdf | Bin 0 -> 50703 bytes .../glossaries/samples/sample-font-abbr.tex | 63 + .../contrib/glossaries/samples/sample-ignored.pdf | Bin 0 -> 31810 bytes .../contrib/glossaries/samples/sample-ignored.tex | 25 + .../contrib/glossaries/samples/sample-index.pdf | Bin 0 -> 43379 bytes .../contrib/glossaries/samples/sample-index.tex | 61 + .../contrib/glossaries/samples/sample-inline.pdf | Bin 0 -> 147381 bytes .../contrib/glossaries/samples/sample-inline.tex | 146 + .../contrib/glossaries/samples/sample-langdict.pdf | Bin 0 -> 38855 bytes .../contrib/glossaries/samples/sample-langdict.tex | 46 + .../contrib/glossaries/samples/sample-newkeys.pdf | Bin 0 -> 39198 bytes .../contrib/glossaries/samples/sample-newkeys.tex | 64 + .../glossaries/samples/sample-noidxapp-utf8.pdf | Bin 0 -> 96000 bytes .../glossaries/samples/sample-noidxapp-utf8.tex | 148 + .../contrib/glossaries/samples/sample-noidxapp.pdf | Bin 0 -> 67077 bytes .../contrib/glossaries/samples/sample-noidxapp.tex | 145 + .../glossaries/samples/sample-nomathhyper.pdf | Bin 0 -> 41745 bytes .../glossaries/samples/sample-nomathhyper.tex | 42 + .../glossaries/samples/sample-numberlist.pdf | Bin 0 -> 41979 bytes .../glossaries/samples/sample-numberlist.tex | 40 + .../contrib/glossaries/samples/sample-prefix.pdf | Bin 0 -> 43259 bytes .../contrib/glossaries/samples/sample-prefix.tex | 73 + .../latex/contrib/glossaries/samples/sample-si.pdf | Bin 0 -> 21710 bytes .../latex/contrib/glossaries/samples/sample-si.tex | 22 + .../samples/sample-storage-abbr-desc.pdf | Bin 0 -> 39892 bytes .../samples/sample-storage-abbr-desc.tex | 147 + .../glossaries/samples/sample-storage-abbr.pdf | Bin 0 -> 37659 bytes .../glossaries/samples/sample-storage-abbr.tex | 112 + macros/latex/contrib/glossaries/samples/sample.pdf | Bin 0 -> 104265 bytes macros/latex/contrib/glossaries/samples/sample.tex | 166 + .../contrib/glossaries/samples/sample4col.pdf | Bin 0 -> 43320 bytes .../contrib/glossaries/samples/sample4col.tex | 29 + .../latex/contrib/glossaries/samples/sampleAcr.pdf | Bin 0 -> 65506 bytes .../latex/contrib/glossaries/samples/sampleAcr.tex | 88 + .../contrib/glossaries/samples/sampleAcrDesc.pdf | Bin 0 -> 65613 bytes .../contrib/glossaries/samples/sampleAcrDesc.tex | 76 + .../contrib/glossaries/samples/sampleCustomAcr.pdf | Bin 0 -> 93612 bytes .../contrib/glossaries/samples/sampleCustomAcr.tex | 115 + .../latex/contrib/glossaries/samples/sampleDB.pdf | Bin 0 -> 47043 bytes .../latex/contrib/glossaries/samples/sampleDB.tex | 24 + .../contrib/glossaries/samples/sampleDesc.pdf | Bin 0 -> 48396 bytes .../contrib/glossaries/samples/sampleDesc.tex | 71 + .../latex/contrib/glossaries/samples/sampleEq.pdf | Bin 0 -> 155760 bytes .../latex/contrib/glossaries/samples/sampleEq.tex | 239 + .../contrib/glossaries/samples/sampleEqPg.pdf | Bin 0 -> 169225 bytes .../contrib/glossaries/samples/sampleEqPg.tex | 295 + .../contrib/glossaries/samples/sampleFnAcrDesc.pdf | Bin 0 -> 91343 bytes .../contrib/glossaries/samples/sampleFnAcrDesc.tex | 79 + .../latex/contrib/glossaries/samples/sampleNtn.pdf | Bin 0 -> 99000 bytes .../latex/contrib/glossaries/samples/sampleNtn.tex | 90 + .../contrib/glossaries/samples/samplePeople.pdf | Bin 0 -> 47459 bytes .../contrib/glossaries/samples/samplePeople.tex | 57 + .../latex/contrib/glossaries/samples/sampleSec.pdf | Bin 0 -> 65669 bytes .../latex/contrib/glossaries/samples/sampleSec.tex | 64 + .../contrib/glossaries/samples/sampleSort.pdf | Bin 0 -> 95383 bytes .../contrib/glossaries/samples/sampleSort.tex | 105 + .../contrib/glossaries/samples/sampleaccsupp.pdf | Bin 0 -> 41155 bytes .../contrib/glossaries/samples/sampleaccsupp.tex | 43 + .../contrib/glossaries/samples/sampleacronyms.pdf | Bin 0 -> 37201 bytes .../contrib/glossaries/samples/sampleacronyms.tex | 42 + .../contrib/glossaries/samples/sampletree.pdf | Bin 0 -> 66912 bytes .../contrib/glossaries/samples/sampletree.tex | 69 + .../contrib/glossaries/samples/sampleutf8.pdf | Bin 0 -> 44939 bytes .../contrib/glossaries/samples/sampleutf8.tex | 53 + .../contrib/glossaries/samples/samplexdy-mc.xdy | 852 + .../contrib/glossaries/samples/samplexdy-mc207.xdy | 591 + .../latex/contrib/glossaries/samples/samplexdy.pdf | Bin 0 -> 133968 bytes .../latex/contrib/glossaries/samples/samplexdy.tex | 300 + .../contrib/glossaries/samples/samplexdy2.pdf | Bin 0 -> 68399 bytes .../contrib/glossaries/samples/samplexdy2.tex | 73 + .../contrib/glossaries/samples/samplexdy3.pdf | Bin 0 -> 178997 bytes .../contrib/glossaries/samples/samplexdy3.tex | 269 + 121 files changed, 103068 insertions(+) create mode 100644 macros/latex/contrib/glossaries/CHANGES create mode 100644 macros/latex/contrib/glossaries/INSTALL create mode 100644 macros/latex/contrib/glossaries/README create mode 100644 macros/latex/contrib/glossaries/glossaries-code.pdf create mode 100644 macros/latex/contrib/glossaries/glossaries-user.html create mode 100644 macros/latex/contrib/glossaries/glossaries-user.pdf create mode 100644 macros/latex/contrib/glossaries/glossaries-user.tex create mode 100644 macros/latex/contrib/glossaries/glossaries.dtx create mode 100644 macros/latex/contrib/glossaries/glossaries.ins create mode 100644 macros/latex/contrib/glossaries/glossariesbegin.html create mode 100644 macros/latex/contrib/glossaries/glossariesbegin.pdf create mode 100644 macros/latex/contrib/glossaries/glossariesbegin.tex create mode 100644 macros/latex/contrib/glossaries/glossary2glossaries.html create mode 100644 macros/latex/contrib/glossaries/glossary2glossaries.pdf create mode 100644 macros/latex/contrib/glossaries/glossary2glossaries.tex create mode 100755 macros/latex/contrib/glossaries/makeglossaries create mode 100644 macros/latex/contrib/glossaries/makeglossaries-lite.1 create mode 100755 macros/latex/contrib/glossaries/makeglossaries-lite.lua create mode 100644 macros/latex/contrib/glossaries/makeglossaries-lite.pod create mode 100644 macros/latex/contrib/glossaries/makeglossaries.1 create mode 100644 macros/latex/contrib/glossaries/samples/README-samples create mode 100644 macros/latex/contrib/glossaries/samples/database1.tex create mode 100644 macros/latex/contrib/glossaries/samples/database2.tex create mode 100644 macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.pdf create mode 100644 macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.tex create mode 100644 macros/latex/contrib/glossaries/samples/minimalgls.pdf create mode 100644 macros/latex/contrib/glossaries/samples/minimalgls.tex create mode 100644 macros/latex/contrib/glossaries/samples/mwe-acr-desc.pdf create mode 100644 macros/latex/contrib/glossaries/samples/mwe-acr-desc.tex create mode 100644 macros/latex/contrib/glossaries/samples/mwe-acr.pdf create mode 100644 macros/latex/contrib/glossaries/samples/mwe-acr.tex create mode 100644 macros/latex/contrib/glossaries/samples/mwe-gls.pdf create mode 100644 macros/latex/contrib/glossaries/samples/mwe-gls.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-FnDesc.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-FnDesc.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-crossref.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-crossref.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-custom-acronym.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-custom-acronym.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-dot-abbr.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-dual.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-dual.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-entrycount.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-entrycount.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-entryfmt.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-entryfmt.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-font-abbr.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-font-abbr.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-ignored.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-ignored.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-index.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-index.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-inline.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-inline.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-langdict.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-langdict.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-newkeys.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-newkeys.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-noidxapp.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-noidxapp.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-nomathhyper.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-nomathhyper.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-numberlist.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-numberlist.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-prefix.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-prefix.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-si.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-si.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample-storage-abbr.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample-storage-abbr.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample.tex create mode 100644 macros/latex/contrib/glossaries/samples/sample4col.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sample4col.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleAcr.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleAcr.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleAcrDesc.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleAcrDesc.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleCustomAcr.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleCustomAcr.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleDB.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleDB.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleDesc.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleDesc.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleEq.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleEq.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleEqPg.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleEqPg.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleNtn.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleNtn.tex create mode 100644 macros/latex/contrib/glossaries/samples/samplePeople.pdf create mode 100644 macros/latex/contrib/glossaries/samples/samplePeople.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleSec.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleSec.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleSort.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleSort.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleaccsupp.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleaccsupp.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleacronyms.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleacronyms.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampletree.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampletree.tex create mode 100644 macros/latex/contrib/glossaries/samples/sampleutf8.pdf create mode 100644 macros/latex/contrib/glossaries/samples/sampleutf8.tex create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy-mc.xdy create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy-mc207.xdy create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy.pdf create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy.tex create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy2.pdf create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy2.tex create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy3.pdf create mode 100644 macros/latex/contrib/glossaries/samples/samplexdy3.tex (limited to 'macros/latex/contrib/glossaries') diff --git a/macros/latex/contrib/glossaries/CHANGES b/macros/latex/contrib/glossaries/CHANGES new file mode 100644 index 0000000000..fb9bc0861a --- /dev/null +++ b/macros/latex/contrib/glossaries/CHANGES @@ -0,0 +1,1512 @@ +glossaries change log: + +v4.42 (2019-01-06): + + * glossaries.sty: + + - changed \edef to \protected@csedef in \glsfieldedef + + - changed \xdef to \protected@csxdef in \glsfieldxdef + + - added package option 'noglossaryindex' to counteract 'index' + (if 'index' happens to be supplied as a global option) + + - automake option now takes 'immediate' as a value. + + * glossary-longbooktabs.sty: + + - removed superfluous \glspatchLToutput + +v4.41 (2018-07-23): + + * glossaries.sty: + + - added package option kernelglossredefs (Warnings are now + generated if the kernel commands \makeglossary and \glossary are + used. These commands are deprecated with the glossaries package. + If the originals are required, by a package or class that must + be used with glossaries.sty for some reason, then use + kernelglossredefs=false, but beware of other possible conflicts.) + + - renamed some internal commands to avoid conflict + \gls@debug@val, \gls@debug@nr + \gls@seenoindex@val, \gls@seenoindex@nr + \gls@numberedsection@val, \gls@numberedsection@nr + \gls@translate@val, \gls@translate@nr + \gls@nonumberlist@val, \gls@nonumberlist@nr + +v4.40 (2018-06-01): + + * bug fix: corrected page number reference when + using \makenoidxglossaries + +v4.39 (2018-05-23): + + * makeglossaries-lite.lua: + + - corrected version information + + * glossariesbegin.tex: + + - updated further information section + + * glossaries-user.tex: + + - updated some external links + +v4.38 (2018-05-10): + + * glossaries.sty: + + - added \GlsEntryCounterLabelPrefix + + - bug fixes: + + - moved conditional inside \glsstepentry, + \glsstepsubentry, \glsrefentry, + \glsentrycounterlabel, \glssubentrycounterlabel, \glsentryitem, + \glssubentryitem, \glsresetentrycounter, \glsresetsubentrycounter + + - removed spurious space in subentrycounter (printgloss) key + + - fixed use of entrycounter and subentrycounter in \setupglossaries + + * glossaries-accsupp.sty: + + - bug fixes: + + - added braces around argument of ActualText in \glsaccsupp + + - corrected field used in \showglonameaccess + +v4.37 (2018-04-07): + + * glossaries.sty: + + - added \gls@begindocdefs + +v4.36 (2018-03-07): + + * glossaries.sty: + + - bug fix (if \makeindex is used without \makeglossaries, + corrupted glossary information is written to the .idx file) + + * makeglossaries-lite.lua: + + - corrected check for double-quotes in \@istfilename + (from \jobname when the .tex file name contains spaces) + + - added check for nil codepage + +v4.35 (2017-11-14): + + * glossaries.sty: + + - bug fix (\glsadd breaks with sort=use) + +v4.34 (2017-11-03): + + * glossaries.sty: + + - modified \glsshowtarget to check for math mode and inner + + * glossary-mcols.sty: + + - removed spurious space in mcolalttreespannav style + + * makeglossaries and makeglossaries-lite.lua: + + - added check for \glsxtr@resource + +v4.33 (2017-09-20): + + * Removed makeglossaries.bat (TeX distributions on Windows + convert the Perl script to makeglossaries.exe, so the + .bat file isn't needed.) + + * makeglossaries and makeglossaries-lite.lua now have their + version numbers synchronised with glossaries.sty + + * Added makeglossaries-lite.pod (to provide the + makeglossaries-lite.1 man file) + + * Updated POD at the end of makeglossaries + + * Added example-glossaries-symbolnames.tex for use in any MWE + requiring symbols in the name fields. + + * Tidied up the user manual and guide for beginners. + + * glossaries.sty: + + - added package option nolangwarn + + - added package option esclocations + + - added \GlsSetXdyNumberGroupOrder + + - added starred form of \GlsSetXdyFirstLetterAfterDigits + +v4.32 (2017-08-24): + + * glossaries.sty: + + - added debug=showtargets and associated commands + \@glsshowtarget and \glsshowtarget + + * glossary-hypernav.sty: + + - added \@glsnavhypertarget + +v4.31 (2017-08-10): + + * glossaries.sty: + + - Bug fix: 'nolist' option sets default style to \relax + if currently set to 'list' to prevent trying to set an + undefined style. + +v4.30 (2017-06-11): + + * glossaries.sty: + + - Added sort=none option + + - Added \glosortentrieswarning + + - Added \@glo@autosee + + - Fixed bug occurring with \setupglossaries{sort=def} + + - Fixed bug in \@xdyuserlocationnames + + - Fixed bug in \@xdylocationclassorder + + - Added \@xdycrossrefhook + + - Added \@glo@check@sortallowed + + - Fixed bug in \printnoidxglossary with group skips in + tabular styles + + * makeglossaries v2.21: + + - Fixed spelling mistake in warning message + (\GlsAddLocation -> \GlsAddXdyLocation) + + - Adjusted range encap clash correction + +v4.29: + + * glossaries-accsupp.sty: corrected check for glossaries-extra + 'accsupp' option. + + * glossaries.sty: moved definition of \@gls@currentlettergroup + before \begin{theglossary} and made redefinitions of it within + theglossary global to guard against scoping issues cause by + tabular-like glossary styles. + + * glossary-hypernav.sty: added \glsnavhyperlinkname + +v4.28: + + * glossaries.sty: added \glspatchtabularx + +v4.27: + + * Version number updated in *.sty files, but no actual code + change. + + * makeglossaries v2.20 and makeglossaries-lite.lua v1.3: + + - Added check for \glsxtr@makeglossaries + +v4.26: + + * glossaries.sty: + + - added check for classicthesis.sty (if it's been loaded + the default style is changed to "index" since the "list" + style doesn't work with classicthesis.) + + * glossary-tree.sty: + + - new commands \glstreeitem, \glstreesubitem and + \glstreesubsubitem provided for the "index" style + to make the style easier to adjust. + + - replaced hard-coded \space with \glstreepredesc + or \glstreechildpredesc for all glossary-tree styles + except for the alttree* styles. + + * glossary-mcol.sty: + + - The "mcolindex" and "mcolindexspannav" styles + use the new \glstreeitem, \glstreesubitem and + \glstreesubsubitem provided by glossary-tree.sty. + +v4.25: + + * glossaries.sty: + + - bug fix + http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=111 + +v4.24: + + * glossaries.sty: + + - added debug and seenoindex option + + - added \GlsSetWriteIstHook and \GlsSetQuote + + - added \@gls@extramakeindexopts for makeglossaries + and makeglossaries-lite.lua (allow makeindex -g + for German documents) + + * makeglossaries (2.19): + + - Improved check in &parse_for_xindy_nosort + + - Added check for \@gls@extramakeindexopts + + * makeglossaries-lite.lua (1.2): + + - Added check for nil codepage + +v4.23 + + * glossaries.sty: + + - added \glscurrentfieldvalue + + * tabular-like styles (glossary-long.sty etc): + + - bug fix (nogroupskip in tabular styles with "noidx" commands) + http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108 + +v4.22: + + * glossaries.sty: + + - added \gls@arabicpage + + - added \ifglswrallowprimitivemods + + - added \glsentrytitlecase + + * glossary-tree.sty: + + - new formatting commands \glstreegroupheaderfmt + and \glstreenavigationfmt to + make it easier to customize styles + + - new command \glsfindwidesttoplevelname + + * glossary-mcols.sty: + + - hard-coded \textbf replaced with + \glstreegroupheaderfmt or \glstreenavigationfmt, + as appropriate + + - added new styles mcolindexspannav, mcoltreespannav, + mcoltreenonamespannav, mcolalttreespannav + + * glossary-list.sty: + + - new formatting commands \glslistgroupheaderfmt + and \glslistnavigationitem to make it easier to + customize styles + + - fixed missing space before description in list + style sub-entries. + + * glossary-super.sty: + + - fixed bug in super4col style + + * glossary-long.sty: + + - fixed bug in long style (typo in \glossentrydesc + for sub-entries) + +v4.21: + + * glossaries.sty: + + - Added warning if there's no default style. + + * glossary-longbooktabs.sty - new package + + * makeglossaries (2.18): + + - Added extra diagnostic if xindy's empty index key + warning/error occurs. + + - Added check for makeindex's multiple encap warning + and attempt to fix. + + * glossaries-user.tex: + + - Fixed typo: \DefineAcronymShortcuts should be + \DefineAcronymSynonyms + +v4.20: + + * makeglossaries (2.17) bug fix + http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=101 + + (No changes to any of the *.sty files, except the version number.) + +v4.19: + + * glossaries.sty: + + - Added commands: \glsdoifexistsordo, + \doifglossarynoexistsordo + + - Added some new internals that will be used by pending new + package glossaries-extra.sty + + * glossary-tree.sty: + + - Added \glstreenamebox + +v4.18: + + * mfirstuc removed from glossaries bundle and now + needs to be installed separately + +v4.17: + + * makeglossaries-lite.lua: + + - changed #! line "lua" to "texlua" + + * mwe-acr.tex and mwe-acr-desc.tex: + + - fixed misplaced \setacronymstyle + +v4.16: + + * Added makeglossaries-lite.lua (Lua trimmed-down alternative + to Perl makeglossaries script. Doesn't have the full + functionality of makeglossaries but doesn't require Perl.) + + * makeglossaries (Perl script): + + - fixed ngerman din5007 issue. + + * glossaries.sty: + + - new field-related commands: + \glsaddstoragekey, \glsfielddef, \glsfieldedef, + \glsfieldgdef, \glsfieldxdef, \glsfieldfetch, + \ifglsfieldeq, \ifglsfielddefeq, \ifglsfieldcseq + + - new user command \glswriteentry to hook into mechanism + that writes entry information to the external files + + - new user command \glspostlinkhook to hook into end of + commands like \gls and \glstext. + + - Added new acronym styles "long-sp-short" and + "long-sp-short-desc" + + - bug fix: \glsadd should use \@@do@wrglossary not + \@do@wrglossary + +v4.15: + + * glossaries.sty: + + - bug fix + www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=79 + +v4.14: + + * glossaries.sty: + + - Added \glsenableentrycount and associated commands + and accompanying sample file sample-entrycount.tex + that illustrates them. + +v4.13: + + * glossaries.sty: + + - provide a definition of \indexspace if not already defined + for those styles that need it. + + * mfirstuc.sty (v1.10): + + - added \ecapitalisewords, \emakefirstuc + +v4.12: + + * glossaries.sty: + + - Separated language-dependent code into separate + modules to be independently installed, as required. + + - Fixed bugs: + www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=67 + www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=69 + www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&category=glossaries&key=72 + +v4.11: + + * glossaries.sty: + + - Added \glsaddprotectedpagefmt + + - Put back the redefinition of \glossary (so that it takes an + optional argument) removed in the previous version to + allow for packages that have hacked the internal glossary + writing mechanism. (This may be removed or moved to a + compatibility mode in the future.) + + - Fixed backward compatibility support of deprecated + sanitize=none option + + - Fixed bug introduced in v4.10 that caused a conflict with + doc.sty + +v4.10: + + * Added test file example-glossaries-url.tex + + * glossaries.sty: + + - Added \glspercentchar and \glstildechar + + - Fixed problem with \Glsentryname (and \Glsname) + when used with \setacronymstyle + + - No longer redefine \glossary but instead define + a replacement internal command \gls@glossary, and + renamed \@glossary to \@gls@glossary + + * glossary-tree.sty: + + - Corrected location of space in alttree style with symbols + +v4.09: + + * Fixed bug in \glsaddkey introduced in v4.08 + www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=64 + +v4.08: + + * New files: example-glossaries-*.tex + + These contain lorem ipsum dummy entries for testing + new styles or constructing MWEs that require a lot of sample entries + (to be placed on TeX's path) + + * glossaries.sty + + - new package option: automake + + - \newglossary now has a starred version where you don't need + to specify the extensions + + - new commands: \forallacronyms, \newignoredglossary + + - new keys for \printglossary/\printnoidxglossary: + entrycounter, subentrycounter, nopostdot + + - \gls etc now have a +-version (opposite of the *-version) + that explicitly switches on the hyperlink with hyper=true + (unlike the unstarred version that uses the default setting). + + - new commands for use within \glsentryfmt or \defglsentryfmt: + \glsifhyperon and \glslinkvar (\glsifhyper now deprecated). + + - fixed bug that didn't correctly honour the hyper setting + in commands like \glslink, \gls, glstext, etc under + certain situations. + + - fixed bug + www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=54 + + - added \@gls@hyp@opt and removed now-redundant internal commands + + - removed some of the redundancy in commands like \gls + + * glossary-longragged.sty: + + - Fixed bug in altlongragged4col style that displayed the + description instead of the symbol in the third column. + + * glossary-tree.sty: + + - Added \glstreenamefmt + + * mfirstuc.sty v1.09: + + - Added \MFUnocap + + * New package: mfirstuc-english.sty + + * makeglossaries + + - Fixed bug report + http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=55 + +v4.07: + + * glossaries.sty: + + - Added \glsletentryfield + + - Bug fixes: + - added optional argument to unstarred sectioning + commands (used with package options numberedsection=nolabel + and numberedsection=autolabel) + + - added \global prefix to definition of \@gls@loclist + in \@gls@noidx@do in case a tabular-like style is used. + + - Fixed no case change bug in \Acrfullplfmt + +v4.06: + + * glossaries.sty: + + - Added \glsifhyper + + - Fixed bookmark issue occurring with + "numbers" and "symbols" package options + in combination with hyperref.sty and translator.sty + +v4.05: + + - Added missing glossaries-prefix.sty to tds + +v4.04: + + * glossaries.sty: + + - new commands: \makenoidxglossaries, \printnoidxglossary + and \printnoidxglossaries that use TeX to sort entries + instead of makeindex/xindy + + - new command: \glsnumberlistloop (for use with + \makenoidxglossaries) + + - new package option: noredefwarn + + - moved definition of \glswrite to \makeglossaries so that write + register is only allocated if required. + + - fixed bug in \defglsdisplayfirst + + * glossary-tree.sty: + + - fixed bug in alttree style + + + * glossaries-accsupp.sty: + + - \compatibleglossentry and \compatiblesubglossentry: + changed \newcommand to \def as they may or may not be + defined depending on whether user has loaded glossaries + separately from glossaries-accsupp + + * makeglossaries: + + - added -Q and -k switches + + - added extra diagnostics + +v4.03: + + glossaries.sty: + + * Added \glsifhasfield + + * Changed default definition of \glswritefiles to \@empty + instead of \relax + + * Fixed bug in \ifglsdescsuppressed + + * Added \glsdetoklabel + + * Added \glsdoifexistsorwarn + + * Changed \glossentryname etc to use \glsdoifexistsorwarn + instead of \glsdoifexists + + * Added \renewacronymstyle + + * Fixed bug in dua acronym style + + glossaries-accsupp.sty: + + * Redefined acronym styles to use accessibility support + + makeglossaries v2.12: + + * Added check for backslashes in -x, -m and -d arguments + + +v4.02: + + glossaries.sty: + + * Added nameref value to 'numberedsection' package option + + * New package option: "index" + + * New package option: xindynoglsnumbers (equivalent to + xindy={glsnumbers=false}) + + * Added \newacronymstyle, \setacronymstyle and associated + commands. (Package options "smallcaps", "smaller", + "description", "dua" and "footnote" now deprecated.) + + * New commands \acrfullfmt etc to govern the format of + \acrfull etc. + + * Made \makeglossaries preamble only + + * Bug Fixes: + + - \acrlong, \Acrlong, \ACRlong, \acrlongpl, + \Acrlongpl and \ACRlongpl: removed \acronymfont and + spurious parenthetical text. + + - \glsentryfull, \Glsentryfull, \glsentryfullpl, + and \Glsentryfullpl: added missing \acronymfont + + - Fixed bug in "sanitize" package option (deprecated option, + but still kept for backward compatibility). + +v4.01: + + * Fixed bug in \CustomAcronymFields caused by missing comma. + + * Fixed valueless package options so that they can be passed via + the document class. + +v4.0: + + First stable release since v3.07. + +v3.14a: + + * glossaries.sty + + - New package options: acronyms, xindygloss, notranslate + + - Modified savewrites option so that it can be set via + \setupglossaries + + - Enabled compatible-3.07 option in \setupglossaries + + - Added \provideglossaryentry and \longprovideglossaryentry + + - Bug fix: fixed the default firstplural value to the value of + the plural key. + + * glossaries-prefix.sty + + - New + + * makeglossaries v2.09: + + - added check for -q switch when issuing warnings + +v3.13a: + + * glossaries.sty + + - Added \glsprestandardsort + + - Renamed \glossarymark to \glsglossarymark to prevent clash + with memoir. + + - Made "translate" package option a choice key rather than boolean + + - Bug fix for \glsaddallunused: + set default value of optional argument to \@glo@types + + - Bug fix for \SetFootnoteAcronymDisplayStyle: + added missing final argument of \ifglshaslong + + - Bug fix for \glossarystyle: + replaced \ifdef with \ifcsdef + + * mfirstuc.sty (v1.08): + + - Made \makefirstuc and \capitalisewords robust + +v3.12a: + + * glossaries.sty + + - Added \glsaddkey (allows the user to add their own custom + keys to glossary entries). + +v3.11a: + + * glossaries.sty + + - Added \setupglossaries + (http://www.dickimaw-books.com/cgi-bin/featuretracker.cgi?action=view&key=7) + + - Added \glsentryfmt and \defglsentryfmt + and deprecated \glsdisplayfirst, \glsdisplay, + \defglsdisplayfirst and \defglsdisplay + (http://www.dickimaw-books.com/cgi-bin/featuretracker.cgi?action=view&key=13) + + - Added \longnewglossaryentry + + - Added \ifglshasshort and \ifglshaslong + + - Added check in \glsgetgrouptitle for non-Latin characters + + - Added compatible-3.07 package option + + - Added "symbols" and "numbers" package options + (http://www.dickimaw-books.com/cgi-bin/featuretracker.cgi?action=view&key=16) + + - Added \printacronyms[opts] as a synonym for + \printglossary[type=\acronymtype,opts] + if "acronym" package option is used and + "compatible-3.07" package has not been used + and \printacronym doesn't already exist at the start + of the document. + + - Added \showgloshort and \showglolong + + - Fixed bug in \@gls@noexpand@fields + + - Fixed bug in \gls@defglossaryentry that didn't set the default + counter correctly + + - Now uses \mfirstucMakeUppercase instead of \MakeUppercase + to be consistent with mfirstuc. + + - Now requires textcase (better handling of case changes) + + * mfirstuc (v1.07) + + - Added \mfirstucMakeUppercase to allow the user to switch from + \MakeUppercase to another case changing command. + + * makeglossaries (v2.08) + + - Added -x and -m switches + +v3.10a: + + * glossaries.sty + + - Added \providecommand to aux file in case user removes + the glossaries package from their document. (This ensures + the next run doesn't throw a load of undefined control + sequence errors when the aux file is parsed.) + + - Fixed new code (from v3.08a) so that document can still + compile if entries are defined within the document after + \printglossary or \printglossaries + +v3.09a: + + * glossaries.sty + + - Added fix for \RecordChanges if doc.sty has been loaded + + - Fixed noexpand for symbolplural field + (http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=41) + + - Made \Glsentryname, \Glsentrytext etc robust + + - Fixed bug in footnote option + (http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=37) + + - Fixed bug where acronym starts with repeated letter + (www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=34) + + - Added \glstextup which checks for \textulc + (http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=40) + +v3.08a: + + * glossaries.sty + + - Changed the way information is written to external glossary + files. Information is now written as just \glossentry{label} + or \subglossentry{level}{label} instead of + \glossaryentryfield{label}{name}{description}{symbol} or + \glossarysubentryfield{level}{label}{name}{description}{symbol} + This means that descriptions can span multiple paragraphs + without exceeding makeindex's buffer. + + - Added \setglossarystyle (replaces \glossarystyle which is now + just for backward compatibility) + + - New user commands: + + \glossentryname, \Glossentryname, + \glossentrydesc, \Glossentrydesc, + \glossentrysymbol, \Glossentrysymbol, + \glsexpandfields, \glsnoexpandfields, + \glsaddallunused, + \ifglshassymbol, ifglshasdesc + + - Added nogroupskip option to \printglossary + + - Added \gls@ifnotmeasuring + + - Made \glsseeformat, \glsseelist, \glsseeitem and \glssee robust + + * glossary-tree.sty + + - Added \par to end of theglossary environment for index style. + (http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=38) + +v3.07: + + * glossaries.sty + + - Fixed bug relating to nohypertypes list option + + - Added \setglossarypreamble (code provided by Michael Pock) + + - Modified \glspostdescription to adjust spacefactor before full + stop. (Patch provided by Michael Pock.) + + - Added check for openright in \gls@doclearpage + + - Added \glsdoparenifnotempty + + - Made \findrootlanguage obsolete + +makeglossaries: + + - Added languagemap to determine root language + +v3.06: + + * glossaries.sty + + - Fixed incompatibility between glossaries and new version of babel. + + * makeglossaries + + - added babel dialect -> xindy language map + +v3.05: + + * glossaries.sty + + - fixed bugs related to location numbering (Roman and Alph). + + - made \nopostdesc robust + + - clarified in the documentation that \makeglossaries must be + used before cross-referenced entries + + - added missing 'nohypertypes' code + + * makeglossaries: + + - added "din5007" as the default to makeglossaries if the + language is german + + * glossary-mcols.sty: + + - Fixed bug -> \begin{multicols}{2} replaced with \begin{multicols}{\glsmcols} + +v3.04: + + * added 'nohypertypes' package option + + * added new commands: \GlsDeclareNoHyperList and \glsIfNoHyperType + + * added 'local' key to \glsdisp, \gls, \Gls and \GLS + + * added check for doc package + + * fixed bug in altlist that can cause an unintentional page break + between entry and description. + + * fixed bug that causes extra space after glossary when using + xindy + + * fixed bug that was introduced by the bug fix in 3.02 regarding wrong + page number + + makeglossaries v2.05: + * added -d option + +v3.03: + + * fixed bug in \printglossary options: title now also sets + toctitle if toctitle missing (as per documentation). + + * added sanitize={sort=false} option + + * added nopostdot package option + + * added nogroupskip package option + + glossary-inline.sty added: + + - \glsinlinenameformat + - \glsinlinedescformat + - \glsinlineemptydescformat + - \glsinlinesubnameformat + - \glsinlinesubdescformat + - \glsinlinepostchild + +v3.02: + + * new package options: + + - 'ucmark' + - 'indexonlyfirst' + - 'savenumberlist' + + * new glossary styles: + + - glossary-mcol.sty + - glossary-inline.sty + + * new commands: + + - \glolinkprefix + - \glsmoveentry + - \renewglossarystyle + - \ifglshaschildren + - \ifglshasparent + - \glsresetentrycounter + - \glsentrynumberlist + - \glsdisplaynumberlist + + * added check to \glswritefiles to see if glossary tokens have + been defined in case savewrites option used and \makeglossaries + omitted. + + * fixed bug in \showglossaryentries + + * fixed bug in \SmallNewAcronymDef + + * fixed unwanted space in + \SetDescriptionFootnoteAcronymDisplayStyle + + * fixed [xindy] wrong page number bug for entries occurring in + paragraph spanning page break + + * fixed bug in \Glsentryfull and \glsentryfullpl + + * swapped order of checks for babel and polyglossia + + mfirstuc v1.06: + + * added \capitalisewords, \xcapitalisewords + + makeglossaries v2.04: + + * fixed bug in &scan_aux + +v3.01: + + * made commands like \glslink, \gls and \acrshort robust + + * Fixed bugs in commands like \acrfullpl which was missing the + plural in some cases. + + * Removed \acronymfont from \acrfullformat as it's already used + in the second argument passed to that command. (Causes a + problem with the "smaller" option.) + +v3.0 (Major changes): + + * Documentation has been restructured: + + - glossaries-user: main user manual + - glossariesbegin: cut-down introduction for beginners + - mfirstuc-manual: user manual for mfirstuc package + - glossaries.pdf: documented code for advanced users + - glossary2glossaries: upgrading from glossary.sty to glossaries.sty + + * Added new package options: + + - entrycounter : number main (level 0) entries in the glossary. + + - counterwithin : set parent counter for the entry counter. + + - subentrycounter : number level 1 entries in the glossary. + + - sort : set the sort order to + - standard alphabetical (sort=standard), + - order of definition (sort=def) + - order of use (sort=use) + + - seeautonumberlist : automatically activates the number list + for entries that use the "see" key. + + - savewrites : minimise number of \newwrite + + - compatible-2.07 : + + bug fixes in v3.0 have cause compatibility problems. This + package option will restore the old behaviour but bugs will + remain. (Should mostly only effect documents that used + \noist with a custom Xindy style file.) + + * \printglossary sets \currentglossary to the current glossary's + label. (Allows custom glossary styles access to the glossary + type.) + + * Modified internal workings of acronyms and: + + - Added starred versions of \acrshort etc. + + - Added "long", "short", "longplural" and "shortplural" keys + (Reserved for use with \newacronym.) + + - Added analogous "longaccess", "shortaccess", "longpluralaccess" + and "shortpluralaccess" keys for \newacronym in + glossaries-accsupp.sty + + * Added \glsseeitemformat to customise the text given in the link + created by \glsseeitem. + + * \newglossaryentry key "nonumberlist" now boolean. + + * added debugging commands \showgloname etc. + + * now loads etoolbox: + + - replaced \DeclareRobustCommand with \newrobustcmd + + - replaced \@ifundefined with \ifcsundef + + - replaced \let...\undefined with \undef... + + * Bug Fixes: + + - now works with equation counter in amsmath's align + environment. + + - Mixed counters now work with xindy option. + + - Fixed hyperlinks in location numbers where \theH + has a prefix not present in \the. + + - If title specified in \printglossary but toctitle hasn't + been specified, make toctitle same as supplied title. + + - \newglossaryentry "see" key and \glssee now sanitize and escape + special characters before writing to output file. (Allows + user to redefine \seename any point before \printglossary or + \printglossaries.) + + - \glshyperlink: Changed the default value of the optional argument + to \glsentrytext instead of \glsentryname. + + * mfirstuc.sty (v1.05): + + - added \glsmakefirstuc (replaces \@gls@makefirstuc) to make + it easier to customise. + + makeglossaries (v2.02): + + * now displays version number on startup unless -q + + * added more diagnostics to give more helpful messages than + those supplied by xindy or makeindex. + +v2.07: + + * Fixed bug that ignored format key in \glsadd + + makeglossaries: + + * Fixed bug causing failure to process aux files containing \@input + +v2.06: + * Added \altnewglossary + + * added facility to customise acronyms if the predefined styles + don't fit the user's requirements. + + * Serbian dictionary added (provided by Zoran Filipovic) + + makeglossaries: + + * Scans aux file for \@input in case \printglossary is in an + imported file. + +v2.05: + * Fixed error in .ist file and in \glsdisp caused by a + misplace brace. (Patch provided by Sergiu Dotenco). + +v2.04: + * Improved support for multiple lists of acronyms. + + * Fixed bug that caused \glsadd to ignore counter option + + * Fixed bug that causes babel to override translator's definition + of \glossaryname. + + * Added user1, ... , user6 keys. + + * Added polyglossia support + + * makeglossaries now creates stub output file if input file is + empty + + glossaries-accsupp v0.2: + * Added access keys. + + * Added support for acronyms. + + mfirstuc v1.04: + * fixed bug occurring when initial control sequence + in the argument of \makefirstuc has more than one + argument. + +v2.03: + * Added check to see if \glossarymark has been defined + + * makeglossaries - failed file test messages printed to + stdout instead of stderr (so that it doesn't interrupt + latexmk). + + * Fixed bug when entries used at the start of a paragraph. + + * Added package option hyperfirst (boolean option to suppress + hyperlink on first use). + + * Added pod to makeglossaries. + +v2.02: + * Renamed glossaries-dictionary-Brazil.dict to + glossaries-dictionary-Brazilian.dict + + * Replaced \@mkboth with \glossarymark in \glossarysection + to make it easier for the user to override it + + * Fixed bug that generated no \printglossary warning when + the glossary is placed in a group + + * translate=false option will now prevent automatic loading + of translator package. + +v2.01: + * Documentation changes: + - removed quick guide section from glossaries.pdf and replaced + it with a separate beginners guide (glossariesbegin.pdf) + - added a section for front-end or script developers who + want to access information from the aux file + + * Added new ragged right versions of long/super styles + + * Added 'nomain' package option to suppress the creation of the + main glossary + + * Added 'nowarn' package option to suppress warnings + + * Removed unwanted full stops in transcript messages + + * Changed \linewidth to \hsize when setting lengths + + * Removed item_02 key from makeindex style file (no such key) + + * Moved \@do@wrglossary before term is displayed to prevent + unwanted whatsit + +v2.0 (1.20): + * Fixed ngerman caption bug in glossaries-babel.sty + +v1.19: + + * changed \acronymfont to use \textsmaller instead of \smaller + (for "smaller" package option) + + * Added \glsdisp (similar to \glslink except that it uses + \glsdisplay/glsdisplayfirst and unsets the first use flag) + + * Added experimental package glossaries-accsupp which + requires accsupp package. + +v1.18: + * fixed missing closing } in glossaries-babel.sty + + * added \glstarget so that glossary styles can be modified + in the document without using internal commands. + + * glossary-super.sty isn't loaded if supertabular.sty isn't + installed. + + * added nolong, nosuper, nolist, notree and nostyles package + options to prevent loading unnecessary packages. + + * added \oldacronym (emulates the old glossary package's + \newacronym command). + + * added sublistdotted style. + + * fixed bug caused by misspelt \glspagewidthlist (should be + \glspagelistwidth). + + * fixed border in super4colheaderborder and + altsuper4colheaderborder styles. + + * fixed sort sanitization when package option sanitize={name=false} + is used. + +v1.17: + * changed definition of \@glossary to prevent conflict with + memoir + + * added check to determine if \printglossary is defined. (If + it is, issue warning and redefine.) + + * provided means to suppress number list for specific entries + + * provided means to suppress description terminator for + specific entries + + * added cross-referencing support + + * added hierarchical support + + * added xindy support + + * modified \glshypernumber to support \nohyperpage + (code provided by Heiko Oberdiek) + + * added 2 and 3-page suffix support + + * added "order" package option to set word/letter ordering + (only has an effect in combination with makeglossaries script) + + * added Brazilian dictionary (supplied by Thiago de Melo) + +v1.16 : + * fixed bug that causes footnote option to remove hyperlink + for first use entries in glossaries other than the list + of acronyms. (footnote option should only affect entries + in \acronymtype glossary.) + + * Raised hypertarget so that links to glossary entries don't + scroll off the top of the page. + + * Fixed expansion-related bug (thanks to fix provided by + Ulrich Diez) + +v1.15 : + * added \glslabel + + * added altlong4col* and altsuper4col* styles + + * fixed PDF encoding problem caused when both translator + and hyperref packages are being used + + * fixed bug when using smallcaps and smaller options that causes + the long form in the list of acronyms to be the same for each + entry + + * Added warnings when rerun required when using glossary + group hyper navigation + +glossaries.perl v1.04: + * add do_cmd_glslabel + + * changed links to the start of the relevant glossary entry + rather than the entry's backlink + + * added implementation of starred forms of \gls etc + + * added frame related code if frames.pl has been loaded + +v1.14 : + * Fixed bug in \glsnavhyperlink that causes an error when used + with hyperref and translator packages. + + * Added \glsautoprefix (specifies a prefix to the automatically + generated label) + + * Added nonumberlist and numberedsection keys to \printglossary + + * Changed \glsnavigation so that it only lists the groups that + are present. (This prevents unknown target warnings.) + + * Amended documentation. + +mfirstuc v1.02 (18 June 2008): + + * Fixed bug that transfered grouping, (e.g + \makefirstuc{\emph{abc}xyz} moved the xyz into the \emph) + + * If group following initial command is empty, \MakeUppercase + is applied to the command, e.g. \makefirstuc{\ae{}bc} now + produces \MakeUppercase\ae{}bc. + +v1.13 : + * Fixed bug in long4colheaderborder that puts an extra row + at the end of the glossary. + + * Fixed bug in \glstext etc that ignored 3rd argument (thanks + to Franz Fischer for pointing this out). + + * Removed only preamble restriction on \newglossaryentry and + \newacronym. + + * Added \glspluralsuffix. + + * Changed firstplural default so that it takes its value from + the plural key if the first key is omitted. + + * Added \acrshortpl, \Acrshortpl, \ACRshortpl, \acrlongpl, + \Acrlongpl, \ACRlongpl, \acrfullpl, \Acrfullpl, \ACRfullpl. + + * Fixed bugs in \Acrshort etc. + + * Add package options "smaller" and "shortcuts". + + * Acronym default plural forms now implemented for the additional + acronym styles. + + * Fixed makeglossaries to allow filenames with spaces. + + * Fixed error in documentation describing \glsaddall + - optional argument should be a key=value list. + + * Added Polish support (thanks to Piotr Formella for supplying + the translations). + + * If babel is loaded and translator package is found on TeX's + path, then the translator package will now be automatically + loaded. + +mfirstuc v1.01 (13 May 2008): + + * Added \xmakefirstuc (expands argument before applying \makefirstuc) + +v1.12 (8 March 2008): + * Fixed bug that causes \glspl to print the plural short form + on first use instead of the plural long form. + + * Added descriptionplural and symbolplural keys. + + * Added \glsshortkey, \glsshortpluralkey, \glslongkey and + \glslongpluralkey. + + * Fixed bugs in \glsname, \glstext, \glsdesc etc. + + * Added a check for \hypertarget in addition to checking + for \hyperlink (in the event that \hyperlink is defined + but not \hypertarget). + + * Changed #! line in makeglossaries to use /usr/bin/env + + * Added package mfirstuc.sty which provides the command + \makefirstuc{} which makes the first object of + uppercase unless starts with a control + sequence followed by a group, in which case the first + object in the group is converted to uppercase. Examples: + + \makefirstuc{abc} -> Abc + \makefirstuc{\emph{abc}} -> \emph{Abc} + \makefirstuc{{\'a}bc} -> {\'A}bc + \makefirstuc{\ae bc} -> \AE bc + \makefirstuc{{\ae}bc} -> {\AE}bc + + (but don't do \makefirstuc{\ae{}bc} which produces \ae Bc.) + +v1.11 (2 March 2008): + * Fixed error in manual (glossary style is set using \glossarystyle + not \setglossarystyle). + + * Changed the way the package is archived to make it compatible + with TeX Live. + + * Improved error handling of makeglossaries and added --version + and --help options. + +v1.1 (22 Feb 2008): + + * New package options: + + - numberline: + inserts \numberline{} in \addcontentsline when used with + the toc option. + + - numberedsection: + puts glossaries in numbered chapters/sections + + - translate: + translate=false option prevents glossaries package from + using pre-supplied translations. + + - description: + changes definition of \newacronym to allow a description + + - footnote: + changes definition of \newacronym to use a footnote on + first use + + - smallcaps: + changes definition of \newacronym to set acronyms in + small capitals + + - dua: + changes definition of \newacronym to always expand + acronyms + + * Added \setglossarysection + - changes the section type used by the glossaries + + * Added listdotted glossary style. + + * No longer uses xspace package; uses amsgen instead. + + * Added \glsname, \glsdesc, \glssymbol, \glsfirst, \glstext, + \glsplural and \glsfirstplural. + + * Added support for translator package. + +v1.08 (13 Oct 2007): + * Added multilingual support + * Fixed bug in listgroup and altlistgroup styles so that + \glsgroupheading uses \glsgetgrouptitle to get the group title + instead of displaying the label + * Fixed typo in error message text when the description key + is missing to \newglossaryentry. + +v1.07 (13 Sep 2007): + * Fixed bug causing incorrect page number for entries in the + first paragraph of a page. + +v1.06 (21 Aug 2007): + * Changed the license text + +v1.05 (10 Aug 2007): + * Changed the default value of the sort key to just use the + name key + * Added \@mkboth to \glossarysection + +v1.04 (3 Aug 2007): + * Added \glstextformat + +v1.03 (4 July 2007): + * Added \glspostdescription + +v1.02 (25 May 2007): + * Added overview section in the documentation + +v1.01 (17 May 2007): + * Added number range facility (equivalent to makeindex's |( and |) + formatting commands.) + * Added a space after \delimN and \delimR in the ist file. + +v1.0 (16 May 2007): Initial release diff --git a/macros/latex/contrib/glossaries/INSTALL b/macros/latex/contrib/glossaries/INSTALL new file mode 100644 index 0000000000..e9ba724de8 --- /dev/null +++ b/macros/latex/contrib/glossaries/INSTALL @@ -0,0 +1,122 @@ +INSTALLATION + +The best method of installing is through your TeX package +manager, but if you need to use the manual method for some +reason, follow the instructions below. + +If you have downloaded the glossaries package using the TeX +Directory Structure (TDS), that is you have downloaded the archive +glossaries.tds.zip containing doc, tex, scripts and source +directories, you need to follow the "Installing from TDS" +instructions below. + +If you have downloaded the following files: + +glossaries.dtx +glossaries.ins +makeglossaries +makeglossaries.bat + +You need to follow the "Installing from DTX and INS" instructions +below. + +For further information on installing LaTeX packages see: + +http://www.tex.ac.uk/cgi-bin/texfaq2html?label=installthings + +INSTALLING FROM TDS +=================== + +Files in tex and doc directories should go in the corresponding +TEXMF directories (for example, ~/texmf or /usr/share/texmf-local/ or +C:\localtexmf\). The scripts/glossaries/ directory contains the Perl +script makeglossaries and the batch file makeglossaries.bat which +should go somewhere on your operating system's PATH. (Both files are +required for Windows, but only the Perl script is required for other +operating systems.) Similarly for makeglossaries-lite.lua, which is +a Lua alternative. + +Example (on UNIX like systems): + +unzip glossaries.tds.zip -d ~/texmf/ + +A minimal example file called minimalgls.tex is provided for testing +and debugging purposes and can be found in the package documentation +samples directory (doc/latex/glossaries/samples/). To test your +installation do: + +latex minimalgls +makeglossaries minimalgls +latex minimalgls + +The LaTeX2HTML style file, glossaries.perl, is located in +source/latex/glossaries and should go in the LaTeX2HTML styles +directory, if required. + +INSTALLING FROM DTX AND INS +=========================== + +Run LaTeX on glossaries.ins to generate the package style files, +sample files and LaTeX2HTML style file: + +latex glossaries.ins + +To create the package documentation (glossaries-code.pdf): + +pdflatex -jobname glossaries-code glossaries.dtx +makeindex -s gind.ist glossaries.idx +makeindex -s gglo.ist -o glossaries.gls glossaries.glo +makeglossaries glossaries +pdflatex -jobname glossaries-code glossaries.dtx +pdflatex -jobname glossaries-code glossaries.dtx + +If TEXMF denotes the base directory of your local TeX installation (e.g. +/usr/share/texmf-local/ or C:\localtexmf\) then create the following +directories (if they don't already exist): + +TEXMF/doc/latex/glossaries +TEXMF/doc/latex/glossaries/samples +TEXMF/tex/latex/glossaries +TEXMF/tex/latex/glossaries/base +TEXMF/tex/latex/glossaries/expl +TEXMF/tex/latex/glossaries/styles +TEXMF/tex/latex/glossaries/test-entries + +Move the example-glossaries-*.tex files to +TEXMF/tex/latex/glossaries/test-entries/ + +Move the sample files (*.tex) to TEXMF/doc/latex/glossaries/sample/ + +Move the documentation (*.pdf) to TEXMF/doc/latex/glossaries/ + +Move glossaries.sty, glossaries-babel.sty, +glossaries-polyglossia.sty, glossaries-compatible-207.sty, +glossaries-compatible-307.sty, +mfirstuc.sty and mfirstuc-english.sty to +TEXMF/tex/latex/glossaries/base/ + +Move glossaries-accsupp.sty to +TEXMF/tex/latex/glossaries/expl/ + +Move the other style files (glossary-*.sty) to +TEXMF/tex/latex/glossaries/styles/ + +Move makeglossaries to somewhere on your path, e.g. /usr/bin/. + +If you are a Windows user, you will also need to move +makeglossaries.bat to the same location as makeglossaries, but you +will need to have Perl installed to be able to use makeglossaries. +(It is possible to use makeindex or xindy directly if you don't have +Perl installed. See the manual, glossaries.pdf, for details.) + +A minimal example file called minimalgls.tex is provided for testing +and debugging purposes. This file is created along with all the other +sample files when you run glossaries.ins through LaTeX. To test your +installation do: + +latex minimalgls +makeglossaries minimalgls +latex minimalgls + +If you want to use the glossaries package with LaTeX2HTML: +move glossaries.perl to the LaTeX2HTML styles directory. diff --git a/macros/latex/contrib/glossaries/README b/macros/latex/contrib/glossaries/README new file mode 100644 index 0000000000..4f0e0ea8e5 --- /dev/null +++ b/macros/latex/contrib/glossaries/README @@ -0,0 +1,81 @@ +LaTeX Package : glossaries v4.42 + +Last Modified : 2019-01-06 + +Author : Nicola Talbot + +Package FAQ : http://www.dickimaw-books.com/faqs/glossariesfaq.html + +This package is provided to assist generating glossaries. +The package supports abbreviations and multiple glossaries. +New entries are defined to have a name and description (and +optionally an associated symbol). Plural forms can also be +specified. New glossary styles can be defined, and preambles +and postambles can be specified. There is provision for loading +a database of terms, only terms used in the text will be added +to the relevant glossary. + +*This package replaces the glossary package which is now obsolete.* + +glossaries-accsupp.sty is an experimental package that uses the +accsupp package to provide accessibility support for the +glossaries package. + +The glossaries package may be extended with the +separately-distributed glossaries-extra package +(https://ctan.org/pkg/glossaries-extra), which provides +more options and improved abbreviation handling. + +The mfirstuc package is now a separate bundle +(https://ctan.org/pkg/mfirstuc). + +INSTALLATION + +See INSTALL file for installation instructions. + +REQUIREMENTS + +mfirstuc +ifthen +xkeyval *at least version 2.5f (2006/11/18)* +xfor +amsgen +etoolbox +longtable (unless you use the nolong or nostyles package options) +datatool-base +textcase +tracklang (to determine if any language modules need to be loaded) + +If the supertabular package is installed, it will also be loaded +unless the nosuper or nostyles package options are used. If the +supertabular package isn't installed, you can still use the +glossaries package, but you won't be able to use any of the styles +defined in glossaries-super.sty. If you want to use +glossary-longragged.sty or glossary-superragged.sty you will also +need the array package. If you want to use glossary-mcols you will +also need the multicol package. + +Note that the current version of the glossaries package doesn't +load xspace. + +If you want to use the experimental glossaries-accsupp.sty +you will also need the accsupp package. + +LaTeX2HTML + +This package comes with a LaTeX2HTML style file glossaries.perl +which should be placed in the relevant LaTeX2HTML +styles directory, but note that these styles only supply a sub-set +of the commands provided by glossaries.sty, so some +commands may not be implemented or may be implemented in a different +way. This file has not be tested with recent versions of +LaTeX2HTML and may no longer be compatible. + +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/glossaries-code.pdf b/macros/latex/contrib/glossaries/glossaries-code.pdf new file mode 100644 index 0000000000..4401858727 Binary files /dev/null and b/macros/latex/contrib/glossaries/glossaries-code.pdf differ diff --git a/macros/latex/contrib/glossaries/glossaries-user.html b/macros/latex/contrib/glossaries/glossaries-user.html new file mode 100644 index 0000000000..df8866e01c --- /dev/null +++ b/macros/latex/contrib/glossaries/glossaries-user.html @@ -0,0 +1,31130 @@ + + + + + + + + + + + + + +

+

+ + +

+ + +

+
+

+

User Manual for glossaries.sty v4.42 +

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

2019-01-06

+
+

+ + +

+
+

+

Abstract

+

The glossaries package provides a means to define terms or abbreviations or symbols that can be +referenced within your document. Sorted lists with collated locations can be generated either +using TEX or using a supplementary indexing application. +

Additional features not provided here may be available through the extension package +glossaries-extra which, if required, needs to be installed separately. New features will be added +to glossaries-extra. Versions of the glossaries package after v4.21 will mostly be just bug fixes. +Note that glossaries-extra provides an extra indexing option (bib2gls) which isn’t available +with just the base glossaries package. +

+ + +

+
+

If you require multilingual support you must also separately install the relevant language +module. Each language module is distributed under the name glossaries-language⟩, +where ⟨language⟩ is the root language name. For example, glossaries-french or +glossaries-german. If a language module is required, the glossaries package will +automatically try to load it and will give a warning if the module isn’t found. See §1.4 +Multi-Lingual Support for further details. If there isn’t any support available for your +language, use the nolangwarn package option to suppress the warning and provide your own +translations. (For example, use the title key in \printglossary.) +

The glossaries package requires a number of other packages including, but not limited to, +tracklang, mfirstuc, etoolbox, xkeyval (at least version dated 2006/11/18), textcase, xfor, +datatool-base (part of the datatool bundle) and amsgen. These packages are all available in the +latest 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 (for Linux users) Updating TEX on +Linux. +

Note that occasionally you may find that certain packages need to be loaded after +packages that are required by glossaries. For example, a package ⟨X⟩ might need to be loaded +after amsgen. In which case, load the required package first (for example, amsgen), then ⟨X⟩, +and finally load glossaries. +

Documents have wide-ranging styles when it comes to presenting glossaries or lists of +terms or notation. People have their own preferences and to a large extent this +is determined by the kind of information that needs to go in the glossary. They +may just have symbols with terse descriptions or they may have long technical +words with complicated descriptions. The glossaries package is flexible enough to +accommodate such varied requirements, but this flexibility comes at a price: a big +manual. +

😱 If you’re freaking out at the size of this manual, start with glossariesbegin.pdf (“The +glossaries package: a guide for beginnners”). You should find it in the same directory as this +document or try texdoc glossariesbegin.pdf. Once you’ve got to grips with +the basics, then come back to this manual to find out how to adjust the settings. +

+

+

The glossaries bundle comes with the following documentation: +

+glossariesbegin.pdf
If you are a complete beginner, start with “The glossaries + package: a guide for beginners”. +
+glossary2glossaries.pdf
If you are moving over from the obsolete glossary package, + read “Upgrading from the glossary package to the glossaries package”. +
+glossaries-user.pdf
This document is the main user guide for the glossaries package. + + +
+glossaries-code.pdf
Advanced users wishing to know more about the inner workings + of all the packages provided in the glossaries bundle should read “Documented + Code for glossaries v4.42”. +
+INSTALL
Installation instructions. +
+CHANGES
Change log. +
+README
Package summary. +
+

Related resources:

+ +

If you use hyperref and glossaries, you must load hyperref first. Similarly the doc package +must also be loaded before glossaries. (If doc is loaded, the file extensions for the default main +glossary are changed to gls2, glo2 and .glg2 to avoid conflict with doc’s changes +glossary.) + + +

If you are using hyperref, it’s best to use pdflatex rather than latex (DVI format) as +pdflatex deals with hyperlinks much better. If you use the DVI format, you will encounter +problems where you have long hyperlinks or hyperlinks in subscripts or superscripts. This is +an issue with the DVI format not with glossaries. If you really need to use the DVI format and +have a problem with hyperlinks in maths mode, I recommend you use glossaries-extra with the +hyperoutside and textformat attributes set to appropriate values for problematic entries. +

+

+ + + + +

+

Contents

+
+ Glossary +
1 Introduction +
 1.1 Indexing Options +
 1.2 Sample Documents +
 1.3 Dummy Entries for Testing +
 1.4 Multi-Lingual Support +
  1.4.1 Changing the Fixed Names +
 1.5 Generating the Associated Glossary Files +
  1.5.1 Using the makeglossaries Perl Script +
  1.5.2 Using the makeglossaries-lite Lua Script +
  1.5.3 Using xindy explicitly (Option 3) +
  1.5.4 Using makeindex explicitly (Option 2) +
  1.5.5 Note to Front-End and Script Developers +
2 Package Options +
 2.1 General Options +
 2.2 Sectioning, Headings and TOC Options +
 2.3 Glossary Appearance Options +
 2.4 Sorting Options +
 2.5 Acronym Options +
  2.5.1 Deprecated Acronym Style Options +
 2.6 Other Options +
 2.7 Setting Options After the Package is Loaded +
3 Setting Up +
 3.1 Option 1 +
 3.2 Options 2 and 3 +
4 Defining Glossary Entries +
 4.1 Plurals +
 4.2 Other Grammatical Constructs +
 4.3 Additional Keys +
  4.3.1 Document Keys +
  4.3.2 Storage Keys +
 4.4 Expansion +
 4.5 Sub-Entries +
  4.5.1 Hierarchical Categories +
  4.5.2 Homographs + + +
 4.6 Loading Entries From a File +
 4.7 Moving Entries to Another Glossary +
 4.8 Drawbacks With Defining Entries in the Document Environment +
  4.8.1 Technical Issues +
  4.8.2 Good Practice Issues +
5 Number lists +
 5.1 Encap Values +
 5.2 Locations +
 5.3 Range Formations +
 5.4 Style Hook +
6 Links to Glossary Entries +
 6.1 The \gls-Like Commands (First Use Flag Queried) +
 6.2 The \glstext-Like Commands (First Use Flag Not Queried) +
 6.3 Changing the format of the link text +
 6.4 Enabling and disabling hyperlinks to glossary entries +
7 Adding an Entry to the Glossary Without Generating Text +
8 Cross-Referencing Entries +
 8.1 Customising Cross-reference Text +
9 Using Glossary Terms Without Links +
10 Displaying a glossary +
11 Xindy (Option 3) +
 11.1 Language and Encodings +
 11.2 Locations and Number lists +
 11.3 Glossary Groups +
12 Defining New Glossaries +
13 Acronyms and Other Abbreviations +
 13.1 Changing the Abbreviation Style +
  13.1.1 Predefined Acronym Styles +
  13.1.2 Defining A Custom Acronym Style +
 13.2 Displaying the List of Acronyms +
 13.3 Upgrading From the glossary Package +
14 Unsetting and Resetting Entry Flags +
 14.1 Counting the Number of Times an Entry has been Used (First Use Flag Unset) +
15 Glossary Styles +
 15.1 Predefined Styles +
  15.1.1 List Styles +
  15.1.2 Longtable Styles +
  15.1.3 Longtable Styles (Ragged Right) +
  15.1.4 Longtable Styles (booktabs) +
  15.1.5 Supertabular Styles +
  15.1.6 Supertabular Styles (Ragged Right) +
  15.1.7 Tree-Like Styles +
  15.1.8 Multicols Style +
  15.1.9 In-Line Style +
 15.2 Defining your own glossary style +
16 Utilities + + +
 16.1 Loops +
 16.2 Conditionals +
 16.3 Fetching and Updating the Value of a Field +
17 Prefixes or Determiners +
18 Accessibility Support +
19 Troubleshooting +
+ + + + + + +

List of Tables

+ + + + + +

+ + +

+

Glossary

+

This glossary style was setup using:

+
\usepackage[xindy, +
+

nonumberlist,
+

toc,
+

nopostdot,
+

style=altlist,
+

nogroupskip]{glossaries}
+

+

+bib2gls

An indexing application that combines two functions in one: (1) fetches entry + definition from a .bib file based on information provided in the .aux file (similar + to bibtex); (2) hierarchically sorts and collates location lists (similar to makeindex + and xindy). This application is designed for use with glossaries-extra and can’t be + used with just the base glossaries package.
+
+Command Line Interface (CLI)

An application that doesn’t have a graphical user interface. That is, an application + that doesn’t have any windows, buttons or menus and can be run in a command + prompt or terminal.
+
+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.
+
+Extended Latin Alphabet

An alphabet consisting of Latin characters and extended Latin characters.
+ + +
+Extended Latin Character

A character that’s created by combining Latin characters to form ligatures (e.g. æ) + or by applying diacritical marks to a Latin character or characters (e.g. á or ø). + See also non-Latin character.
+
+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. (See first use flag & first use text.)
+
+First use flag

A conditional that determines whether or not the entry has been used according + to the rules of first use. Commands to unset or reset this conditional are described + in §14 Unsetting and Resetting Entry Flags.
+
+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 or by + \defglsentry.)
+
+glossaries-extra

A separate package that extends the glossaries package, providing new features + or improving existing features. If you want to use glossaries-extra, you must have + both the glossaries package and the glossaries-extra package installed.
+
+Indexing application

An application (piece of software) separate from TEX/LATEX that collates and + sorts information that has an associated page reference. Generally the information + is an index entry but in this case the information is a glossary entry. There are + two main indexing applications that are used with TEX: makeindex and xindy. + These are both command line interface (CLI) applications.
+
+Latin Alphabet

The alphabet consisting of Latin characters. See also extended Latin alphabet.
+ + +
+Latin Character

One of the letters a, …, z, A, …, Z. See also extended Latin character.
+
+Link text

The text produced by commands such as \gls. It may or may not be a hyperlink + to the glossary.
+
+makeglossaries

A custom designed Perl script interface to xindy and makeindex provided + with the glossaries package. TEX distributions on Windows convert the original + makeglossaries script into an executable makeglossaries.exe for convenience + (but Perl is still required).
+
+makeglossariesgui

A Java GUI alternative to makeglossaries that also provides diagnostic tools. + Available separately on CTAN.
+
+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 actually + distributed 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.
+
+makeindex

An indexing application.
+
+Non-Latin Alphabet

An alphabet consisting of non-Latin characters.
+
+Non-Latin Character

An extended Latin character or a character that isn’t a Latin character.
+ + +
+Number list

A list of entry locations (also called a location list). The number list can be + suppressed using the nonumberlist package option.
+
+Sanitize

Converts command names into character sequences. That is, a command called, + say, \foo, is converted into the sequence of characters: \, f, o, o. Depending on + the font, the backslash character may appear as a dash when used in the main + document text, so \foo will appear as: —foo. +

Earlier versions of glossaries used this technique to write information to the files + used by the indexing applications to prevent problems caused by fragile commands. + Now, this is only used for the sort key.
+

+Standard LATEX Extended Latin Character

An extended Latin character that can be created by a core LATEX command, + such as \o (ø) or \’e (é). That is, the character can be produced without the + need to load a particular package.
+
+xindy

A flexible indexing application with multilingual support written in Perl.
+ + +

1. Introduction

+

The glossaries package is provided to assist generating lists of terms, symbols or +abbreviations. (For convenience, these lists are all referred to as glossaries in this manual.) +The package has a certain amount of flexibility, allowing the user to customize +the format of the glossary and define multiple glossaries. It also supports glossary +styles that include symbols (in addition to a name and description) for glossary +entries. There is provision for loading a database of glossary terms. Only those terms +indexed1.1 in +the document will be added to the glossary. +

The glossaries-extra package, which is distributed as a separated bundle, extends the +capabilities of the glossaries package. The simplest document can be created with +glossaries-extra (which internally loads the glossaries package): + + +

+
+\documentclass{article} + 
\usepackage[ + 
 sort=none,% no sorting or indexing required + 
 abbreviations,% create list of abbreviations + 
 symbols,% create list of symbols + 
 postdot % append a full stop after the descriptions + 
]{glossaries-extra} + 
\newglossaryentry % provided by glossaries.sty + 
 {cafe}% label + 
 {% definition: + 
   name={caf\'e}, + 
   description={small restaurant selling refreshments} + 
 } + 
\newabbreviation % provided by glossaries-extra.sty + 
 {html}% label + 
 {HTML}% short form + 
 {hypertext markup language}% long form + 
\glsxtrnewsymbol % provided by glossaries-extra.sty 'symbols' option + 
 [description={Archimedes' constant}]% options + 
 {pi}% label + 
 {\ensuremath{\pi}}% symbol + 
\begin{document} + 
First use: \gls{cafe}, \gls{html}, \gls{pi}. + 
Next use: \gls{cafe}, \gls{html}, \gls{pi}. + 
\printunsrtglossaries % list all defined entries + 
\end{document} +
+

+

The glossaries package replaces the glossary package which is now obsolete. +Please see the document “Upgrading from the glossary package to the glossaries package” for +assistance in upgrading. +

One of the strengths of this package is its flexibility, however the drawback of this is the +necessity of having a large manual that covers all the various settings. If you are +daunted by the size of the manual, try starting off with the much shorter guide for +beginners. +

There’s a common misconception that you have to have Perl installed in order to use +the glossaries package. Perl is not a requirement but it does increase the available +options, particularly if you use an extended Latin alphabet or a non-Latin alphabet. +
+ + +

+

This document uses the glossaries package. For example, when viewing the PDF version of +this document in a hyperlinked-enabled PDF viewer (such as Adobe Reader or +Okular) if you click on the word “xindy” you’ll be taken to the entry in the glossary +where there’s a brief description of the term “xindy”. This is the way the glossaries +mechanism works. An indexing application is used to generated the sorted list of +terms. The indexing applications are command line interface (CLI) tools, which +means they can be run directly from a command prompt or terminal, or can be +integrated into some text editors, or you can use a build tool such as arara to run +them. +

The remainder of this introductory section covers the following:

+ +

Top

1.1 Indexing Options

+

The basic idea behind the glossaries package is that you first define your entries (terms, +symbols or abbreviations). Then you can reference these within your document (like \cite or +\ref). You can also, optionally, display a list of the entries you have referenced in your +document (the glossary). This last part, displaying the glossary, is the part that most new +users find difficult. There are three options available with the base glossaries package and two +further options with the extension package glossaries-extra. An overview of these options is +given in table 1.1. +

If you are developing a class or package that loads glossaries, I recommend that you +don’t force the user into a particular indexing method by adding an unconditional +\makeglossaries into your class or package code. Aside from forcing the user into a +particular indexing method, it means that they’re unable to use any commands that must +come before \makeglossaries (such as \newglossary) and they can’t switch off the indexing +whilst working on a draft document. +

For a comparison of the various methods when used with large entry sets or when used +with symbols such as \alpha, see the glossaries performance page. + + +

+
+ + +


+ + +
Table 1.1: Glossary Options: Pros and Cons
+ + +
+ + + + + + + + + + + + + + + + +

Option 1 Option 2 Option 3 Option 4 Option 5

Requires +glossaries-extra?

Requires +an +external +application?

Requires +Perl?

Requires +Java?

Can +sort +extended +Latin +alphabets +or +non-Latin +alphabets?

* N/A

Efficient +sort +algorithm?

N/A

Can +use +a +different +sort +method +for +each +glossary?

N/A

Any +problematic +sort +values?

Are +entries +with +identical +sort +values +treated +as +separate +unique +entries?

§

Can +automatically +form +ranges +in +the +location +lists?

Can +have +non-standard +locations +in +the +location +lists?

Maximum +hierarchical +depth +(style-dependent)

# 3

\glsdisplaynumberlist +reliable?

\newglossaryentry +allowed +in +document +environment? +(Not +recommended.)

Requires +additional +write +registers?

Default +value +of +sanitizesort +package +option

false true true true true
+ +
+

________________________________________________________________________ +

* Strips standard LATEX accents (that is, accents generated by core LATEX commands) so, for +example, \AA is treated the same as A. +

Only with the hybrid method provided with glossaries-extra. +

Provided sort=none is used. +

§ Entries with the same sort value are merged. +

Requires some setting up. +

The locations must be set explicitly through the custom location field provided by glossaries-extra. +

# Unlimited but unreliable. +

Entries are defined in .bib format. \newglossaryentry should not be used explicitly. +

Provided docdefs=true or docdefs=restricted but not recommended. +

Provided docdefs=false or docdefs=restricted. +

Irrelevant with sort=none. (The record=only option automatically switches this on.) + + +

+

+
+ +

Option 1 (TEX)

+

This option doesn’t require an external indexing application but, with the default +alphabetic sorting, it’s very slow with severe limitations. If you want a sorted list, it +doesn’t work well for extended Latin alphabets or non-Latin alphabets. However, if +you use the sanitizesort=false package option (the default for Option 1) then the +standard LATEX accent commands will be ignored, so if an entry’s name is set to +{\’e}lite then the sort value will default to elite if sanitizesort=false is used and +will default to \’elite if sanitizesort=true is used. If you have any other kinds of +commands that don’t expand to ASCII characters, such as \alpha or \si, then you +must use sanitizesort=true or change the sort method (sort=use or sort=def) in the +package options or explicitly set the sort key when you define the relevant entries. For +example: + + +

+
+\newglossaryentry{alpha}{name={\ensuremath{\alpha}}, + 
 sort={alpha},description={...}} +
+

+

This option works best with the sort=def or sort=use setting. For any other setting, be +prepared for a long document build time, especially if you have a lot of entries defined. This +option is intended as a last resort for alphabetical sorting. This option allows a +mixture of sort methods. (For example, sorting by word order for one glossary and order of +use for another.) This option is not suitable for hierarchical glossaries and does not form +ranges in the number lists. If you really can’t use an indexing application consider using +Option 5 instead. +

+

    +
  1. Add + + +
    + \makenoidxglossaries +
    +

    to your preamble (before you start defining your entries, as described in §4 Defining + Glossary Entries). +

  2. +
  3. Put + + +
    + \printnoidxglossary +
    +

    where you want your list of entries to appear (described in §10 Displaying a glossary). + Alternatively, to display all glossaries use the iterative command: + + +

    +
    + \printnoidxglossaries +
    +

    +

  4. +
  5. Run LATEX twice on your document. (As you would do to make a table of contents + appear.) For example, click twice on the “typeset” or “build” or “PDFLATEX” button + in your editor.
+

Complete example: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\makenoidxglossaries % use TeX to sort + 
\newglossaryentry{sample}{name={sample}, + 
  description={an example}} + 
\begin{document} + 
\gls{sample}. + 
\printnoidxglossary + 
\end{document} +
+

+ +

+

+

Option 2 (makeindex)

+

This option uses a CLI application called makeindex to sort the entries. This application +comes with all modern TEX distributions, but it’s hard-coded for the non-extended Latin +alphabet. It can’t correctly sort accent commands (such as \’ or \c) and fails with UTF-8 +characters, especially for any sort values that start with a UTF-8 character (as it separates +the octets resulting in an invalid file encoding). This process involves making LATEX write +the glossary information to a temporary file which makeindex reads. Then makeindex writes +a new file containing the code to typeset the glossary. Then \printglossary reads this file in +on the next run. +

This option works best if you want to sort entries according to the English alphabet and +you don’t want to install Perl (or Java or you don’t want to use glossaries-extra). This method +can also work with the restricted shell escape since makeindex is considered a trusted +application. (So you should be able to use the automake package option provided the shell +escape hasn’t been completely disabled.) +

This method can form ranges in the number list but only accepts limited number formats: +\arabic, \roman, \Roman, \alph and \Alph. +

This option does not allow a mixture of sort methods. All glossaries must be sorted +according to the same method: word/letter ordering or order of use or order of definition. If +you need word ordering for one glossary and letter ordering for another you’ll have to +explicitly call makeindex for each glossary type. (The glossaries-extra package allows a hybrid +mix of Options 1 and 2 to provide word/letter ordering with Option 2 and order of +use/definition with Option 1. See the glossaries-extra documentation for further +details.) +

+

    +
  1. If you want to use makeindex’s -g option you must change the quote character using + + + \GlsSetQuote. For example: + + +
    + \GlsSetQuote{+} +
    +

    This must be used before \makeglossaries. Note that if you are using babel, the + shorthands aren’t enabled until the start of the document, so you won’t be able to use + the shorthands in definitions made in the preamble. +

  2. +
  3. Add + + +
    + \makeglossaries +
    +

    to your preamble (before you start defining your entries, as described in §4 Defining + Glossary Entries). +

  4. +
  5. Put + + +
    + \printglossary +
    +

    where you want your list of entries to appear (described in §10 Displaying a glossary). + Alternatively, to display all glossaries use the iterative command: + + +

    +
    + \printglossaries +
    +

    +

  6. +
  7. Run LATEX on your document. This creates files with the extensions .glo and .ist + (for example, if your LATEX document is called myDoc.tex, then you’ll have two + extra files called myDoc.glo and myDoc.ist). If you look at your document + at this point, you won’t see the glossary as it hasn’t been created yet. (If + you use glossaries-extra you’ll see the section heading and some boilerplate + text.) +
  8. +
  9. Run makeindex with the .glo file as the input file and the .ist file as the style so + that it creates an output file with the extension .gls. If you have access to a + terminal or a command prompt (for example, the MSDOS command prompt for + Windows users or the bash console for Unix-like users) then you need to run the + command: + + +
    + makeindex -s myDoc.ist -o myDoc.gls myDoc.glo +
    +

    (Replace myDoc with the base name of your LATEX document file. Avoid spaces in the + file name if possible.) If you don’t know how to use the command prompt, + then you can probably access makeindex via your text editor, but each editor + has a different method of doing this, so I can’t give a general description. + You will have to check your editor’s manual. The simplest approach is to use + arara and add the following comment lines to the start of your document: +

    +
    + % arara: pdflatex +
    % arara: makeglossaries +
    % arara: pdflatex +
    +
    (Replace makeglossaries with makeglossaries-lite if you don’t have Perl + installed.) +

    The default sort is word order (“sea lion” comes before “seal”). If you want letter + ordering you need to add the -l switch: + + +

    +
    + makeindex -l -s myDoc.ist -o myDoc.gls myDoc.glo +
    +

    (See §1.5.4 Using makeindex explicitly (Option 2) for further details on using + makeindex explicitly.) If you use makeglossaries or makeglossaries-lite + then use the order=letter package option and the -l option will be added + automatically. +

  10. +
  11. Once you have successfully completed the previous step, you can now run LATEX on + your document again. You’ll need to repeat the process if you have used the toc option + (unless you’re using glossaries-extra) to ensure the section heading is added + to the table of contents. You’ll also need to repeat the process if you have + any cross-references which can’t be indexed until the glossary file has been + created.
+

Complete example: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\makeglossaries % open glossary files + 
\newglossaryentry{sample}{name={sample}, + 
 description={an example}} + 
\begin{document} + 
\gls{sample}. + 
\printglossary + 
\end{document} +
+

+ +

+

+

Option 3 (xindy)

+

This option uses a CLI application called xindy to sort the entries. This application is more +flexible than makeindex and is able to sort extended Latin alphabets or non-Latin alphabets, +however it does still have some limitations. +

The xindy application comes with both TEX Live and MiKTEX, but since xindy is a +Perl script, you will also need to install Perl, if you don’t already have it. In a similar way to +Option 2, this option involves making LATEX write the glossary information to +a temporary file which xindy reads. Then xindy writes a new file containing the +code to typeset the glossary. Then \printglossary reads this file in on the next +run. +

This is the best option with just the base glossaries package if you want to sort according +to a language other than English or if you want non-standard location lists, but it can require +some setting up (see §11 Xindy (Option 3)). There are some problems with certain sort +values:

+
    +
  • entries with the same sort value are merged by xindy into a single glossary line + so you must make sure that each entry has a unique sort value; +
  • +
  • xindy forbids empty sort values; +
  • +
  • xindy automatically strips control sequences, the math-shift character $ and + braces {} from the sort value, which is usually desired but this can cause the sort + value to collapse to an empty string which xindy forbids.
+

In these problematic cases, you must set the sort field explicitly. For example: + + +

+
+\newglossaryentry{alpha}{name={\ensuremath{\alpha}}, + 
 sort={alpha},description={...}} +
+

+

All glossaries must be sorted according to the same method (word/letter ordering, order +of use, or order of definition). (The glossaries-extra package allows a hybrid mix +of Options 1 and 3 to provide word/letter ordering with Option 3 and order of +use/definition with Option 1. See the glossaries-extra documentation for further +details.) +

+

    +
  1. Add the xindy option to the glossaries package option list: + + +
    + \usepackage[xindy]{glossaries} +
    +

    If you are using a non-Latin script you’ll also need to either switch off the creation of + the number group: + + +

    +
    + \usepackage[xindy={glsnumbers=false}]{glossaries} +
    +

    or use either \GlsSetXdyFirstLetterAfterDigits{letter} or \GlsSetXdyNumberGroupOrder + {spec} to indicate where the number group should be placed (see §11 Xindy (Option + 3)). +

  2. +
  3. Add \makeglossaries to your preamble (before you start defining your entries, as + described in §4 Defining Glossary Entries). +
  4. +
  5. Run LATEX on your document. This creates files with the extensions .glo and .xdy + (for example, if your LATEX document is called myDoc.tex, then you’ll have two extra + files called myDoc.glo and myDoc.xdy). If you look at your document at this point, you + won’t see the glossary as it hasn’t been created yet. (If you’re using the extension + package glossaries-extra, you’ll see the section header and some boilerplate + text.) +
  6. +
  7. Run xindy with the .glo file as the input file and the .xdy file as a module so that it + creates an output file with the extension .gls. You also need to set the language name + and input encoding. If you have access to a terminal or a command prompt + (for example, the MSDOS command prompt for Windows users or the bash + console for Unix-like users) then you need to run the command (all on one + line): + + +
    + xindy -L english -C utf8 -I xindy -M myDoc +  
    -t myDoc.glg -o myDoc.gls myDoc.glo +
    +

    (Replace myDoc with the base name of your LATEX document file. Avoid spaces in the + file name. If necessary, also replace english with the name of your language and utf8 + with your input encoding, for example, -L german -C din5007-utf8.) Note that it’s + much simpler to use makeglossaries instead: + + +

    +
    + makeglossaries myDoc +
    +

    (Remember that xindy is a Perl script so if you can use xindy then you can also use + makeglossaries, and if you don’t want to use makeglossaries because you don’t want + to install Perl, then you can’t use xindy either.) +

    If you don’t know how to use the command prompt, then you can probably + access xindy or makeglossaries via your text editor, but each editor has a + different method of doing this, so I can’t give a general description. You + will have to check your editor’s manual. Again, a convenient method is to + use arara and add the follow comment lines to the start of your document: +

    +
    + % arara: pdflatex +
    % arara: makeglossaries +
    % arara: pdflatex +
    +
    +

    The default sort is word order (“sea lion” comes before “seal”). If you want letter + ordering you need to add the order=letter package option: + + +

    +
    + \usepackage[xindy,order=letter]{glossaries} +
    +

    (and return to the previous step). This option is picked up by makeglossaries. If you + are explicitly using xindy then you’ll need to add -M ord/letorder to the options list. + See §1.5.3 Using xindy explicitly (Option 3) for further details on using xindy + explicitly. +

  8. +
  9. Once you have successfully completed the previous step, you can now run + LATEX on your document again. As with the previous option, you may need to + repeat the process to ensure the table of contents and cross-references are + resolved. +
+

Complete example: + + +

+
+\documentclass{article} + 
\usepackage[xindy]{glossaries} + 
\makeglossaries % open glossary files + 
\newglossaryentry{sample}{name={sample}, + 
 description={an example}} + 
\begin{document} + 
\gls{sample}. + 
\printglossary + 
\end{document} +
+

+ +

+

+

Option 4 (bib2gls)

+

This option is only available with the extension package glossaries-extra. This method uses +bib2gls to both fetch entry definitions from .bib files and to hierarchically sort and +collate. +

All entries must be provided in one or more .bib files. (See the bib2gls user manual for +the required format.) The glossaries-extra package needs to be loaded with the record package +option + + +

+
+\usepackage[record]{glossaries-extra} +
+

or (equivalently) + + +

+
+\usepackage[record=only]{glossaries-extra} +
+

(It’s possible to use a hybrid of this method and Options 2 or 3 with record=alsoindex but in +general there is little need for this and it complicates the build process.) +

Each resource set is loaded with \GlsXtrLoadResources[options]. For example: + + +

+
+\GlsXtrLoadResources + 
[% definitions in entries1.bib and entries2.bib: + 
 src={entries1,entries2}, + 
 sort={de-CH-1996}% sort according to this locale + 
] +
+

You can have multiple resource commands. +

The glossary is displayed using + + +

+
+\printunsrtglossary +
+

Alternatively all glossaries can be displayed using the iterative command: + + +

+
+\printunsrtglossaries +
+

The document is build using: + + +

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

If letter groups are required, you need the --group switch: + + +

+
+bib2gls --group myDoc +
+

Unlike Options 2 and 3, this method doesn’t create a file containing the typeset glossary but +simply determines which entries are needed for the document, their associated locations and +(if required) their associated letter group. This option allows a mixture of sort methods. +(For example, sorting by word order for one glossary and order of use for another +or even sorting one block of the glossary differently to another block in the same +glossary.) +

This method supports Unicode and (with at least Java 8) uses the Common +Locale Data Repository, which provides more extensive language support than +xindy.1.2 The +locations in the number list may be in any format. If bib2gls can deduce a numerical value it +will attempt to form ranges otherwise it will simply list the locations. +

Complete example: + + +

+
+\documentclass{article} + 
\usepackage[record]{glossaries-extra} + 
\GlsXtrLoadResources[src={entries}] + 
\begin{document} + 
\gls{sample}. + 
\printunsrtglossary + 
\end{document} +
+

where entries.bib contains + + +

+
+@entry{sample, + 
 name={sample}, + 
 description={an example} + 
} +
+

See the bib2gls user manual for further details. + +

+

+

Option 5 (no sorting)

+

This option is only available with the extension package glossaries-extra. No indexing +application is required. This method is best used with the package option sort=none. + + +

+
+\usepackage[sort=none]{glossaries-extra} +
+

There’s no “activation” command (such as \makeglossaries for Options 2 and 3). +

All entries must be defined before the glossary is displayed (preferably in the preamble) in +the required order, and child entries must be defined immediately after their parent entry if +they must be kept together in the glossary +

The glossary is displayed using + + +

+
+\printunsrtglossary +
+

Alternatively all glossaries can be displayed using the iterative command: + + +

+
+\printunsrtglossaries +
+

This will display all defined entries, regardless of whether or not they have been used in the +document. The number lists have to be set explicitly otherwise they won’t appear. Note +that this uses the same command for displaying the glossary as Option 4. This is +because bib2gls takes advantage of this method by defining the wanted entries +in the required order and setting the locations (and letter group information, if +required). +

This just requires a single LATEX call + + +

+
+pdflatex myDoc +
+

unless the glossary needs to appear in the table of contents, in which case a second run is +required. + + +

+
+pdflatex myDoc + 
pdflatex myDoc +
+

(Naturally if the document also contains citations, and so on, then additional steps are +required. Similarly for all the other options above.) +

Complete example: + + +

+
+\documentclass{article} + 
\usepackage[sort=none]{glossaries-extra} + 
\newglossaryentry{sample}{name={sample}, + 
 description={an example}} + 
\begin{document} + 
\gls{sample}. + 
\printunsrtglossary + 
\end{document} +
+

See the glossaries-extra documentation for further details. +

+

+

Top

1.2 Sample Documents

+

The glossaries package is provided with some sample documents that illustrate the +various functions. These should be located in the samples subdirectory (folder) +of the glossaries documentation directory. This location varies according to your +operating system and TEX distribution. You can use texdoc to locate the main +glossaries documentation. For example, in a terminal or command prompt, type: + +
texdoc -l glossaries
+

+This should display a list of all the files in the glossaries documentation directory with +their full pathnames. (The GUI version of texdoc may also provide you with the +information.) +

If you can’t find the sample files on your computer, they are also available from your nearest +CTAN mirror at http://mirror.ctan.org/macros/latex/contrib/glossaries/samples/. +

The sample documents are listed +below1.3 If +you prefer to use UTF-8 aware engines (xelatex or lualatex) remember that you’ll need to +switch from fontenc & inputenc to fontspec where appropriate. The glossaries-extra package +provides some additional sample files. +

+minimalgls.tex
This document is a minimal working example. You can test your + installation using this file. To create the complete document you will need to do the + following steps: +
    +
  1. Run minimalgls.tex through LATEX either by typing +
    latex minimalgls
    + + +

    + in a terminal or by using the relevant button or menu item in your text editor or + front-end. This will create the required associated files but you will not see the + glossary. If you use PDFLATEX you will also get warnings about non-existent + references that look something like: + + +

    +
    + pdfTeX warning (dest): name{glo:aca} has been +  
    referenced but does not exist, +  
    replaced by a fixed one +
    +

    These warnings may be ignored on the first run. +

    If you get a Missing \begin{document} error, then it’s most likely that + your version of xkeyval is out of date. Check the log file for a warning + of that nature. If this is the case, you will need to update the xkeyval + package. +

  2. +
  3. If you have Perl installed, run makeglossaries on the document (§1.5 Generating + the Associated Glossary Files). This can be done on a terminal by typing + +
    makeglossaries minimalgls
    +

    + otherwise do +
    makeglossaries-lite minimalgls
    +

    + If for some reason you want to call makeindex explicitly, you can do this in a + terminal by typing (all on one line): +
    makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls + minimalgls.glo
    +

    + (See §1.5.4 Using makeindex explicitly (Option 2) for further details on using + makeindex explicitly.) +

    Note that if the file name contains spaces, you will need to use the double-quote + character to delimit the name. +

  4. +
  5. Run minimalgls.tex through LATEX again (as step 1)
+

You should now have a complete document. The number following each entry in the + glossary is the location number. By default, this is the page number where the entry + was referenced. +

There are three other files that can be used as a minimal working example: + mwe-gls.tex, mwe-acr.tex and mwe-acr-desc.tex. +

+sample-noidxapp.tex
This document illustrates how to use the glossaries package without + an external indexing application (Option 1). To create the complete document, you + need to do: +
latex sample-noidxapp + + +
latex sample-noidxapp
+

+

+sample-noidxapp-utf8.tex
As the previous example, except that it uses the inputenc + package. To create the complete document, you need to do: +
latex sample-noidxapp-utf8 +
latex sample-noidxapp-utf8
+

+

+sample4col.tex
This document illustrates a four column glossary where the entries have a + symbol in addition to the name and description. To create the complete document, you + need to do: +
latex sample4col +
makeglossaries sample4col +
latex sample4col
+

+ or +
latex sample4col +
makeglossaries-lite sample4col +
latex sample4col
+

+ The vertical gap between entries is the gap created at the start of each group. This can + be suppressed using the nogroupskip package option. +

+sampleAcr.tex
This document has some sample abbreviations. It also adds the glossary to + the table of contents, so an extra run through LATEX is required to ensure the + document is up to date: +
latex sampleAcr +
makeglossaries sampleAcr +
latex sampleAcr +
latex sampleAcr
+

+ (or use makeglossaries-lite). +

+sampleAcrDesc.tex
This is similar to the previous example, except that the abbreviations + have an associated description. As with the previous example, the glossary is + + + added to the table of contents, so an extra run through LATEX is required: + +
latex sampleAcrDesc +
makeglossaries sampleAcrDesc +
latex sampleAcrDesc +
latex sampleAcrDesc
+

+

+sampleDesc.tex
This is similar to the previous example, except that it defines the + abbreviations using \newglossaryentry instead of \newacronym. As with the previous + example, the glossary is added to the table of contents, so an extra run through + LATEX is required: +
latex sampleDesc +
makeglossaries sampleDesc +
latex sampleDesc +
latex sampleDesc
+

+

+sampleCustomAcr.tex
This document has some sample abbreviations with a custom + acronym style. It also adds the glossary to the table of contents, so an extra run through + LATEX is required: +
latex sampleCustomAcr +
makeglossaries sampleCustomAcr +
latex sampleCustomAcr +
latex sampleCustomAcr
+

+

+sampleFnAcrDesc.tex
This is similar to sampleAcrDesc.tex, except that it uses the + footnote-sc-desc style. As with the previous example, the glossary is added to the table + of contents, so an extra run through LATEX is required: +
latex sampleFnAcrDesc +
makeglossaries sampleFnAcrDesc +
latex sampleFnAcrDesc +
latex sampleFnAcrDesc
+

+ + +

+sample-FnDesc.tex
This example defines a custom display format that puts the description + in a footnote on first use. +
latex sample-FnDesc +
makeglossaries sample-FnDesc +
latex sample-FnDesc
+

+

+sample-custom-acronym.tex
This document illustrates how to define your own acronym + style if the predefined styles don’t suit your requirements. +
latex sample-custom-acronym +
makeglossaries sample-custom-acronym +
latex sample-custom-acronym
+

+

+sample-crossref.tex
This document illustrates how to cross-reference entries in the + glossary. +
latex sample-crossref +
makeglossaries sample-crossref +
latex sample-crossref
+

+

+sample-dot-abbr.tex
This document illustrates how to use the post link hook to adjust the + space factor after abbreviations. +
latex sample-dot-abbr +
makeglossaries sampledot-abbrf +
latex sample-dot-abbr
+

+

+sampleDB.tex
This document illustrates how to load external files containing the glossary + definitions. It also illustrates how to define a new glossary type. This document has the + number list suppressed and uses \glsaddall to add all the entries to the + glossaries without referencing each one explicitly. To create the document do: + + + +
latex sampleDB +
makeglossaries sampleDB +
latex sampleDB
+

+ or +
latex sampleDB +
makeglossaries-lite sampleDB +
latex sampleDB
+

+ The glossary definitions are stored in the accompanying files database1.tex and + database2.tex. If for some reason you want to call makeindex explicitly you must have + a separate call for each glossary: +

    +
  1. + Create + the + main + glossary + (all + on + one + line): + +
    makeindex + -s + sampleDB.ist + -t + sampleDB.glg + -o + sampleDB.gls + sampleDB.glo
    +

    +

  2. +
  3. + Create + the + secondary + glossary + (all + on + + + one + line): + +
    makeindex + -s + sampleDB.ist + -t + sampleDB.nlg + -o + sampleDB.not + sampleDB.ntn
    +

    + Note that both makeglossaries and makeglossaries-lite do this all in one call, + so they not only make it easier because you don’t need to supply all the switches + and remember all the extensions but they also call makeindex the appropriate + number of times.

+
+sampleEq.tex
This document illustrates how to change the location to something other + than the page number. In this case, the equation counter is used since all glossary + entries appear inside an equation environment. To create the document do: + +
latex sampleEq +
makeglossaries sampleEq +
latex sampleEq
+

+

+sampleEqPg.tex
This is similar to the previous example, but the number lists + are a mixture of page numbers and equation numbers. This example adds + the glossary to the table of contents, so an extra LATEX run is required: + +
latex sampleEqPg +
makeglossaries sampleEqPg +
latex sampleEqPg +
latex sampleEqPg
+

+

+sampleSec.tex
This document also illustrates how to change the location to something + other than the page number. In this case, the section counter is used. This example + adds the glossary to the table of contents, so an extra LATEX run is required: + + + +
latex sampleSec +
makeglossaries sampleSec +
latex sampleSec +
latex sampleSec
+

+

+sampleNtn.tex
This document illustrates how to create an additional glossary type. This + example adds the glossary to the table of contents, so an extra LATEX run is required: + +
latex sampleNtn +
makeglossaries sampleNtn +
latex sampleNtn +
latex sampleNtn
+

+ Note that if you want to call makeindex explicitly instead of using makeglossaries or + makeglossaries-lite then you need to call makeindex twice: +

    +
  1. + Create + the + main + glossary + (all + on + one + line): + +
    makeindex + -s + sampleNtn.ist + -t + sampleNtn.glg + -o + sampleNtn.gls + sampleNtn.glo
    +

    +

  2. + + +
  3. + Create + the + secondary + glossary + (all + on + one + line): + +
    makeindex + -s + sampleNtn.ist + -t + sampleNtn.nlg + -o + sampleNtn.not + sampleNtn.ntn
    +

    +

+
+sample.tex
This document illustrates some of the basics, including how to create child + entries that use the same name as the parent entry. This example adds the glossary to + the table of contents and it also uses \glsrefentry, so an extra LATEX run is + required: +
latex sample +
makeglossaries sample +
latex sample +
latex sample
+

+ You can see the difference between word and letter ordering if you substitute + order=word with order=letter. (Note that this will only have an effect if you use + makeglossaries or makeglossaries-lite. If you use makeindex explicitly, you will + need to use the -l switch to indicate letter ordering.) +

+sample-inline.tex
This document is like sample.tex, above, but uses the inline glossary + style to put the glossary in a footnote. +
+sampletree.tex
This document illustrates a hierarchical glossary structure where child + entries have different names to their corresponding parent entry. To create the + document do: +
latex sampletree + + +
makeglossaries sampletree +
latex sampletree
+

+

+sample-dual.tex
This document illustrates how to define an entry that both appears in + the list of acronyms and in the main glossary. To create the document do: + +
latex sample-dual +
makeglossaries sample-dual +
latex sample-dual
+

+

+sample-langdict.tex
This document illustrates how to use the glossaries package to create + English to French and French to English dictionaries. To create the document do: + +
latex sample-langdict +
makeglossaries sample-langdict +
latex sample-langdict
+

+

+samplexdy.tex
This document illustrates how to use the glossaries package with xindy + instead of makeindex. The document uses UTF8 encoding (with the inputenc package). + The encoding is picked up by makeglossaries. By default, this document will + create a xindy style file called samplexdy.xdy, but if you uncomment the + lines + + +
+ \setStyleFile{samplexdy-mc} +  
\noist +  
\GlsSetXdyLanguage{} +
+

it will set the style file to samplexdy-mc.xdy instead. This provides an additional letter + group for entries starting with “Mc” or “Mac”. If you use makeglossaries or + makeglossaries-lite, you don’t need to supply any additional information. If you + don’t use makeglossaries, you will need to specify the required information. Note that + if you set the style file to samplexdy-mc.xdy you must also specify \noist, otherwise + the glossaries package will overwrite samplexdy-mc.xdy and you will lose the “Mc” + letter group. +

To create the document do: +
latex samplexdy +
makeglossaries samplexdy +
latex samplexdy
+

+ If you don’t have Perl installed then you can’t use makeglossaries, but you also can’t + use xindy! However, if for some reason you want to call xindy explicitly instead of using + makeglossaries (or makeglossaries-lite):

+
    +
  • + if + you + are + using + the + default + style + file + samplexdy.xdy, + then + do + (no + line + breaks): + +
    xindy + -L + english + + + -C + utf8 + -I + xindy + -M + samplexdy + -t + samplexdy.glg + -o + samplexdy.gls + samplexdy.glo
    +

    +

  • +
  • + if + you + are + using + samplexdy-mc.xdy, + then + do + (no + line + breaks): + +
    xindy + -I + xindy + -M + samplexdy-mc + -t + samplexdy.glg + -o + samplexdy.gls + samplexdy.glo
    +

    +

+
+samplexdy2.tex
This document illustrates how to use the glossaries package where the + location numbers don’t follow a standard format. This example will only work with + xindy. To create the document do: +
pdflatex samplexdy2 + + +
makeglossaries samplexdy2 +
pdflatex samplexdy2
+

+ The + explicit + xindy + call + is: + +
xindy + -L + english + -C + utf8 + -I + xindy + -M + samplexdy2 + -t + samplexdy2.glg + -o + samplexdy2.gls + samplexdy2.glo
+

+ See §11.2 Locations and Number lists for further details. +

+samplexdy3.tex
This document is like samplexdy.tex but uses the command + \Numberstring from the fmtcount package to format the page numbers. +
+sampleutf8.tex
This is another example that uses xindy. Unlike makeindex, xindy can + cope with non-Latin characters. This document uses UTF8 encoding. To create the + document do: +
latex sampleutf8 +
makeglossaries sampleutf8 +
latex sampleutf8
+

+ The + explicit + xindy + call + + + is + (no + line + breaks): + +
xindy + -L + english + -C + utf8 + -I + xindy + -M + sampleutf8 + -t + sampleutf8.glg + -o + sampleutf8.gls + sampleutf8.glo
+

+

If you remove the xindy option from sampleutf8.tex and do: +
latex sampleutf8 +
makeglossaries sampleutf8 +
latex sampleutf8
+

+ or +
latex sampleutf8 +
makeglossaries-lite sampleutf8 +
latex sampleutf8
+

+ you + will + see + that + the + entries + that + start + with + an + extended + + + Latin + character + now + appear + in + the + symbols + group, + and + the + word + “manœuvre” + is + now + after + “manor” + instead + of + before + it. + If + you + want + to + explicitly + call + makeindex + (no + line + breaks): + +
makeindex + -s + sampleutf8.ist + -t + sampleutf8.glg + -o + sampleutf8.gls + sampleutf8.glo
+

+

+sample-index.tex
This document uses the glossaries package to create both a glossary and + an index. This requires two makeglossaries (or makeglossaries-lite) calls to ensure + the document is up to date: + + +
latex sample-index +
makeglossaries sample-index +
latex sample-index +
makeglossaries sample-index +
latex sample-index
+

+

+sample-newkeys.tex
This document illustrates how add custom keys (using \glsaddkey). +
+sample-storage-abbr.tex
This document illustrates how add custom storage keys (using + \glsaddstoragekey). +
+sample-storage-abbr-desc.tex
An extension of the previous example where the user + needs to provide a description. +
+sample-chap-hyperfirst.tex
This document illustrates how to add a custom key using + \glsaddstoragekey and hook into the \gls-like and \glstext-like mechanism used to + determine whether or not to hyperlink an entry. +
+sample-font-abbr.tex
This document illustrates how to different fonts for abbreviations + within the style. +
+sample-numberlist.tex
This document illustrates how to reference the number list in the + document text. This requires an additional LATEX run: +
latex sample-numberlist +
makeglossaries sample-numberlist +
latex sample-numberlist +
latex sample-numberlist
+

+

+samplePeople.tex
This document illustrates how you can hook into the standard sort + mechanism to adjust the way the sort key is set. This requires an additional run to + ensure the table of contents is up-to-date: +
latex samplePeople +
makeglossaries samplePeople +
latex samplePeople + + +
latex samplePeople
+

+

+sampleSort.tex
This is another document that illustrates how to hook into the standard + sort mechanism. An additional run is required to ensure the table of contents is + up-to-date: +
latex sampleSort +
makeglossaries sampleSort +
latex sampleSort +
latex sampleSort
+

+

+sample-nomathhyper.tex
This document illustrates how to selectively enable and disable + entry hyperlinks in \glsentryfmt. +
+sample-entryfmt.tex
This document illustrates how to change the way an entry is + displayed in the text. +
+sample-prefix.tex
This document illustrates the use of the glossaries-prefix package. + An additional run is required to ensure the table of contents is up-to-date: + +
latex sample-prefix +
makeglossaries sample-prefix +
latex sample-prefix +
latex sample-prefix
+

+

+sampleaccsupp.tex
This document uses the experimental glossaries-accsupp package. The + symbol is set to the replacement text. Note that some PDF viewers don’t use the + accessibility support. Information about the glossaries-accsupp package can be found in + §18 Accessibility Support. +
+sample-ignored.tex
This document defines an ignored glossary for common terms that + don’t need a definition. + + +
+sample-entrycount.tex
This document uses \glsenableentrycount and \cgls (described + in §14.1 Counting the Number of Times an Entry has been Used (First Use + Flag Unset)) so that acronyms only used once don’t appear in the list of + acronyms.
+

+

+

Top

1.3 Dummy Entries for Testing

+

In addition to the sample files described above, glossaries also provides some files containing +lorum ipsum dummy entries. These are provided for testing purposes and are on TEX’s path +(in tex/latex/glossaries/test-entries) so they can be included via \input or +\loadglsentries. The files are as follows: +

+example-glossaries-brief.tex
These entries all have brief descriptions. For example: + + +
+ \newglossaryentry{lorem}{name={lorem},description={ipsum}} +
+

+

+example-glossaries-long.tex
These entries all have long descriptions. For example: + + +
+ \newglossaryentry{loremipsum}{name={lorem ipsum}, +  
description={dolor sit amet, consectetuer adipiscing +  
elit. Ut purus elit, vestibulum ut, placerat ac, +  
adipiscing vitae, felis. Curabitur dictum gravida +  
mauris.}} +
+

+

+example-glossaries-multipar.tex
These entries all have multi-paragraph descriptions. +
+example-glossaries-symbols.tex
These entries all use the symbol key. For example: + + +
+ \newglossaryentry{alpha}{name={alpha}, +  
symbol={\ensuremath{\alpha}}, +  
description={Quisque ullamcorper placerat ipsum.}} +
+

+

+example-glossaries-symbolnames.tex
Similar to the previous file but the symbol key isn’t + used. Instead the symbol is stored in the name key. For example: + + +
+ \newglossaryentry{sym.alpha}{sort={alpha}, +  
name={\ensuremath{\alpha}}, +  
description={Quisque ullamcorper placerat ipsum.}} +
+

+

+example-glossaries-images.tex
These entries use the user1 key to store the name of an + image file. (The images are provided by the mwe package and should be on TEX’s + path.) One entry doesn’t have an associated image to help test for a missing + key. +
+example-glossaries-acronym.tex
These entries are all abbreviations. For example: + + +
+ \newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum +  
dolor} +
+

+

+example-glossaries-acronym-desc.tex
These entries are all abbreviations that use the + description key. For example: + + +
+ \newacronym[type=\glsdefaulttype, +  
  description={fringilla a, euismod sodales, +  
  sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula} +
+

+

+example-glossaries-acronyms-lang.tex
These entries are all abbreviations, where some of + them have a translation supplied in the user1 key. For example: + + +
+ \newacronym[type=\glsdefaulttype,user1={love itself}] +  
 {li}{LI}{lorem ipsum} +
+

+

+example-glossaries-parent.tex
These are hierarchical entries where the child entries use + the name key. For example: + + +
+ \newglossaryentry{sedmattis}{name={sed mattis}, +  
description={erat sit amet} +  
\newglossaryentry{gravida}{parent={sedmattis}, +  
  name={gravida},description={malesuada}} +
+

+

+example-glossaries-childnoname.tex
These are hierarchical entries where the child + entries don’t use the name key. For example: + + +
+ \newglossaryentry{scelerisque}{name={scelerisque}, +  
  description={at}} +
+

+

+example-glossaries-cite.tex
These entries use the user1 key to store a citation + key (or comma-separated list of citation keys). The citations are defined in + xampl.bib, which should be available on all modern TEX distributions. One + entry doesn’t have an associated citation to help test for a missing key. For + example: + + +
+ \newglossaryentry{fusce}{name={fusce}, +  
description={suscipit cursus sem},user1={article-minimal}} +
+

+

+example-glossaries-url.tex
These entries use the user1 key to store an URL associated + with the entry. For example: + + +
+ \newglossaryentry{aenean-url}{name={aenean}, +  
 description={adipiscing auctor est}, +  
 user1={http://uk.tug.org/}} +
+

+

The sample file glossary-lipsum-examples.tex in the doc/latex/glossaries/samples +directory uses all these files. See also http://www.dickimaw-books.com/gallery/#glossaries. +The glossaries-extra package provides additional test files. +

+

+

Top

1.4 Multi-Lingual Support

+

As from version 1.17, the glossaries package can be used with xindy as well as makeindex. If +you are writing in a language that uses an extended Latin alphabet or non-Latin alphabet it’s +best to use Option 3 (xindy) or Option 4 (bib2gls) as makeindex (Option 2) is hard-coded +for the non-extended Latin alphabet and Option 1 can performed limited ASCII +comparisons. +

This means that with Options 3 or 4 you are not restricted to the A, …, Z letter +groups. If you want to use xindy, remember to use the xindy package option. For +example: + + +

+
+\documentclass[frenchb]{article} + 
\usepackage[utf8]{inputenc} + 
\usepackage[T1]{fontenc} + 
\usepackage{babel} + 
\usepackage[xindy]{glossaries} +
+

If you want to use bib2gls, you need to use the record option with glossaries-extra +and supply the definitions in .bib files. (See the bib2gls user manual for further +details.) +

Note that although a non-Latin character, such as é, looks like a plain character +in your .tex file, with standard LATEX it’s actually a macro and can therefore +cause expansion problems. You may need to switch off the field expansions with +\glsnoexpandfields. This issue doesn’t occur with XeLaTeX or LuaLATEX. +
+

+

With inputenc, if you use a non-Latin character (or other expandable) character at the +start of an entry name, you must place it in a group, or it will cause a problem for +commands that convert the first letter to upper case (e.g. \Gls). For example: +

+
+\newglossaryentry}{elite}{name={{é}lite}, +
description={select group or class}} +
+
(With newer versions of mfirstuc and datatool-base you may be able to omit this grouping.) +For further details, see the “UTF-8” section in the mfirstuc user manual. +

If you are using xindy or bib2gls, the application needs to know the encoding of the +.tex file. This information is added to the .aux file and can be picked up by makeglossaries +and bib2gls. If you use xindy explicitly instead of via makeglossaries, you may need to +specify the encoding using the -C option. Read the xindy manual for further details of this +option. +

As from v4.24, if you are writing in German (for example, using the ngerman +package1.4 +or babel with the ngerman package option), and you want to use makeindex’s -g option, you’ll +need to change makeindex’s quote character using: +


\GlsSetQuote  \GlsSetQuote{character}

+

+Note that ⟨character⟩ may not be one of ? (question mark), | (pipe) or ! (exclamation mark). +For example: + + +

+
+\GlsSetQuote{+} +
+

This must be done before \makeglossaries and any entry definitions. It’s only applicable +for makeindex. This option in conjunction with ngerman will also cause makeglossaries to +use the -g switch when invoking makeindex. +

Be careful of babel’s shorthands. These aren’t switched on until the start of the +document, so any entries defined in the preamble won’t be able to use those shorthands. +However, if you define the entries in the document and any of those shorthands happen to be +special characters for makeindex or xindy (such as the double-quote) then this will interfere +with code that tries to escape any of those characters that occur in the sort key. +
+

+

In general, it’s best not to use babel’s shorthands in entry definitions. For example: + + +

+
+\documentclass{article} + 
\usepackage[ngerman]{babel} + 
\usepackage{glossaries} + 
\GlsSetQuote{+} + 
\makeglossaries + 
\newglossaryentry{rna}{name={ribonukleins\"aure}, + 
  sort={ribonukleins"aure}, + 
  description={eine Nukleins\"aure}} + 
\begin{document} + 
\gls{rna} + 
\printglossaries + 
\end{document} +
+

+

The ngerman package has the shorthands on in the preamble, so they can be used if +\GlsSetQuote has changed the makeindex quote character. Example: + + +

+
+\documentclass{article} + 
\usepackage[ngerman]{babel} + 
\usepackage{glossaries} + 
\GlsSetQuote{+} + 
\makeglossaries + 
\newglossaryentry{rna}{name={ribonukleins"aure}, + 
  description={eine Nukleins"aure}} + 
\begin{document} + 
\gls{rna} + 
\printglossaries + 
\end{document} +
+

+

+

+

Top

1.4.1 Changing the Fixed Names

+

The fixed names are produced using the commands listed in table 1.2. If you aren’t using a +language package such as babel or polyglossia that uses caption hooks, you can just redefine +these commands as appropriate. If you are using babel or polyglossia, you need to use their +caption hooks to change the defaults. See changing the words babel uses or read the babel or +polyglossia documentation. If you have loaded babel, then glossaries will attempt to load +translator, unless you have used the notranslate, translate=false or translate=babel package +options. If the translator package is loaded, the translations are provided by dictionary files +(for example, glossaries-dictionary-English.dict). See the translator package for advice +on changing translations provided by translator dictionaries. If you can’t work out +how to modify these dictionary definitions, try switching to babel’s interface using +translate=babel: + + +

+
+\documentclass[english,french]{article} + 
\usepackage{babel} + 
\usepackage[translate=babel]{glossaries} +
+

and then use babel’s caption hook mechanism. Note that if you pass the language options +directly to babel rather that using the document class options or otherwise passing the same +options to translator, then translator won’t pick up the language and no dictionaries will be +loaded and babel’s caption hooks will be used instead. +

+
+ + +


+ + +
Table 1.2: Customised Text
+ + +
+ + + + + + + + +
Command Name

Translator + Key + Word

Purpose

\glossaryname

Glossary

Title + of + the + main + glossary.

\acronymname

Acronyms

Title + of + the + list + of + acronyms + (when + used + with + package + option + acronym).

\entryname

Notation + (glossaries)

Header + for + first + column + in + the + glossary + (for + 2, + 3 + or + 4 + column + glossaries + that + support + headers).

\descriptionname

Description + (glossaries)

Header + for + second + column + in + the + glossary + (for + 2, + 3 + or + 4 + column + glossaries + that + support + headers).

\symbolname

Symbol + (glossaries)

Header + for + symbol + column + in + the + glossary + for + glossary + styles + that + support + this + option.

\pagelistname

Page + List + (glossaries)

Header + for + page + list + column + in + the + glossary + for + glossaries + that + support + this + option.

\glssymbolsgroupname

Symbols + (glossaries)

Header + for + symbols + section + of + the + glossary + for + glossary + styles + that + support + this + option.

\glsnumbersgroupname

Numbers + (glossaries)

Header + for + numbers + section + of + the + glossary + for + glossary + styles + that + support + this + option.

+ +
+ + +

+
+

As from version 4.12, multilingual support is provided by separate language modules that +need to be installed in addition to installing the glossaries package. You only need to install +the modules for the languages that you require. If the language module has an +unmaintained status, you can volunteer to take over the maintenance by contacting me at +http://www.dickimaw-books.com/contact.html. The translator dictionary files for glossaries +are now provided by the appropriate language module. For further details about +information specific to a given language, please see the documentation for that language +module. +

Examples of use:

+
    +
  • Using babel and translator: + + +
    + \documentclass[english,french]{article} +  
    \usepackage{babel} +  
    \usepackage{glossaries} +
    +

    (translator is automatically loaded). +

  • +
  • Using babel: + + +
    + \documentclass[english,french]{article} +  
    \usepackage{babel} +  
    \usepackage[translate=babel]{glossaries} +
    +

    (translator isn’t loaded). +

  • +
  • Using polyglossia: + + +
    + \documentclass{article} +  
    \usepackage{polyglossia} +  
    \setmainlanguage{english} +  
    \usepackage{glossaries} +
    +

    +

    +
+

Due to the varied nature of glossaries, it’s likely that the predefined translations may not +be appropriate. If you are using the babel package and the glossaries package option +translate=babel, you need to be familiar with the advice given in changing the words +babel uses. If you are using the translator package, then you can provide your own +dictionary with the necessary modifications (using \deftranslation) and load it using +\usedictionary. If you simply want to change the title of a glossary, you can use the +title key in commands like \printglossary (but not the iterative commands like +\printglossaries). +

Note that the translator dictionaries are loaded at the beginning of the document, so it +won’t have any effect if you put \deftranslation in the preamble. It should be put in your +personal dictionary instead (as in the example below). See the translator documentation for +further details. (Now with beamer documentation.)
+

+

Your custom dictionary doesn’t have to be just a translation from English to another +language. You may prefer to have a dictionary for a particular type of document. For +example, suppose your institution’s in-house reports have to have the glossary labelled as +“Nomenclature” and the page list should be labelled “Location”, then you can create a file +called, say, + + +

+
+myinstitute-glossaries-dictionary-English.dict +
+

that contains the following: + + +

+
+\ProvidesDictionary{myinstitute-glossaries-dictionary}{English} + 
\deftranslation{Glossary}{Nomenclature} + 
\deftranslation{Page List (glossaries)}{Location} +
+

You can now load it using: + + +

+
+\usedictionary{myinstitute-glossaries-dictionary} +
+

(Make sure that myinstitute-glossaries-dictionary-English.dict can be +found by TEX.) If you want to share your custom dictionary, you can upload it to +CTAN. +

If you are using babel and don’t want to use the translator interface, you can use the +package option translate=babel. For example: + + +

+
+\documentclass[british]{article} + 
\usepackage{babel} + 
\usepackage[translate=babel]{glossaries} + 
\addto\captionsbritish{% + 
    \renewcommand*{\glossaryname}{List of Terms}% + 
    \renewcommand*{\acronymname}{List of Acronyms}% + 
} +
+

+

Note that xindy and bib2gls provide much better multi-lingual support than makeindex, +so I recommend that you use Options 3 or 4 if you have glossary entries that contain +non-Latin characters. See §11 Xindy (Option 3) for further details on xindy, and see the +bib2gls user manual for further details of that application. +

+
Creating a New Language Module
+

The glossaries package now uses the tracklang package to determine which language modules +need to be loaded. If you want to create a new language module, you should first read the +tracklang documentation. +

To create a new language module, you need to at least create two files: glossaries-lang.ldf +and glossaries-dictionary-Lang.dict where ⟨lang⟩ is the root language name (for +example, english) and ⟨Lang⟩ is the language name used by translator (for example, +English). +

Here’s an example of glossaries-dictionary-English.dict: + + +

+
+\ProvidesDictionary{glossaries-dictionary}{English} + 
\providetranslation{Glossary}{Glossary} + 
\providetranslation{Acronyms}{Acronyms} + 
\providetranslation{Notation (glossaries)}{Notation} + 
\providetranslation{Description (glossaries)}{Description} + 
\providetranslation{Symbol (glossaries)}{Symbol} + 
\providetranslation{Page List (glossaries)}{Page List} + 
\providetranslation{Symbols (glossaries)}{Symbols} + 
\providetranslation{Numbers (glossaries)}{Numbers} +
+

You can use this as a template for your dictionary file. Change English to the translator name +for your language (so that it matches the file name glossaries-dictionary-Lang.dict) +and, for each \providetranslation, change the second argument to the appropriate +translation. +

Here’s an example of glossaries-english.ldf: + + +

+
+\ProvidesGlossariesLang{english} + 
\glsifusedtranslatordict{English} + 
{% + 
  \addglossarytocaptions{\CurrentTrackedLanguage}% + 
  \addglossarytocaptions{\CurrentTrackedDialect}% + 
} + 
{% + 
  \@ifpackageloaded{polyglossia}% + 
  {% + 
    \newcommand*{\glossariescaptionsenglish}{% + 
      \renewcommand*{\glossaryname}{\textenglish{Glossary}}% + 
      \renewcommand*{\acronymname}{\textenglish{Acronyms}}% + 
      \renewcommand*{\entryname}{\textenglish{Notation}}% + 
      \renewcommand*{\descriptionname}{\textenglish{Description}}% + 
      \renewcommand*{\symbolname}{\textenglish{Symbol}}% + 
      \renewcommand*{\pagelistname}{\textenglish{Page List}}% + 
      \renewcommand*{\glssymbolsgroupname}{\textenglish{Symbols}}% + 
      \renewcommand*{\glsnumbersgroupname}{\textenglish{Numbers}}% + 
    }% + 
  }% + 
  {% + 
    \newcommand*{\glossariescaptionsenglish}{% + 
      \renewcommand*{\glossaryname}{Glossary}% + 
      \renewcommand*{\acronymname}{Acronyms}% + 
      \renewcommand*{\entryname}{Notation}% + 
      \renewcommand*{\descriptionname}{Description}% + 
      \renewcommand*{\symbolname}{Symbol}% + 
      \renewcommand*{\pagelistname}{Page List}% + 
      \renewcommand*{\glssymbolsgroupname}{Symbols}% + 
      \renewcommand*{\glsnumbersgroupname}{Numbers}% + 
    }% + 
  }% + 
  \ifcsdef{captions\CurrentTrackedDialect} + 
  {% + 
    \csappto{captions\CurrentTrackedDialect}% + 
    {% + 
      \glossariescaptionsenglish + 
    }% + 
  }% + 
  {% + 
    \ifcsdef{captions\CurrentTrackedLanguage} + 
    { + 
      \csappto{captions\CurrentTrackedLanguage}% + 
      {% + 
        \glossariescaptionsenglish + + + 
      }% + 
    }% + 
    {% + 
    }% + 
  }% + 
  \glossariescaptionsenglish + 
} + 
\renewcommand*{\glspluralsuffix}{s} + 
\renewcommand*{\glsacrpluralsuffix}{\glspluralsuffix} + 
\renewcommand*{\glsupacrpluralsuffix}{\glstextup{\glspluralsuffix}} +
+

This is a somewhat longer file, but again you can use it as a template. Replace English with +the translator language label ⟨Lang⟩ used for the dictionary file and replace english with the +root language name ⟨lang⟩. Within the definition of \glossariescaptionslang⟩, replace the +English text (such as “Glossaries”) with the appropriate translation. +

Note: the suffixes used to generate the plural forms when the plural hasn’t been specified +are given by \glspluralsuffix (for general entries) and \glsupacrpluralsuffix for +acronyms where the suffix needs to be set using \glstextup to counteract the effects of +\textsc and \glsacrpluralsuffix for other acronym styles. There’s no guarantee when +these commands will be expanded. They may be expanded on definition or they may be +expanded on use, depending on the glossaries configuration. +

Therefore these plural suffix command definitions aren’t included in the caption +mechanism as that’s typically not switched on until the start of the document. This means +that the suffix in effect will be for the last loaded language that redefined these +commands. It’s best to initialise these commands to the most common suffix required in +your document and use the plural, longplural, shortplural etc keys to override exceptions. +
+

+

If you want to add a regional variation, create a file called glossaries-iso lang-iso +country.ldf, where ⟨iso lang⟩ is the ISO language code and ⟨iso country⟩ is the ISO country +code. For example, glossaries-en-GB.ldf. This file can load the root language file and +make the appropriate changes, for example: + + +

+
+ \ProvidesGlossariesLang{en-GB} + 
 \RequireGlossariesLang{english} + 
 \glsifusedtranslatordict{British} + 
 {% + 
   \addglossarytocaptions{\CurrentTrackedLanguage}% + 
   \addglossarytocaptions{\CurrentTrackedDialect}% + 
 } + 
 {% + 
   \@ifpackageloaded{polyglossia}% + 
   {% + 
     % Modify \glossariescaptionsenglish as appropriate for + 
     % polyglossia + 
   }% + 
   {% + 
     % Modify \glossariescaptionsenglish as appropriate for + 
     % non-polyglossia + 
   }% + 
 } +
+

+

If the translations includes non-Latin characters, it’s necessary to provide code that’s +independent of the input encoding. Remember that while some users may use UTF-8, others +may use Latin-1 or any other supported encoding, but while users won’t appreciate +you enforcing your preference on them, it’s useful to provide a UTF-8 version for +XeLaTeX users. +

The glossaries-irish.ldf file provides this as follows: + + +

+
+\ProvidesGlossariesLang{irish} + 
\glsifusedtranslatordict{Irish} + 
{% + 
  \addglossarytocaptions{\CurrentTrackedLanguage}% + 
  \addglossarytocaptions{\CurrentTrackedDialect}% + 
} + 
{% + 
  \ifdefstring{\inputencodingname}{utf8} + 
  {\input{glossaries-irish-utf8.ldf}}% + 
  {% + 
    \ifdef{\XeTeXinputencoding}% XeTeX defaults to UTF-8 + 
    {\input{glossaries-irish-utf8.ldf}}% + 
    {\input{glossaries-irish-noenc.ldf}} + 
  } + 
  \ifcsdef{captions\CurrentTrackedDialect} + 
  {% + 
    \csappto{captions\CurrentTrackedDialect}% + 
    {% + 
      \glossariescaptionsirish + 
    }% + 
  }% + 
  {% + 
    \ifcsdef{captions\CurrentTrackedLanguage} + 
    { + 
      \csappto{captions\CurrentTrackedLanguage}% + 
      {% + 
        \glossariescaptionsirish + 
      }% + 
    }% + 
    {% + 
    }% + 
  }% + 
  \glossariescaptionsirish + 
} +
+

(Again you can use this as a template. Replace irish with your root language label and +Irish with the translator dictionary label.) +

There are now two extra files: glossaries-irish-noenc.ldf and glossaries-irish-utf8.ldf. +

These both define \glossariescaptionsirish but the *-noenc.ldf uses LATEX accent +commands: + + +

+
+\@ifpackageloaded{polyglossia}% + 
{% + 
  \newcommand*{\glossariescaptionsirish}{% + 
    \renewcommand*{\glossaryname}{\textirish{Gluais}}% + 
    \renewcommand*{\acronymname}{\textirish{Acrainmneacha}}% + 
    \renewcommand*{\entryname}{\textirish{Ciall}}% + 
    \renewcommand*{\descriptionname}{\textirish{Tuairisc}}% + 
    \renewcommand*{\symbolname}{\textirish{Comhartha}}% + 
    \renewcommand*{\glssymbolsgroupname}{\textirish{Comhartha\'{\i}}}% + 
    \renewcommand*{\pagelistname}{\textirish{Leathanaigh}}% + 
    \renewcommand*{\glsnumbersgroupname}{\textirish{Uimhreacha}}% + 
  }% + 
}% + 
{% + 
  \newcommand*{\glossariescaptionsirish}{% + 
    \renewcommand*{\glossaryname}{Gluais}% + 
    \renewcommand*{\acronymname}{Acrainmneacha}% + 
    \renewcommand*{\entryname}{Ciall}% + 
    \renewcommand*{\descriptionname}{Tuairisc}% + 
    \renewcommand*{\symbolname}{Comhartha}% + 
    \renewcommand*{\glssymbolsgroupname}{Comhartha\'{\i}}% + 
    \renewcommand*{\pagelistname}{Leathanaigh}% + 
    \renewcommand*{\glsnumbersgroupname}{Uimhreacha}% + 
  }% + 
} +
+

whereas the *-utf8.ldf replaces the accent commands with the appropriate UTF-8 +characters. +

+

+

Top

1.5 Generating the Associated Glossary Files

+

This section is only applicable if you have chosen Options 2 or 3. You can ignore this section +if you have chosen any of the other options. If you want to alphabetically sort your entries +always remember to use the sort key if the name contains any LATEX commands. +
+

+

If this section seriously confuses you, and you can’t work out how to run external +tools like makeglossaries or makeindex, you can try using the automake package +option, described in §2.4 Sorting Options, but you will need TEX’s shell escape +enabled. + + +

In order to generate a sorted glossary with compact number lists, it is necessary to use an +external indexing application as an intermediate step (unless you have chosen Option 1, +which uses TEX to do the sorting or Option 5, which doesn’t perform any sorting). It is this +application that creates the file containing the code required to typeset the glossary. If this +step is omitted, the glossaries will not appear in your document. The two +indexing applications that are most commonly used with LATEX are makeindex and +xindy. As from version 1.17, the glossaries package can be used with either of these +applications. Previous versions were designed to be used with makeindex only. With +the glossaries-extra package, you can also use bib2gls as the indexing application. +(See the glossaries-extra and bib2gls user manuals for further details.) Note that +xindy and bib2gls have much better multi-lingual support than makeindex, so +xindy or bib2gls are recommended if you’re not writing in English. Commands +that only have an effect when xindy is used are described in §11 Xindy (Option +3). +

This is a multi-stage process, but there are methods of automating document compilation +using applications such as latexmk and arara. With arara you can just add special +comments to your document source:

+
+% arara: pdflatex +
% arara: makeglossaries +
% arara: pdflatex +
+
With latexmk you need to set up the required dependencies.
+

+

The glossaries package comes with the Perl script makeglossaries which will run +makeindex or xindy on all the glossary files using a customized style file (which is created by +\makeglossaries). See §1.5.1 Using the makeglossaries Perl Script for further details. Perl is +stable, cross-platform, open source software that is used by a number of TEX-related +applications (including xindy and latexmk). Most Unix-like operating systems come with +a Perl interpreter. TEX Live also comes with a Perl interpreter. MiKTEX doesn’t come +with a Perl interpreter so if you are a Windows MiKTEX user you will need to install Perl if +you want to use makeglossaries or xindy. Further information is available at +http://www.perl.org/about.html and MiKTeX and Perl scripts (and one Python +script). +

The advantages of using makeglossaries:

+
    +
  • It automatically detects whether to use makeindex or xindy and sets the relevant + application switches. +
  • +
  • One call of makeglossaries will run makeindex/xindy for each glossary type. +
  • + + +
  • If things go wrong, makeglossaries will scan the messages from makeindex or + xindy and attempt to diagnose the problem in relation to the glossaries package. + This will hopefully provide more helpful messages in some cases. If it can’t diagnose + the problem, you will have to read the relevant transcript file and see if you can + work it out from the makeindex or xindy messages. +
  • +
  • If makeindex warns about multiple encap values, makeglossaries will detect this + and attempt to correct the problem.1.5 + This correction is only provided by makeglossaries when makeindex is used since + xindy uses the order of the attributes list to determine which format should take + precedence. (See \GlsAddXdyAttribute in §11.2 Locations and Number lists.) +
+

As from version 4.16, the glossaries package also comes with a Lua script called +makeglossaries-lite. This is a trimmed-down alternative to the makeglossaries Perl +script. It doesn’t have some of the options that the Perl version has and it doesn’t attempt to +diagnose any problems, but since modern TEX distributions come with LuaTEX (and +therefore have a Lua interpreter) you don’t need to install anything else in order to use +makeglossaries-lite so it’s an alternative to makeglossaries if you want to use Option 2 +(makeindex). +

If things go wrong and you can’t work out why your glossaries aren’t being generated +correctly, you can use makeglossariesgui as a diagnostic tool. Once you’ve fixed the +problem, you can then go back to using makeglossaries or makeglossaries-lite. +

Whilst I strongly recommended that you use the makeglossaries Perl script or +the makeglossaries-lite Lua script, it is possible to use the glossaries package +without using those applications. However, note that some commands and package +options have no effect if you explicitly run makeindex/xindy. These are listed in +table 1.3. +

If you are choosing not to use makeglossaries because you don’t want to install Perl, +you will only be able to use makeindex as xindy also requires Perl. (Other useful Perl +scripts include epstopdf and latexmk, so it’s well-worth the effort to install Perl.) +
+

+

Note that if any of your entries use an entry that is not referenced outside +the glossary, you will need to do an additional makeglossaries, makeindex or +xindy run, as appropriate. For example, suppose you have defined the following +entries:1.6 + + +

+
+\newglossaryentry{citrusfruit}{name={citrus fruit}, + 
description={fruit of any citrus tree. (See also + 
\gls{orange})}} + 
\newglossaryentry{orange}{name={orange}, + 
description={an orange coloured fruit.}} +
+

and suppose you have \gls{citrusfruit} in your document but don’t reference +the orange entry, then the orange entry won’t appear in your glossary until you +first create the glossary and then do another run of makeglossaries, makeindex +or xindy. For example, if the document is called myDoc.tex, then you must do: + +
latex myDoc +
makeglossaries myDoc +
latex myDoc +
makeglossaries myDoc +
latex myDoc
+

+(Note that if you use glossaries-extra, this will be done automatically for you if +the indexcrossrefs feature is enabled. See the glossaries-extra user guide for further +details.) +

Likewise, an additional makeglossaries and LATEX run may be required if the +document pages shift with re-runs. For example, if the page numbering is not reset after the +table of contents, the insertion of the table of contents on the second LATEX run may push +glossary entries across page boundaries, which means that the number lists in the glossary +may need updating. +

The examples in this document assume that you are accessing makeglossaries, xindy or +makeindex via a terminal. Windows users can use the MSDOS Prompt which is usually +accessed via the Start->All Programs menu or Start->All Programs->Accessories +menu. +

Alternatively, your text editor may have the facility to create a function that will call the +required application. See Incorporating makeglossaries or makeglossaries-lite or bib2gls into +the document build. +

If any problems occur, remember to check the transcript files (e.g. .glg or .alg) for +messages. +

+
+ + +


+ + +
Table 1.3: Commands and package options that have no effect when using xindy or +makeindex explicitly
+
+ + + + +
Command or Package Option makeindex xindy
order=letter use -l use -M ord/letorder
order=word default default
xindy={language=lang,codename=code} N/A use -Llang-Ccode
\GlsSetXdyLanguage{lang} N/A use -Llang
\GlsSetXdyCodePage{code} N/A use -Ccode
+
+ + +

+
+

Top

1.5.1 Using the makeglossaries Perl Script

+

The makeglossaries script picks up the relevant information from the auxiliary (.aux) file +and will either call xindy or makeindex, depending on the supplied information. Therefore, +you only need to pass the document’s name without the extension to makeglossaries. For +example, if your document is called myDoc.tex, type the following in your terminal: + +
latex myDoc +
makeglossaries myDoc +
latex myDoc
+

+You may need to explicitly load makeglossaries into Perl: +
perl makeglossaries myDoc
+

+

Windows users: TEX Live on Windows has its own internal Perl interpreter and provides +makeglossaries.exe as a convenient wrapper for the makeglossaries Perl script. MiKTeX also +provides a wrapper makeglossaries.exe but doesn’t provide a Perl interpreter, which is still +required even if you run MiKTeX’s makeglossaries.exe, so with MiKTeX you’ll need to install +Perl.1.7 +There’s more information about this at http://tex.stackexchange.com/q/158796/19862 +on the TeX.SX site. +

The makeglossaries script attempts to fork the makeindex/xindy process +using open() on the piped redirection 2>&1 | and parses the processor output to +help diagnose problems. If this method fails makeglossaries will print an “Unable +to fork” warning and will retry without redirection. If you run makeglossaries +on an operating system that doesn’t support this form of redirection, then you +can use the -Q switch to suppress this warning or you can use the -k switch to +make makeglossaries automatically use the fallback method without attempting +the redirection. Without this redirection, the -q (quiet) switch doesn’t work as +well. +

You can specify in which directory the .aux, .glo etc files are located using the -d switch. +For example: +
pdflatex -output-directory myTmpDir myDoc +
makeglossaries -d myTmpDir myDoc
+

+Note that makeglossaries assumes by default that makeindex/xindy is on your operating +system’s path. If this isn’t the case, you can specify the full pathname using -m +⟨path/to/makeindex⟩ for makeindex or -xpath/to/xindy⟩ for xindy. +

As from makeglossaries v2.18, if you are using makeindex, there’s a check for +makeindex’s multiple encap warning. This is where different encap values (location formats) +are used on the same location for the same entry. For example: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\makeglossaries + 
\newglossaryentry{sample}{name={sample},description={an example}} + 
\begin{document} + 
\gls{sample}, \gls[format=textbf]{sample}. + 
\printglossaries + 
\end{document} +
+

If you explicitly use makeindex, this will cause a warning and the location list +will be “1, 1”. That is, the page number will be repeated with each format. As +from v2.18, makeglossaries will check for this warning and, if found, will attempt +to correct the problem by removing duplicate locations and retrying. There’s no +similar check for xindy as xindy won’t produce any warning and will simply discard +duplicates. +

The makeglossaries script contains POD (Plain Old Documentation). If you want, you +can create a man page for makeglossaries using pod2man and move the resulting file onto +the man path. Alternatively do makeglossaries --help for a list of all options or +makeglossaries --version for the version number. +

When upgrading the glossaries package, make sure you also upgrade your version of +makeglossaries. The current version is 4.41.
+

+

+

+

Top

1.5.2 Using the makeglossaries-lite Lua Script

+

The Lua alternative to the makeglossaries Perl script requires a Lua interpreter, which +should already be available if you have a modern TEX distribution that includes LuaTEX. +Lua is a light-weight, cross-platform scripting language, but because it’s light-weight it +doesn’t have the full-functionality of heavy-weight scripting languages, such as Perl. The +makeglossaries-lite script is therefore limited by this and some of the options +available to the makeglossaries Perl script aren’t available here. (In particular the -d +option.) +

Note that TEX Live on Unix-like systems creates a symbolic link called +makeglossaries-lite (without the .lua extension) to the actual makeglossaries-lite.lua +script, so you may not need to supply the extension.
+

+ + +

The makeglossaries-lite script can be invoked in the same way as makeglossaries. +For example, if your document is called myDoc.tex, then do +
makeglossaries-lite.lua myDoc
+

+or +
makeglossaries-lite myDoc
+

+

Some of the options available with makeglossaries are also available with +makeglossaries-lite. For a complete list of available options, do +
makeglossaries-lite.lua --help
+

+

+

+

Top

1.5.3 Using xindy explicitly (Option 3)

+

Xindy comes with TEX Live. It has also been added to MikTEX, but if you don’t have it +installed, see How to use Xindy with MikTeX on TEX on StackExchange. +

If you want to use xindy to process the glossary files, you must make sure you have used +the xindy package option: + + +

+
+\usepackage[xindy]{glossaries} +
+

This is required regardless of whether you use xindy explicitly or whether it’s +called implicitly via applications such as makeglossaries. This causes the glossary +entries to be written in raw xindy format, so you need to use -I xindy not -I +tex. +

To run xindy type the following in your terminal (all on one line): +
xindy -L language-C encoding-I xindy -M style-t base.glg -o base.gls +⟨base.glo
+

+where ⟨language⟩ is the required language name, ⟨encoding⟩ is the encoding, ⟨base⟩ is the name of +the document without the .tex extension and ⟨style⟩ is the name of the xindy style file +without the .xdy extension. The default name for this style file is ⟨base.xdy but can be +changed via \setStyleFile{style}. You may need to specify the full path name depending +on the current working directory. If any of the file names contain spaces, you must delimit +them using double-quotes. +

For example, if your document is called myDoc.tex and you are using UTF8 encoding in +English, then type the following in your terminal: +
xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls +myDoc.glo
+

+

Note that this just creates the main glossary. You need to do the same for each of +the other glossaries (including the list of acronyms if you have used the acronym +package option), substituting .glg, .gls and .glo with the relevant extensions. For +example, if you have used the acronym package option, then you would need to do: + +
xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.alg -o myDoc.acr +myDoc.acn
+

+For additional glossaries, the extensions are those supplied when you created the glossary +with \newglossary. +

Note that if you use makeglossaries instead, you can replace all those calls to xindy +with just one call to makeglossaries: +
makeglossaries myDoc
+

+Note also that some commands and package options have no effect if you use xindy explicitly +instead of using makeglossaries. These are listed in table 1.3. +

+

+ + +

Top

1.5.4 Using makeindex explicitly (Option 2)

+

If you want to use makeindex explicitly, you must make sure that you haven’t used the xindy +package option or the glossary entries will be written in the wrong format. To run makeindex, +type the following in your terminal: +
makeindex -s style.ist -t base.glg -o base.gls base.glo
+

+where ⟨base⟩ is the name of your document without the .tex extension and ⟨style.ist is the +name of the makeindex style file. By default, this is ⟨base.ist, but may be changed via +\setStyleFile{style}. Note that there are other options, such as -l (letter ordering). See +the makeindex manual for further details. +

For example, if your document is called myDoc.tex, then type the following at the +terminal: +
makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo
+

+Note that this only creates the main glossary. If you have additional glossaries (for example, if +you have used the acronym package option) then you must call makeindex for each glossary, +substituting .glg, .gls and .glo with the relevant extensions. For example, if you have used +the acronym package option, then you need to type the following in your terminal: + +
makeindex -s myDoc.ist -t myDoc.alg -o myDoc.acr myDoc.acn
+

+For additional glossaries, the extensions are those supplied when you created the glossary +with \newglossary. +

Note that if you use makeglossaries instead, you can replace all those calls to makeindex +with just one call to makeglossaries: +
makeglossaries myDoc
+

+Note also that some commands and package options have no effect if you use makeindex +explicitly instead of using makeglossaries. These are listed in table 1.3. +

+

+

Top

1.5.5 Note to Front-End and Script Developers

+

The information needed to determine whether to use xindy or makeindex and the +information needed to call those applications is stored in the auxiliary file. This +information can be gathered by a front-end, editor or script to make the glossaries where +appropriate. This section describes how the information is stored in the auxiliary +file. +

The file extensions used by each defined glossary are given by +


\@newglossary  \@newglossary{label}{log}{out-ext}{in-ext}

+

+where ⟨in-ext⟩ is the extension of the indexing application’s input file (the output file from the +glossaries package’s point of view), ⟨out-ext⟩ is the extension of the indexing application’s +output file (the input file from the glossaries package’s point of view) and ⟨log⟩ is the +extension of the indexing application’s transcript file. The label for the glossary + + +is also given for information purposes only, but is not required by the indexing +applications. For example, the information for the default main glossary is written +as: + + +

+
+\@newglossary{main}{glg}{gls}{glo} +
+

+

The indexing application’s style file is specified by +


\@istfilename  \@istfilename{filename}

+

+The file extension indicates whether to use makeindex (.ist) or xindy (.xdy). +Note that the glossary information is formatted differently depending on which +indexing application is supposed to be used, so it’s important to call the correct +one. +

Word or letter ordering is specified by: +


\@glsorder  \@glsorder{order}

+

+where ⟨order⟩ can be either word or letter. +

If xindy should be used, the language and code page for each glossary is specified +by +


\@xdylanguage \@gls@codepage  \@xdylanguage{label}{language}
\@gls@codepage{label}{code}

+

+where ⟨label⟩ identifies the glossary, ⟨language⟩ is the root language (e.g. english) and ⟨code⟩ is +the encoding (e.g. utf8). These commands are omitted if makeindex should be +used. +

If Option 1 has been used, the .aux file will contain +


\@gls@reference{type}{label}{location}

+

+for every time an entry has been referenced. If Option 4 has been used, the .aux file will +contain one or more instances of +


\glsxtr@resource{options}{basename}

+

+ + +

+

+

Top

2. Package Options

+

This section describes the available glossaries package options. You may omit the +=true for boolean options. (For example, acronym is equivalent to acronym=true). +The glossaries-extra package has additional options described in the glossaries-extra +manual. +

Note that ⟨key⟩=⟨value⟩ package options can’t be passed via the document class options. +(This includes options where the ⟨value⟩ part may be omitted, such as acronym.) +This is a general limitation not restricted to the glossaries package. Options that +aren’t ⟨key⟩=⟨value⟩ (such as makeindex) may be passed via the document class options. +
+

+

+

Top

2.1 General Options

+
+nowarn
This suppresses all warnings generated by the glossaries package. Don’t use this + option if you’re new to using glossaries as the warnings are designed to help detect + common mistakes (such as forgetting to use \makeglossaries). Note that the + debug=true and debug=showtargets will override this option. +
+nolangwarn
This suppresses the warning generated by a missing language module. +
+noredefwarn
If you load glossaries with a class or another package that already defines + glossary related commands, by default glossaries will warn you that it’s redefining + those commands. If you are aware of the consequences of using glossaries with that + class or package and you don’t want to be warned about it, use this option to + suppress those warnings. Other warnings will still be issued unless you use the + nowarn option described above. +
+debug
Introduced in version 4.24. The default setting is debug=false. This was a + boolean option but as from v4.32 it now accepts the values: false, true and + showtargets. If no value is given, debug=true is assumed. Both debug=true + and debug=showtargets switch on the debug mode (and will automatically + cancel the nowarn option). The debug=showtargets option will additionally + use +


\glsshowtarget  \glsshowtarget{target name}

+

+ to show the hypertarget or hyperlink name in the margin when \glsdohypertarget is + used by commands like \glstarget and when \glsdohyperlink is used by commands + + + like \gls. This puts the information in the margin using \marginpar unless math mode + or inner mode are detected, in which case it puts the information in line enclosed by + square brackets. The glossaries-extra package provides an additional setting that may be + used to show where the indexing is occurring. See the glossaries-extra manual for further + details. +

The purpose of the debug mode can be demonstrated with the following example + document: + + +

+
+ \documentclass{article} +  
\usepackage{glossaries} +  
\newglossaryentry{sample1}{name={sample1}, +  
  description={example}} +  
\newglossaryentry{sample2}{name={sample2}, +  
  description={example}} +  
\glsadd{sample2} +  
\makeglossaries +  
\begin{document} +  
\gls{sample1}. +  
\printglossaries +  
\end{document} +
+

In this case, only the sample1 entry has been indexed, even though \glsadd{sample2} + appears in the source code. This is because \glsadd{sample2} has been used before the + associated file is opened by \makeglossaries. Since the file isn’t open yet, the + information can’t be written to it, which is why the sample2 entry doesn’t appear in + the glossary. +

This situation doesn’t cause any errors or warnings as it’s perfectly legitimate for a user + to want to use glossaries to format the entries (e.g. abbreviation expansion) but not + display any lists of terms, abbreviations, symbols etc. Without \makeglossaries the + indexing is suppressed but, other than that, commands like \gls behave as + usual. It’s also possible that the user may want to temporarily comment out + \makeglossaries in order to suppress the indexing while working on a draft + version to speed compilation. Therefore \makeglossaries can’t be used to + enable \newglossaryentry and \glsadd. They must be enabled by default. (It + does, however, enable the see key as that’s a more common problem. See + below.) +

The debug mode, enabled with the debug option, + + +

+
+ \usepackage[debug]{glossaries} +
+

will write information to the log file when the indexing can’t occur because the + associated file isn’t open. The message is written in the form +

+

Package glossaries Info: wrglossary(⟨type⟩)(⟨text⟩) on input line ⟨line + number⟩.

+

where ⟨type⟩ is the glossary label and ⟨text⟩ is the line of text that would’ve been written to + the associated file if it had been open. So if any entries haven’t appeared in the glossary + but you’re sure you used commands like \glsadd or \glsaddall, try switching + on the debug option and see if any information has been written to the log + file. +

+seenoindex
Introduced in version 4.24, this option may take one of three values: error, warn or + ignore. The see key automatically indexes the cross-referenced entry using \glsadd. This + means that it suffers from the same problem as the above. If used before + the relevant glossary file has been opened, the indexing can’t be performed. + Since this is easy to miss, the glossaries package by default issues an error + message if the see key is used before \makeglossaries. This option allows + you to change the error into just a warning (seenoindex=warn) or ignore it + (seenoindex=ignore) if, for example, you want to temporarily comment out + \makeglossaries to speed up the compilation of a draft document by omitting the + indexing. +
+nomain
This suppresses the creation of the main glossary and associated .glo file, if + unrequired. Note that if you use this option, you must create another glossary in which + to put all your entries (either via the acronym (or acronyms) package option described in + §2.5 Acronym Options or via the symbols, numbers or index options described + in §2.6 Other Options or via \newglossary described in §12 Defining New + Glossaries). +

If you don’t use the main glossary and you don’t use this option, makeglossaries will + produce a warning.
+

+

+ + +
+ Warning: File 'filename.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. +
+
If you did actually want to use the main glossary and you see this warning, check + that you have referenced the entries in that glossary via commands such as + \gls. +
+sanitizesort
This is a boolean option that determines whether or not to sanitize the sort + value when writing to the external glossary file. For example, suppose you define an + entry as follows: + + +
+ \newglossaryentry{hash}{name={\#},sort={#}, +  
 description={hash symbol}} +
+

The sort value (#) must be sanitized before writing it to the glossary file, otherwise + LATEX will try to interpret it as a parameter reference. If, on the other hand, you + want the sort value expanded, you need to switch off the sanitization. For example, + suppose you do: + + +

+
+ \newcommand{\mysortvalue}{AAA} +  
\newglossaryentry{sample}{% +  
  name={sample}, +  
  sort={\mysortvalue}, +  
  description={an example}} +
+

and you actually want \mysortvalue expanded, so that the entry is sorted according + to AAA, then use the package option sanitizesort=false. +

The default for Options 2 and 3 is sanitizesort=true, and the default for Option 1 is + sanitizesort=false. +

+savewrites
This is a boolean option to minimise the number of write registers used by the + glossaries package. (Default is savewrites=false.) There are only a limited number of + write registers, and if you have a large number of glossaries or if you are using a class or + other packages that create a lot of external files, you may exceed the maximum number + of available registers. If savewrites is set, the glossary information will be stored in token + registers until the end of the document when they will be written to the external + files. +

This option can significantly slow document compilation and may cause the indexing to + fail. Page numbers in the number list will be incorrect on page boundaries due + to TEX’s asynchronous output routine. As an alternative, you can use the + scrwfile package (part of the KOMA-Script bundle) and not use this option. +
+

+

You can also reduce the number of write registers by using Options 1 or 4 or by + ensuring you define all your glossary entries in the preamble. +

If you want to use TEX’s \write18 mechanism to call makeindex or xindy from + your document and use savewrites, you must create the external files with + \glswritefiles before you call makeindex/xindy. Also set \glswritefiles to + nothing or \relax before the end of the document to avoid rewriting the files. For + example: + + +

+
+ \glswritefiles +  
\write18{makeindex -s \istfilename\space +  
-t \jobname.glg -o \jobname.gls \jobname} +  
\let\glswritefiles\relax +
+

+

+ In general, this package option is best avoided. +

+translate
This can take the following values: +
+ translate=true
If babel has been loaded and the translator package is installed, + translator will be loaded and the translations will be provided by the translator + package interface. You can modify the translations by providing your own + dictionary. If the translator package isn’t installed and babel is loaded, the + glossaries-babel package will be loaded and the translations will be provided + using babel’s \addto\captionlanguage⟩ mechanism. If polyglossia has been + loaded, glossaries-polyglossia will be loaded. +
+ translate=false
Don’t provide translations, even if babel or polyglossia has been + loaded. (Note that babel provides the command \glossaryname so that will + still be translated if you have loaded babel.) +
+ translate=babel
Don’t load the translator package. Instead load glossaries-babel. +

I recommend you use translate=babel if you have any problems with the + translations or with PDF bookmarks, but to maintain backward compatibility, if + babel has been loaded the default is translate=true.
+

+

+
+

If translate is specified without a value, translate=true is assumed. If translate isn’t + specified, translate=true is assumed if babel, polyglossia or translator have been loaded. + Otherwise translate=false is assumed. +

See §1.4.1 Changing the Fixed Names for further details. + + +

+notranslate
This is equivalent to translate=false and may be passed via the document class + options. +
+nohypertypes
Use this option if you have multiple glossaries and you want to suppress the + entry hyperlinks for a particular glossary or glossaries. The value of this option should + be a comma-separated list of glossary types where \gls etc shouldn’t have hyperlinks + by default. Make sure you enclose the value in braces if it contains any commas. + Example: + + +
+ \usepackage[acronym,nohypertypes={acronym,notation}] +  
  {glossaries} +  
\newglossary[nlg]{notation}{not}{ntn}{Notation} +
+

The values must be fully expanded, so don’t try nohypertypes=\acronymtype. You + may also use +


\GlsDeclareNoHyperList{list}

+

+ instead or additionally. See §6 Links to Glossary Entries for further details. +

+hyperfirst
This is a boolean option that specifies whether each term has a hyperlink on first + use. The default is hyperfirst=true (terms on first use have a hyperlink, unless + explicitly suppressed using starred versions of commands such as \gls* or + by identifying the glossary with nohypertypes, described above). Note that + nohypertypes overrides hyperfirst=true. This option only affects commands that + check the first use flag, such as the \gls-like commands (for example, \gls or + \glsdisp), but not the \glstext-like commands (for example, \glslink or + \glstext). +

The hyperfirst setting applies to all glossary types (unless identified by nohypertypes or + defined with \newignoredglossary). It can be overridden on an individual basis by + explicitly setting the hyper key when referencing an entry (or by using the plus or + starred version of the referencing command). +

It may be that you only want to apply this to just the acronyms (where the first use + explains the meaning of the acronym) but not for ordinary glossary entries (where the + first use is identical to subsequent uses). In this case, you can use hyperfirst=false + and apply \glsunsetall to all the regular (non-acronym) glossaries. For + example: + + +

+
+  \usepackage[acronym,hyperfirst=false]{glossaries} +  
 % acronym and glossary entry definitions +  
 % at the end of the preamble +  
 \glsunsetall[main] +
+

+

Alternatively you can redefine the hook +


\glslinkcheckfirsthyperhook  \glslinkcheckfirsthyperhook

+

+ which is used by the commands that check the first use flag, such as \gls. Within the + definition of this command, you can use \glslabel to reference the entry label and + \glstype to reference the glossary type. You can also use \ifglsused to determine if + the entry has been used. You can test if an entry is an acronym by checking if it has the + long key set using \ifglshaslong. For example, to switch off the hyperlink on first use + just for acronyms: + + +

+
+ \renewcommand*{\glslinkcheckfirsthyperhook}{% +  
 \ifglsused{\glslabel}{}% +  
 {% +  
   \ifglshaslong{\glslabel}{\setkeys{glslink}{hyper=false}}{}% +  
 }% +  
} +
+

+

Note that this hook isn’t used by the commands that don’t check the first use flag, such + as \glstext. (You can, instead, redefine \glslinkpostsetkeys, which is used by both + the \gls-like and \glstext-like commands.) +

+indexonlyfirst
This is a boolean option that specifies whether to only add information to the + external glossary file on first use. The default is indexonlyfirst=false, which will add a + line to the file every time one of the \gls-like or \glstext-like commands are + used. Note that \glsadd will always add information to the external glossary + file2.1 (since + that’s the purpose of that command). +

You can customise this by redefining +


\glswriteentry  \glswriteentry{label}{wr-code}

+

+ where ⟨label⟩ is the entry’s label and ⟨wr-code⟩ is the code that writes the entry’s + information to the external file. The default definition of \glswriteentry + is: + + +

+
+ \newcommand*{\glswriteentry}[2]{% +  
  \ifglsindexonlyfirst +  
    \ifglsused{#1}{}{#2}% +  
  \else +  
    #2% +  
  \fi +  
} +
+

This checks the indexonlyfirst package option (using \ifglsindexonlyfirst) and does + ⟨wr-code⟩ if this is false otherwise it only does ⟨wr-code⟩ of the entry hasn’t been + used. +

For example, suppose you only want to index the first use for entries in the acronym + glossary and not in the main (or any other) glossary: + + +

+
+ \renewcommand*{\glswriteentry}[2]{% +  
 \ifthenelse{\equal{\glsentrytype{#1}}{acronym}} +  
 {\ifglsused{#1}{}{#2}}% +  
 {#2}% +  
} +
+

Here I’ve used \ifthenelse to ensure the arguments of \equal are fully expanded + before the comparison is made. +

+savenumberlist
This is a boolean option that specifies whether or not to gather and + store the number list for each entry. The default is savenumberlist=false. (See + \glsentrynumberlist and \glsdisplaynumberlist in §9 Using Glossary Terms + Without Links.) This is always true if you use Option 1. +
+

+

+

Top

2.2 Sectioning, Headings and TOC Options

+
+toc
Add the glossaries to the table of contents. Note that an extra LATEX run is + required with this option. Alternatively, you can switch this function on and off + using +


\glstoctrue  \glstoctrue

+

+ and +


\glstocfalse  \glstocfalse

+

+

+numberline
When used with toc, this will add \numberline{} in the final argument of + \addcontentsline. This will align the table of contents entry with the numbered + section titles. Note that this option has no effect if the toc option is omitted. If toc is + used without numberline, the title will be aligned with the section numbers rather than + the section titles. + + +
+section
This is a ⟨key⟩=⟨value⟩ option. Its value should be the name of a sectional unit + (e.g. chapter). This will make the glossaries appear in the named sectional unit, + otherwise each glossary will appear in a chapter, if chapters exist, otherwise in a section. + Unnumbered sectional units will be used by default. Example: + + +
+ \usepackage[section=subsection]{glossaries} +
+

You can omit the value if you want to use sections, i.e.  + + +

+
+ \usepackage[section]{glossaries} +
+

is equivalent to + + +

+
+ \usepackage[section=section]{glossaries} +
+

You can change this value later in the document using +


\setglossarysection  \setglossarysection{name}

+

+ where ⟨name⟩ is the sectional unit. +

The start of each glossary adds information to the page header via +


\glsglossarymark  \glsglossarymark{glossary title}

+

+ By default this uses \@mkboth2.2 + but you may need to redefine it. For example, to only change the right header: + + +

+
+ \renewcommand{\glsglossarymark}[1]{\markright{#1}} +
+

or to prevent it from changing the headers: + + +

+
+ \renewcommand{\glsglossarymark}[1]{} +
+

If you want \glsglossarymark to use \MakeUppercase in the header, use the ucmark + option described below. +

Occasionally you may find that another package defines \cleardoublepage when it is + not required. This may cause an unwanted blank page to appear before each glossary. + This can be fixed by redefining \glsclearpage \glsclearpage: + + +

+
+ \renewcommand*{\glsclearpage}{\clearpage} +
+

+

+ucmark
This is a boolean option (default: ucmark=false, unless memoir has been loaded, + in which case it defaults to ucmark=true). If set, \glsglossarymark uses + \MakeTextUppercase2.3. + You can test whether this option has been set or not using +


\ifglsucmark  \ifglsucmark true part\else false part\fi

+

+ For example: + + +

+
+ \renewcommand{\glsglossarymark}[1]{% +  
  \ifglsucmark +  
    \markright{\MakeTextUppercase{#1}}% +  
  \else +  
    \markright{#1}% +  
  \fi} +
+

If memoir has been loaded and ucfirst is set, then memoir’s \memUChead is + used. +

+numberedsection
The glossaries are placed in unnumbered sectional units by default, but + this can be changed using numberedsection. This option can take one of the following + values: +
    +
  • false: + no number, i.e. use starred form of sectioning command (e.g. \chapter* or + \section*); +
  • +
  • nolabel: use a numbered section, i.e. the unstarred form of sectioning + command (e.g. \chapter or \section), but the section not labelled; +
  • +
  • autolabel: numbered with automatic labelling. Each glossary uses the unstarred + form of a sectioning command (e.g. \chapter or \section) and is assigned a label + (via \label). The label is formed from +


    \glsautoprefix  \glsautoprefix type

    +

    + where ⟨type⟩ is the label identifying that glossary. The default value of + \glsautoprefix is empty. For example, if you load glossaries using: + + +

    +
    + \usepackage[section,numberedsection=autolabel] +  
      {glossaries} +
    +

    then each glossary will appear in a numbered section, and can be referenced using + something like: + + +

    +
    + The main glossary is in section~\ref{main} and +  
    the list of acronyms is in section~\ref{acronym}. +
    +

    If you can’t decide whether to have the acronyms in the main glossary or a + separate list of acronyms, you can use \acronymtype which is set to main if the + acronym option is not used and is set to acronym if the acronym option is used. For + example: + + +

    +
    + The list of acronyms is in section~\ref{\acronymtype}. +
    +

    You can redefine the prefix if the default label clashes with another label in your + document. For example: + + +

    +
    + \renewcommand*{\glsautoprefix}{glo:} +
    +

    will add glo: to the automatically generated label, so you can then, for example, + refer to the list of acronyms as follows: + + +

    +
    + The list of acronyms is in +  
    section~\ref{glo:\acronymtype}. +
    +

    Or, if you are undecided on a prefix: + + +

    +
    + The list of acronyms is in +  
    section~\ref{\glsautoprefix\acronymtype}. +
    +

    +

  • +
  • nameref: this is like autolabel but uses an unnumbered sectioning command + (e.g. \chapter* or \section*). It’s designed for use with the nameref package. + For example: + + +
    + \usepackage{nameref} +  
    \usepackage[numberedsection=nameref]{glossaries} +
    +

    Now \nameref{main} will display the (TOC) section title associated with the + main glossary. As above, you can redefine \glsautoprefix to provide a prefix for + the label.

+
+

+

+

Top

2.3 Glossary Appearance Options

+
+entrycounter
This is a boolean option. (Default is entrycounter=false.) If set, each main + (level 0) glossary entry will be numbered when using the standard glossary styles. + This option creates the counter glossaryentry glossaryentry. +

If you use this option, you can reference the entry number within the document + using +


\glsrefentry  \glsrefentry{label}

+

+ where ⟨label⟩ is the label associated with that glossary entry. The labelling + systems uses ⟨prefix⟩⟨label⟩, where ⟨label⟩ is the entry’s label and ⟨prefix⟩ is given + by +


\GlsEntryCounterLabelPrefix  \GlsEntryCounterLabelPrefix

+

+ (which defaults to glsentry-). +

If you use \glsrefentry, you must run LATEX twice after creating the glossary files + using makeglossaries, makeindex or xindy to ensure the cross-references are + up-to-date.
+

+

+counterwithin
This is a ⟨key⟩=⟨value⟩ option where ⟨value⟩ is the name of a counter. If used, this + option will automatically set entrycounter=true and the glossaryentry counter will be + reset every time ⟨value⟩ is incremented. +

The glossaryentry counter isn’t automatically reset at the start of each glossary, except + when glossary section numbering is on and the counter used by counterwithin is the + same as the counter used in the glossary’s sectioning command.
+ + +

+

If you want the counter reset at the start of each glossary, you can redefine + \glossarypreamble to use +


\glsresetentrycounter  \glsresetentrycounter

+

+ which sets glossaryentry to zero: + + +

+
+ \renewcommand{\glossarypreamble}{% +  
  \glsresetentrycounter +  
} +
+

or if you are using \setglossarypreamble, add it to each glossary preamble, as + required. For example: + + +

+
+ \setglossarypreamble[acronym]{% +  
  \glsresetentrycounter +  
  The preamble text here for the list of acronyms. +  
} +  
\setglossarypreamble{% +  
  \glsresetentrycounter +  
  The preamble text here for the main glossary. +  
} +
+

+

+subentrycounter
This is a boolean option. (Default is subentrycounter=false.) If set, each + level 1 glossary entry will be numbered when using the standard glossary + styles. This option creates the counter glossarysubentry glossarysubentry. + The counter is reset with each main (level 0) entry. Note that this package + option is independent of entrycounter. You can reference the number within the + document using \glsrefentry{label} where ⟨label⟩ is the label associated with the + sub-entry. +
+style
This is a ⟨key⟩=⟨value⟩ option. (Default is style=list, unless classicthesis has been loaded, in + which case the default is style=index.) Its value should be the name of the + glossary style to use. This key may only be used for styles defined in glossary-list, + glossary-long, glossary-super or glossary-tree. Alternatively, you can set the style + using +


\setglossarystyle{style name}

+

+ (See §15 Glossary Styles for further details.) +

+nolong
This prevents the glossaries package from automatically loading glossary-long (which + means that the longtable package also won’t be loaded). This reduces overhead by not + defining unwanted styles and commands. Note that if you use this option, you won’t be + able to use any of the glossary styles defined in the glossary-long package (unless you + explicitly load glossary-long). +
+nosuper
This prevents the glossaries package from automatically loading glossary-super (which + means that the supertabular package also won’t be loaded). This reduces overhead by + not defining unwanted styles and commands. Note that if you use this option, you won’t + be able to use any of the glossary styles defined in the glossary-super package (unless you + explicitly load glossary-super). + + +
+nolist
This prevents the glossaries package from automatically loading glossary-list. This + reduces overhead by not defining unwanted styles. Note that if you use this option, you + won’t be able to use any of the glossary styles defined in the glossary-list package (unless + you explicitly load glossary-list). Note that since the default style is list (unless + classicthesis has been loaded), you will also need to use the style option to set the style + to something else. +
+notree
This prevents the glossaries package from automatically loading glossary-tree. This + reduces overhead by not defining unwanted styles. Note that if you use this + option, you won’t be able to use any of the glossary styles defined in the + glossary-tree package (unless you explicitly load glossary-tree). Note that if + classicthesis has been loaded, the default style is index, which is provided by + glossary-tree. +
+nostyles
This prevents all the predefined styles from being loaded. If you use this option, you + need to load a glossary style package (such as glossary-mcols). Also if you use + this option, you can’t use the style package option. Instead you must either + use \setglossarystyle{style} or the style key in the optional argument to + \printglossary. Example: + + +
+ \usepackage[nostyles]{glossaries} +  
\usepackage{glossary-mcols} +  
\setglossarystyle{mcoltree} +
+

+

+esclocations
This is a boolean option. (The default is esclocations=true, but + \makenoidxglossaries changes it to esclocations=false.) Both makeindex and xindy + are fussy about the location formats (makeindex more so than xindy) so the glossaries + package tries to ensure that special characters are escaped and allows for the location to + be substituted for a format that’s more acceptable to the indexing application. This + requires a bit of trickery to circumvent the problem posed by TEX’s asynchronous + output routine, which can go wrong and also adds to the complexity of the document + build. +

If you’re sure that your locations will always expand to an acceptable format (or you’re + prepared to post-process the glossary file before passing it to the relevant indexing + application) then use esclocations=false to avoid the complex escaping of location values. + (See “Writing information to associated files” in the documented code for further + details.) +

+nonumberlist
This option will suppress the associated number lists in the glossaries (see also + §5 Number lists). Note that if you use Options 2 or 3 (makeindex or xindy) then the + locations must still be valid. This package option merely prevents the number list from + being displayed, but both makeindex and xindy still require a location or + cross-reference for each term that’s indexed. Remember that number list includes any + cross-references, so suppressing the number list will also hide the cross-references (see + below). +
+seeautonumberlist
If you suppress the number lists with nonumberlist, described + above, this will also suppress any cross-referencing information supplied by + the see key in \newglossaryentry or \glssee. If you use seeautonumberlist, + the see key will automatically implement nonumberlist=false for that entry. + (Note this doesn’t affect \glssee.) For further details see §8 Cross-Referencing + Entries. +
+counter
This is a ⟨key⟩=⟨value⟩ option. (Default is counter=page.) The value should be + the name of the default counter to use in the number lists (see §5 Number + lists). + + +
+nopostdot
This is a boolean option. If no value is specified, true is assumed. When set to + true, this option suppresses the default post description dot used by some of the + predefined styles. The default setting is nopostdot=false. +
+nogroupskip
This is a boolean option. If no value is specified, true is assumed. When set to + true, this option suppresses the default vertical gap between groups used by some of + the predefined styles. The default setting is nogroupskip=false. +
+

+

+

Top

2.4 Sorting Options

+
+sort
If you use Options 2 or 3, this package option is the only way of specifying how to + sort the glossaries. Only Option 1 allows you to specify sort methods for individual + glossaries via the sort key in the optional argument of \printnoidxglossary. If + you have multiple glossaries in your document and you are using Option 1, only + use the package options sort=def or sort=use if you want to set this sort method + for all your glossaries. +

This is a ⟨key⟩=⟨value⟩ option where ⟨value⟩ may be one of the following:

+
    +
  • standard : entries are sorted according to the value of the sort key used in + \newglossaryentry (if present) or the name key (if sort key is missing); +
  • +
  • def : entries are sorted in the order in which they were defined (the sort key + in \newglossaryentry is ignored); +
  • +
  • use : entries are sorted according to the order in which they are used in the + document (the sort key in \newglossaryentry is ignored). +

    Both sort=def and sort=use set the sort key to a six digit number via +


    \glssortnumberfmt  \glssortnumberfmt{number}

    +

    + (padded with leading zeros, where necessary). This can be redefined, if required, + before the entries are defined (in the case of sort=def) or before the entries are + used (in the case of sort=use). +

  • +
  • none : this setting is new to version 4.30 and is only for documents that don’t use + \makeglossaries (Options 2 or 3) or \makenoidxglossaries (Option 1). It + + + omits the code used to sanitize or escape the sort value, since it’s not + required. This can help to improve the document build speed, especially + if there are a large number of entries. This option can’t be used with + \printglossary or \printnoidxglossary (or the iterative versions + \printglossaries or \printnoidxglossaries). It may be used with + glossaries-extra’s \printunsrtglossary (Option 5).
+

Note that the group styles (such as listgroup) are incompatible with the sort=use and + sort=def options. +

The default is sort=standard. When the standard sort option is in use, you can hook into + the sort mechanism by redefining: +


\glsprestandardsort  \glsprestandardsort{sort cs}{type}{label}

+

+ where ⟨sort cs⟩ is a temporary control sequence that stores the sort value (which was + either explicitly set via the sort key or implicitly set via the name key) before any + escaping of the makeindex/xindy special characters is performed. By default + \glsprestandardsort just does: +


\glsdosanitizesort  \glsdosanitizesort

+

+ which sanitizes ⟨sort cs⟩ if the sanitizesort package option is set (or does nothing if the + package option sanitizesort=false is used). +

The other arguments, ⟨type⟩ and ⟨label⟩, are the glossary type and the entry label for the + current entry. Note that ⟨type⟩ will always be a control sequence, but ⟨label⟩ will be in the + form used in the first argument of \newglossaryentry. +

Redefining \glsprestandardsort won’t affect any entries that have already been + defined and will have no effect at all if you are using sort=def or sort=use. +
+

+ +

Example 1 (Mixing Alphabetical and Order of Definition + Sorting) +

Suppose I have three glossaries: main, acronym and notation, and let’s suppose I want + the main and acronym glossaries to be sorted alphabetically, but the notation type + should be sorted in order of definition. +

For Option 1, I just need to set the sort key in the optional argument of + \printnoidxglossary: + + +

+
+ \printnoidxglossary[sort=word] +  
\printnoidxglossary[type=acronym,sort=word] +  
\printnoidxglossary[type=notation,sort=def] +
+

+

For Options 2 or 3, I can set the sort to standard (which is the default, but can be + explicitly set via the package option sort=standard), and I can either define all my main + and acronym entries, then redefine \glsprestandardsort to set ⟨sort cs⟩ to an + incremented integer, and then define all my notation entries. Alternatively, I can + redefine \glsprestandardsort to check for the glossary type and only modify ⟨sort cs⟩ if + ⟨type⟩ is notation. +

The first option can be achieved as follows: + + +

+
+ \newcounter{sortcount} +  
\renewcommand{\glsprestandardsort}[3]{% +  
  \stepcounter{sortcount}% +  
  \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% +  
} +
+

The second option can be achieved as follows: + + +

+
+ \newcounter{sortcount} +  
\renewcommand{\glsprestandardsort}[3]{% +  
  \ifdefstring{#2}{notation}% +  
  {% +  
     \stepcounter{sortcount}% +  
     \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% +  
  }% +  
  {% +  
     \glsdosanitizesort +  
  }% +  
} +
+

(\ifdefstring is defined by the etoolbox package.) For a complete document, see the + sample file sampleSort.tex.

+
+

+

____________________________

+ +

Example 2 (Customizing Standard Sort (Options 2 or + 3)) +

Suppose you want a glossary of people and you want the names listed as ⟨first-name⟩ + ⟨surname⟩ in the glossary, but you want the names sorted by ⟨surname⟩, ⟨first-name⟩. You + can do this by defining a command called, say, \name{first-name}{surname} that you + can use in the name key when you define the entry, but hook into the standard + sort mechanism to temporarily redefine \name while the sort value is being + set. +

First, define two commands to set the person’s name: + + +

+
+ \newcommand{\sortname}[2]{#2, #1} +  
\newcommand{\textname}[2]{#1 #2} +
+

and \name needs to be initialised to \textname: + + +

+
+ \let\name\textname +
+

Now redefine \glsprestandardsort so that it temporarily sets \name to \sortname + and expands the sort value, then sets \name to \textname so that the person’s name + appears as ⟨first-name⟩ ⟨surname⟩ in the text: + + +

+
+ \renewcommand{\glsprestandardsort}[3]{% +  
 \let\name\sortname +  
 \edef#1{\expandafter\expandonce\expandafter{#1}}% +  
 \let\name\textname +  
 \glsdosanitizesort +  
} +
+

(The somewhat complicate use of \expandafter etc helps to protect fragile commands, + but care is still needed.) +

Now the entries can be defined: + + +

+
+ \newglossaryentry{joebloggs}{name={\name{Joe}{Bloggs}}, +  
  description={some information about Joe Bloggs}} +  
\newglossaryentry{johnsmith}{name={\name{John}{Smith}}, +  
  description={some information about John Smith}} +
+

For a complete document, see the sample file samplePeople.tex.

+
+

+

____________________________

+
+order
This may take two values: word or letter. The default is word ordering. +

Note that the order option has no effect if you don’t use makeglossaries. +
+

+

If you use Option 1, this setting will be used if you use sort=standard in the optional + argument of \printnoidxglossary: + + +

+
+ \printnoidxglossary[sort=standard] +
+

Alternatively, you can specify the order for individual glossaries: + + +

+
+ \printnoidxglossary[sort=word] +  
\printnoidxglossary[type=acronym,sort=letter] +
+

+

+makeindex
(Option 2) The glossary information and indexing style file will be written in + makeindex format. If you use makeglossaries, it will automatically detect that it + needs to call makeindex. If you don’t use makeglossaries, you need to remember + to use makeindex not xindy. The indexing style file will been given a .ist + extension. +

You may omit this package option if you are using Option 2 as this is the default. It’s + available in case you need to override the effect of an earlier occurrence of xindy in the + package option list. +

+xindy
(Option 3) The glossary information and indexing style file will be written in + xindy format. If you use makeglossaries, it will automatically detect that it + needs to call xindy. If you don’t use makeglossaries, you need to remember + to use xindy not makeindex. The indexing style file will been given a .xdy + extension. +

This package option may additionally have a value that is a ⟨key⟩=⟨value⟩ comma-separated + list to override the language and codepage. For example: + + +

+
+ \usepackage[xindy={language=english,codepage=utf8}] +  
  {glossaries} +
+

You can also specify whether you want a number group in the glossary. This defaults to + true, but can be suppressed. For example: + + +

+
+ \usepackage[xindy={glsnumbers=false}]{glossaries} +
+

If no value is supplied to this package option (either simply writing xindy or writing + xindy={}) then the language, codepage and number group settings are unchanged. See + §11 Xindy (Option 3) for further details on using xindy with the glossaries + package. +

+xindygloss
(Option 3) This is equivalent to xindy={} (that is, the xindy option without any + value supplied) and may be used as a document class option. The language and code + page can be set via \GlsSetXdyLanguage and \GlsSetXdyCodePage (see §11.1 + Language and Encodings.) +
+xindynoglsnumbers
(Option 3) This is equivalent to xindy={glsnumbers=false} and may + be used as a document class option. +
+automake
This is option was introduced to version 4.08 as a boolean option. As from version + 4.42 it may now take three values: false (default), true or immediate. If no option is + supplied, immediate is assumed. The option automake=true will attempt to run + makeindex or xindy using TEX’s \write18 mechanism at the end of the document. + The option automake=immediate will attempt to run makeindex or xindy at the start + of \makeglossaries using \immediate (before the glossary files have been + opened). +

In the case of automake=true, the associated files are created at the end of the + document ready for the next LATEX run. Since there is a possibility of commands such + as \gls occurring on the last page of the document, it’s not possible to use \immediate + to close the associated file or with \write18 since the writing of the final + indexing lines may have been delayed. In certain situations this can mean that + the \write18 fails. In such cases, you will need to use automake=immediate + instead. +

With automake=immediate, you will get a warning on the first LATEX run as the + associated glossary files don’t exist yet. +

Since this mechanism can be a security risk, some TEX distributions disable it + completely, in which case this option won’t have an effect. (If this option doesn’t appear + to work, search the log file for “runsystem” and see if it is followed by “enabled” or + “disabled”.) +

Some distributions allow \write18 in a restricted mode. This mode has a limited + number of trusted applications, which usually includes makeindex but may not include + xindy. So if you have the restricted mode on, automake should work with makeindex + but may not work with xindy. + + +

However even in unrestricted mode this option may not work with xindy as xindy uses + language names that don’t always correspond with \babel’s language names. (The + makeglossaries script applies mappings to assist you.) Note that you still need + at least two LATEX runs to ensure the document is up-to-date with this + setting. +

Since this package option attempts to run the indexing application on every + LATEX run, its use should be considered a last resort for those who can’t work out + how to incorporate the indexing application into their document build. The default + value for this option is automake=false. +

+
+

+

+

Top

2.5 Acronym Options

+
+acronym
This creates a new glossary with the label acronym. This is equivalent + to: + + +
+ \newglossary[alg]{acronym}{acr}{acn}{\acronymname} +
+

It will also define +


\printacronyms  \printacronyms[options]

+

+ that’s equivalent to

+
+ \printglossary[type=acronym,options] +
+
(unless that command is already defined before the beginning of the document or the + package option compatible-3.07 is used). +

If you are using Option 1, you need to use

+
+ \printnoidxglossary[type=acronym,options] +
+
to display the list of acronyms. +

If the acronym package option is used, \acronymtype is set to acronym otherwise it is set to + main.2.4 + Entries that are defined using \newacronym are placed in the glossary whose label is + given by \acronymtype, unless another glossary is explicitly specified. +

Remember to use the nomain package option if you’re only interested in using + this acronym glossary. (That is, you don’t intend to use the main glossary.) +
+

+

+acronyms
This is equivalent to acronym=true and may be used in the document class option + list. +
+acronymlists
By default, only the \acronymtype glossary is considered to be a list of + acronyms. If you have other lists of acronyms, you can specify them as a + comma-separated list in the value of acronymlists. For example, if you use the acronym + package option but you also want the main glossary to also contain a list of acronyms, + you can do: + + +
+ \usepackage[acronym,acronymlists={main}]{glossaries} +
+

No check is performed to determine if the listed glossaries exist, so you can add + glossaries you haven’t defined yet. For example: + + +

+
+ \usepackage[acronym,acronymlists={main,acronym2}] +  
  {glossaries} +  
\newglossary[alg2]{acronym2}{acr2}{acn2}% +  
  {Statistical Acronyms} +
+

You can use +


\DeclareAcronymList  \DeclareAcronymList{list}

+

+ instead of or in addition to the acronymlists option. This will add the glossaries given in + ⟨list⟩ to the list of glossaries that are identified as lists of acronyms. To replace the list of + acronym lists with a new list use: +


\SetAcronymLists  \SetAcronymLists{list}

+

+

You can determine if a glossary has been identified as being a list of acronyms + using: +


\glsIfListOfAcronyms  \glsIfListOfAcronyms{label}{true part}{false part} +

+

+

+shortcuts
This option provides shortcut commands for acronyms. See §13 Acronyms and + Other Abbreviations for further details. Alternatively you can use: +


\DefineAcronymSynonyms  \DefineAcronymSynonyms

+

+

+

+

+

Top

2.5.1 Deprecated Acronym Style Options

+

The package options listed in this section are now deprecated but are kept for +backward-compatibility. Use \setacronymstyle instead. See §13 Acronyms and Other +Abbreviations for further details. +

+description
This option changes the definition of \newacronym to allow a description. This + option may be replaced by + + +
+ \setacronymstyle{long-short-desc} +
+

or (with smallcaps) + + +

+
+ \setacronymstyle{long-sc-short-desc} +
+

or (with smaller) + + +

+
+ \setacronymstyle{long-sm-short-desc} +
+

or (with footnote) + + +

+
+ \setacronymstyle{footnote-desc} +
+

or (with footnote and smallcaps) + + +

+
+ \setacronymstyle{footnote-sc-desc} +
+

or (with footnote and smaller) + + +

+
+ \setacronymstyle{footnote-sm-desc} +
+

or (with dua) + + +

+
+ \setacronymstyle{dua-desc} +
+

+

+smallcaps
This option changes the definition of \newacronym and the way that acronyms are + displayed. This option may be replaced by: + + +
+ \setacronymstyle{long-sc-short} +
+

or (with description) + + +

+
+ \setacronymstyle{long-sc-short-desc} +
+

or (with description and footnote) + + +

+
+ \setacronymstyle{footnote-sc-desc} +
+

+

+smaller
This option changes the definition of \newacronym and the way that acronyms are + displayed. +

If you use this option, you will need to include the relsize package or otherwise define + \textsmaller or redefine \acronymfont.
+

+ This option may be replaced by: + + +

+
+ \setacronymstyle{long-sm-short} +
+

or (with description) + + +

+
+ \setacronymstyle{long-sm-short-desc} +
+

or (with description and footnote) + + +

+
+ \setacronymstyle{footnote-sm-desc} +
+

+

+footnote
This option changes the definition of \newacronym and the way that acronyms are + displayed. This option may be replaced by: + + +
+ \setacronymstyle{footnote} +
+

or (with smallcaps) + + +

+
+ \setacronymstyle{footnote-sc} +
+

or (with smaller) + + +

+
+ \setacronymstyle{footnote-sm} +
+

or (with description) + + +

+
+ \setacronymstyle{footnote-desc} +
+

or (with smallcaps and description) + + +

+
+ \setacronymstyle{footnote-sc-desc} +
+

or (with smaller and description) + + +

+
+ \setacronymstyle{footnote-sm-desc} +
+

+

+dua
This option changes the definition of \newacronym so that acronyms are always + expanded. This option may be replaced by: + + +
+ \setacronymstyle{dua} +
+

or (with description) + + +

+
+ \setacronymstyle{dua-desc} +
+

+

+
+

+

+

Top

2.6 Other Options

+

Other available options that don’t fit any of the above categories are: +

+symbols
This option defines a new glossary type with the label symbols via + + +
+ \newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname} +
+

It also defines +


\printsymbols  \printsymbols[options]

+

+ which is a synonym for

+
+ \printglossary[type=symbols,options] +
+
+

If you use Option 1, you need to use:

+
+ \printnoidxglossary[type=symbols,options] +
+
to display the list of symbols. +

Remember to use the nomain package option if you’re only interested in using this + symbols glossary and don’t intend to use the main glossary.
+

+

The glossaries-extra package has a slightly modified version of this option which + additionally provides \glsxtrnewsymbol as a convenient shortcut method for defining + symbols. See the glossaries-extra manual for further details. +

+numbers
This option defines a new glossary type with the label numbers via + + +
+ \newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname} +
+

It also defines +


\printnumbers  \printnumbers[options]

+

+ which is a synonym for

+
+ \printglossary[type=numbers,options] +
+
+

If you use Option 1, you need to use:

+
+ \printnoidxglossary[type=numbers,options] +
+
to display the list of numbers. +

Remember to use the nomain package option if you’re only interested in using this + numbers glossary and don’t intend to use the main glossary.
+

+

The glossaries-extra package has a slightly modified version of this option which + additionally provides \glsxtrnewnumber as a convenient shortcut method for defining + numbers. See the glossaries-extra manual for further details. +

+index
This option defines a new glossary type with the label index via + + +
+ \newglossary[ilg]{index}{ind}{idx}{\indexname}% +
+

It also defines +


\newterm  \newterm[options]{term}

+

+ which is a synonym for

+
+ \newglossaryentry{term}[type=index,name={term},% +
description=\nopostdesc,options] +
+
and +


\printindex  \printindex[options]

+

+ which is a synonym for

+
+ \printglossary[type=index,options] +
+
+

If you use Option 1, you need to use:

+
+ \printnoidxglossary[type=index,options] +
+
to display this glossary. +

Remember to use the nomain package option if you’re only interested in using this + index glossary and don’t intend to use the main glossary. Note that you can’t mix this + option with \index. Either use glossaries for the indexing or use a custom + indexing package, such as makeidx, index or imakeidx. (You can, of course, load + one of those packages and load glossaries without the index package option.) +
+

+ + +

Since the index isn’t designed for terms with descriptions, you might also want to + disable the hyperlinks for this glossary using the package option nohypertypes=index or + the command +
\GlsDeclareNoHyperList{index} +
+

The example file sample-index.tex illustrates the use of the index package + option. +

+noglossaryindex
This option switches off index if index has been passed implicitly (for + example, through global document options). This option can’t be used in + \setupglossaries. +
+compatible-2.07
Compatibility mode for old documents created using version 2.07 or + below. +
+compatible-3.07
Compatibility mode for old documents created using version 3.07 or + below. +
+kernelglossredefs
As a legacy from the precursor glossary package, the standard glossary + commands provided by the LATEX kernel (\makeglossary and \glossary) are + redefined in terms of the glossaries package’s commands. However, they were never + documented in this user manual, and the conversion guide (“Upgrading from + the glossary package to the glossaries package”) explicitly discourages their + use. +

The use of those kernel commands (instead of the appropriate commands documented + in this user guide) are deprecated, and you will now get a warning if you try using + them. +

In the event that you require the original form of these kernel commands, + for example, if you need to use the glossaries package with another class or + package that also performs glossary-style indexing, then you can restore these + commands to their previous definition (that is, their definitions prior to loading the + glossaries package) with the package option kernelglossredefs=false. You may + also need to use the nomain option in the event of file extension conflicts. (In + which case, you must provide a new default glossary for use with the glossaries + package.) +

This option may take one of three values: true (redefine with warnings, default), + false (restore previous definitions) or nowarn (redefine without warnings, not + recommended). +

Note that the only glossary-related commands provided by the LATEX kernel are + \makeglossary and \glossary. Other packages or classes may provide additional + + + glossary-related commands or environments that conflict with glossaries (such as + \printglossary and theglossary). These non-kernel commands aren’t affected by this + package option, and you will have to find some way to resolve the conflict if you require + both glossary mechanisms. (The glossaries package will override the existing definitions + of \printglossary and theglossary.) +

In general, if possible, it’s best to stick with just one package that provides a glossary + mechanism. (The glossaries package does check for the doc package and patches + \PrintChanges.) +

+
+

+

+

Top

2.7 Setting Options After the Package is Loaded

+

Some of the options described above may also be set after the glossaries package has been +loaded using +


\setupglossaries  \setupglossaries{key-val list}

+

+The following package options can’t be used in \setupglossaries: xindy, xindygloss, +xindynoglsnumbers, makeindex, nolong, nosuper, nolist, notree, nostyles, nomain, compatible-2.07, +translate, notranslate, acronym. These options have to be set while the package is loading, +except for the xindy sub-options which can be set using commands like \GlsSetXdyLanguage +(see §11 Xindy (Option 3) for further details). +

If you need to use this command, use it as soon as possible after loading glossaries +otherwise you might end up using it too late for the change to take effect. For example, if you +try changing the acronym styles (such as smallcaps) after you have started defining your +acronyms, you are likely to get unexpected results. If you try changing the sort +option after you have started to define entries, you may get unexpected results. +
+

+ + +

+

+

Top

3. Setting Up

+

In the preamble you need to indicate whether you want to use Option 1, Option 2 or +Option 3. It’s not possible to mix these options within a document, although some +combinations are possible with glossaries-extra. (For Options 4 and 5 see the bib2gls and +glossaries-extra manuals.) +

+

Top

3.1 Option 1

+

The command +


\makenoidxglossaries  \makenoidxglossaries

+

+must be placed in the preamble. This sets up the internal commands required to make +Option 1 work. If you omit \makenoidxglossaries none of the glossaries will be +displayed. +

+

+

Top

3.2 Options 2 and 3

+

The command +


\makeglossaries  \makeglossaries

+

+must be placed in the preamble in order to create the customised makeindex (.ist) or xindy +(.xdy) style file (for Options 2 or 3, respectively) and to ensure that glossary entries are +written to the appropriate output files. If you omit \makeglossaries none of the +glossary files will be created. +

Note that some of the commands provided by the glossaries package must not be used +after \makeglossaries as they are required when creating the customised style file. If +you attempt to use those commands after \makeglossaries you will generate an +error. +

Similarly, there are some commands that must not be used before \makeglossaries. +

+

+

You can suppress the creation of the customised xindy or makeindex style file +using +


\noist  \noist

+

+That this command must not be used after \makeglossaries. +

Note that if you have a custom .xdy file created when using glossaries version 2.07 or +below, you will need to use the compatible-2.07 package option with it.
+

+ + +

The default name for the customised style file is given by \jobname.ist (Option 2) or +\jobname.xdy (Option 3). This name may be changed using: +


\setStyleFile  \setStyleFile{name}

+

+where ⟨name⟩ is the name of the style file without the extension. Note that this command must +not be used after \makeglossaries. +

Each glossary entry is assigned a number list that lists all the locations in the document +where that entry was used. By default, the location refers to the page number but this may +be overridden using the counter package option. The default form of the location number +assumes a full stop compositor (e.g. 1.2), but if your location numbers use a different +compositor (e.g. 1-2) you need to set this using +


\glsSetCompositor  \glsSetCompositor{symbol}

+

+For example: + + +

+
+\glsSetCompositor{-} +
+

This command must not be used after \makeglossaries. +

If you use Option 3, you can have a different compositor for page numbers starting with +an upper case alphabetical character using: +


\glsSetAlphaCompositor  \glsSetAlphaCompositor{symbol}

+

+This command has no effect if you use Option 2. For example, if you want number lists +containing a mixture of A-1 and 2.3 style formats, then do: + + +

+
+\glsSetCompositor{.}\glsSetAlphaCompositor{-} +
+

See §5 Number lists for further information about number lists. + + +

+

+

Top

4. Defining Glossary Entries

+

All glossary entries must be defined before they are used, so it is better to define them in +the preamble to ensure this. In fact, some commands such as \longnewglossaryentry +may only be used in the preamble. See §4.8 Drawbacks With Defining Entries in +the Document Environment for a discussion of the problems with defining entries +within the document instead of in the preamble. (The glossaries-extra package has an +option that provides a restricted form of document definitions that avoids some of +the issues discussed in §4.8 Drawbacks With Defining Entries in the Document +Environment.) +

Option 1 enforces the preamble-only restriction on \newglossaryentry. Option 4 +requires that definitions are provided in .bib format. Option 5 requires either +preamble-only definitions or the use of the glossaries-extra package option docdef=restricted. +
+

+

Only those entries that are indexed in the document (using any of the commands +described in §6 Links to Glossary Entries, §7 Adding an Entry to the Glossary Without +Generating Text or §8 Cross-Referencing Entries) will appear in the glossary. See §10 +Displaying a glossary to find out how to display the glossary. +

New glossary entries are defined using the command: +


\newglossaryentry  \newglossaryentry{label}{key=value list}

+

+This is a short command, so values in ⟨key-val list⟩ can’t contain any paragraph breaks. Take +care to enclose values containing any commas (,) or equal signs (=) with braces to hide them +from the key=value list parser. Be careful to ensure that no spurious spaces are included at +the start and end of the braces. +

If you have a long description that needs to span multiple paragraphs, use +


\longnewglossaryentry  \longnewglossaryentry{label}{key=value list}{long +description}

+

+instead. Note that this command may only be used in the preamble. Be careful of unwanted +spaces. \longnewglossaryentry will remove trailing spaces in the description (via \unskip) +but won’t remove leading spaces (otherwise it would interfere with commands like +\Glsentrydesc). This command also appends \nopostdesc to the end of the description, +which suppresses the post-description hook. The glossaries-extra package provides a +starred version of \longnewglossaryentry that doesn’t append either \unskip or +\nopostdesc. +

There are also commands that will only define the entry if it hasn’t already been +defined: +


\provideglossaryentry  \provideglossaryentry{label}{key=value list} +

+

+and +


\longprovideglossaryentry  \longprovideglossaryentry{label}{key=value list} + + +{long description}

+

+(These are both preamble-only commands.) +

For all the above commands, the first argument, ⟨label⟩, must be a unique label with which +to identify this entry. This can’t contain any non-expandable commands +or active characters. The reason for this restriction is that the label is used to +construct internal commands that store the associated information (similarly to +commands like \label) and therefore must be able to expand to a valid control sequence +name. +

Note that although an extended Latin character or other non-Latin character, such as é +or ß, looks like a plain character in your .tex file, it’s actually a macro (an active character) +and therefore can’t be used in the label. (This applies to LATEX rather than XeLaTeX.) +Also be careful of babel’s options that change certain punctuation characters (such as : or -) +to active characters.
+

+

The second argument, ⟨key=value list⟩, is a ⟨key⟩=⟨value⟩ list that supplies the relevant +information about this entry. There are two required fields: description and either name or +parent. The description is set in the third argument of \longnewglossaryentry and +\longprovideglossaryentry. With the other commands it’s set via the description key. As is +typical with ⟨key⟩=⟨value⟩ lists, values that contain a comma or equal sign must be enclosed in +braces. Available fields are listed below. Additional fields are provided by the supplementary +packages glossaries-prefix (§17 Prefixes or Determiners) and glossaries-accsupp (§18 +Accessibility Support) and also by glossaries-extra. You can also define your own custom keys +(see §4.3 Additional Keys). +

+name
The name of the entry (as it will appear in the glossary). If this key is omitted + and the parent key is supplied, this value will be the same as the parent’s name. +

If the name key contains any commands, you must also use the sort key (described + below) if you intend sorting the entries alphabetically, otherwise the entries can’t be + sorted correctly.
+

+

+description
A brief description of this term (to appear in the glossary). Within this value, + you can use +


\nopostdesc  \nopostdesc

+

+ to suppress the description terminator for this entry. For example, if this + entry is a parent entry that doesn’t require a description, you can do + description={\nopostdesc}. If you want a paragraph break in the description + use +


\glspar  \glspar

+ + +

+ or, better, use \longnewglossaryentry. However, note that not all glossary styles + support multi-line descriptions. If you are using one of the tabular-like glossary styles + that permit multi-line descriptions, use \newline not \\ if you want to force a line + break. +

+parent
The label of the parent entry. Note that the parent entry must be defined before its + sub-entries. See §4.5 Sub-Entries for further details. +
+descriptionplural
The plural form of the description, if required. If omitted, the value is set to + the same as the description key. +
+text
How this entry will appear in the document text when using \gls (or one of its + upper case variants). If this field is omitted, the value of the name key is + used. +
+first
How the entry will appear in the document text on first use with \gls (or one of its + upper case variants). If this field is omitted, the value of the text key is used. Note that + if you use \glspl, \Glspl, \GLSpl, \glsdisp before using \gls, the firstplural value + won’t be used with \gls. +
+plural
How the entry will appear in the document text when using \glspl (or one + of its upper case variants). If this field is omitted, the value is obtained by + appending \glspluralsuffix to the value of the text field. The default value of + \glspluralsuffix is the letter “s”. +
+firstplural
How the entry will appear in the document text on first use with \glspl (or one + of its upper case variants). If this field is omitted, the value is obtained from the plural + key, if the first key is omitted, or by appending \glspluralsuffix to the value of + the first field, if the first field is present. Note that if you use \gls, \Gls, + \GLS, \glsdisp before using \glspl, the firstplural value won’t be used with + \glspl. +

Note: prior to version 1.13, the default value of firstplural was always taken by + appending “s” to the first key, which meant that you had to specify both plural and + firstplural, even if you hadn’t used the first key. +

+symbol
This field is provided to allow the user to specify an associated symbol. If + omitted, the value is set to \relax. Note that not all glossary styles display the + symbol. +
+symbolplural
This is the plural form of the symbol (as passed to \glsdisplay and + + + \glsdisplayfirst by \glspl, \Glspl and \GLSpl). If omitted, the value is set to the + same as the symbol key. +
+sort
This value indicates how this entry should be sorted. If omitted, the value is given by the + name field unless one of the package options sort=def and sort=use have been + used. In general, it’s best to use the sort key if the name contains commands + (e.g. \ensuremath{\alpha}). You can also override the sort key by redefining + \glsprestandardsort (see §2.4 Sorting Options). +

Option 1 by default strips the standard LATEX accents (that is, accents generated by + core LATEX commands) from the name key when it sets the sort key. So with + Option 1: + + +

+
+ \newglossaryentry{elite}{% +  
  name={{\'e}lite}, +  
  description={select group of people} +  
} +
+

This is equivalent to: + + +

+
+ \newglossaryentry{elite}{% +  
  name={{\'e}lite}, +  
  description={select group of people}, +  
  sort={elite} +  
} +
+

Unless you use the package option sanitizesort=true, in which case it’s equivalent + to: + + +

+
+ \newglossaryentry{elite}{% +  
  name={{\'e}lite}, +  
  description={select group of people}, +  
  sort={\'elite} +  
} +
+

This will place the entry before the “A” letter group since the sort value starts with a + symbol. +

Similarly if you use the inputenc package:

+
+ \newglossaryentry{elite}{% +
  name={{é}lite}, +
  description={select group of people} +
} +
+
This is equivalent to
+
+ \newglossaryentry{elite}{% +
  name={{é}lite}, +
  description={select group of people}, +
  sort=elite +
} +
+
Unless you use the package option sanitizesort=true, in which case it’s equivalent to: +
+
+ \newglossaryentry{elite}{% +
  name={{é}lite}, +
  description={select group of people}, +
  sort=élite +
} +
+
Again, this will place the entry before the “A” group. + + +

With Options 2 and 3, the default value of sort will either be set to the name + key (if sanitizesort=true) or it will set it to the expansion of the name key (if + sanitizesort=false). +

Take care with xindy (Option 3): if you have entries with the same sort value they will + be treated as the same entry. If you use xindy and aren’t using the def or use sort + methods, always use the sort key for entries where the name just consists of a control + sequence (for example name={\alpha}). +

Take care if you use Option 1 and the name contains fragile commands. You will either + need to explicitly set the sort key or use the sanitizesort=true package option (unless you + use the def or use sort methods).

+

+

+type
This specifies the label of the glossary in which this entry belongs. If omitted, the + default glossary is assumed unless \newacronym is used (see §13 Acronyms and Other + Abbreviations). +
+user1, …, user6
Six keys provided for any additional information the user may want to + specify. (For example, an associated dimension or an alternative plural or some other + grammatical construct.) Alternatively, you can add new keys using \glsaddkey or + \glsaddstoragekey (see §4.3 Additional Keys). +
+nonumberlist
A boolean key. If the value is missing or is true, this will suppress the number + list just for this entry. Conversely, if you have used the package option nonumberlist, you + can activate the number list just for this entry with nonumberlist=false. (See §5 Number + lists.) +
+see
Cross-reference another entry. Using the see key will automatically add this entry to the + glossary, but will not automatically add the cross-referenced entry. The referenced entry + should be supplied as the value to this key. If you want to override the “see” tag, + you can supply the new tag in square brackets before the label. For example + see=[see also]{anotherlabel}. Note that if you have suppressed the number + list, the cross-referencing information won’t appear in the glossary, as it + forms part of the number list. You can override this for individual glossary + entries using nonumberlist=false (see above). Alternatively, you can use the + seeautonumberlist package option. For further details, see §8 Cross-Referencing + Entries. +

This key essentially provides a convenient shortcut that performs

+
+ \glssee[tag]{label}{xr-label list} +
+ + +
after the entry has been defined. +

For Options 2 and 3, \makeglossaries must be used before any occurrence of + \newglossaryentry that contains the see key. This key should not be used with entries + defined in the document environment.
+

+ Since it’s useful to suppress the indexing while working on a draft document, + consider using the seenoindex package option to warn or ignore the see key while + \makeglossaries is commented out. +

If you use the see key, you may want to consider using the glossaries-extra package which + additionally provides a seealso and alias key. If you want to avoid the automatic + indexing triggered by the see key, consider using Option 4. +

+
+

The following keys are reserved for \newacronym (see §13 Acronyms and Other +Abbreviations): long, longplural, short and shortplural. +

Avoid using any of the \gls-like or \glstext-like commands within the text, first, short +or long keys (or their plural equivalent) or any other key that you plan to access through +those commands. (For example, the symbol key if you intend to use \glssymbol.) Otherwise +you end up with nested links, which can cause complications and they won’t work with the +case-changing commands. You can use them within the value of keys that won’t be accessed +through those commands. For example, the description key if you don’t use \glsdesc. +Additionally, they’ll confuse the entry formatting commands, such as \glslabel. +
+

+

Note that if the name starts with non-Latin character, you must group the +character, otherwise it will cause a problem for commands like \Gls and \Glspl. For +example: + + +

+
+\newglossaryentry{elite}{name={{\'e}lite}, + 
description={select group or class}} +
+

Note that the same applies if you are using the inputenc package:

+
+\newglossaryentry{elite}{name={{é}lite}, +
description={select group or class}} +
+
(This doesn’t apply for XeLaTeX documents using the fontspec package. For further details, +see the “UTF-8” section in the mfirstuc user manual.) +

Note that in both of the above examples, you will also need to supply the sort key if you +are using Option 2 whereas xindy (Option 3) is usually able to sort non-Latin characters +correctly. Option 1 discards accents from standard LATEX extended Latin characters unless +you use the sanitizesort=true. +

+

Top

4.1 Plurals

+

You may have noticed from above that you can specify the plural form when you define a +term. If you omit this, the plural will be obtained by appending +


\glspluralsuffix  \glspluralsuffix

+

+to the singular form. This command defaults to the letter “s”. For example: + + +

+
+\newglossaryentry{cow}{name=cow,description={a fully grown + 
female of any bovine animal}} +
+

defines a new entry whose singular form is “cow” and plural form is “cows”. However, if you +are writing in archaic English, you may want to use “kine” as the plural form, in which case +you would have to do: + + +

+
+\newglossaryentry{cow}{name=cow,plural=kine, + 
description={a fully grown female of any bovine animal}} +
+

+

If you are writing in a language that supports multiple plurals (for a given term) then use +the plural key for one of them and one of the user keys to specify the other plural form. For +example: + + +

+
+\newglossaryentry{cow}{% + 
  name=cow,% + 
  description={a fully grown female of any bovine animal + 
               (plural cows, archaic plural kine)},% + 
  user1={kine}} +
+

You can then use \glspl{cow} to produce “cows” and \glsuseri{cow} to produce “kine”. +You can, of course, define an easy to remember synonym. For example: + + +

+
+\let\glsaltpl\glsuseri +
+

Then you don’t have to remember which key you used to store the second plural. +Alternatively, you can define your own keys using \glsaddkey, described in §4.3 Additional +Keys. +

If you are using a language that usually forms plurals by appending a different letter, or +sequence of letters, you can redefine \glspluralsuffix as required. However, this must be +done before the entries are defined. For languages that don’t form plurals by simply +appending a suffix, all the plural forms must be specified using the plural key (and the +firstplural key where necessary). +

+

+

Top

4.2 Other Grammatical Constructs

+

You can use the six user keys to provide alternatives, such as participles. For example: + + +

+
+\let\glsing\glsuseri + 
\let\glsd\glsuserii + 
\newcommand*{\ingkey}{user1} + 
\newcommand*{\edkey}{user2} + 
\newcommand*{\newword}[3][]{% + 
  \newglossaryentry{#2}{% + 
   name={#2},% + 
   description={#3},% + 
   \edkey={#2ed},% + 
   \ingkey={#2ing},#1% + 
  }% + 
} +
+

With the above definitions, I can now define terms like this: + + +

+
+\newword{play}{to take part in activities for enjoyment} + 
\newword[\edkey={ran},\ingkey={running}]{run}{to move fast using + 
the legs} +
+

and use them in the text: + + +

+
+Peter is \glsing{play} in the park today. + 
Jane \glsd{play} in the park yesterday. + 
Peter and Jane \glsd{run} in the park last week. +
+

+

Alternatively, you can define your own keys using \glsaddkey, described below in §4.3 +Additional Keys. +

+

+

Top

4.3 Additional Keys

+

You can now also define your own custom keys using the commands described in this section. +There are two types of keys: those for use within the document and those to store information +used behind the scenes by other commands. +

For example, if you want to add a key that indicates the associated unit for a term, you +might want to reference this unit in your document. In this case use \glsaddkey described in +§4.3.1 Document Keys. If, on the other hand, you want to add a key to indicate to a +glossary style or acronym style that this entry should be formatted differently to +other entries, then you can use \glsaddstoragekey described in §4.3.2 Storage +Keys. +

In both cases, a new command ⟨no link cs⟩ will be defined that can be used to access the +value of this key (analogous to commands such as \glsentrytext). This can be used in an +expandable context (provided any fragile commands stored in the key have been protected). +The new keys must be added using \glsaddkey or \glsaddstoragekey before glossary +entries are defined. +

+

+

Top

4.3.1 Document Keys

+

A custom key that can be used in the document is defined using: +


\glsaddkey  \glsaddkey{key}{default value}{no link cs}{no link ucfirst cs} +{link cs}{link ucfirst cs}{link allcaps cs}

+

+where: +

+⟨key
is the new key to use in \newglossaryentry (or similar commands such as + \longnewglossaryentry); + + +
+⟨default value
is the default value to use if this key isn’t used in an entry definition + (this may reference the current entry label via \glslabel, but you will have to + switch on expansion via the starred version of \glsaddkey and protect fragile + commands); +
+⟨no link cs
is the control sequence to use analogous to commands like \glsentrytext; +
+⟨no link ucfirst cs
is the control sequence to use analogous to commands like + \Glsentrytext; +
+⟨link cs
is the control sequence to use analogous to commands like \glstext; +
+⟨link ucfirst cs
is the control sequence to use analogous to commands like \Glstext; +
+⟨link allcaps cs
is the control sequence to use analogous to commands like \GLStext.
+

The starred version of \glsaddkey switches on expansion for this key. The unstarred version +doesn’t override the current expansion setting. + +

Example 3 (Defining Custom Keys) +

Suppose I want to define two new keys, ed and ing, that default to the entry text followed +by “ed” and “ing”, respectively. The default value will need expanding in both cases, so I +need to use the starred form: + + +

+
+ % Define "ed" key: + 
 \glsaddkey* + 
  {ed}% key + 
  {\glsentrytext{\glslabel}ed}% default value + 
  {\glsentryed}% command analogous to \glsentrytext + 
  {\Glsentryed}% command analogous to \Glsentrytext + 
  {\glsed}% command analogous to \glstext + 
  {\Glsed}% command analogous to \Glstext + 
  {\GLSed}% command analogous to \GLStext + 
 % Define "ing" key: + 
 \glsaddkey* + 
  {ing}% key + 
  {\glsentrytext{\glslabel}ing}% default value + 
  {\glsentrying}% command analogous to \glsentrytext + 
  {\Glsentrying}% command analogous to \Glsentrytext + 
  {\glsing}% command analogous to \glstext + 
  {\Glsing}% command analogous to \Glstext + 
  {\GLSing}% command analogous to \GLStext +
+

Now I can define some entries: + + +

+
+ % No need to override defaults for this entry: + 
 \newglossaryentry{jump}{name={jump},description={}} + 
 % Need to override defaults on these entries: + 
 \newglossaryentry{run}{name={run},% + 
   ed={ran},% + 
   ing={running},% + 
   description={}} + 
 \newglossaryentry{waddle}{name={waddle},% + 
   ed={waddled},% + 
   ing={waddling},% + 
   description={}} +
+

+

These entries can later be used in the document: + + +

+
+The dog \glsed{jump} over the duck. + 
The duck was \glsing{waddle} round the dog. + 
The dog \glsed{run} away from the duck. +
+

For a complete document, see the sample file sample-newkeys.tex.

+
+

+

____________________________

+

+

+

Top

4.3.2 Storage Keys

+

A custom key that can be used for simply storing information is defined using: +


\glsaddstoragekey  \glsaddstoragekey{key}{default value}{no link cs} +

+

+where the arguments are as the first three arguments of \glsaddkey, described above in +§4.3.1 Document Keys. +

This is essentially the same as \glsaddkey except that it doesn’t define the additional +commands. You can access or update the value of your new field using the commands +described in §16.3 Fetching and Updating the Value of a Field. + +

Example 4 (Defining Custom Storage Key (Acronyms and +Initialisms)) +

Suppose I want to define acronyms and other forms of abbreviations, such as initialisms, +but I want them all in the same glossary and I want the acronyms on first use to be displayed +with the short form followed by the long form in parentheses, but the opposite way round for +other forms of abbreviations. (The glossaries-extra package provides a simpler way of achieving +this.) +

Here I can define a new key that determines whether the term is actually an acronym +rather than some other form of abbreviation. I’m going to call this key abbrtype (since type +already exists): + + +

+
+\glsaddstoragekey + 
 {abbrtype}% key/field name + 
 {word}% default value if not explicitly set + 
 {\abbrtype}% custom command to access the value if required +
+

+

Now I can define a style that looks up the value of this new key to determine how to +display the full form: + + +

+
+\newacronymstyle + 
 {mystyle}% style name + 
 {% Use the generic display + 
   \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + 
 } + 
 {% Put the long form in the description + 
   \renewcommand*{\GenericAcronymFields}{% + 
       description={\the\glslongtok}}% + 
   % For the full format, test the value of the "abbrtype" key. + 
   % If it's set to "word" put the short form first with + 
   % the long form in brackets. + 
   \renewcommand*{\genacrfullformat}[2]{% + 
    \ifglsfieldeq{##1}{abbrtype}{word} + 
    {% is a proper acronym + 
      \protect\firstacronymfont{\glsentryshort{##1}}##2\space + 
       (\glsentrylong{##1})% + 
    } + 
    {% is another form of abbreviation + 
     \glsentrylong{##1}##2\space + 
      (\protect\firstacronymfont{\glsentryshort{##1}})% + 
    }% + 
  }% + 
  % first letter upper case version: + 
   \renewcommand*{\Genacrfullformat}[2]{% + 
    \ifglsfieldeq{##1}{abbrtype}{word} + 
    {% is a proper acronym + 
      \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + 
       (\glsentrylong{##1})% + 
    } + 
    {% is another form of abbreviation + 
     \Glsentrylong{##1}##2\space + 
      (\protect\firstacronymfont{\glsentryshort{##1}})% + 
    }% + 
  }% + 
  % plural + 
   \renewcommand*{\genplacrfullformat}[2]{% + 
    \ifglsfieldeq{##1}{abbrtype}{word} + 
    {% is a proper acronym + 
      \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + 
       (\glsentrylong{##1})% + 
    } + 
    {% is another form of abbreviation + 
     \glsentrylongpl{##1}##2\space + 
      (\protect\firstacronymfont{\glsentryshortpl{##1}})% + 
    }% + 
  }% + + + 
  % plural and first letter upper case + 
  \renewcommand*{\Genplacrfullformat}[2]{% + 
    \ifglsfieldeq{##1}{abbrtype}{word} + 
    {% is a proper acronym + 
      \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + 
       (\glsentrylong{##1})% + 
    } + 
    {% is another form of abbreviation + 
     \Glsentrylongpl{##1}##2\space + 
      (\protect\firstacronymfont{\glsentryshortpl{##1}})% + 
    }% + 
  }% + 
  % Just use the short form as the name part in the glossary: + 
  \renewcommand*{\acronymentry}[1]{% + 
     \acronymfont{\glsentryshort{##1}}}% + 
  % Sort by the short form: + 
  \renewcommand*{\acronymsort}[2]{##1}% + 
  % Just use the surrounding font for the short form: + 
  \renewcommand*{\acronymfont}[1]{##1}% + 
  % Same for first use: + 
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + 
  % Default plural suffix if the plural isn't explicitly set + 
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + 
 } +
+

Remember that the new style needs to be set before defining any terms: + + +

+
+\setacronymstyle{mystyle} +
+

+

Since it’s a bit confusing to use \newacronym for something that’s not technically an +acronym, let’s define a new command for initialisms: + + +

+
+\newcommand*{\newinitialism}[4][]{% + 
  \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% + 
} +
+

Now the entries can all be defined: + + +

+
+\newacronym{radar}{radar}{radio detecting and ranging} + 
\newacronym{laser}{laser}{light amplification by stimulated + 
emission of radiation} + 
\newacronym{scuba}{scuba}{self-contained underwater breathing + 
apparatus} + 
\newinitialism{dsp}{DSP}{digital signal processing} + 
\newinitialism{atm}{ATM}{automated teller machine} +
+

On first use, \gls{radar} will produce “radar (radio detecting and ranging)” but \gls{dsp} +will produce “DSP (digital signal processing)”. +

For a complete document, see the sample file sample-storage-abbr.tex.

+
+

+

____________________________

+

In the above example, if \newglossaryentry is explicitly used (instead of through +\newacronym) the abbrtype key will be set to its default value of “word” but the +\ifglshaslong test in the custom acronym style will be false (since the long key hasn’t been +set) so the display style will switch to that given by \glsgenentryfmt and they’ll be no test +performed on the abbrtype field. + +

Example 5 (Defining Custom Storage Key (Acronyms and +Non-Acronyms with Descriptions)) +

The previous example can be modified if the description also needs to be provided. Here +I’ve changed “word” to “acronym”: + + +

+
+\glsaddstoragekey + 
 {abbrtype}% key/field name + 
 {acronym}% default value if not explicitly set + 
 {\abbrtype}% custom command to access the value if required +
+

This may seem a little odd for non-abbreviated entries defined using \newglossaryentry +directly, but \ifglshaslong can be used to determine whether or not to reference the value +of this new abbrtype field. +

The new acronym style has a minor modification that forces the user to specify a +description. In the previous example, the line: + + +

+
+   \renewcommand*{\GenericAcronymFields}{% + 
     description={\the\glslongtok}}% +
+

needs to be changed to: + + +

+
+   \renewcommand*{\GenericAcronymFields}{}% +
+

Additionally, to accommodate the change in the default value of the abbrtype key, all +instances of + + +

+
+    \ifglsfieldeq{##1}{abbrtype}{word} +
+

need to be changed to: + + +

+
+    \ifglsfieldeq{##1}{abbrtype}{acronym} +
+

+

Once this new style has been set, the new acronyms can be defined using the optional +argument to set the description: + + +

+
+\newacronym[description={system for detecting the position and + 
speed of aircraft, ships, etc}]{radar}{radar}{radio detecting + 
and ranging} +
+

+

No change is required for the definition of \newinitialism but again the optional +argument is required to set the description: + + +

+
+\newinitialism[description={mathematical manipulation of an + 
information signal}]{dsp}{DSP}{digital signal processing} +
+

+

We can also accommodate contractions in a similar manner to the initialisms: + + +

+
+\newcommand*{\newcontraction}[4][]{% + 
  \newacronym[abbrtype=contraction,#1]{#2}{#3}{#4}% + 
} +
+

The contractions can similarly been defined using this new command: + + +

+
+\newcontraction[description={front part of a ship below the + 
deck}]{focsle}{fo'c's'le}{forecastle} +
+

+

Since the custom acronym style just checks if abbrtype is acronym, the contractions will +be treated the same as the initialisms, but the style could be modified by a further test of the +abbrtype value if required. +

To test regular non-abbreviated entries, I’ve also defined a simple word: + + +

+
+\newglossaryentry{apple}{name={apple},description={a fruit}} +
+

+

Now for a new glossary style that provides information about the abbreviation (in +addition to the description): + + +

+
+\newglossarystyle + 
 {mystyle}% style name + 
 {% base it on the "list" style + 
   \setglossarystyle{list}% + 
   \renewcommand*{\glossentry}[2]{% + 
     \item[\glsentryitem{##1}% + 
          \glstarget{##1}{\glossentryname{##1}}] + 
       \ifglshaslong{##1}% + 
       { (\abbrtype{##1}: \glsentrylong{##1})\space}{}% + 
       \glossentrydesc{##1}\glspostdescription\space ##2}% + 
 } +
+

This uses \ifglshaslong to determine whether or not the term is an abbreviation. If it has +an abbreviation, the full form is supplied in parentheses and \abbrtype (defined by +\glsaddstoragekey earlier) is used to indicate the type of abbreviation. +

With this style set, the apple entry is simply displayed in the glossary as +

+apple
a fruit.
+

but the abbreviations are displayed in the form +

+laser
(acronym: light amplification by stimulated emission of radiation) device that + creates a narrow beam of intense light.
+

(for acronyms) or +

+DSP
(initialism: digital signal processing) mathematical manipulation of an + information signal.
+

(for initalisms) or +

+fo’c’s’le
(contraction: forecastle) front part of a ship below the deck.
+

(for contractions). +

For a complete document, see sample-storage-abbr-desc.tex.

+
+

+

____________________________

+ + +

+

+

Top

4.4 Expansion

+

When you define new glossary entries expansion is performed by default, except for the name, +description, descriptionplural, symbol, symbolplural and sort keys (these keys all have expansion +suppressed via \glssetnoexpandfield). +

You can switch expansion on or off for individual keys using +


\glssetexpandfield  \glssetexpandfield{field}

+

+or +


\glssetnoexpandfield  \glssetnoexpandfield{field}

+

+respectively, where ⟨field⟩ is the field tag corresponding to the key. In most cases, this is the +same as the name of the key except for those listed in table 4.1. +

+
+ + +


+ + +
Table 4.1: Key to Field Mappings
+
+ + + + + + + + + + +
Key Field
sort sortvalue
firstplural firstpl
description desc
descriptionplural descplural
user1 useri
user2 userii
user3 useriii
user4 useriv
user5 userv
user6 uservi
longplural longpl
shortplural shortpl
+
+ + +

+
+

Any keys that haven’t had the expansion explicitly set using \glssetexpandfield or +\glssetnoexpandfield are governed by +


\glsexpandfields  \glsexpandfields

+

+and +


\glsnoexpandfields  \glsnoexpandfields

+

+

If your entries contain any fragile commands, I recommend you switch off expansion via +\glsnoexpandfields. (This should be used before you define the entries.) +

+

Top

4.5 Sub-Entries

+

As from version 1.17, it is possible to specify sub-entries. These may be used to order the +glossary into categories, in which case the sub-entry will have a different name to its parent +entry, or it may be used to distinguish different definitions for the same word, in which +case the sub-entries will have the same name as the parent entry. Note that not all +glossary styles support hierarchical entries and may display all the entries in a +flat format. Of the styles that support sub-entries, some display the sub-entry’s +name whilst others don’t. Therefore you need to ensure that you use a suitable +style. (See §15 Glossary Styles for a list of predefined styles.) As from version 3.0, +level 1 sub-entries are automatically numbered in the predefined styles if you use the +subentrycounter package option (see §2.3 Glossary Appearance Options for further +details). +

Note that the parent entry will automatically be added to the glossary if any of its child +entries are used in the document. If the parent entry is not referenced in the document, it will +not have a number list. Note also that makeindex has a restriction on the maximum +sub-entry depth. +

+

+

Top

4.5.1 Hierarchical Categories

+

To arrange a glossary with hierarchical categories, you need to first define the category and +then define the sub-entries using the relevant category entry as the value of the parent +key. + +

Example 6 (Hierarchical Categories—Greek and Roman Mathematical +Symbols) +

Suppose I want a glossary of mathematical symbols that are divided into Greek letters + + +and Roman letters. Then I can define the categories as follows: + + +

+
+\newglossaryentry{greekletter}{name={Greek letters}, + 
description={\nopostdesc}} + 
\newglossaryentry{romanletter}{name={Roman letters}, + 
description={\nopostdesc}} +
+

+

Note that in this example, the category entries don’t need a description so I have set the +descriptions to \nopostdesc. This gives a blank description and suppresses the description +terminator. +

I can now define my sub-entries as follows: + + +

+
+\newglossaryentry{pi}{name={\ensuremath{\pi}},sort={pi}, + 
description={ratio of the circumference of a circle to + 
the diameter}, + 
parent=greekletter} + 
\newglossaryentry{C}{name={\ensuremath{C}},sort={C}, + 
description={Euler's constant}, + 
parent=romanletter} +
+

For a complete document, see the sample file sampletree.tex.

+
+

+

____________________________

+

+

+

Top

4.5.2 Homographs

+

Sub-entries that have the same name as the parent entry, don’t need to have the +name key. For example, the word “glossary” can mean a list of technical words or a +collection of glosses. In both cases the plural is “glossaries”. So first define the parent +entry: + + +

+
+\newglossaryentry{glossary}{name=glossary, + 
description={\nopostdesc}, + 
plural={glossaries}} +
+

Again, the parent entry has no description, so the description terminator needs to be +suppressed using \nopostdesc. +

Now define the two different meanings of the word: + + +

+
+\newglossaryentry{glossarylist}{ + 
description={list of technical words}, + 
sort={1}, + 
parent={glossary}} + 
\newglossaryentry{glossarycol}{ + 
description={collection of glosses}, + 
sort={2}, + 
parent={glossary}} +
+

Note that if I reference the parent entry, the location will be added to the parent’s number +list, whereas if I reference any of the child entries, the location will be added to the child +entry’s number list. Note also that since the sub-entries have the same name, the sort key is +required unless you are using the sort=use or sort=def package options (see §2.4 +Sorting Options). You can use the subentrycounter package option to automatically +number the first-level child entries. See §2.3 Glossary Appearance Options for further +details. +

In the above example, the plural form for both of the child entries is the same as the +parent entry, so the plural key was not required for the child entries. However, if the +sub-entries have different plurals, they will need to be specified. For example: + + +

+
+\newglossaryentry{bravo}{name={bravo}, + 
description={\nopostdesc}} + 
\newglossaryentry{bravocry}{description={cry of approval + 
(pl.\ bravos)}, + 
sort={1}, + 
plural={bravos}, + 
parent=bravo} + 
\newglossaryentry{bravoruffian}{description={hired + 
ruffian or killer (pl.\ bravoes)}, + 
sort={2}, + 
plural={bravoes}, + 
parent=bravo} +
+

+

+

+

Top

4.6 Loading Entries From a File

+

You can store all your glossary entry definitions in another file and use: +


\loadglsentries  \loadglsentries[type]{filename}

+

+where ⟨filename⟩ is the name of the file containing all the \newglossaryentry or +\longnewglossaryentry commands. The optional argument ⟨type⟩ is the name of the glossary +to which those entries should belong, for those entries where the type key has been omitted +(or, more specifically, for those entries whose type has been specified by \glsdefaulttype, +which is what \newglossaryentry uses by default). +

This is a preamble-only command. You may also use \input to load the file but don’t use +\include. If you find that your file is becoming unmanageably large, you may want to +consider switching to bib2gls and use an application such as JabRef to manage the entry +definitions. +

If you want to use \AtBeginDocument to \input all your entries automatically at the +start of the document, add the \AtBeginDocument command before you load the glossaries +package (and babel, if you are also loading that) to avoid the creation of the .glsdefs file and +any associated problems that are caused by defining commands in the document +environment. (See §4.8 Drawbacks With Defining Entries in the Document Environment.) +
+

+ + + +

Example 7 (Loading Entries from Another File) +

Suppose I have a file called myentries.tex which contains: + + +

+
+\newglossaryentry{perl}{type=main, + 
name={Perl}, + 
description={A scripting language}} + 
\newglossaryentry{tex}{name={\TeX}, + 
description={A typesetting language},sort={TeX}} + 
\newglossaryentry{html}{type=\glsdefaulttype, + 
name={html}, + 
description={A mark up language}} +
+

and suppose in my document preamble I use the command: + + +

+
+\loadglsentries[languages]{myentries} +
+

then this will add the entries tex and html to the glossary whose type is given by +languages, but the entry perl will be added to the main glossary, since it explicitly sets the +type to main.

+
+

+

____________________________

+

Note: if you use \newacronym (see §13 Acronyms and Other Abbreviations) the type is +set as type=\acronymtype unless you explicitly override it. For example, if my file +myacronyms.tex contains: + + +

+
+\newacronym{aca}{aca}{a contrived acronym} +
+

then (supposing I have defined a new glossary type called altacronym) + + +

+
+\loadglsentries[altacronym]{myacronyms} +
+

will add aca to the glossary type acronym, if the package option acronym has been specified, +or will add aca to the glossary type altacronym, if the package option acronym is not +specified.4.1 +

If you have used the acronym package option, there are two possible solutions to this +problem: +

    +
  1. Change myacronyms.tex so that entries are defined in the form: + + +
    + \newacronym[type=\glsdefaulttype]{aca}{aca}{a +  
    contrived acronym} +
    +

    and do: + + +

    +
    + \loadglsentries[altacronym]{myacronyms} +
    +

    +

  2. +
  3. Temporarily change \acronymtype to the target glossary: + + +
    + \let\orgacronymtype\acronymtype +  
    \renewcommand{\acronymtype}{altacronym} +  
    \loadglsentries{myacronyms} +  
    \let\acronymtype\orgacronymtype +
    +

+

Note that only those entries that have been used in the text will appear in the relevant +glossaries. Note also that \loadglsentries may only be used in the preamble. +

Remember that you can use \provideglossaryentry rather than \newglossaryentry. +Suppose you want to maintain a large database of acronyms or terms that you’re likely to use +in your documents, but you may want to use a modified version of some of those entries. +(Suppose, for example, one document may require a more detailed description.) Then if you +define the entries using \provideglossaryentry in your database file, you can override the +definition by simply using \newglossaryentry before loading the file. For example, suppose +your file (called, say, terms.tex) contains: + + +

+
+\provideglossaryentry{mallard}{name=mallard, + 
 description={a type of duck}} +
+

but suppose your document requires a more detailed description, you can do: + + +

+
+\usepackage{glossaries} + 
\makeglossaries + 
\newglossaryentry{mallard}{name=mallard, + 
 description={a dabbling duck where the male has a green head}} + 
\loadglsentries{terms} +
+

Now the mallard definition in the terms.tex file will be ignored. +

+

+

Top

4.7 Moving Entries to Another Glossary

+

As from version 3.02, you can move an entry from one glossary to another using: +


\glsmoveentry  \glsmoveentry{label}{target glossary label}

+

+where ⟨label⟩ is the unique label identifying the required entry and ⟨target glossary label⟩ is the +unique label identifying the glossary in which to put the entry. +

Note that no check is performed to determine the existence of the target glossary. If +you want to move an entry to a glossary that’s skipped by \printglossaries, +then define an ignored glossary with \newignoredglossary. (See §12 Defining New +Glossaries.) +

Unpredictable results may occur if you move an entry to a different glossary from its +parent or children.
+

+

+

+

Top

4.8 Drawbacks With Defining Entries in the Document Environment

+

Originally, \newglossaryentry (and \newacronym) could only be used in the preamble. I +reluctantly removed this restriction in version 1.13, but there are issues with defining +commands in the document environment instead of the preamble, which is why the restriction +is maintained for newer commands. This restriction is also reimposed for \newglossaryentry +by the new Option 1. (The glossaries-extra package automatically reimposes this +restriction for Options 2 and 3 but provides a package option to allow document +definitions.) + + +

+

+

Top

4.8.1 Technical Issues

+

+

    +
  1. If you define an entry mid-way through your document, but subsequently shuffle + sections around, you could end up using an entry before it has been defined. +
  2. +
  3. Entry information is required when displaying the glossary. If this occurs at the + start of the document, but the entries aren’t defined until later, then the entry + details are being looked up before the entry has been defined. +
  4. +
  5. If you use a package, such as babel, that makes certain characters active at the start + of the document environment, there will be a problem if those characters have + a special significance when defining glossary entries. These characters include the + double-quote " character, the exclamation mark ! character, the question mark + ? character, and the pipe | character. They must not be active when defining + a glossary entry where they occur in the sort key (and they should be avoided in + the label if they may be active at any point in the document). Additionally, the + comma , character and the equals = character should not be active when using + commands that have ⟨key⟩=⟨value⟩ arguments. +
+

To overcome the first two problems, as from version 4.0 the glossaries package modifies the +definition of \newglossaryentry at the beginning of the document environment so that the +definitions are written to an external file (\jobname.glsdefs) which is then read in at the +start of the document on the next run. The entry will then only be defined in the +document environment if it doesn’t already exist. This means that the entry can now +be looked up in the glossary, even if the glossary occurs at the beginning of the +document. +

There are drawbacks to this mechanism: if you modify an entry definition, you need a +second run to see the effect of your modification; this method requires an extra \newwrite, +which may exceed TEX’s maximum allocation; unexpected expansion issues could occur; the +see key isn’t stored, which means it can’t be added to the .glsdefs file when it’s +created at the end of the document (and therefore won’t be present on subsequent +runs). +

The glossaries-extra package provides a setting (but only for Options 2 and 3) that allows +\newglossaryentry to occur in the document environment but doesn’t create the +.glsdefs file. This circumvents some problems but it means that you can’t display +any of the glossaries before all the entries have been defined (so it’s all right if all +the glossaries are at the end of the document but not if any occur in the front +matter). + + +

+

+

Top

4.8.2 Good Practice Issues

+

The above section covers technical issues that can cause your document to have compilation +errors or produce incorrect output. This section focuses on good writing practice. The main +reason cited by users wanting to define entries within the document environment +rather than in the preamble is that they want to write the definition as they type in +their document text. This suggests a “stream of consciousness” style of writing +that may be acceptable in certain literary genres but is inappropriate for factual +documents. +

When you write technical documents, regardless of whether it’s a PhD thesis or an article +for a journal or proceedings, you must plan what you write in advance. If you plan in +advance, you should have a fairly good idea of the type of terminology that your +document will contain, so while you are planning, create a new file with all your +entry definitions. If, while you’re writing your document, you remember another +term you need, then you can switch over to your definition file and add it. Most +text editors have the ability to have more than one file open at a time. The other +advantage to this approach is that if you forget the label, you can look it up in +the definition file rather than searching through your document text to find the +definition. + + +

+

+

Top

5. Number lists

+

Each entry in the glossary has an associated number list. By default, these numbers refer +to the pages on which that entry has been indexed (using any of the commands described in +§6 Links to Glossary Entries and §7 Adding an Entry to the Glossary Without Generating +Text). The number list can be suppressed using the nonumberlist package option, or an +alternative counter can be set as the default using the counter package option. The number +list is also referred to as the location list. +

Number lists are more common with indexes rather than glossaries (although you can use +the glossaries package for indexes as well). However, the glossaries package makes use of +makeindex or xindy to hierarchically sort and collate the entries since they are readily +available with most modern TEX distributions. Since these are both designed as indexing +applications they both require that terms either have a valid location or a cross-reference. +Even if you use nonumberlist, the locations must still be provided and acceptable +to the indexing application or they will cause an error during the indexing stage, +which will interrupt the document build. However, if you’re not interested in the +locations, each entry only needs to be indexed once, so consider using indexonlyfirst, +which can improve the document build time by only indexing the first use of each +term. +

The \glsaddall command (see §7 Adding an Entry to the Glossary Without Generating +Text), which is used to automatically index all entries, iterates over all defined entries and +does \glsadd{label} for each entry (where ⟨label⟩ is that entry’s label). This means that +\glsaddall automatically adds the same location to every entry’s number list, which looks +weird if the number list hasn’t been suppressed. +

With Option 4, the indexing is performed by bib2gls, which was specifically designed for +the glossaries-extra package. So it will allow any location format, and its selection=all +option will select all entries without adding an unwanted location to the number list. If +bib2gls can deduce a numerical value for a location, it will attempt to form a range over +consecutive locations, otherwise it won’t try to form a range and the location will just form +an individual item in the list. Option 1 also allows any location but it doesn’t form +ranges. +

+

Top

5.1 Encap Values

+

Each location in the number list is encapsulated with a command formed from the encap +value. By default this is the \glsnumberformat command, which corresponds to the encap +glsnumberformat, but this may be overridden using the format key in the optional argument +to commands like \gls. (See §6 Links to Glossary Entries.) For example, you may want the +location to appear in bold to indicate the principle use of a term or symbol. If the encap +starts with an open parenthesis ( this signifies the start of a range and if the encap starts +with close parenthesis ) this signifies the end of a range. These must always occur in +matching pairs. +

The glossaries package provides the command \glsignore which ignores its argument. +This is the format used by \glsaddallunused to suppress the location, which works fine as +long as no other locations are added to the number list. For example, if you use + + +\gls{sample} on page 2 then reset the first use flag and then use \glsaddallunused on +page 10, the number list for sample will be 2, \glsignore{10} which will result in “2, ” +which has a spurious comma. +

This isn’t a problem with bib2gls because you’d use selection=all instead of +\glsaddallunused, but even if you explicitly had, for example, \gls[format=glsignore] +{label} for some reason, bib2gls will recognise glsignore as a special encap indicating an +ignored location, so it will select the entry but not add that location to the number list. It’s a +problem for all the other options (except Option 5, which doesn’t perform any +indexing). +

Complications can arise if you use different encap values for the same location. For +example, suppose on page 10 you have both the default glsnumberformat and textbf +encaps. While it may seem apparent that textbf should override glsnumberformat in this +situation, the indexing application may not know it. This is therefore something you need to +be careful about if you use the format key or if you use a command that implicitly sets +it. +

In the case of xindy, it only accepts one encap (according to the order of precedence given +in the xindy module) and discards the others for identical locations (for the same +entry). This can cause a problem if a discarded location forms the start or end of a +range. +

In the case of makeindex, it accepts different encaps for the same location, but warns +about it. This leads to a number list with the same location repeated in different formats. If +you use the makeglossaries Perl script with Option 2 it will detect makeindex’s warning +and attempt to fix the problem, ensuring that the glsnumberformat encap always has the +least precedence unless it includes a range identifier. Other conflicting encaps will have the +last one override earlier ones for the same location with range identifiers taking +priority. +

No discard occurs with Option 1 so again you get the same location repeated in different +formats. With Option 4, bib2gls will discard according to order of precedence, +giving priority to start and end range encaps. (See the bib2gls manual for further +details.) +

+

+

Top

5.2 Locations

+

Neither Option 1 nor Option 4 care about the location syntax as long as it’s valid +LATEX code (and doesn’t contain fragile commands). In both cases, the indexing is +performed by writing a line to the .aux file. The write operation is deferred to avoid the +problems associated with TEX’s asynchronous output routine. (See, for example, Finding if +you’re on an odd or an even page for more details on this issue.) Unfortunately Options 2 +and 3 are far more problematic and need some complex code to deal with awkward +locations. +

If you know that your locations will always expand to a format acceptable to your chosen +indexing application then use the package option esclocations=false to bypass this operation. +This setting only affects Options 2 and 3 as the problem doesn’t arise with the other + + +indexing options. +

Both makeindex and xindy are fussy about the syntax of the locations. In the +case of makeindex, only the numbering system obtained with \arabic, \roman, +\Roman, \alph and \Alph or composites formed from them with the same separator +(set with \glsSetCompositor{char}) are accepted. (makeindex won’t accept an +empty location.) In the case of xindy, you can define your own location classes, +but if the location contains a robust command then the leading backslash must be +escaped. The glossaries package tries to do this, but it’s caught between two conflicting +requirements: +

    +
  1. The location must be fully expanded before \ can be converted to \\ (there’s no + point converting \thepage to \\thepage); +
  2. +
  3. The page number can’t be expanded until the deferred write operation (so \c@page + mustn’t expand in the previous step but \the\c@page mustn’t be converted to + \\the\\c@page and \number\c@page mustn’t be converted to \\number\\c@page + etc).
+

There’s a certain amount of trickery needed to deal with this conflict and the code requires +the location to be in a form that doesn’t embed the counter’s internal register in +commands like \value. For example, suppose you have a robust command called +\tallynum that takes a number as the argument and an expandable command called +\tally that converts a counter name into the associated register or number to +pass to \tallynum. Let’s suppose that this command is used to represent the page +number: + + +

+
+\renewcommand{\thepage}{\tally{page}} +
+

Now let’s suppose that a term is indexed at the beginning of page 2 at the end of a +paragraph that started on page 1. With xindy, the location \tally{page} needs to be +written to the file as \\tallynum{2}. If it’s written as \tallynum{2} then xindy will +interpret \t as the character “t” (which means the location would appear as “tallynum2”). So +glossaries tries to expand \thepage without expanding \c@page and then escapes all the +backslashes, except for the page counter’s internal command. The following definitions of +\tally will work:

+
    +
  • In the following, \arabic works as its internal command \c@arabic is temporarily + redefined to check for \c@page: + + +
    + \newcommand{\tally}[1]{\tallynum{\arabic{#1}}} +
    +

    +

  • +
  • The form \expandafter\the\csname c@counter\endcsname also works (provided \the + is allowed to be temporarily redefined, see below): + + +
    + \newcommand{\tally}[1]{% +  
     \tallynum{\expandafter\the\csname c@#1\endcsname}} +
    +

    +

  • +
  • \expandafter\the\value{counter} now also works (with the same condition as + above): + + +
    + \newcommand{\tally}[1]{\tallynum{\expandafter\the\value{#1}}} +
    +

    +

  • +
  • Another variation that will work: + + +
    + \newcommand{\tally}[1]{% +  
      \expandafter\tallynum\expandafter{\the\csname c@#1\endcsname}} +
    +

    +

  • +
  • and also: + + +
    + \newcommand{\tally}[1]{\tallynum{\the\csname c@#1\endcsname}} +
    +

+

The following don’t work:

+
    +
  • This definition leads to the premature expansion of \c@page to “1” when, in this case, + it should be “2”: + + +
    + \newcommand{\tally}[1]{\tallynum{\the\value{#1}}} +
    +

    +

  • +
  • This definition leads to \\c@page in the glossary file: + + +
    + \newcommand{\tally}[1]{\tallynum{\csname c@#1\endcsname}} +
    +

+

If you have a numbering system where \cs name{page} expands to \internal cs name\c@page +(for example, if \tally{page} expands to \tallynum\c@page) then you need to +use: +


\glsaddprotectedpagefmt  \glsaddprotectedpagefmt{internal cs name} +

+

+Note that the backslash must be omitted from ⟨internal cs name⟩ and the corresponding +command must be able to process a count register as the (sole) argument. +

For example, suppose you have a style samplenum that is implemented as follows: + + +

+
+ \newcommand*{\samplenum}[1]{% + 
   \expandafter\@samplenum\csname c@#1\endcsname} + 
 \newcommand*{\@samplenum}[1]{\two@digits{#1}} +
+

(That is, it displays the value of the counter as a two-digit number.) Then to ensure the +location is correct for entries in page-spanning paragraphs, you need to do: + + +

+
+\glsaddprotectedpagefmt{@samplenum} +
+

(If you are using a different counter for the location, such as section or equation, you don’t +need to worry about this provided the inner command is expandable.) +

If the inner macro (as given by \internal cs name⟩) contains non-expandable +commands then you may need to redefine \glsinternal cs namepage after using +\glsaddprotectedpagefmt{internal cs name}. This command doesn’t take any arguments as +the location is assumed to be given by \c@page because that’s the only occasion this +command should be used. For example, suppose now my page counter format uses small caps +Roman numerals: + + +

+
+ \newcommand*{\samplenum}[1]{% + 
  \expandafter\@samplenum\csname c@#1\endcsname} + 
 \newcommand*{\@samplenum}[1]{\textsc{\romannumeral#1}} +
+

Again, the inner macro needs to be identified using: + + +

+
+\glsaddprotectedpagefmt{@samplenum} +
+

However, since \textsc isn’t fully expandable, the location is written to the file as +\textsc  {i} (for page 1), \textsc  {ii} (for page 2), etc. This format may cause a +problem for the indexing application (particularly for makeindex). To compensate for this, +the \glsinternal cs namepage command may be redefined so that it expands to a format +that’s acceptable to the indexing application. For example: + + +

+
+\renewcommand*{\gls@samplenumpage}{\romannumeral\c@page} +
+

While this modification means that the number list in the glossary won’t exactly match the +format of the page numbers (displaying lower case Roman numbers instead of small cap +Roman numerals) this method will at least work correctly for both makeindex and xindy. If +you are using xindy, the following definition: + + +

+
+ \renewcommand*{\gls@samplenumpage}{% + 
   \glsbackslash\string\textsc{\romannumeral\c@page}} +
+

combined with + + +

+
+\GlsAddXdyLocation{romansc}{:sep "\string\textsc\glsopenbrace" + 
 "roman-numbers-lowercase" :sep "\glsclosebrace"} +
+

will now have lowercase Roman numerals in the location list (see §11.2 Locations and +Number lists for further details on that command). Take care of the backslashes. The location +(which ends up in the :locref attribute) needs \\ but the location class (identified with +\GlsAddXdyLocation) just has a single backslash. Note that this example will cause problems +if your locations should be hyperlinks. +

Another possibility that may work with both makeindex and xindy is to redefine +\glsinternal cs namepage (\gls@samplenumpage in this example) to just expand to the +decimal page number (\number\c@page) and redefine \glsnumberformat to change the +displayed format: + + +

+
+\renewcommand*{\gls@samplenumpage}{\number\c@page} + 
\renewcommand*{\glsnumberformat}[1]{\textsc{\romannumeral#1}} +
+

+

If you redefine \glsinternal cs namepage, you must make sure that \c@page is expanded +when it’s written to the file. (So don’t, for example, hide \c@page inside a robust command.) +
+

+

The mechanism that allows this to work temporarily redefines \the and \number while it +processes the location. If this causes a problem you can disallow it using +


\glswrallowprimitivemodsfalse  \glswrallowprimitivemodsfalse

+

+but you will need to find some other way to ensure the location expands correctly. +

+

+

Top

5.3 Range Formations

+

Both makeindex and xindy (Options 2 and 3) concatenate a sequence of 3 or more +consecutive pages into a range. With xindy (Option 3) you can vary the minimum sequence +length using \GlsSetXdyMinRangeLength{n} where ⟨n⟩ is either an integer or the keyword +none which indicates that there should be no range formation (see §11.2 Locations and +Number lists for further details). +

Note that \GlsSetXdyMinRangeLength must be used before \makeglossaries and has +no effect if \noist is used.
+

+

With both makeindex and xindy (Options 2 and 3), you can replace the separator and +the closing number in the range using: +


\glsSetSuffixF  \glsSetSuffixF{suffix}

+

+


\glsSetSuffixFF  \glsSetSuffixFF{suffix}

+

+where the former command specifies the suffix to use for a 2 page list and the latter specifies +the suffix to use for longer lists. For example: + + +

+
+\glsSetSuffixF{f.} + 
\glsSetSuffixFF{ff.} +
+

Note that if you use xindy (Option 3), you will also need to set the minimum range length +to 1 if you want to change these suffixes: + + +

+
+\GlsSetXdyMinRangeLength{1} +
+

Note that if you use the hyperref package, you will need to use \nohyperpage in the suffix to +ensure that the hyperlinks work correctly. For example: + + +

+
+\glsSetSuffixF{\nohyperpage{f.}} + 
\glsSetSuffixFF{\nohyperpage{ff.}} +
+

+

Note that \glsSetSuffixF and \glsSetSuffixFF must be used before \makeglossaries +and have no effect if \noist is used.
+

+

It’s also possible to concatenate a sequence of consecutive locations into a range or have +suffixes with Option 4, but with bib2gls these implicit ranges can’t be merged with +explicit ranges (created with the ( and ) encaps). See the bib2gls manual for further +details. +

Option 1 doesn’t form ranges. However, with this option you can iterate over an entry’s +number list using: +


\glsnumberlistloop  \glsnumberlistloop{label}{handler cs}{xr handler cs} +

+

+where ⟨label⟩ is the entry’s label and ⟨handler cs⟩ is a handler control sequence of the +form: +


handler cs{prefix}{counter}{format}{location}

+

+where ⟨prefix⟩ is the hyperref prefix, ⟨counter⟩ is the name of the counter used for the location, +⟨format⟩ is the format used to display the location (e.g. textbf) and ⟨location⟩ is the location. +The third argument is the control sequence to use for any cross-references in the list. This +handler should have the syntax: +


xr handler cs[tag]{xr list}

+

+where ⟨tag⟩ is the cross-referenced text (e.g. “see”) and ⟨xr list⟩ is a comma-separated list of +labels. (This actually has a third argument but it’s always empty when used with +Option 1.) +

For example, if on page 12 I have used + + +

+
+\gls[format=textbf]{apple} +
+

and on page 18 I have used + + +

+
+\gls[format=emph]{apple} +
+

then + + +

+
+\glsnumberlistloop{apple}{\myhandler} +
+

will be equivalent to: + + +

+
+\myhandler{}{page}{textbf}{12}% + 
\myhandler{}{page}{emph}{18}% +
+

There is a predefined handler that’s used to display the number list in the glossary: +


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

+

+The predefined handler used for the cross-references in the glossary is: +


\glsseeformat[tag]{xr list}{location}

+

+which is described in §8.1 Customising Cross-reference Text. +

\glsnumberlistloop is not available for Options 2 and 3.
+

+

+

+

Top

5.4 Style Hook

+

As from version 4.24, there’s a hook that’s used near the end of \writeist before the file is +closed. You can set the code to be performed then using: +


\GlsSetWriteIstHook  \GlsSetWriteIstHook{code}

+

+If you want the ⟨code⟩ to write any information to the file, you need to use +


\glswrite  \write\glswrite{style information}

+

+Make sure you use the correct format within ⟨style information⟩. For example, if you are using +makeindex: + + +

+
+\GlsSetWriteIstHook{% + 
 \write\glswrite{page_precedence "arnAR"}% + 
 \write\glswrite{line_max 80}% + 
} +
+

This changes the page type precedence and the maximum line length used by +makeindex. +

Remember that if you switch to xindy, this will no longer be valid code. + + +

+

+

Top

6. Links to Glossary Entries

+

Once you have defined a glossary entry using \newglossaryentry (§4 Defining +Glossary Entries) or \newacronym (see §13 Acronyms and Other Abbreviations), you +can refer to that entry in the document using one of the commands listed in §6.1 +The \gls-Like Commands (First Use Flag Queried) or §6.2 The \glstext-Like +Commands (First Use Flag Not Queried). The text which appears at that point in the +document when using one of these commands is referred to as the link text (even if +there are no hyperlinks). These commands also add a line to an external file that is +used to generate the relevant entry in the glossary. This information includes an +associated location that is added to the number list for that entry. By default, the +location refers to the page number. For further information on number lists, see §5 +Number lists. These external files need to be post-processed by makeindex or xindy +unless you have chosen Options 1 or 4. If you don’t use \makeglossaries these +external files won’t be created. (Options 1 and 4 write the information to the .aux +file.) +

Note that repeated use of these commands for the same entry can cause the number list to +become quite long, which may not be particular helpful to the reader. In this case, +you can use the non-indexing commands described in §9 Using Glossary Terms +Without Links or you can use the supplemental glossaries-extra package, which +provides a means to suppress the automated indexing of the commands listed in this +chapter. +

I strongly recommend that you don’t use the commands defined in this chapter in the +arguments of sectioning or caption commands or any other command that has a moving +argument. +

Aside from problems with expansion issues, PDF bookmarks and possible nested +hyperlinks in the table of contents (or list of whatever) any use of the commands +described in §6.1 The \gls-Like Commands (First Use Flag Queried) will have their +first use flag unset when they appear in the table of contents (or list of whatever). +

+

+

The above warning is particularly important if you are using the glossaries package in +conjunction with the hyperref package. Instead, use one of the expandable commands listed in +§9 Using Glossary Terms Without Links (such as \glsentrytext but not the non-expandable +case changing versions like \Glsentrytext). Alternatively, provide an alternative via the +optional argument to the sectioning/caption command or use hyperref’s \texorpdfstring. +Examples: + + +

+
+\chapter{An overview of \glsentrytext{perl}} + 
\chapter[An overview of Perl]{An overview of \gls{perl}} + 
\chapter{An overview of \texorpdfstring{\gls{perl}}{Perl}} +
+

If you want to retain the formatting that’s available through commands like \acrshort (for +example, if you are using one of the small caps styles), then you might want to consider the +glossaries-extra package which provides commands for this purpose. +

If you want the link text to produce a hyperlink to the corresponding entry details in the +glossary, you should load the hyperref package before the glossaries package. That’s what I’ve +done in this document, so if you see a hyperlinked term, such as link text, you can click on +the word or phrase and it will take you to a brief description in this document’s +glossary. +

If you use the hyperref package, I strongly recommend you use pdflatex rather than +latex to compile your document, if possible. The DVI format of LATEX has limitations with +the hyperlinks that can cause a problem when used with the glossaries package. Firstly, the +DVI format can’t break a hyperlink across a line whereas PDFLATEX can. This means that +long glossary entries (for example, the full form of an acronym) won’t be able to break across +a line with the DVI format. Secondly, the DVI format doesn’t correctly size hyperlinks in +subscripts or superscripts. This means that if you define a term that may be used as a +subscript or superscript, if you use the DVI format, it won’t come out the correct +size. +

These are limitations of the DVI format not of the glossaries package.

+

+

It may be that you only want terms in certain glossaries to have hyperlinks, but not for +other glossaries. In this case, you can use the package option nohypertypes to identify the +glossary lists that shouldn’t have hyperlinked link text. See §2.1 General Options for further +details. +

The way the link text is displayed depends on +


\glstextformat  \glstextformat{text}

+

+For example, to make all link text appear in a sans-serif font, do: + + +

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

Further customisation can be done via \defglsentryfmt or by redefining \glsentryfmt. See +§6.3 Changing the format of the link text for further details. +

Each entry has an associated conditional referred to as the first use flag. Some of the +commands described in this chapter automatically unset this flag and can also use it +to determine what text should be displayed. These types of commands are the +\gls-like commands and are described in §6.1 The \gls-Like Commands (First Use +Flag Queried). The commands that don’t reference or change the first use flag are +\glstext-like commands and are described in §6.2 The \glstext-Like Commands (First Use +Flag Not Queried). See §14 Unsetting and Resetting Entry Flags for commands that unset +(mark the entry as having been used) or reset (mark the entry as not used) the first use +flag without referencing the entries. +

The \gls-like and \glstext-like commands all take a first optional argument that is a +comma-separated list of ⟨key⟩=⟨value⟩ options, described below. They also have a star-variant, +which inserts hyper=false at the start of the list of options and a plus-variant, which +inserts hyper=true at the start of the list of options. For example \gls*{sample} +is the same as \gls[hyper=false]{sample} and \gls+{sample} is the same as +\gls[hyper=true]{sample}, whereas just \gls{sample} will use the default hyperlink +setting which depends on a number of factors (such as whether the entry is in a glossary that +has been identified in the nohypertypes list). You can override the hyper key in the variant’s +optional argument, for example, \gls*[hyper=true]{sample} but this creates redundancy +and is best avoided. The glossaries-extra package provides the option to add a third custom +variant. +

Avoid nesting these commands. For example don’t do \glslink{label}{\gls +{label2}} as this is likely to cause problems. By implication, this means that +you should avoid using any of these commands within the text, first, short or long +keys (or their plural equivalent) or any other key that you plan to access through +these commands. (For example, the symbol key if you intend to use \glssymbol.) +
+

+

The keys listed below are available for the optional argument. The glossaries-extra package +provides additional keys. (See the glossaries-extra manual for further details.) +

+hyper
This is a boolean key which can be used to enable/disable the hyperlink + to the relevant entry in the glossary. If this key is omitted, the value is + determined by current settings, as indicated above. For example, when used with + a \gls-like command, if this is the first use and the hyperfirst=false package + option has been used, then the default value is hyper=false. The hyperlink + can be forced on using hyper=true unless the hyperlinks have been suppressed + using \glsdisablehyper. You must load the hyperref package before the glossaries + package to ensure the hyperlinks work. + + +
+format
This specifies how to format the associated location number for this entry in the + glossary. This value is equivalent to the makeindex encap value, and (as with + \index) the value needs to be the name of a command without the initial + backslash. As with \index, the characters ( and ) can also be used to specify the + beginning and ending of a number range and they must be in matching pairs. (For + example, \gls[format={(}]{sample} on one page to start the range and later + \gls[format={)}]{sample} to close the range.) Again as with \index, the command + should be the name of a command which takes an argument (which will be the + associated location). Be careful not to use a declaration (such as bfseries) instead of a + text block command (such as textbf) as the effect is not guaranteed to be + localised. If you want to apply more than one style to a given entry (e.g. bold + and italic) you will need to create a command that applies both formats, + e.g.  + + +
+ \newcommand*{\textbfem}[1]{\textbf{\emph{#1}}} +
+

and use that command. +

In this document, the standard formats refer to the standard text block commands such + as \textbf or \emph or any of the commands listed in table 6.1. You can combine + a range and format using (format⟩ to start the range and )format⟩ to end + the range. The ⟨format⟩ part must match. For example, format={(emph} and + format={)emph}. +

If you use xindy instead of makeindex, you must specify any non-standard + formats that you want to use with the format key using \GlsAddXdyAttribute + {name}. So if you use xindy with the above example, you would need to + add: + + +

+
+ \GlsAddXdyAttribute{textbfem} +
+

See §11 Xindy (Option 3) for further details.

+

+

If you are using hyperlinks and you want to change the font of the hyperlinked location, + don’t use \hyperpage (provided by the hyperref package) as the locations may not refer + to a page number. Instead, the glossaries package provides number formats listed in + table 6.1. +

+
+


+
Table 6.1: Predefined Hyperlinked Location Formats
+
+ + + + + + + + +
hyperrm serif hyperlink
hypersf sans-serif hyperlink
hypertt monospaced hyperlink
hyperbf bold hyperlink
hypermd medium weight hyperlink
hyperit italic hyperlink
hypersl slanted hyperlink
hyperup upright hyperlink
hypersc small caps hyperlink
hyperemph emphasized hyperlink
+
+

+
+

Note that if the \hyperlink command hasn’t been defined, the hyperxx⟩ formats are + equivalent to the analogous textxx⟩ font commands (and hyperemph is equivalent to + emph). If you want to make a new format, you will need to define a command + which takes one argument and use that. For example, if you want the location + number to be in a bold sans-serif font, you can define a command called, say, + \hyperbsf: + + +

+
+ \newcommand{\hyperbsf}[1]{\textbf{\hypersf{#1}}} +
+

and then use hyperbsf as the value for the format + key.6.1 + Remember that if you use xindy, you will need to add this to the list of location + attributes: + + +

+
+ \GlsAddXdyAttribute{hyperbsf} +
+

+

+counter
This specifies which counter to use for this location. This overrides the default + counter used by this entry. (See also §5 Number lists.) +
+local
This is a boolean key that only makes a difference when used with \gls-like commands + that change the entry’s first use flag. If local=true, the change to the first use flag will + be localised to the current scope. The default is local=false. +
+

The link text isn’t scoped by default. Any unscoped declarations in the link text may +affect subsequent text.
+

+

+

Top

6.1 The \gls-Like Commands (First Use Flag Queried)

+

This section describes the commands that unset (mark as used) the first use flag on +completion, and in most cases they use the current state of the flag to determine the text to +be displayed. As described above, these commands all have a star-variant (hyper=false) and +a plus-variant (hyper=true) and have an optional first argument that is a ⟨key⟩=⟨value⟩ +list. +

These commands use \glsentryfmt or the equivalent definition provided by +\defglsentryfmt to determine the automatically generated text and its format (see §6.3 +Changing the format of the link text). +

Apart from \glsdisp, the commands described in this section also have a final optional +argument ⟨insert⟩ which may be used to insert material into the automatically generated +text. +

Since the commands have a final optional argument, take care if you actually want to +display an open square bracket after the command when the final optional argument is +absent. Insert an empty set of braces {} immediately before the opening square bracket to +prevent it from being interpreted as the final argument. For example: + + +

+
+\gls{sample} {}[Editor's comment] +
+

+

Don’t use any of the \gls-like or \glstext-like commands in the ⟨insert⟩ argument. +

+

+

Take care using these commands within commands or environments that are processed +multiple times as this can confuse the first use flag query and state change. This includes +frames with overlays in beamer and the tabularx environment provided by tabularx. The +glossaries package automatically deals with this issue in amsmath’s align environment. You can +apply a patch to tabularx by placing the following command (new to v4.28) in the +preamble: +


\glspatchtabularx  \glspatchtabularx

+

+This does nothing if tabularx hasn’t been loaded. There’s no patch available for beamer. See +§14 Unsetting and Resetting Entry Flags for more details. +


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

+

+This command typically determines the link text from the values of the text or first keys +supplied when the entry was defined using \newglossaryentry. However, if the entry was +defined using \newacronym and \setacronymstyle was used, then the link text will usually +be determined from the long or short keys. +

There are two upper case variants: +


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

+

+and +


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

+

+which make the first letter of the link text or all the link text upper case, respectively. For the +former, the uppercasing of the first letter is performed by \makefirstuc. +

The first letter uppercasing command \makefirstuc has limitations which must be taken +into account if you use \Gls or any of the other commands that convert the first letter to +uppercase.
+

+The upper casing is performed as follows:

+
    +
  • If the first thing in the link text is a command follow by a group, the upper casing is + performed on the first object of the group. For example, if an entry has been defined + as + + +
    + \newglossaryentry{sample}{ +  
     name={\emph{sample} phrase}, +  
     sort={sample phrase}, +  
     description={an example}} +
    +

    Then \Gls{sample} will set the link text + to6.2 + + +

    +
    + \emph{\MakeUppercase sample} phrase +
    +

    which will appear as Sample phrase. +

  • +
  • If the first thing in the link text isn’t a command or is a command but isn’t followed by + a group, then the upper casing will be performed on that first thing. For example, if an + entry has been defined as: + + +
    + \newglossaryentry{sample}{ +  
      name={\oe-ligature}, +  
      sort={oe-ligature}, +  
      description={an example} +  
    } +
    +

    Then \Gls{sample} will set the link text to + + +

    +
    + \MakeUppercase \oe-ligature +
    +

    which will appear as Œ-ligature. +

  • +
  • If you have mfirstuc v2.01 or above, an extra case is added. If the first thing is \protect + it will be discarded and the above rules will then be tried. +
+

(Note the use of the sort key in the above examples.) +

There are hundreds of LATEX packages that altogether define thousands of commands +with various syntax and it’s impossible for mfirstuc to take them all into account. The above +rules are quite simplistic and are designed for link text that starts with a text-block +command (such as \emph) or a command that produces a character (such as \oe). This means +that if your link text starts with something that doesn’t adhere to mfirstuc’s assumptions then +things are likely to go wrong. +

For example, starting with a math-shift symbol: + + +

+
+\newglossaryentry{sample}{ + 
  name={$a$}, + 
  sort={a}, + 
  description={an example} + 
} +
+

This falls into case 2 above, so the link text will be set to + + +

+
+\MakeUppercase $a$ +
+

This attempts to uppercase the math-shift $, which will go wrong. In this case it’s not +appropriate to perform any case-changing, but it may be that you want to use \Gls +programmatically without checking if the text contains any maths. In this case, the simplest +solution is to insert an empty brace at the start: + + +

+
+\newglossaryentry{sample}{ + 
  name={{}$a$}, + 
  sort={a}, + 
  description={an example} + 
} +
+

Now the link text will be set to + + +

+
+\MakeUppercase{}$a$ +
+

and the \uppercase becomes harmless. +

Another issue occurs when the link text starts with a command followed by an argument +(case 1) but the argument is a label, identifier or something else that shouldn’t have a +case-change. A common example is when the link text starts with one of the commands +described in this chapter. (But you haven’t done that, have you? What with the warning not +to do it at the beginning of the chapter.) Or when the link text starts with one of the +non-linking commands described in §9 Using Glossary Terms Without Links. For +example: + + +

+
+\newglossaryentry{sample}{name={sample},description={an example}} + 
\newglossaryentry{sample2}{ + 
   name={\glsentrytext{sample} two}, + 
   sort={sample two}, + 
   description={another example} + 
 } +
+

Now the link text will be set to: + + +

+
+\glsentrytext{\MakeUppercase sample} two +
+

This will generate an error because there’s no entry with the label given by +\MakeUppercase sample. The best solution here is to write the term out in the text field and +use the command in the name field. If you don’t use \glsname anywhere in your document, +you can use \gls in the name field: + + +

+
+\newglossaryentry{sample}{name={sample},description={an example}} + 
\newglossaryentry{sample2}{ + 
   name={\gls{sample} two}, + 
   sort={sample two}, + 
   text={sample two}, + 
   description={another example} + 
 } +
+

+

If the link text starts with a command that has an optional argument or with multiple +arguments where the actual text isn’t in the first argument, then \makefirstuc will also fail. +For example: + + +

+
+\newglossaryentry{sample}{ + 
 name={\textcolor{blue}{sample} phrase}, + 
 sort={sample phrase}, + 
 description={an example}} +
+

Now the link text will be set to: + + +

+
+\textcolor{\MakeUppercase blue}{sample} phrase +
+

This won’t work because \MakeUppercase blue isn’t a recognised colour name. In this case +you will have to define a helper command where the first argument is the text. For +example: + + +

+
+\newglossaryentry{sample}{ + 
\newcommand*{\blue}[1]{\textcolor{blue}{#1}} + 
 name={\blue{sample} phrase}, + 
 sort={sample phrase}, + 
 description={an example}} +
+

In fact, since the whole design ethos of LATEX is the separation of content and style, it’s +better to use a semantic command. For example: + + +

+
+\newglossaryentry{sample}{ + 
\newcommand*{\keyword}[1]{\textcolor{blue}{#1}} + 
 name={\keyword{sample} phrase}, + 
 sort={sample phrase}, + 
 description={an example}} +
+

For further details see the mfirstuc user manual. +

There are plural forms that are analogous to \gls: +


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

+

+


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

+

+


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

+

+These typically determine the link text from the plural or firstplural keys supplied when the +entry was defined using \newglossaryentry or, if the entry is an abbreviation and +\setacronymstyle was used, from the longplural or shortplural keys. +

Be careful when you use glossary entries in math mode especially if you are using hyperref +as it can affect the spacing of subscripts and superscripts. For example, suppose you have +defined the following entry: + + +

+
+\newglossaryentry{Falpha}{name={F_\alpha}, + 
description=sample} +
+

and later you use it in math mode: + + +

+
+$\gls{Falpha}^2$ +
+

This will result in Fα2 instead of Fα2. In this situation it’s best to bring the superscript into +the hyperlink using the final ⟨insert⟩ optional argument: + + +

+
+$\gls{Falpha}[^2]$ +
+

+

+


\glsdisp  \glsdisp[options]{label}{link text}

+

+This behaves in the same way as the above commands, except that the ⟨link text⟩ is explicitly +set. There’s no final optional argument as any inserted material can be added to the ⟨link text⟩ +argument. +

Don’t use any of the \gls-like or \glstext-like commands in the ⟨link text⟩ argument of +\glsdisp.
+

+

+

+

Top

6.2 The \glstext-Like Commands (First Use Flag Not Queried)

+

This section describes the commands that don’t change or reference the first use flag. +As described above, these commands all have a star-variant (hyper=false) and a +plus-variant (hyper=true) and have an optional first argument that is a ⟨key⟩=⟨value⟩ +list. These commands also don’t use \glsentryfmt or the equivalent definition +provided by \defglsentryfmt (see §6.3 Changing the format of the link text). +Additional commands for abbreviations are described in §13 Acronyms and Other +Abbreviations. +

Apart from \glslink, the commands described in this section also have a final +optional argument ⟨insert⟩ which may be used to insert material into the automatically +generated text. See the caveat above in §6.1 The \gls-Like Commands (First Use Flag +Queried). +


\glslink  \glslink[options]{label}{link text}

+

+This command explicitly sets the link text as given in the final argument. +

Don’t use any of the \gls-like or \glstext-like commands in the argument of +\glslink. By extension, this means that you can’t use them in the value of fields that are +used to form link text.
+

+


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

+

+This command always uses the value of the text key as the link text. + + +

There are also analogous commands: +


\Glstext  \Glstext[options]{text}[insert]

+

+


\GLStext  \GLStext[options]{text}[insert]

+

+These convert the first character or all the characters to uppercase, respectively. See the note +on \Gls above for details on the limitations of converting the first letter to upper +case. +

There’s no equivalent command for title-casing, but you can use the more generic +command \glsentrytitlecase in combination with \glslink. For example: + + +

+
+\glslink{sample}{\glsentrytitlecase{sample}{text}} +
+

(See §9 Using Glossary Terms Without Links.) +


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

+

+This command always uses the value of the first key as the link text. +

There are also analogous uppercasing commands: +


\Glsfirst  \Glsfirst[options]{text}[insert]

+

+


\GLSfirst  \GLSfirst[options]{text}[insert]

+

+

The value of the first key (and firstplural key) doesn’t necessarily match the text produced +by \gls (or \glspl) on first use as the link text used by \gls may be modified +through commands like \defglsentry. (Similarly, the value of the text and plural keys +don’t necessarily match the link text used by \gls or \glspl on subsequent use.) +
+

+


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

+

+This command always uses the value of the plural key as the link text. +

There are also analogous uppercasing commands: +


\Glsplural  \Glsplural[options]{text}[insert]

+

+


\GLSplural  \GLSplural[options]{text}[insert]

+

+


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

+

+This command always uses the value of the firstplural key as the link text. +

There are also analogous uppercasing commands: +


\Glsfirstplural  \Glsfirstplural[options]{text}[insert]

+

+


\GLSfirstplural  \GLSfirstplural[options]{text}[insert]

+

+


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

+ + +

+This command always uses the value of the name key as the link text. Note that this may be +different from the values of the text or first keys. In general it’s better to use \glstext or +\glsfirst instead of \glsname. +

There are also analogous uppercasing commands: +


\Glsname  \Glsname[options]{text}[insert]

+

+


\GLSname  \GLSname[options]{text}[insert]

+

+

In general it’s best to avoid \Glsname with acronyms. Instead, consider using \Acrlong, +\Acrshort or \Acrfull.
+

+


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

+

+This command always uses the value of the symbol key as the link text. +

There are also analogous uppercasing commands: +


\Glssymbol  \Glssymbol[options]{text}[insert]

+

+


\GLSsymbol  \GLSsymbol[options]{text}[insert]

+

+


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

+

+This command always uses the value of the description key as the link text. +

There are also analogous uppercasing commands: +


\Glsdesc  \Glsdesc[options]{text}[insert]

+

+


\GLSdesc  \GLSdesc[options]{text}[insert]

+

+

If you want the title case version you can use + + +

+
+\glslink{sample}{\glsentrytitlecase{sample}{desc}} +
+

+


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

+

+This command always uses the value of the user1 key as the link text. +

There are also analogous uppercasing commands: +


\Glsuseri  \Glsuseri[options]{text}[insert]

+

+


\GLSuseri  \GLSuseri[options]{text}[insert]

+

+


\glsuserii  \glsuserii[options]{text}[insert]

+

+This command always uses the value of the user2 key as the link text. +

There are also analogous uppercasing commands: +


\Glsuserii  \Glsuserii[options]{text}[insert]

+

+


\GLSuserii  \GLSuserii[options]{text}[insert]

+

+


\glsuseriii  \glsuseriii[options]{text}[insert]

+

+This command always uses the value of the user3 key as the link text. +

There are also analogous uppercasing commands: +


\Glsuseriii  \Glsuseriii[options]{text}[insert]

+

+


\GLSuseriii  \GLSuseriii[options]{text}[insert]

+

+


\glsuseriv  \glsuseriv[options]{text}[insert]

+

+This command always uses the value of the user4 key as the link text. +

There are also analogous uppercasing commands: +


\Glsuseriv  \Glsuseriv[options]{text}[insert]

+

+


\GLSuseriv  \GLSuseriv[options]{text}[insert]

+ + +

+


\glsuserv  \glsuserv[options]{text}[insert]

+

+This command always uses the value of the user5 key as the link text. +

There are also analogous uppercasing commands: +


\Glsuserv  \Glsuserv[options]{text}[insert]

+

+


\GLSuserv  \GLSuserv[options]{text}[insert]

+

+


\glsuservi  \glsuservi[options]{text}[insert]

+

+This command always uses the value of the user6 key as the link text. +

There are also analogous uppercasing commands: +


\Glsuservi  \Glsuservi[options]{text}[insert]

+

+


\GLSuservi  \GLSuservi[options]{text}[insert]

+

+

+

+

Top

6.3 Changing the format of the link text

+

The default format of the link text for the \gls-like commands is governed +by6.3: +


\glsentryfmt  \glsentryfmt

+

+This may be redefined but if you only want the change the display style for a given glossary, +then you need to use +


\defglsentryfmt  \defglsentryfmt[type]{definition}

+

+instead of redefining \glsentryfmt. The optional first argument ⟨type⟩ is the glossary type. +This defaults to \glsdefaulttype if omitted. The second argument is the entry format +definition. +

Note that \glsentryfmt is the default display format for entries. Once the display format +has been changed for an individual glossary using \defglsentryfmt, redefining +\glsentryfmt won’t have an effect on that glossary, you must instead use \defglsentryfmt +again. Note that glossaries that have been identified as lists of acronyms (via the package +option acronymlists or the command \DeclareAcronymList, see §2.5 Acronym Options) use +\defglsentryfmt to set their display style.
+ + +

+

Within the ⟨definition⟩ argument of \defglsentryfmt, or if you want to redefine +\glsentryfmt, you may use the following commands: +


\glslabel  \glslabel

+

+This is the label of the entry being referenced. As from version 4.08, you can also access the +glossary entry type using: +


\glstype  \glstype

+

+This is defined using \edef so the replacement text is the actual glossary type rather than +\glsentrytype{\glslabel}. +


\glscustomtext  \glscustomtext

+

+This is the custom text supplied in \glsdisp. It’s always empty for \gls, \glspl and their +upper case variants. (You can use etoolbox’s \ifdefempty to determine if \glscustomtext is +empty.) +


\glsinsert  \glsinsert

+

+The custom text supplied in the final optional argument to \gls, \glspl and their upper case +variants. +


\glsifplural  \glsifplural{true text}{false text}

+

+If \glspl, \Glspl or \GLSpl was used, this command does ⟨true text⟩ otherwise it does ⟨false +text⟩. +


\glscapscase  \glscapscase{no case}{first uc}{all caps}

+

+If \gls, \glspl or \glsdisp were used, this does ⟨no case⟩. If \Gls or \Glspl were used, this +does ⟨first uc⟩. If \GLS or \GLSpl were used, this does ⟨all caps⟩. +


\glsifhyperon  \glsifhyperon{hyper true}{hyper false}

+

+This will do ⟨hyper true⟩ if the hyperlinks are on for the current reference, otherwise it will +do ⟨hyper false⟩. The hyperlink may be off even if it wasn’t explicitly switched off +with the hyper key or the use of a starred command. It may be off because the +hyperref package hasn’t been loaded or because \glsdisablehyper has been used or +because the entry is in a glossary type that’s had the hyperlinks switched off (using +nohypertypes) or because it’s the first use and the hyperlinks have been suppressed on first +use. +

Note that \glsifhyper is now deprecated. If you want to know if the command used to +reference this entry was used with the star or plus variant, you can use: +


\glslinkvar  \glslinkvar{unmodified}{star}{plus}

+

+This will do ⟨unmodified⟩ if the unmodified version was used, or will do ⟨star⟩ if the starred +version was used, or will do ⟨plus⟩ if the plus version was used. Note that this doesn’t +take into account if the hyper key was used to override the default setting, so this +command shouldn’t be used to guess whether or not the hyperlink is on for this + + +reference. +

Note that you can also use commands such as \ifglsused within the definition of +\glsentryfmt (see §14 Unsetting and Resetting Entry Flags). +

The commands \glslabel, \glstype, \glsifplural, \glscapscase, \glscustomtext and +\glsinsert are typically updated at the start of the \gls-like and \glstext-like commands +so they can usually be accessed in the hook user commands, such as \glspostlinkhook and +\glslinkpostsetkeys. +

This means that using commands like \gls within the fields that are accessed using the +\gls-like or \glstext-like commands (such as the first, text, long or short keys) will cause a +problem. The entry formatting performed by \glsentryfmt and related commands isn’t +scoped (otherwise if would cause problems for \glspostlinkhook which may need to look +ahead as well as look behind). This means that any nested commands will, at the very least, +change the label stored in \glslabel.
+

+

If you only want to make minor modifications to \glsentryfmt, you can use +


\glsgenentryfmt  \glsgenentryfmt

+

+This uses the above commands to display just the first, text, plural or firstplural keys (or the +custom text) with the insert text appended. +

Alternatively, if want to change the entry format for abbreviations (defined via +\newacronym) you can use: +


\glsgenacfmt  \glsgenacfmt

+

+This uses the values from the long, short, longplural and shortplural keys, rather than +using the text, plural, first and firstplural keys. The first use singular text is obtained +via: +


\genacrfullformat  \genacrfullformat{label}{insert}

+

+instead of from the first key, and the first use plural text is obtained via: +


\genplacrfullformat  \genplacrfullformat{label}{insert}

+

+instead of from the firstplural key. In both cases, ⟨label⟩ is the entry’s label and ⟨insert⟩ is the +insert text provided in the final optional argument of commands like \gls. The default +behaviour is to do the long form (or plural long form) followed by ⟨insert⟩ and a space +and the short form (or plural short form) in parentheses, where the short form +is in the argument of \firstacronymfont. There are also first letter upper case +versions: +


\Genacrfullformat  \Genacrfullformat{label}{insert}

+

+and +


\Genplacrfullformat  \Genplacrfullformat{label}{insert}

+

+By default these perform a protected expansion on their no-case-change equivalents and then +use \makefirstuc to convert the first character to upper case. If there are issues +caused by this expansion, you will need to redefine those commands to explicitly + + +use commands like \Glsentrylong (which is what the predefined acronym styles, +such as long-short, do). Otherwise, you only need to redefine \genacrfullformat +and \genplacrfullformat to change the behaviour of \glsgenacfmt. See §13 +Acronyms and Other Abbreviations for further details on changing the style of +acronyms. +

Note that \glsentryfmt (or the formatting given by \defglsentryfmt) is not used by +the \glstext-like commands.
+

+

As from version 4.16, both the \gls-like and \glstext-like commands use +


\glslinkpostsetkeys  \glslinkpostsetkeys

+

+after the ⟨options⟩ are set. This macro does nothing by default but can be redefined. (For +example, to switch off the hyperlink under certain conditions.) This version also +introduces +


\glspostlinkhook  \glspostlinkhook

+

+which is done after the link text has been displayed and also after the first use flag has been +unset (see example 25). + +

Example 8 (Custom Entry Display in Text) +

Suppose you want a glossary of measurements and units, you can use the symbol key to +store the unit: + + +

+
+\newglossaryentry{distance}{name=distance, + 
description={The length between two points}, + 
symbol={km}} +
+

and now suppose you want \gls{distance} to produce “distance (km)” on first use, then +you can redefine \glsentryfmt as follows: + + +

+
+\renewcommand*{\glsentryfmt}{% + 
  \glsgenentryfmt + 
  \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}% + 
} +
+

+

(Note that I’ve used \glsentrysymbol rather than \glssymbol to avoid nested +hyperlinks.) +

Note also that all of the link text will be formatted according to \glstextformat +(described earlier). So if you do, say: + + +

+
+\renewcommand{\glstextformat}[1]{\textbf{#1}} + 
\renewcommand*{\glsentryfmt}{% + 
  \glsgenentryfmt + 
  \ifglsused{\glslabel}{}{\space(\glsentrysymbol{\glslabel})}% + 
} +
+

then \gls{distance} will produce “distance (km)”. +

For a complete document, see the sample file sample-entryfmt.tex.

+
+

+

____________________________

+ +

Example 9 (Custom Format for Particular Glossary) +

Suppose you have created a new glossary called notation and you want to change +the way the entry is displayed on first use so that it includes the symbol, you can +do: + + +

+
+\defglsentryfmt[notation]{\glsgenentryfmt + 
 \ifglsused{\glslabel}{}{\space + 
   (denoted \glsentrysymbol{\glslabel})}} +
+

Now suppose you have defined an entry as follows: + + +

+
+\newglossaryentry{set}{type=notation, + 
  name=set, + 
  description={A collection of objects}, + 
  symbol={$S$} + 
} +
+

The first time you reference this entry it will be displayed as: “set (denoted S)” (assuming +\gls was used). +

Alternatively, if you expect all the symbols to be set in math mode, you can +do: + + +

+
+\defglsentryfmt[notation]{\glsgenentryfmt + 
 \ifglsused{\glslabel}{}{\space + 
   (denoted $\glsentrysymbol{\glslabel}$)}} +
+

and define entries like this: + + +

+
+\newglossaryentry{set}{type=notation, + 
  name=set, + 
  description={A collection of objects}, + 
  symbol={S} + 
} +
+

+
+

+

____________________________

+

Remember that if you use the symbol key, you need to use a glossary style that displays +the symbol, as many of the styles ignore it. +

+

+

Top

6.4 Enabling and disabling hyperlinks to glossary entries

+

If you load the hyperref or html packages prior to loading the glossaries package, the +\gls-like and \glstext-like commands will automatically have hyperlinks to the relevant +glossary entry, unless the hyper option has been switched off (either explicitly or through +implicit means, such as via the nohypertypes package option). +

You can disable or enable links using: +


\glsdisablehyper  \glsdisablehyper

+

+and +


\glsenablehyper  \glsenablehyper

+

+respectively. The effect can be localised by placing the commands within a group. Note that +you should only use \glsenablehyper if the commands \hyperlink and \hypertarget have +been defined (for example, by the hyperref package). +

You can disable just the first use links using the package option hyperfirst=false. Note +that this option only affects the \gls-like commands that recognise the first use +flag. + +

Example 10 (First Use With Hyperlinked Footnote Description) +

Suppose I want the first use to have a hyperlink to the description in a footnote instead of +hyperlinking to the relevant place in the glossary. First I need to disable the hyperlinks on +first use via the package option hyperfirst=false: + + +

+
+\usepackage[hyperfirst=false]{glossaries} +
+

Now I need to redefine \glsentryfmt (see §6.3 Changing the format of the link +text): + + +

+
+\renewcommand*{\glsentryfmt}{% + 
  \glsgenentryfmt + 
  \ifglsused{\glslabel}{}{\footnote{\glsentrydesc{\glslabel}}}% + 
} +
+

+

Now the first use won’t have hyperlinked text, but will be followed by a footnote. See the +sample file sample-FnDesc.tex for a complete document.

+
+

+

____________________________

+

Note that the hyperfirst option applies to all defined glossaries. It may be that you only +want to disable the hyperlinks on first use for glossaries that have a different form on first use. +This can be achieved by noting that since the entries that require hyperlinking for all +instances have identical first and subsequent text, they can be unset via \glsunsetall (see +§14 Unsetting and Resetting Entry Flags) so that the hyperfirst option doesn’t get +applied. + +

Example 11 (Suppressing Hyperlinks on First Use Just For +Acronyms) +

Suppose I want to suppress the hyperlink on first use for acronyms but not for entries in +the main glossary. I can load the glossaries package using: + + +

+
+\usepackage[hyperfirst=false,acronym]{glossaries} +
+

Once all glossary entries have been defined I then do: + + +

+
+\glsunsetall[main] +
+

+

+
+

+

____________________________

+

For more complex requirements, you might find it easier to switch off all hyperlinks via +\glsdisablehyper and put the hyperlinks (where required) within the definition of +\glsentryfmt (see §6.3 Changing the format of the link text) via \glshyperlink (see §9 +Using Glossary Terms Without Links). + +

Example 12 (Only Hyperlink in Text Mode Not Math Mode) +

This is a bit of a contrived example, but suppose, for some reason, I only want the +\gls-like commands to have hyperlinks when used in text mode, but not in math mode. +I can do this by adding the glossary to the list of nohypertypes and redefining +\glsentryfmt: + + +

+
+\GlsDeclareNoHyperList{main} + 
\renewcommand*{\glsentryfmt}{% + 
  \ifmmode + 
    \glsgenentryfmt + 
  \else + 
    \glsifhyperon + 
    {\glsgenentryfmt}% hyperlink already on + 
    {\glshyperlink[\glsgenentryfmt]{\glslabel}}% + 
  \fi + 
} +
+

Note that this doesn’t affect the \glstext-like commands, which will have the hyperlinks off +unless they’re forced on using the plus variant. +

See the sample file sample-nomathhyper.tex for a complete document.

+
+

+

____________________________

+ +

Example 13 (One Hyper Link Per Entry Per Chapter) +

Here’s a more complicated example that will only have the hyperlink on the first time an +entry is used per chapter. This doesn’t involve resetting the first use flag. Instead it adds +a new key using \glsaddstoragekey (see §4.3.2 Storage Keys) that keeps track of the +chapter number that the entry was last used in: + + +

+
+\glsaddstoragekey{chapter}{0}{\glschapnum} +
+

This creates a new user command called \glschapnum that’s analogous to \glsentrytext. +The default value for this key is 0. I then define my glossary entries as usual. +

Next I redefine the hook \glslinkpostsetkeys (see §6.3 Changing the format of the link +text) so that it determines the current chapter number (which is stored in \currentchap +using \edef). This value is then compared with the value of the entry’s chapter key that I +defined earlier. If they’re the same, this entry has already been used in this chapter so the +hyperlink is switched off using xkeyval’s \setkeys command. If the chapter number isn’t the +same, then this entry hasn’t been used in the current chapter. The chapter field is +updated using \glsfieldxdef (§16.3 Fetching and Updating the Value of a Field) +provided the user hasn’t switched off the hyperlink. (This test is performed using +\glsifhyperon. + + +

+
+\renewcommand*{\glslinkpostsetkeys}{% + 
 \edef\currentchap{\arabic{chapter}}% + 
 \ifnum\currentchap=\glschapnum{\glslabel}\relax + 
  \setkeys{glslink}{hyper=false}% + 
 \else + 
  \glsifhyperon{\glsfieldxdef{\glslabel}{chapter}{\currentchap}}{}% + 
 \fi + 
} +
+

Note that this will be confused if you use \gls etc when the chapter counter is 0. (That is, +before the first \chapter.) +

See the sample file sample-chap-hyperfirst.tex for a complete document. +

+
+

+

____________________________

+ + +

+

Top

7. Adding an Entry to the Glossary Without Generating Text

+

It is possible to add a line to the glossary file without generating any text at that point in +the document using: +


\glsadd  \glsadd[options]{label}

+

+This is similar to the \glstext-like commands, only it doesn’t produce any text (so +therefore, there is no hyper key available in ⟨options⟩ but all the other options that can be +used with \glstext-like commands can be passed to \glsadd). For example, to +add a page range to the glossary number list for the entry whose label is given by +set: + + +

+
+\glsadd[format=(]{set} + 
Lots of text about sets spanning many pages. + 
\glsadd[format=)]{set} +
+

+

To add all entries that have been defined, use: +


\glsaddall  \glsaddall[options]

+

+The optional argument is the same as for \glsadd, except there is also a key types which can +be used to specify which glossaries to use. This should be a comma separated list. For +example, if you only want to add all the entries belonging to the list of acronyms (specified by +the glossary type \acronymtype) and a list of notation (specified by the glossary type +notation) then you can do: + + +

+
+\glsaddall[types={\acronymtype,notation}] +
+

+

Note that \glsadd and \glsaddall add the current location to the number list. In the +case of \glsaddall, all entries in the glossary will have the same location in the number list. +If you want to use \glsaddall, it’s best to suppress the number list with the nonumberlist +package option. (See sections 2.3 and 5.)
+

+

There is now a variation of \glsaddall that skips any entries that have already been +used: +


\glsaddallunused  \glsaddallunused[list]

+

+This command uses \glsadd[format=@gobble] which will ignore this location in the number +list. The optional argument ⟨list⟩ is a comma-separated list of glossary types. If omitted, it +defaults to the list of all defined glossaries. +

If you want to use \glsaddallunused, it’s best to place the command at the end of the +document to ensure that all the commands you intend to use have already been +used. Otherwise you could end up with a spurious comma or dash in the location +list. + +

Example 14 (Dual Entries) +

The example file sample-dual.tex makes use of \glsadd to allow for an entry that +should appear both in the main glossary and in the list of acronyms. This example sets up the +list of acronyms using the acronym package option: + + +

+
+\usepackage[acronym]{glossaries} +
+

A new command is then defined to make it easier to define dual entries: + + +

+
+\newcommand*{\newdualentry}[5][]{% + 
  \newglossaryentry{main-#2}{name={#4},% + 
  text={#3\glsadd{#2}},% + 
  description={#5},% + 
  #1 + 
  }% + 
  \newacronym{#2}{#3\glsadd{main-#2}}{#4}% + 
} +
+

This has the following syntax:

+
+\newdualentry[options]{label}{abbrv}{long}{description} +
+
You can then define a new dual entry: + + +
+\newdualentry{svm}% label + 
  {SVM}% abbreviation + 
  {support vector machine}% long form + 
  {Statistical pattern recognition technique}% description +
+

Now you can reference the acronym with \gls{svm} or you can reference the entry in the +main glossary with \gls{main-svm}.

+
+

+

____________________________

+ + +

+

Top

8. Cross-Referencing Entries

+

You must use \makeglossaries (Options 2 or 3) or \makenoidxglossaries +(Option 1) before defining any terms that cross-reference entries. If any of the terms that +you have cross-referenced don’t appear in the glossary, check that you have put +\makeglossaries/\makenoidxglossaries before all entry definitions. The glossaries-extra +package provides better cross-reference handling.
+

+

There are several ways of cross-referencing entries in the glossary: +

    +
  1. You can use commands such as \gls in the entries description. For example: + + +
    + \newglossaryentry{apple}{name=apple, +  
    description={firm, round fruit. See also \gls{pear}}} +
    +

    Note that with this method, if you don’t use the cross-referenced term in the main part + of the document, you will need two runs of makeglossaries: + + +

    +
    + latex filename +  
    makeglossaries filename +  
    latex filename +  
    makeglossaries filename +  
    latex filename +
    +

    +

  2. +
  3. As described in §4 Defining Glossary Entries, you can use the see key when you define + the entry. For example: + + +
    + \newglossaryentry{MaclaurinSeries}{name={Maclaurin +  
    series}, +  
    description={Series expansion}, +  
    see={TaylorsTheorem}} +
    +

    Note that in this case, the entry with the see key will automatically be added to the + glossary, but the cross-referenced entry won’t. You therefore need to ensure that you + use the cross-referenced term with the commands described in §6 Links to + Glossary Entries or §7 Adding an Entry to the Glossary Without Generating + Text. +

    The “see” tag is produce using \seename, but can be overridden in specific instances + using square brackets at the start of the see value. For example: + + +

    +
    + \newglossaryentry{MaclaurinSeries}{name={Maclaurin +  
    series}, +  
    description={Series expansion}, +  
    see=[see also]{TaylorsTheorem}} +
    +

    Take care if you want to use the optional argument of commands such as \newacronym + or \newterm as the value will need to be grouped. For example: + + +

    +
    + \newterm{seal} +  
    \newterm[see={[see also]seal}]{sea lion} +
    +

    Similarly if the value contains a list. For example: + + +

    +
    + \glossaryentry{lemon}{ +  
      name={lemon}, +  
      description={Yellow citrus fruit} +  
    } +  
    \glossaryentry{lime} +  
    { +  
      name={lime}, +  
      description={Green citrus fruit} +  
    } +  
    \glossaryentry{citrus} +  
    { +  
      name={citrus}, +  
      description={Plant in the Rutaceae family}, +  
      see={lemon,lime} +  
    } +
    +

    +

  4. +
  5. After you have defined the entry, use +


    \glssee  \glssee[tag]{label}{xr label list}

    +

    + where ⟨xr label list⟩ is a comma-separated list of entry labels to be cross-referenced, ⟨label⟩ + is the label of the entry doing the cross-referencing and ⟨tag⟩ is the “see” tag. (The + default value of ⟨tag⟩ is \seename.) For example: + + +

    +
    + \glssee[see also]{series}{FourierSeries,TaylorsTheorem} +
    +

    Note that this automatically adds the entry given by ⟨label⟩ to the glossary + but doesn’t add the cross-referenced entries (specified by ⟨xr label list⟩) to the + glossary.

+

In both cases 2 and 3 above, the cross-referenced information appears in the number list, +whereas in case 1, the cross-referenced information appears in the description. (See the +sample-crossref.tex example file that comes with this package.) This means that in +cases 2 and 3, the cross-referencing information won’t appear if you have suppressed the +number list. In this case, you will need to activate the number list for the given entries using +nonumberlist=false. Alternatively, if you just use the see key instead of \glssee, you +can automatically activate the number list using the seeautonumberlist package +option. +

+

Top

8.1 Customising Cross-reference Text

+

When you use either the see key or the command \glssee, the cross-referencing information +will be typeset in the glossary according to: +


\glsseeformat  \glsseeformat[tag]{label-list}{location}

+

+The default definition of \glsseeformat is: +
\emph{tag} \glsseelist{label-list} +
+Note that the location is always ignored.8.1 +For example, if you want the tag to appear in bold, you can +do:8.2 + + +

+
+\renewcommand*{\glsseeformat}[3][\seename]{\textbf{#1} + 
 \glsseelist{#2}} +
+

+

The list of labels is dealt with by \glsseelist, which iterates through the list and +typesets each entry in the label. The entries are separated by +


\glsseesep  \glsseesep

+

+or (for the last pair) +


\glsseelastsep  \glsseelastsep

+

+These default to “,\space” and “\space\andname\space” respectively. The list entry text is +displayed using: +


\glsseeitemformat  \glsseeitemformat{label}

+

+This defaults to \glsentrytext{label}.8.3 +For example, to make the cross-referenced list use small caps: + + +

+
+\renewcommand{\glsseeitemformat}[1]{% + 
  \textsc{\glsentrytext{#1}}} +
+

+

You can use \glsseeformat and \glsseelist in the main body of the text, but they +won’t automatically add the cross-referenced entries to the glossary. If you want them added +with that location, you can do: + + +

+
+Some information (see also + 
\glsseelist{FourierSeries,TaylorsTheorem}% + 
\glsadd{FourierSeries}\glsadd{TaylorsTheorem}). +
+

+

+ + +

+

+

Top

9. Using Glossary Terms Without Links

+

The commands described in this section display entry details without adding any +information to the glossary. They don’t use \glstextformat, they don’t have any optional +arguments, they don’t affect the first use flag and, apart from \glshyperlink, they don’t +produce hyperlinks. +

Commands that aren’t expandable will be ignored by PDF bookmarks, so you will need +to provide an alternative via hyperref’s \texorpdfstring if you want to use them in +sectioning commands. (This isn’t specific to the glossaries package.) See the hyperref +documentation for further details. All the commands that convert the first letter to upper +case aren’t expandable. The other commands depend on whether their corresponding keys +were assigned non-expandable values.
+

+

If you want to title case a field, you can use: +


\glsentrytitlecase  \glsentrytitlecase{label}{field}

+

+where ⟨label⟩ is the label identifying the glossary entry, ⟨field⟩ is the field label (see table 4.1). +For example: + + +

+
+\glsentrytitlecase{sample}{desc} +
+

(If you want title-casing in your glossary style, you might want to investigate the +glossaries-extra package.) +

Note that this command has the same limitations as \makefirstuc which is used by +commands like \Gls and \Glsentryname to upper-case the first letter (see the notes about +\Gls in §6.1 The \gls-Like Commands (First Use Flag Queried)). +


\glsentryname  \glsentryname{label}

+

+


\Glsentryname  \Glsentryname{label}

+

+These commands display the name of the glossary entry given by ⟨label⟩, as specified by the +name key. \Glsentryname makes the first letter upper case. Neither of these commands check +for the existence of ⟨label⟩. The first form \glsentryname is expandable (unless the name +contains unexpandable commands). Note that this may be different from the values of the +text or first keys. In general it’s better to use \glsentrytext or \glsentryfirst instead of +\glsentryname. +

In general it’s best to avoid \Glsentryname with abbreviations. Instead, consider using +\Glsentrylong, \Glsentryshort or \Glsentryfull.
+

+


\glossentryname  \glossentryname{label}

+

+This is like \glsnamefont{\glsentryname{label}} but also checks for the existence of ⟨label⟩. +This command is not expandable. It’s used in the predefined glossary styles, so if you want to +change the way the name is formatted in the glossary, you can redefine \glsnamefont to use +the required fonts. For example: + + +

+
+\renewcommand*{\glsnamefont}[1]{\textmd{\sffamily #1}} +
+

+


\Glossentryname  \Glossentryname{label}

+

+This is like \glossentryname but makes the first letter of the name upper case. +


\glsentrytext  \glsentrytext{label}

+

+


\Glsentrytext  \Glsentrytext{label}

+

+These commands display the subsequent use text for the glossary entry given by ⟨label⟩, as +specified by the text key. \Glsentrytext makes the first letter upper case. The first form is +expandable (unless the text contains unexpandable commands). The second form is not +expandable. Neither checks for the existence of ⟨label⟩. +


\glsentryplural  \glsentryplural{label}

+

+


\Glsentryplural  \Glsentryplural{label}

+

+These commands display the subsequent use plural text for the glossary entry given by ⟨label⟩, +as specified by the plural key. \Glsentryplural makes the first letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the existence of +⟨label⟩. +


\glsentryfirst  \glsentryfirst{label}

+

+


\Glsentryfirst  \Glsentryfirst{label}

+

+These commands display the first use text for the glossary entry given by ⟨label⟩, +as specified by the first key. \Glsentryfirst makes the first letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the existence of +⟨label⟩. +


\glsentryfirstplural  \glsentryfirstplural{label}

+

+


\Glsentryfirstplural  \Glsentryfirstplural{label}

+

+These commands display the plural form of the first use text for the glossary entry given by +⟨label⟩, as specified by the firstplural key. \Glsentryfirstplural makes the first letter upper +case. The first form is expandable (unless the value of that key contains unexpandable + + +commands). The second form is not expandable. Neither checks for the existence of +⟨label⟩. +


\glsentrydesc  \glsentrydesc{label}

+

+


\Glsentrydesc  \Glsentrydesc{label}

+

+These commands display the description for the glossary entry given by ⟨label⟩. \Glsentrydesc +makes the first letter upper case. The first form is expandable (unless the value of that key +contains unexpandable commands). The second form is not expandable. Neither checks for +the existence of ⟨label⟩. +


\glossentrydesc  \glossentrydesc{label}

+

+This is like \glsentrydesc{label} but also checks for the existence of ⟨label⟩. This +command is not expandable. It’s used in the predefined glossary styles to display the +description. +


\Glossentrydesc  \Glossentrydesc{label}

+

+This is like \glossentrydesc but converts the first letter to upper case. This command is not +expandable. +


\glsentrydescplural  \glsentrydescplural{label}

+

+


\Glsentrydescplural  \Glsentrydescplural{label}

+

+These commands display the plural description for the glossary entry given by ⟨label⟩. +\Glsentrydescplural makes the first letter upper case. The first form is expandable (unless +the value of that key contains unexpandable commands). The second form is not expandable. +Neither checks for the existence of ⟨label⟩. +


\glsentrysymbol  \glsentrysymbol{label}

+

+


\Glsentrysymbol  \Glsentrysymbol{label}

+

+These commands display the symbol for the glossary entry given by ⟨label⟩. \Glsentrysymbol +makes the first letter upper case. The first form is expandable (unless the value of that key +contains unexpandable commands). The second form is not expandable. Neither checks for +the existence of ⟨label⟩. +


\glsletentryfield  \glsletentryfield{cs}{label}{field}

+

+This command doesn’t display anything. It merely fetches the value associated with the given +field (where the available field names are listed in table 4.1) and stores the result in the +control sequence ⟨cs⟩. For example, to store the description for the entry whose label is “apple” +in the control sequence \tmp: + + +

+
+\glsletentryfield{\tmp}{apple}{desc} +
+

+


\glossentrysymbol  \glossentrysymbol{label}

+

+This is like \glsentrysymbol{label} but also checks for the existence of ⟨label⟩. This command +is not expandable. It’s used in some of the predefined glossary styles to display the +symbol. +


\Glossentrysymbol  \Glossentrysymbol{label}

+

+This is like \glossentrysymbol but converts the first letter to upper case. This command is +not expandable. +


\glsentrysymbolplural  \glsentrysymbolplural{label}

+

+


\Glsentrysymbolplural  \Glsentrysymbolplural{label}

+

+These commands display the plural symbol for the glossary entry given by ⟨label⟩. +\Glsentrysymbolplural makes the first letter upper case. The first form is expandable +(unless the value of that key contains unexpandable commands). The second form is not +expandable. Neither checks for the existence of ⟨label⟩. +


\glsentryuseri  \glsentryuseri{label}

+

+


\Glsentryuseri  \Glsentryuseri{label}

+

+


\glsentryuserii  \glsentryuserii{label}

+

+


\Glsentryuserii  \Glsentryuserii{label}

+

+


\glsentryuseriii  \glsentryuseriii{label}

+

+


\Glsentryuseriii  \Glsentryuseriii{label}

+

+


\glsentryuseriv  \glsentryuseriv{label}

+

+


\Glsentryuseriv  \Glsentryuseriv{label}

+ + +

+


\glsentryuserv  \glsentryuserv{label}

+

+


\Glsentryuserv  \Glsentryuserv{label}

+

+


\glsentryuservi  \glsentryuservi{label}

+

+


\Glsentryuservi  \Glsentryuservi{label}

+

+These commands display the value of the user keys for the glossary entry given by ⟨label⟩. The +lower case forms are expandable (unless the value of the key contains unexpandable +commands). The commands beginning with an upper case letter convert the first letter of the +required value to upper case and are not expandable. None of these commands check for the +existence of ⟨label⟩. +


\glshyperlink  \glshyperlink[link text]{label}

+

+This command provides a hyperlink to the glossary entry given by ⟨labelbut does not add +any information to the glossary file. The link text is given by \glsentrytext{label} by +default9.1, +but can be overridden using the optional argument. Note that the hyperlink will be +suppressed if you have used \glsdisablehyper or if you haven’t loaded the hyperref +package. +

If you use \glshyperlink, you need to ensure that the relevant entry has been added to +the glossary using any of the commands described in §6 Links to Glossary Entries or §7 +Adding an Entry to the Glossary Without Generating Text otherwise you will end up with an +undefined link.
+

+

The next two commands are only available with Option 1 or with the savenumberlist +package option: +


\glsentrynumberlist  \glsentrynumberlist{label}

+

+


\glsdisplaynumberlist  \glsdisplaynumberlist{label}

+

+Both display the number list for the entry given by ⟨label⟩. When used with Option 1 a rerun +is required to ensure this list is up-to-date, when used with Options 2 or 3 a run of +makeglossaries (or makeindex/xindy) followed by one or two runs of LATEX is +required. +

The first command, \glsentrynumberlist, simply displays the number list as is. The +second command, \glsdisplaynumberlist, formats the list using: +


\glsnumlistsep  \glsnumlistsep

+ + +

+as the separator between all but the last two elements and +


\glsnumlistlastsep  \glsnumlistlastsep

+

+between the final two elements. The defaults are ,␣ and ␣\&␣, respectively. +

\glsdisplaynumberlist is fairly experimental. It works with Option 1, but for +Options 2 or 3 it only works when the default counter format is used (that is, when the +format key is set to glsnumberformat). This command will only work with hyperref if you +choose Option 1. If you try using this command with Options 2 or 3 and hyperref, +\glsentrynumberlist will be used instead.
+

+

For further information see “Displaying entry details without adding information to the +glossary” in the documented code (glossaries-code.pdf). + + +

+

+

Top

10. Displaying a glossary

+

All defined glossaries may be displayed using: +

+Option 1:
+


\printnoidxglossaries  \printnoidxglossaries

+

+ (Must be used with \makenoidxglossaries in the preamble.) +

+Options 2 and 3:
+


\printglossaries  \printglossaries

+

+ (Must be used with \makeglossaries in the preamble.)

+

These commands will display all the glossaries in the order in which they were defined. +Note that, in the case of Options 2 and 3, no glossaries will appear until you have either used +the Perl script makeglossaries or Lua script makeglossaries-lite or have directly used +makeindex or xindy (as described in §1.5 Generating the Associated Glossary Files). +(While the external files are missing, these commands will just do \null for each +missing glossary to assist dictionary style documents that just use \glsaddall +without inserting any text. If you use glossaries-extra, it will insert a heading and +boilerplate text when the external files are missing. The extension package also provides +\printunsrtglossaries as an alternative. See the glossaries-extra manual for further +details.) +

If the glossary still does not appear after you re-LATEX your document, check the +makeindex/xindy log files to see if there is a problem. With Option 1, you just need two +LATEX runs to make the glossaries appear, but you may need further runs to make the +number lists up-to-date. +

An individual glossary can be displayed using: +

+Option 1:
+


\printnoidxglossary  \printnoidxglossary[options]

+

+ (Must be used with \makenoidxglossaries in the preamble.) +

+Options 2 and 3:
+


\printglossary  \printglossary[options]

+

+ (Must be used with \makeglossaries in the preamble.)

+

where ⟨options⟩ is a ⟨key⟩=⟨value⟩ list of options. (Again, when the associated external file is missing, +\null is inserted into the document.) + + +

The following keys are available: +

+type
The value of this key specifies which glossary to print. If omitted, the default glossary is + assumed. For example, to print the list of acronyms: + + +
+ \printglossary[type=\acronymtype] +
+

Note that you can’t display an ignored glossary, so don’t try setting type to the name of + a glossary that was defined using \newignoredglossary, described in §12 Defining New + Glossaries. (You can display an ignored glossary with \printunsrtglossary provided + by glossaries-extra.) +

+title
This is the glossary’s title (overriding the title specified when the glossary was + defined). +
+toctitle
This is the title to use for the table of contents (if the toc package option has been + used). It may also be used for the page header, depending on the page style. If omitted, + the value of title is used. +
+style
This specifies which glossary style to use for this glossary, overriding the effect of the + style package option or \glossarystyle. +
+numberedsection
This specifies whether to use a numbered section for this glossary, + overriding the effect of the numberedsection package option. This key has the same + syntax as the numberedsection package option, described in §2.2 Sectioning, Headings + and TOC Options. +
+nonumberlist
This is a boolean key. If true (nonumberlist=true) the numberlist is + suppressed for this glossary. If false (nonumberlist=false) the numberlist is displayed + for this glossary. +
+nogroupskip
This is a boolean key. If true the vertical gap between groups is suppressed for + this glossary. +
+nopostdot
This is a boolean key. If true the full stop after the description is suppressed for + this glossary. +
+entrycounter
This is a boolean key. Behaves similar to the package option of the same name. + The corresponding package option must be used to make \glsrefentry work + correctly. + + +
+subentrycounter
This is a boolean key. Behaves similar to the package option of the same + name. If you want to set both entrycounter and subentrycounter, make sure you specify + entrycounter first. The corresponding package option must be used to make + \glsrefentry work correctly. +
+sort
This key is only available for Option 1. Possible values are: word (word order), letter + (letter order), standard (word or letter ordering taken from the order package option), + use (order of use), def (order of definition) nocase (case-insensitive) or case + (case-sensitive). Note that the word and letter comparisons (that is, everything other + than sort=use and sort=def) just use a simple character code comparison. For a + locale-sensitive sort, you must use either xindy (Option 3) or bib2gls (Option 4). + Note that bib2gls provides many other sort options. +

If you use the use or def values make sure that you select a glossary style that doesn’t + have a visual indicator between groups, as the grouping no longer makes sense. Consider + using the nogroupskip option.
+

+

The + word + and + letter + order + sort + methods + use + datatool’s + \dtlwordindexcompare + and + \dtlletterindexcompare + handlers. + The + case-insensitive + sort + method + uses + datatool’s + \dtlicompare + handler. + The + case-sensitive + sort + method + uses + datatool’s + + + \dtlcompare + handler. + See + the + datatool + documentation + for + further + details. +

If you don’t get an error with sort=use and sort=def but you do get an error with one + of the other sort options, then you probably need to use the sanitizesort=true package + option or make sure none of the entries have fragile commands in their sort + field.

+

By default, the glossary is started either by \chapter* or by \section*, depending on +whether or not \chapter is defined. This can be overridden by the section package option or +the \setglossarysection command. Numbered sectional units can be obtained using +the numberedsection package option. Each glossary sets the page header via the +command +


\glsglossarymark  \glsglossarymark{title}

+

+If this mechanism is unsuitable for your chosen class file or page style package, you will need +to redefine \glsglossarymark. Further information about these options and commands is +given in §2.2 Sectioning, Headings and TOC Options. +

Information can be added to the start of the glossary (after the title and before the main +body of the glossary) by redefining +


\glossarypreamble  \glossarypreamble

+

+For example: + + +

+
+\renewcommand{\glossarypreamble}{Numbers in italic + 
indicate primary definitions.} +
+

This needs to be done before the glossary is displayed. +

If you want a different preamble per glossary you can use +


\setglossarypreamble  \setglossarypreamble[type]{preamble text}

+

+If ⟨type⟩ is omitted, \glsdefaulttype is used. +

For example: + + +

+
+\setglossarypreamble{Numbers in italic + 
indicate primary definitions.} +
+

This will print the given preamble text for the main glossary, but not have any preamble text +for any other glossaries. +

There is an analogous command to \glossarypreamble called +


\glossarypostamble  \glossarypostamble

+

+which is placed at the end of each glossary. + +

Example 15 (Switch to Two Column Mode for Glossary) +

Suppose you are using the superheaderborder +style10.1, +and you want the glossary to be in two columns, but after the glossary you want to switch +back to one column mode, you could do: + + +

+
+\renewcommand*{\glossarysection}[2][]{% + 
  \twocolumn[{\chapter*{#2}}]% + 
  \setlength\glsdescwidth{0.6\linewidth}% + 
  \glsglossarymark{\glossarytoctitle}% + 
} + 
\renewcommand*{\glossarypostamble}{\onecolumn} +
+

+

+
+

+

____________________________

+

Within each glossary, each entry name is formatted according to +


\glsnamefont  \glsnamefont{name}

+

+which takes one argument: the entry name. This command is always used regardless of the +glossary style. By default, \glsnamefont simply displays its argument in whatever the +surrounding font happens to be. This means that in the list-like glossary styles (defined in +the glossary-list style file) the name will appear in bold, since the name is placed +in the optional argument of \item, whereas in the tabular styles (defined in the +glossary-long and glossary-super style files) the name will appear in the normal font. The +hierarchical glossary styles (defined in the glossary-tree style file) also set the name in +bold. +

If you want to change the font for the description, or if you only want to change the name +font for some types of entries but not others, you might want to consider using the +glossaries-extra package. + +

Example 16 (Changing the Font Used to Display Entry Names in the +Glossary) +

Suppose you want all the entry names to appear in medium weight small caps in your +glossaries, then you can do: + + +

+
+\renewcommand{\glsnamefont}[1]{\textsc{\mdseries #1}} +
+

+
+

+

____________________________

+ + +

+

Top

11. Xindy (Option 3)

+

If you want to use xindy to sort the glossary, you must use the package option +xindy: + + +

+
+\usepackage[xindy]{glossaries} +
+

This ensures that the glossary information is written in xindy syntax. +

§1.5 Generating the Associated Glossary Files covers how to use the external indexing +application, and §5.2 Locations covers the issues involved in the location syntax. This section +covers the commands provided by the glossaries package that allow you to adjust the xindy +style file (.xdy) and parameters. +

To assist writing information to the xindy style file, the glossaries package provides the +following commands: +


\glsopenbrace  \glsopenbrace

+

+


\glsclosebrace  \glsclosebrace

+

+which produce an open and closing brace. (This is needed because \{ and \} don’t expand to +a simple brace character when written to a file.) Similarly, you can write a percent character +using: +


\glspercentchar  \glspercentchar

+

+and a tilde character using: +


\glstildechar  \glstildechar

+

+For example, a newline character is specified in a xindy style file using ~n so you can use +\glstildechar n to write this correctly (or you can do \string~n). A backslash can be +written to a file using +


\glsbackslash  \glsbackslash

+

+

In addition, if you are using a package that makes the double quote character active (e.g. +ngerman) you can use: +


\glsquote  \glsquote{text}

+

+which will produce "text". Alternatively, you can use \string" to write the double-quote +character. This document assumes that the double quote character has not been made active, +so the examples just use " for clarity. +

If you want greater control over the xindy style file than is available through the +LATEX commands provided by the glossaries package, you will need to edit the xindy +style file. In which case, you must use \noist to prevent the style file from being +overwritten by the glossaries package. For additional information about xindy, read +the xindy documentation. I’m sorry I can’t provide any assistance with writing +xindy style files. If you need help, I recommend you ask on the xindy mailing list +(http://xindy.sourceforge.net/mailing-list.html). + + +

+

Top

11.1 Language and Encodings

+

When you use xindy, you need to specify the language and encoding used (unless you +have written your own custom xindy style file that defines the relevant alphabet +and sort rules). If you use makeglossaries, this information is obtained from the +document’s auxiliary (.aux) file. The makeglossaries script attempts to find the root +language given your document settings, but in the event that it gets it wrong or if +xindy doesn’t support that language, then you can specify the required language +using: +


\GlsSetXdyLanguage  \GlsSetXdyLanguage[glossary type]{language}

+

+where ⟨language⟩ is the name of the language. The optional argument can be used if you have +multiple glossaries in different languages. If ⟨glossary type⟩ is omitted, it will be applied to all +glossaries, otherwise the language setting will only be applied to the glossary given by +⟨glossary type⟩. +

If the inputenc package is used, the encoding will be obtained from the value of +\inputencodingname. Alternatively, you can specify the encoding using: +


\GlsSetXdyCodePage  \GlsSetXdyCodePage{code}

+

+where ⟨code⟩ is the name of the encoding. For example: + + +

+
+\GlsSetXdyCodePage{utf8} +
+

+

Note that you can also specify the language and encoding using the package option +xindy={language=lang,codepage=code}. For example: + + +

+
+\usepackage[xindy={language=english,codepage=utf8}]{glossaries} +
+

+

If you write your own custom xindy style file that includes the language settings, you need +to set the language to nothing: + + +

+
+\GlsSetXdyLanguage{} +
+

(and remember to use \noist to prevent the style file from being overwritten). +

The commands \GlsSetXdyLanguage and \GlsSetXdyCodePage have no effect if +you don’t use makeglossaries. If you call xindy without makeglossaries you +need to remember to set the language and encoding using the -L and -C switches. +
+

+

+

+

Top

11.2 Locations and Number lists

+

If you use xindy, the glossaries package needs to know which counters you will be using in the +number list in order to correctly format the xindy style file. Counters specified using the +counter package option or the ⟨counter⟩ option of \newglossary are automatically taken +care of, but if you plan to use a different counter in the counter key for commands +like \glslink, then you need to identify these counters before \makeglossaries +using: +


\GlsAddXdyCounters  \GlsAddXdyCounters{counter list}

+

+where ⟨counter list⟩ is a comma-separated list of counter names. +

The most likely attributes used in the format key (textrm, hyperrm etc) are automatically +added to the xindy style file, but if you want to use another attribute, you need to add it +using: +


\GlsAddXdyAttribute  \GlsAddXdyAttribute{name}

+

+where ⟨name⟩ is the name of the attribute, as used in the format key. +

Take care if you have multiple instances of the same location with different formats. The +duplicate locations will be discarded according to the order in which the attributes are +listed. Consider defining semantic commands to use for primary references. For +example: + + +

+
+\newcommand*{\primary}[1]{\textbf{#1}} + 
\GlsAddXdyAttribute{primary} +
+

Then in the document: + + +

+
+A \gls[format=primary]{duck} is an aquatic bird. + 
There are lots of different types of \gls{duck}. +
+

This will give the format=primary instance preference over the next use that doesn’t use the +format key. + +

Example 17 (Custom Font for Displaying a Location) +

Suppose I want a bold, italic, hyperlinked location. I first need to define a command that +will do this: + + +

+
+\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}} +
+

but with xindy, I also need to add this as an allowed attribute: + + +

+
+\GlsAddXdyAttribute{hyperbfit} +
+

Now I can use it in the optional argument of commands like \gls: + + +

+
+Here is a \gls[format=hyperbfit]{sample} entry. +
+

(where sample is the label of the required entry).

+
+

+

____________________________

+

Note that \GlsAddXdyAttribute has no effect if \noist is used or if \makeglossaries is +omitted. \GlsAddXdyAttribute must be used before \makeglossaries. Additionally, +\GlsAddXdyCounters must come before \GlsAddXdyAttribute.
+

+

If the location numbers include formatting commands, then you need to add a location +style in the appropriate format using +


\GlsAddXdyLocation  \GlsAddXdyLocation[prefix-location]{name}{definition} +

+

+where ⟨name⟩ is the name of the format and ⟨definition⟩ is the xindy definition. The optional +argument ⟨prefix-location⟩ is needed if \theHcounter⟩ either isn’t defined or is different from +\thecounter⟩. Be sure to also read §5.2 Locations for some issues that you may +encounter. +

Note that \GlsAddXdyLocation has no effect if \noist is used or if \makeglossaries is +omitted. \GlsAddXdyLocation must be used before \makeglossaries.
+

+ +

Example 18 (Custom Numbering System for Locations) +

Suppose I decide to use a somewhat eccentric numbering system for sections where I +redefine \thesection as follows: + + +

+
+\renewcommand*{\thesection}{[\thechapter]\arabic{section}} +
+

If I haven’t done counter=section in the package option, I need to specify that the counter +will be used as a location number: + + +

+
+\GlsAddXdyCounters{section} +
+

Next I need to add the location style (\thechapter is assumed to be the standard +\arabic{chapter}): + + +

+
+\GlsAddXdyLocation{section}{:sep "[" "arabic-numbers" :sep "]" + 
  "arabic-numbers" + 
} +
+

Note that if I have further decided to use the hyperref package and want to redefine +\theHsection as: + + +

+
+\renewcommand*{\theHsection}{\thepart.\thesection} + 
\renewcommand*{\thepart}{\Roman{part}} +
+

then I need to modify the \GlsAddXdyLocation code above to: + + +

+
+\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "[" + 
  "arabic-numbers" :sep "]" "arabic-numbers" + 
} +
+

Since \Roman will result in an empty string if the counter is zero, it’s a good idea to add an +extra location to catch this: + + +

+
+\GlsAddXdyLocation{zero.section}{:sep "[" + 
  "arabic-numbers" :sep "]" "arabic-numbers" + 
} +
+

This example is illustrated in the sample file samplexdy2.tex.

+
+

+

____________________________

+ +

Example 19 (Locations as Dice) +

Suppose I want a rather eccentric page numbering system that’s represented by the +number of dots on dice. The stix package provides \dicei, …, \dicevi that represent the six +sides of a die. I can define a command that takes a number as its argument. If the +number is less than seven, the appropriate \dicen⟩ command is used otherwise it +does \dicevi the required number of times with the leftover in a final \dicen⟩. For +example, the number 16 is represented by \dicevi\dicevi\diceiv (6 + 6 + 4 = 16). +I’ve called this command \tallynum to match the example given earlier in §5.2 +Locations: + + +

+
+\newrobustcmd{\tallynum}[1]{% + 
 \ifnum\number#1<7 + 
  $\csname dice\romannumeral#1\endcsname$% + 
 \else + 
  $\dicevi$% + 
  \expandafter\tallynum\expandafter{\numexpr#1-6}% + 
 \fi + 
} +
+

Here’s the counter command: + + +

+
+newcommand{\tally}[1]{\tallynum{\arabic{#1}}} +
+

The page counter representation (\thepage) needs to be changed to use this command: + + +

+
+\renewcommand*{\thepage}{\tally{page}} +
+

The \tally command expands to \tallynum {number} so this needs a location class that +matches this format: + + +

+
+\GlsAddXdyLocation{tally}{% + 
 :sep "\string\tallynum\space\glsopenbrace" + 
 "arabic-numbers" + 
 :sep "\glsclosebrace" + 
} +
+

The space between \tallynum and {number} is significant to xindy so \space is +required. +

Note that \GlsAddXdyLocation{name}{definition} will define commands in the +form: +


\glsXcounterXname{Hprefix}{location}

+

+for each counter that has been identified either by the counter package option, the ⟨counter⟩ +option for \newglossary or in the argument of \GlsAddXdyCounters. The first argument +⟨Hprefix⟩ is only relevant when used with the hyperref package and indicates that \theHcounter⟩ +is given by \Hprefix.\thecounter⟩. +

The sample file samplexdy.tex, which comes with the glossaries package, uses the default +page counter for locations, and it uses the default \glsnumberformat and a custom +\hyperbfit format. A new xindy location called tallynum, as illustrated above, is defined +to make the page numbers appear as dice. In order for the location numbers to +hyperlink to the relevant pages, I need to redefine the necessary \glsXcounterXformat⟩ +commands: + + +

+
+\renewcommand{\glsXpageXglsnumberformat}[2]{% + 
 \linkpagenumber#2% + 
} + 
\renewcommand{\glsXpageXhyperbfit}[2]{% + 
 \textbf{\em\linkpagenumber#2}% + 
} + 
\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} +
+

Note that the second argument of \glsXpageXglsnumberformat is in the format \tallynum +{n} so the line + + +

+
+ \linkpagenumber#2% +
+

does

+
+ \linkpagenumber\tallynum{number} +
+
so \tallynum is the first argument of \linkpagenumber and ⟨number⟩ is the second +argument. +
+

+

____________________________

+

This method is very sensitive to the internal definition of the location command. +
+

+ +

Example 20 (Locations as Words not Digits) +

Suppose I want the page numbers written as words rather than digits and I use the +fmtcount package to do this. I can redefine \thepage as follows: + + +

+
+\renewcommand*{\thepage}{\Numberstring{page}} +
+

This used to get expanded to \protect \Numberstringnum {n} where ⟨n⟩ is the +Arabic page number. This means that I needed to define a new location with the +form: + + +

+
+\GlsAddXdyLocation{Numberstring}{:sep "\string\protect\space + 
  \string\Numberstringnum\space\glsopenbrace" + 
  "arabic-numbers" :sep "\glsclosebrace"} +
+

and if I’d used the \linkpagenumber command from the previous example, it would need +three arguments (the first being \protect): + + +

+
+\newcommand{\linkpagenumber}[3]{\hyperlink{page.#3}{#1#2{#3}}} +
+

+

The internal definition of \Numberstring has since changed so that it now expands to +\Numberstringnum {n} (no \protect). This means that the location class definition must be +changed to: + + +

+
+\GlsAddXdyLocation{Numberstring}{% no \protect now! + 
  :sep "\string\Numberstringnum\space\glsopenbrace" + 
  "arabic-numbers" :sep "\glsclosebrace"} +
+

and \linkpagenumber goes back to only two arguments: + + +

+
+\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} +
+

The other change is that \Numberstring uses

+
+\the\value{counter} +
+
instead of
+
+\expandafter\the\csname c@counter\endcsname +
+
so it hides \c@page from the location escaping mechanism (see §5.2 Locations). This means +that the page number may be incorrect if the indexing occurs during the output +routine. +

A more recent change to fmtcount (v3.03) now puts three instances of \expandafter +before \the\value which no longer hides \c@page from the location escaping mechanism, so +the page numbers should once more be correct. Further changes to the fmtcount package may +cause a problem again. +

When dealing with custom formats where the internal definitions are outside of your +control and liable to change, it’s best to provide a wrapper command.
+

+

Instead of directly using \Numberstring in the definition of \thepage, I can provide a +custom command in the same form as the earlier \tally command: + + +

+
+\newcommand{\customfmt}[1]{\customfmtnum{\arabic{#1}}} + 
\newrobustcmd{\customfmtnum}[1]{\Numberstringnum{#1}} +
+

This ensures that the location will always be written to the indexing file in the form: +

+
+:locref "{}{\\customfmtnum {n}}" +
+
So the location class can be defined as: + + +
+\GlsAddXdyLocation{customfmt}{ + 
 :sep "\string\customfmtnum\space\glsopenbrace" + 
 "arabic-numbers" + 
 :sep "\glsclosebrace"} +
+

+

The sample file samplexdy3.tex illustrates this.

+
+

+

____________________________

+

In the number list, the locations are sorted according to the list of provided location classes. +The default ordering is: roman-page-numbers (i, ii, …), arabic-page-numbers (1, 2, …), +arabic-section-numbers (for example, 1.1 if the compositor is a full stop or 1-1 if the compositor is a +hyphen11.1), +alpha-page-numbers (a, b, …), Roman-page-numbers (I, II, …), +Alpha-page-numbers (A, B, …), Appendix-page-numbers (for example, A.1 +if the Alpha compositor is a full stop or A-1 if the Alpha compositor is a +hyphen11.2), +user defined location names (as specified by \GlsAddXdyLocation in +the order in which they were defined), and finally see (cross-referenced +entries).11.3 +This ordering can be changed using: +


\GlsSetXdyLocationClassOrder  \GlsSetXdyLocationClassOrder{location names} +

+

+where each location name is delimited by double quote marks and separated by white space. +For example: + + +

+
+\GlsSetXdyLocationClassOrder{ + 
  "arabic-page-numbers" + 
  "arabic-section-numbers" + 
  "roman-page-numbers" + 
  "Roman-page-numbers" + 
  "alpha-page-numbers" + 
  "Alpha-page-numbers" + 
  "Appendix-page-numbers" + 
  "see" + 
} +
+

(Remember to add "seealso" if you’re using glossaries-extra.) +

Note that \GlsSetXdyLocationClassOrder has no effect if \noist is used or if +\makeglossaries is omitted. \GlsSetXdyLocationClassOrder must be used before +\makeglossaries.
+

+

If a number list consists of a sequence of consecutive numbers, the range will be +concatenated. The number of consecutive locations that causes a range formation defaults to +2, but can be changed using: +


\GlsSetXdyMinRangeLength  \GlsSetXdyMinRangeLength{n}

+

+For example: + + +

+
+\GlsSetXdyMinRangeLength{3} +
+

The argument may also be the keyword none, to indicate that there should be no range +formations. See the xindy manual for further details on range formations. +

Note that \GlsSetXdyMinRangeLength has no effect if \noist is used or if +\makeglossaries is omitted. \GlsSetXdyMinRangeLength must be used before +\makeglossaries.
+

+See also §5.3 Range Formations. +

+

+

Top

11.3 Glossary Groups

+

The glossary is divided into groups according to the first letter of the sort key. The glossaries +package also adds a number group by default, unless you suppress it in the xindy package +option. For example: + + +

+
+\usepackage[xindy={glsnumbers=false}]{glossaries} +
+

Any entry that doesn’t go in one of the letter groups or the number group is placed in the +default group. If you want xindy to sort the number group numerically (rather than by a +string sort) then you need to use xindy’s numeric-sort module: + + +

+
+\GlsAddXdyStyle{numeric-sort} +
+

+

If you don’t use glsnumbers=false, the default behaviour is to locate the number group +before the “A” letter group. If you are not using a Roman alphabet, you need to change this +using: +


\GlsSetXdyFirstLetterAfterDigits  \GlsSetXdyFirstLetterAfterDigits{letter} +

+

+where ⟨letter⟩ is the first letter of your alphabet. Take care if you’re using inputenc as +non-ASCII characters are actually active characters that expand. (This isn’t a problem with +the native UTF-8 engines and fontspec.) The starred form will sanitize the argument to +prevent expansion. Alternatively you can use: +


\GlsSetXdyNumberGroupOrder  \GlsSetXdyNumberGroupOrder{relative location} +

+

+to change the default

+
+:before \string"letter\string" +
+
to ⟨relative location⟩. For example: + + +
+\GlsSetXdyNumberGroupOrder{:after \string"Z\string"} +
+

will put the number group after the “Z” letter group. Again take care of active characters. +There’s a starred version that sanitizes the argument (so don’t use \string in it). +

+
+\GlsSetXdyNumberGroupOrder*{:after "Ö"} +
+
+

Note that these commands have no effect if \noist is used or if \makeglossaries is +omitted. \GlsSetXdyFirstLetterAfterDigits must be used before \makeglossaries. +
+

+ + +

+

+

Top

12. Defining New Glossaries

+

A new glossary can be defined using: +


\newglossary  \newglossary[log-ext]{name}{in-ext}{out-ext} +{title}[counter]

+

+where ⟨name⟩ is the label to assign to this glossary. The arguments ⟨in-ext⟩ and ⟨out-ext⟩ specify +the extensions to give to the input and output files for that glossary, ⟨title⟩ is the default title +for this new glossary and the final optional argument ⟨counter⟩ specifies which counter to use +for the associated number lists (see also §5 Number lists). The first optional argument +specifies the extension for the makeindex (Option 2) or xindy (Option 3) transcript file (this +information is only used by makeglossaries which picks up the information from the +auxiliary file). If you use Option 1, the ⟨log-ext⟩, ⟨in-ext⟩ and ⟨out-ext⟩ arguments are +ignored. +

The glossary label ⟨name⟩ must not contain any active characters. It’s generally best to +stick with just characters that have category code 11 (typically the non-extended Latin +characters for standard LATEX).
+

+

There is also a starred version (new to v4.08): +


\newglossary*  \newglossary*{name}{title}[counter]

+

+which is equivalent to

+
+\newglossary[name-glg]{name}{name-gls}{name-glo}{title}[counter] +
+
or you can also use: +


\altnewglossary  \altnewglossary{name}{tag}{title}[counter]

+

+which is equivalent to

+
+\newglossary[tag-glg]{name}{tag-gls}{tag-glo}{title}[counter] +
+
+

It may be that you have some terms that are so common that they don’t need to be listed. +In this case, you can define a special type of glossary that doesn’t create any associated files. +This is referred to as an “ignored glossary” and it’s ignored by commands that iterate +over all the glossaries, such as \printglossaries. To define an ignored glossary, +use +


\newignoredglossary  \newignoredglossary{name}

+

+where ⟨name⟩ is the name of the glossary (as above). This glossary type will automatically be + + +added to the nohypertypes list, since there are no hypertargets for the entries in +an ignored glossary. (The sample file sample-entryfmt.tex defines an ignored +glossary.) +

You can test if a glossary is an ignored one using: +


\ifignoredglossary  \ifignoredglossary{name}{true}{false}

+

+This does ⟨true⟩ if ⟨name⟩ was defined as an ignored glossary, otherwise it does ⟨false⟩. +

Note that the main (default) glossary is automatically created as: + + +

+
+\newglossary{main}{gls}{glo}{\glossaryname} +
+

so it can be identified by the label main (unless the nomain package option is used). Using +the acronym package option is equivalent to: + + +

+
+\newglossary[alg]{acronym}{acr}{acn}{\acronymname} +
+

so it can be identified by the label acronym. If you are not sure whether the acronym +option has been used, you can identify the list of acronyms by the command +\acronymtype \acronymtype which is set to acronym, if the acronym option has been used, +otherwise it is set to main. Note that if you are using the main glossary as your list of +acronyms, you need to declare it as a list of acronyms using the package option +acronymlists. +

The symbols package option creates a new glossary with the label symbols using: + + +

+
+\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname} +
+

The numbers package option creates a new glossary with the label numbers using: + + +

+
+\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname} +
+

The index package option creates a new glossary with the label index using: + + +

+
+\newglossary[ilg]{index}{ind}{idx}{\indexname} +
+

+

Options 2 and 3: all glossaries must be defined before \makeglossaries to ensure that +the relevant output files are opened. +

See §1.4.1 Changing the Fixed Names if you want to redefine \glossaryname, +especially if you are using babel or translator. (Similarly for \glssymbolsgroupname and +\glsnumbersgroupname.) If you want to redefine \indexname, just follow the advice in How +to change LaTeX’s “fixed names”.

+

+ + +

+

+

Top

13. Acronyms and Other Abbreviations

+

The glossaries-extra package provides superior abbreviation handling. You may want to +consider using that package instead of the commands described here. +

Note that although this chapter uses the term “acronym”, you can also use the +commands described here for initialisms or contractions (as in the case of some of the +examples given below). If the glossary title is no longer applicable (for example, +it should be “Abbreviations” rather than “Acronyms”) then you can change the +title either by redefining \acronymname (see §1.4 Multi-Lingual Support) or by +using the title in the optional argument of \printglossary (or \printacronym). +Alternatively consider using the glossaries-extra package’s abbreviations option instead. +
+

+

You may have noticed in §4 Defining Glossary Entries that when you specify a new entry, +you can specify alternate text to use when the term is first used in the document. This +provides a useful means to define abbreviations. For convenience, the glossaries package +defines the command: +


\newacronym  \newacronym[key-val list]{label}{abbrv}{long}

+

+

This uses \newglossaryentry to create an entry with the given label in the glossary given +by \acronymtype. You can specify a different glossary using the type key within the optional +argument. The \newacronym command also uses the long, longplural, short and shortplural +keys in \newglossaryentry to store the long and abbreviated forms and their +plurals. +

Note that the same restrictions on the entry ⟨label⟩ in \newglossaryentry also apply to +\newacronym (see §4 Defining Glossary Entries). +

If you haven’t identified the specified glossary type as a list of acronyms (via +the package option acronymlists or the command \DeclareAcronymList, see §2.5 +Acronym Options) \newacronym will add it to the list and reset the display style +for that glossary via \defglsentryfmt. If you have a mixture of acronyms and +regular entries within the same glossary, care is needed if you want to change the +display style: you must first identify that glossary as a list of acronyms and then +use \defglsentryfmt (not redefine \glsentryfmt) before defining your entries. +
+

+

The optional argument {key-val list} allows you to specify additional information. Any +key that can be used in the second argument of \newglossaryentry can also be used +here in ⟨key-val list⟩. For example, description (when used with one of the styles that +require a description, described in §13.1 Changing the Abbreviation Style) or you can +override plural forms of ⟨abbrv⟩ or ⟨long⟩ using the shortplural or longplural keys. For +example: + + +

+
+\newacronym[longplural={diagonal matrices}]% + 
  {dm}{DM}{diagonal matrix} +
+

If the first use uses the plural form, \glspl{dm} will display: diagonal matrices +(DMs). If you want to use the longplural or shortplural keys, I recommend you use +\setacronymstyle to set the display style rather than using one of the pre-version 4.02 +acronym styles. +

As with plural and firstplural, if longplural is missing, it’s obtained by appended +\glspluralsuffix to the singular form. The short plural shortplural is obtained (is not +explicitly set) by appending \glsacrpluralsuffix to the short form. These commands may +be changed by the associated language files, but they can’t be added to the usual +caption hooks as there’s no guarantee when they’ll be expanded (as discussed earlier). +A different approach is used by glossaries-extra, which has category attributes to +determine whether or not to append a suffix when forming the default value of +shortplural. +

Since \newacronym uses \newglossaryentry, you can use commands like \gls and +\glsreset as with any other glossary entry. +

Since \newacronym sets type=\acronymtype, if you want to load a file containing +acronym definitions using \loadglsentries[type]{filename}, the optional argument ⟨type⟩ +will not have an effect unless you explicitly set the type as type=\glsdefaulttype +in the optional argument to \newacronym. See §4.6 Loading Entries From a File. +
+

+ +

Example 21 (Defining an Abbreviation) +

The following defines the abbreviation IDN: + + +

+
+\newacronym{idn}{IDN}{identification number} +
+

\gls{idn} will produce “identification number (IDN)” on first use and “IDN” on +subsequent uses. If you want to use one of the smallcaps acronym styles, described in §13.1 +Changing the Abbreviation Style, you need to use lower case characters for the shortened +form: + + +

+
+\newacronym{idn}{idn}{identification number} +
+

Now \gls{idn} will produce “identification number (idn)” on first use and “idn” on +subsequent uses.

+
+

+

____________________________

+

Avoid nested definitions.
+

+

Recall from the warning in §4 Defining Glossary Entries that you should avoid using the +\gls-like and \glstext-like commands within the value of keys like text and first due to +complications arising from nested links. The same applies to abbreviations defined using +\newacronym. +

For example, suppose you have defined: + + +

+
+\newacronym{ssi}{SSI}{server side includes} + 
\newacronym{html}{HTML}{hypertext markup language} +
+

you may be tempted to do: + + +

+
+\newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}} +
+

Don’t! This will break the case-changing commands, such as \Gls, it will cause +inconsistencies on first use, and, if hyperlinks are enabled, will cause nested hyperlinks. It will +also confuse the commands used by the entry formatting (such as \glslabel). +

Instead, consider doing: + + +

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

or + + +

+
+\newacronym + 
 [description={\gls{ssi} enabled \gls{html}}] + 
 {shtml}{SHTML} + 
 {server side includes enabled hypertext markup language} +
+

Similarly for the \glstext-like commands. +

Other approaches are available with glossaries-extra. See the section “Nested Links” in the +glossaries-extra user manual. +

The commands described below are similar to the \glstext-like commands in that they +don’t modify the first use flag. However, their display is governed by \defentryfmt with +\glscustomtext set as appropriate. All caveats that apply to the \glstext-like commands +also apply to the following commands. (Including the warning immediately above this box.) +
+

+

The optional arguments are the same as those for the \glstext-like commands, +and there are similar star and plus variants that switch off or on the hyperlinks. +As with the \glstext-like commands, the link text is placed in the argument of +\glstextformat. +


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

+

+This sets the link text to the short form (within the argument of \acronymfont) for the entry +given by ⟨label⟩. The short form is as supplied by the short key, which \newacronym implicitly +sets. +

There are also analogous upper case variants: +


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

+

+


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

+

+There are also plural versions: +


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

+

+


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

+

+


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

+

+The short plural form is as supplied by the shortplural key, which \newacronym implicitly +sets. +


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

+ + +

+This sets the link text to the long form for the entry given by ⟨label⟩. The long form is as +supplied by the long key, which \newacronym implicitly sets. +

There are also analogous upper case variants: +


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

+

+


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

+

+Again there are also plural versions: +


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

+

+


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

+

+


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

+

+The long plural form is as supplied by the longplural key, which \newacronym implicitly +sets. +

The commands below display the full form of the acronym, but note that this isn’t +necessarily the same as the form used on first use. These full-form commands are shortcuts +that use the above commands, rather than creating the link text from the complete full form. +These full-form commands have star and plus variants and optional arguments that are +passed to the above commands. +


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

+

+This is a shortcut for +


\acrfullfmt  \acrfullfmt{options}{label}{insert}

+

+which by default does

+
+\acrfullformat +
 {\acrlong[options]{label}{insert}} +
 {\acrshort[options]{label}} +
+
where +


\acrfullformat  \acrfullformat{long}{short}

+

+by default does ⟨long⟩ (⟨short⟩). This command is now deprecated for new acronym styles but is +used by the default for backward compatibility if \setacronymstyle (§13.1 Changing the +Abbreviation Style) hasn’t been used. (For further details of these format commands see the +documented code, glossaries-code.pdf.) +

There are also analogous upper case variants: +


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

+ + +

+


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

+

+and plural versions: +


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

+

+


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

+

+


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

+

+

If you find the above commands too cumbersome to write, you can use the shortcuts +package option to activate the shorter command names listed in table 13.1. +

+
+ + +


+ + +
Table 13.1: Synonyms provided by the package option shortcuts
+
+ + + + + + + + + + + + + + + +
Shortcut Command Equivalent Command
\acs \acrshort
\Acs \Acrshort
\acsp \acrshortpl
\Acsp \Acrshortpl
\acl \acrlong
\Acl \Acrlong
\aclp \acrlongpl
\Aclp \Acrlongpl
\acf \acrfull
\Acf \Acrfull
\acfp \acrfullpl
\Acfp \Acrfullpl
\ac \gls
\Ac \Gls
\acp \glspl
\Acp \Glspl
+
+ + +

+
+

It is also possible to access the long and short forms without adding information to the +glossary using commands analogous to \glsentrytext (described in §9 Using Glossary Terms +Without Links). +

The commands that convert the first letter to upper case come with the same caveats as +those for analogous commands like \Glsentrytext (non-expandable, can’t be used in PDF +bookmarks, care needs to be taken if the first letter is an accented character etc). See §9 +Using Glossary Terms Without Links.
+

+

The long form can be accessed using: +


\glsentrylong  \glsentrylong{label}

+

+or, with the first letter converted to upper case: +


\Glsentrylong  \Glsentrylong{label}

+

+Plural forms: +


\glsentrylongpl  \glsentrylongpl{label}

+

+


\Glsentrylongpl  \Glsentrylongpl{label}

+

+

Similarly, to access the short form: +


\glsentryshort  \glsentryshort{label}

+

+or, with the first letter converted to upper case: +


\Glsentryshort  \Glsentryshort{label}

+

+Plural forms: +


\glsentryshortpl  \glsentryshortpl{label}

+

+


\Glsentryshortpl  \Glsentryshortpl{label}

+

+

And the full form can be obtained using: +


\glsentryfull  \glsentryfull{label}

+

+


\Glsentryfull  \Glsentryfull{label}

+

+


\glsentryfullpl  \glsentryfullpl{label}

+ + +

+


\Glsentryfullpl  \Glsentryfullpl{label}

+

+These again use \acrfullformat by default, but the new styles described in the section +below use different formatting commands. +

+

Top

13.1 Changing the Abbreviation Style

+

It may be that the default style doesn’t suit your requirements in which case you can switch +to another style using +


\setacronymstyle  \setacronymstyle{style name}

+

+where ⟨style name⟩ is the name of the required style. +

You must use \setacronymstyle before you define the acronyms with \newacronym. +
+

+

For example: + + +

+
+\usepackage[acronym]{glossaries} + 
\makeglossaries + 
\setacronymstyle{long-sc-short} + 
\newacronym{html}{html}{hypertext markup language} + 
\newacronym{xml}{xml}{extensible markup language} +
+

Unpredictable results can occur if you try to use multiple styles. +

If you need multiple abbreviation styles, then try using the glossaries-extra package, which +has better abbreviation management.
+

+

Note that unlike the default behaviour of \newacronym, the styles used via +\setacronymstyle don’t use the first or text keys, but instead they use \defglsentryfmt to +set a custom format that uses the long and short keys (or their plural equivalents). This +means that these styles cope better with plurals that aren’t formed by simply appending the +singular form with the letter “s”. In fact, most of the predefined styles use \glsgenacfmt and +modify the definitions of commands like \genacrfullformat. +

Note that when you use \setacronymstyle the name key is set to +


\acronymentry  \acronymentry{label}

+

+and the sort key is set to +


\acronymsort  \acronymsort{short}{long}

+

+These commands are redefined by the acronym styles. However, you can redefine them again +after the style has been set but before you use \newacronym. Protected expansion is +performed on \acronymsort when the entry is defined. +

+

+

Top

13.1.1 Predefined Acronym Styles

+

The glossaries package provides a number of predefined styles. These styles apply +


\firstacronymfont  \firstacronymfont{text}

+

+to the short form on first use and +


\acronymfont  \acronymfont{text}

+

+on subsequent use. The styles modify the definition of \acronymfont as required, but +\firstacronymfont is only set once by the package when it’s loaded. By default + + +\firstacronymfont{text} is the same as \acronymfont{text}. If you want the short form +displayed differently on first use, you can redefine \firstacronymfont independently of the +acronym style. +

The predefined styles that contain sc in their name (for example long-sc-short) redefine +\acronymfont to use \textsc, which means that the short form needs to be specified in lower +case. +

+

Some fonts don’t support bold smallcaps, so you may need to redefine \glsnamefont (see +§10 Displaying a glossary) to switch to medium weight if you are using a glossary style that +displays entry names in bold and you have chosen an acronym style that uses \textsc. +
+

+

The predefined styles that contain sm in their name (for example long-sm-short) redefine +\acronymfont to use \textsmaller. +

+

Note that the glossaries package doesn’t define or load any package that defines +\textsmaller. If you use one of the acronym styles that set \acronymfont to \textsmaller +you must explicitly load the relsize package or otherwise define \textsmaller.
+

+

The remaining predefined styles redefine \acronymfont{text} to simply do its argument +⟨text⟩. +

In most cases, the predefined styles adjust \acrfull and \glsentryfull (and their +plural and upper case variants) to reflect the style. The only exceptions to this are the dua +and footnote styles (and their variants).
+

+

The following styles are supplied by the glossaries package:

+
    +
  • long-short, long-sc-short, long-sm-short, long-sp-short: +

    With these three styles, acronyms are displayed in the form +


    long(\firstacronymfont{short})

    +

    + on first use and +


    \acronymfont{short}

    +

    + on subsequent use. They also set \acronymsort{short}{long} to just ⟨short⟩. This means + that the acronyms are sorted according to their short form. In addition, \acronymentry + {label} is set to just the short form (enclosed in \acronymfont) and the description key + is set to the long form. +

    The long-sp-short style was introduced in version 4.16 and uses +


    \glsacspace  \glsacspace{label}

    + + +

    + for the space between the long and short forms. This defaults to a non-breakable space + (~) if (\acronymfont{short}) is less than 3em, otherwise it uses a normal space. This + may be redefined as required. For example, to always use a non-breakable + space: + + +

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

    +

  • +
  • short-long, sc-short-long, sm-short-long: +

    These three styles are analogous to the above three styles, except the display order is + swapped to +


    \firstacronymfont{short} (long)

    +

    + on first use. +

    Note, however, that \acronymsort and \acronymentry are the same as for the ⟨long⟩ + (⟨short⟩) styles above, so the acronyms are still sorted according to the short + form. +

  • +
  • long-short-desc, long-sc-short-desc, long-sm-short-desc, long-sp-short-desc: +

    These are like the long-short, long-sc-short, long-sm-short and long-sp-short styles + described above, except that the description key must be supplied in the optional + argument of \newacronym. They also redefine \acronymentry to {long} (\acronymfont + {short}) and redefine \acronymsort{short}{long} to just ⟨long⟩. This means that the + acronyms are sorted according to the long form, and in the list of acronyms the name + field has the long form followed by the short form in parentheses. I recommend you use + a glossary style such as altlist with these acronym styles to allow for the long name + field. +

  • +
  • short-long-desc, sc-short-long-desc, sm-short-long-desc: +

    These styles are analogous to the above three styles, but the first use display style + is: +


    \firstacronymfont{short} (long)

    +

    + The definitions of \acronymsort and \acronymentry are the same as those for + long-short-desc etc. +

  • +
  • dua, dua-desc: + + +

    With these styles, the \gls-like commands always display the long form regardless of + whether the entry has been used or not. However, \acrfull and \glsentryfull will + display ⟨long⟩ (\acronymfont{short}). In the case of dua, the name and sort keys are set + to the short form and the description is set to the long form. In the case of dua-desc, the + name and sort keys are set to the long form and the description is supplied in the + optional argument of \newacronym. +

  • +
  • footnote, footnote-sc, footnote-sm: +

    With these three styles, on first use the \gls-like commands display: +


    \firstacronymfont{short}\footnote{long}

    +

    + However, \acrfull and \glsentryfull are set to \acronymfont{short} (⟨long⟩). On + subsequent use the display is: +


    \acronymfont{short}

    +

    + The sort and name keys are set to the short form, and the description is set to the long + form. +

    In order to avoid nested hyperlinks on first use the footnote styles automatically + implement hyperfirst=false for the acronym lists.
    +

    +

  • +
  • footnote-desc, footnote-sc-desc, footnote-sm-desc: +

    These three styles are similar to the previous three styles, but the description + has to be supplied in the optional argument of \newacronym. The name key + is set to the long form followed by the short form in parentheses and the + sort key is set to the long form. This means that the acronyms will be sorted + according to the long form. In addition, since the name will typically be quite + wide it’s best to choose a glossary style that can accommodate this, such as + altlist. +

    +
+ +

Example 22 (Adapting a Predefined Acronym Style) +

Suppose I want to use the footnote-sc-desc style, but I want the name key set to the short +form followed by the long form in parentheses and the sort key set to the short form. Then I +need to specify the footnote-sc-desc style: + + +

+
+\setacronymstyle{footnote-sc-desc} +
+

and then redefine \acronymsort and \acronymentry: + + +

+
+\renewcommand*{\acronymsort}[2]{#1}% sort by short form + 
\renewcommand*{\acronymentry}[1]{% + 
  \acronymfont{\glsentryshort{#1}}\space (\glsentrylong{#1})}% +
+

(I’ve used \space for extra clarity, but you can just use an actual space instead.) +

Since the default Computer Modern fonts don’t support bold smallcaps, I’m also going to +redefine \acronymfont so that it always switches to medium weight to ensure the smallcaps +setting is used: + + +

+
+\renewcommand*{\acronymfont}[1]{\textmd{\scshape #1}} +
+

This isn’t necessary if you use a font that supports bold smallcaps. +

The sample file sampleFnAcrDesc.tex illustrates this example.

+
+

+

____________________________

+

+

+

Top

13.1.2 Defining A Custom Acronym Style

+

You may find that the predefined acronyms styles that come with the glossaries +package don’t suit your requirements. In this case you can define your own style +using: +


\newacronymstyle  \newacronymstyle{style name}{display}{definitions} +

+

+where ⟨style name⟩ is the name of the new style (avoid active characters). The second +argument, ⟨display⟩, is equivalent to the mandatory argument of \defglsentryfmt. You can +simply use \glsgenacfmt or you can customize the display using commands like +\ifglsused, \glsifplural and \glscapscase. (See §6.3 Changing the format +of the link text for further details.) If the style is likely to be used with a mixed +glossary (that is entries in that glossary are defined both with \newacronym and +\newglossaryentry) then you can test if the entry is an acronym and use \glsgenacfmt if it +is or \glsgenentryfmt if it isn’t. For example, the long-short style sets ⟨display⟩ +as + + +

+
+\ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +
+

(You can use \ifglshasshort instead of \ifglshaslong to test if the entry is an acronym if +you prefer.) +

The third argument, ⟨definitions⟩, can be used to redefine the commands that affect the +display style, such as \acronymfont or, if ⟨display⟩ uses \glsgenacfmt, \genacrfullformat +and its variants. +

Note that \setacronymstyle redefines \glsentryfull and \acrfullfmt to use +\genacrfullformat (and similarly for the plural and upper case variants). If this isn’t +appropriate for the style (as in the case of styles like footnote and dua) \newacronymstyle +should redefine these commands within ⟨definitions⟩. +

Within \newacronymstyle’s ⟨definitions⟩ argument you can also redefine +


\GenericAcronymFields  \GenericAcronymFields

+

+This is a list of additional fields to be set in \newacronym. You can use the following token +registers to access the entry label, long form and short form: \glslabeltok \glslabeltok, +\glslongtok \glslongtok and \glsshorttok \glsshorttok. As with all TEX registers, you +can access their values by preceding the register with \the. For example, the long-short style +does: + + +

+
+\renewcommand*{\GenericAcronymFields}{% + 
   description={\the\glslongtok}}% +
+

which sets the description field to the long form of the acronym whereas the long-short-desc +style does: + + +

+
+\renewcommand*{\GenericAcronymFields}{}% +
+

since the description needs to be specified by the user. +

It may be that you want to define a new acronym style that’s based on an existing style. +Within ⟨display⟩ you can use +


\GlsUseAcrEntryDispStyle  \GlsUseAcrEntryDispStyle{style name}

+

+to use the ⟨display⟩ definition from the style given by ⟨style name⟩. Within ⟨definitions⟩ you can +use +


\GlsUseAcrStyleDefs  \GlsUseAcrStyleDefs{style name}

+

+to use the ⟨definitions⟩ from the style given by ⟨style name⟩. For example, the long-sc-short +acronym style is based on the long-short style with minor modifications (remember to use ## +instead of # within ⟨definitions⟩): + + +

+
+\newacronymstyle{long-sc-short}% + 
{% use the same display as "long-short" + 
  \GlsUseAcrEntryDispStyle{long-short}% + 
}% + 
{% use the same definitions as "long-short" + 
  \GlsUseAcrStyleDefs{long-short}% + 
  % Minor modifications: + 
  \renewcommand{\acronymfont}[1]{\textsc{##1}}% + 
  \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + 
} +
+

(\glstextup \glstextup is used to cancel the effect of \textsc. This defaults to \textulc, +if defined, otherwise \textup. For example, the plural of svm should be rendered as svms +rather than svms.) + +

Example 23 (Defining a Custom Acronym Style) +

Suppose I want my acronym on first use to have the short form in the text and the long +form with the description in a footnote. Suppose also that I want the short form to be put in +small caps in the main body of the document, but I want it in normal capitals in the list of +acronyms. In my list of acronyms, I want the long form as the name with the short form in +brackets followed by the description. That is, in the text I want \gls on first use to display: + +
\textsc{abbrv}\footnote{long⟩: ⟨description} +
+on subsequent use: +
\textsc{abbrv} +
+and in the list of acronyms, each entry will be displayed in the form: +
long⟩ (⟨short⟩) ⟨description⟩ +
+

Let’s suppose it’s possible that I may have a mixed glossary. I can check this in the second +argument of \newacronymstyle using: + + +

+
+\ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +
+

This will use \glsgenentryfmt if the entry isn’t an acronym, otherwise it will use +\glsgenacfmt. The third argument (⟨definitions⟩) of \newacronymstyle needs to redefine +\genacrfullformat etc so that the first use displays the short form in the text with the long +form in a footnote followed by the description. This is done as follows (remember to use ## +instead of #): + + +

+
+ % No case change, singular first use: + 
  \renewcommand*{\genacrfullformat}[2]{% + 
   \firstacronymfont{\glsentryshort{##1}}##2% + 
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + 
  }% + 
 % First letter upper case, singular first use: + 
  \renewcommand*{\Genacrfullformat}[2]{% + 
   \firstacronymfont{\Glsentryshort{##1}}##2% + 
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + 
  }% + 
 % No case change, plural first use: + 
  \renewcommand*{\genplacrfullformat}[2]{% + 
   \firstacronymfont{\glsentryshortpl{##1}}##2% + 
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + 
  }% + 
 % First letter upper case, plural first use: + 
  \renewcommand*{\Genplacrfullformat}[2]{% + 
   \firstacronymfont{\Glsentryshortpl{##1}}##2% + 
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + 
  }% +
+

If you think it inappropriate for the short form to be capitalised at the start of a sentence +you can change the above to: + + +

+
+ % No case change, singular first use: + 
  \renewcommand*{\genacrfullformat}[2]{% + 
   \firstacronymfont{\glsentryshort{##1}}##2% + 
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + 
  }% + 
 % No case change, plural first use: + 
  \renewcommand*{\genplacrfullformat}[2]{% + 
   \firstacronymfont{\glsentryshortpl{##1}}##2% + 
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + 
  }% + 
 \let\Genacrfullformat\genacrfullformat + 
 \let\Genplacrfullformat\genplacrfullformat +
+

Another variation is to use \Glsentrylong and \Glsentrylongpl in the footnote instead of +\glsentrylong and \glsentrylongpl. +

Now let’s suppose that commands such as \glsentryfull and \acrfull shouldn’t use +a footnote, but instead use the format: ⟨long⟩ (⟨short⟩). This means that the style +needs to redefine \glsentryfull, \acrfullfmt and their plural and upper case +variants. +

First, the non-linking commands: + + +

+
+  \renewcommand*{\glsentryfull}[1]{% + 
    \glsentrylong{##1}\space + 
      (\acronymfont{\glsentryshort{##1}})% + 
  }% + 
  \renewcommand*{\Glsentryfull}[1]{% + 
    \Glsentrylong{##1}\space + 
      (\acronymfont{\glsentryshort{##1}})% + 
  }% + 
  \renewcommand*{\glsentryfullpl}[1]{% + 
    \glsentrylongpl{##1}\space + 
      (\acronymfont{\glsentryshortpl{##1}})% + 
  }% + 
  \renewcommand*{\Glsentryfullpl}[1]{% + 
    \Glsentrylongpl{##1}\space + 
      (\acronymfont{\glsentryshortpl{##1}})% + 
  }% +
+

Now for the linking commands: + + +

+
+  \renewcommand*{\acrfullfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \glsentrylong{##2}##3\space + 
      (\acronymfont{\glsentryshort{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\Acrfullfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \Glsentrylong{##2}##3\space + 
      (\acronymfont{\glsentryshort{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\ACRfullfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \MakeTextUppercase{% + 
       \glsentrylong{##2}##3\space + 
         (\acronymfont{\glsentryshort{##2}})% + 
     }% + 
    }% + 
  }% + 
  \renewcommand*{\acrfullplfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \glsentrylongpl{##2}##3\space + 
       (\acronymfont{\glsentryshortpl{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\Acrfullplfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \Glsentrylongpl{##2}##3\space + 
       (\acronymfont{\glsentryshortpl{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\ACRfullplfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \MakeTextUppercase{% + 
       \glsentrylongpl{##2}##3\space + 
         (\acronymfont{\glsentryshortpl{##2}})% + 
     }% + 
    }% + 
  }% +
+

(This may cause problems with long hyperlinks, in which case adjust the definitions so that, +for example, only the short form is inside the argument of \glslink.) +

The style also needs to redefine \acronymsort so that the acronyms are sorted according +to the long form: + + +

+
+  \renewcommand*{\acronymsort}[2]{##2}% +
+

If you prefer them to be sorted according to the short form you can change the above +to: + + +

+
+  \renewcommand*{\acronymsort}[2]{##1}% +
+

The acronym font needs to be set to \textsc and the plural suffix adjusted so that the “s” +suffix in the plural short form doesn’t get converted to smallcaps: + + +

+
+  \renewcommand*{\acronymfont}[1]{\textsc{##1}}% + 
  \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% +
+

There are a number of ways of dealing with the format in the list of acronyms. The simplest +way is to redefine \acronymentry to the long form followed by the upper case short form in +parentheses: + + +

+
+ \renewcommand*{\acronymentry}[1]{% + 
   \Glsentrylong{##1}\space + 
     (\MakeTextUppercase{\glsentryshort{##1}})}% +
+

(I’ve used \Glsentrylong instead of \glsentrylong to capitalise the name in the +glossary.) +

An alternative approach is to set \acronymentry to just the long form and redefine +\GenericAcronymFields to set the symbol key to the short form and use a glossary style +that displays the symbol in parentheses after the name (such as the tree style) like +this: + + +

+
+ \renewcommand*{\acronymentry}[1]{\Glsentrylong{##1}}% + 
 \renewcommand*{\GenericAcronymFields}{% + 
    symbol={\protect\MakeTextUppercase{\the\glsshorttok}}}% +
+

I’m going to use the first approach and set \GenericAcronymFields to do nothing: + + +

+
+ \renewcommand*{\GenericAcronymFields}{}% +
+

+

Finally, this style needs to switch off hyperlinks on first use to avoid nested +links: + + +

+
+ \glshyperfirstfalse +
+

Putting this all together: + + +

+
+\newacronymstyle{custom-fn}% new style name + 
{% + 
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + 
}% + 
{% + 
 \renewcommand*{\GenericAcronymFields}{}% + 
 \glshyperfirstfalse + 
  \renewcommand*{\genacrfullformat}[2]{% + 
   \firstacronymfont{\glsentryshort{##1}}##2% + 
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + 
  }% + 
  \renewcommand*{\Genacrfullformat}[2]{% + 
   \firstacronymfont{\Glsentryshort{##1}}##2% + 
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + 
  }% + 
  \renewcommand*{\genplacrfullformat}[2]{% + 
   \firstacronymfont{\glsentryshortpl{##1}}##2% + 
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + 
  }% + 
  \renewcommand*{\Genplacrfullformat}[2]{% + 
   \firstacronymfont{\Glsentryshortpl{##1}}##2% + 
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + 
  }% + 
  \renewcommand*{\glsentryfull}[1]{% + 
    \glsentrylong{##1}\space + 
      (\acronymfont{\glsentryshort{##1}})% + 
  }% + 
  \renewcommand*{\Glsentryfull}[1]{% + 
    \Glsentrylong{##1}\space + 
      (\acronymfont{\glsentryshort{##1}})% + 
  }% + 
  \renewcommand*{\glsentryfullpl}[1]{% + 
    \glsentrylongpl{##1}\space + 
      (\acronymfont{\glsentryshortpl{##1}})% + 
  }% + 
  \renewcommand*{\Glsentryfullpl}[1]{% + 
    \Glsentrylongpl{##1}\space + 
      (\acronymfont{\glsentryshortpl{##1}})% + 
  }% + 
  \renewcommand*{\acrfullfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \glsentrylong{##2}##3\space + 
      (\acronymfont{\glsentryshort{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\Acrfullfmt}[3]{% + + + 
    \glslink[##1]{##2}{% + 
     \Glsentrylong{##2}##3\space + 
      (\acronymfont{\glsentryshort{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\ACRfullfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \MakeTextUppercase{% + 
       \glsentrylong{##2}##3\space + 
         (\acronymfont{\glsentryshort{##2}})% + 
     }% + 
    }% + 
  }% + 
  \renewcommand*{\acrfullplfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \glsentrylongpl{##2}##3\space + 
       (\acronymfont{\glsentryshortpl{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\Acrfullplfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \Glsentrylongpl{##2}##3\space + 
       (\acronymfont{\glsentryshortpl{##2}})% + 
    }% + 
  }% + 
  \renewcommand*{\ACRfullplfmt}[3]{% + 
    \glslink[##1]{##2}{% + 
     \MakeTextUppercase{% + 
       \glsentrylongpl{##2}##3\space + 
         (\acronymfont{\glsentryshortpl{##2}})% + 
     }% + 
    }% + 
  }% + 
  \renewcommand*{\acronymfont}[1]{\textsc{##1}}% + 
  \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + 
  \renewcommand*{\acronymsort}[2]{##2}% + 
  \renewcommand*{\acronymentry}[1]{% + 
   \Glsentrylong{##1}\space + 
     (\MakeTextUppercase{\glsentryshort{##1}})}% + 
} +
+

+

Now I need to specify that I want to use this new style: + + +

+
+\setacronymstyle{custom-fn} +
+

I also need to use a glossary style that suits this acronym style, for example altlist: + + +

+
+\setglossarystyle{altlist} +
+

+

Once the acronym style has been set, I can define my acronyms: + + +

+
+\newacronym[description={set of tags for use in + 
developing hypertext documents}]{html}{html}{Hyper + 
Text Markup Language} + 
\newacronym[description={language used to describe the + 
layout of a document written in a markup language}]{css} + 
{css}{Cascading Style Sheet} +
+

+

The sample file sample-custom-acronym.tex illustrates this example.

+
+

+

____________________________

+ +

Example 24 (Italic and Upright Abbreviations) +

Suppose I want to have some abbreviations in italic and some that just use the +surrounding font. Hard-coding this into the ⟨short⟩ argument of \newacronym can cause +complications. +

This example uses \glsaddstoragekey to add an extra field that can be used to store the +formatting declaration (such as \em). + + +

+
+\glsaddstoragekey{font}{}{\entryfont} +
+

This defines a new field/key called font, which defaults to nothing if it’s not explicitly set. +This also defines a command called \entryfont that’s analogous to \glsentrytext. A new +style is then created to format abbreviations that access this field. +

There are two ways to do this. The first is to create a style that doesn’t use \glsgenacfmt +but instead provides a modified version that doesn’t use \acronymfont{short} but instead +uses {\entryfont{\glslabel}short}. The full format given by commands such as +\genacrfullformat need to be similarly adjusted. For example: + + +

+
+  \renewcommand*{\genacrfullformat}[2]{% + 
   \glsentrylong{##1}##2\space + 
   ({\entryfont{##1}\glsentryshort{##1}})% + 
  }% +
+

This will deal with commands like \gls but not commands like \acrshort which still use +\acronymfont. Another approach is to redefine \acronymfont to look up the required font +declaration. Since \acronymfont doesn’t take the entry label as an argument, the following +will only work if \acronymfont is used in a context where the label is provided by +\glslabel. This is true in \gls, \acrshort and \acrfull. The redefinition is +now: + + +

+
+\renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}#1}}% +
+

So the new style can be defined as: + + +

+
+\newacronymstyle{long-font-short} + 
{% + 
  \GlsUseAcrEntryDispStyle{long-short}% + 
} + 
{% + 
  \GlsUseAcrStyleDefs{long-short}% + 
  \renewcommand*{\genacrfullformat}[2]{% + 
   \glsentrylong{##1}##2\space + 
   ({\entryfont{##1}\glsentryshort{##1}})% + 
  }% + 
  \renewcommand*{\Genacrfullformat}[2]{% + 
   \Glsentrylong{##1}##2\space + 
   ({\entryfont{##1}\glsentryshort{##1}})% + 
  }% + 
  \renewcommand*{\genplacrfullformat}[2]{% + 
   \glsentrylongpl{##1}##2\space + 
   ({\entryfont{##1}\glsentryshortpl{##1}})% + 
  }% + 
  \renewcommand*{\Genplacrfullformat}[2]{% + 
   \Glsentrylongpl{##1}##2\space + 
   ({\entryfont{##1}\glsentryshortpl{##1}})% + 
  }% + 
  \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}% + 
  \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}% + 
} +
+

Remember the style needs to be set before defining the entries: + + +

+
+\setacronymstyle{long-font-short} +
+

+

The complete document is contained in the sample file sample-font-abbr.tex. +

+
+

+

____________________________

+

Some writers and publishing houses have started to drop full stops (periods) from upper +case initials but may still retain them for lower case abbreviations, while others +may still use them for both upper and lower case. This can cause complications. +Chapter 12 of The TEXbook discusses the spacing between words but, briefly, the default +behaviour of TEX is to assume that an upper case character followed by a full stop +and space is an abbreviation, so the space is the default inter-word space whereas +a lower case character followed by a full stop and space is a word occurring at the +end of a sentence. In the event that this isn’t true, you need to make a manual +adjustment using (back slash space) in place of just a space character for an +inter-word mid-sentence space and use \@ before the full stop to indicate the end of the +sentence. +

For example: + + +

+
+I was awarded a B.Sc. and a Ph.D. (From the same place.) +
+

is typeset as +
I was awarded a B.Sc. and a Ph.D. (From the same place.) +
+The spacing is more noticeable with the typewriter font: + + +

+
+\ttfamily + 
I was awarded a B.Sc. and a Ph.D. (From the same place.) +
+

is typeset as +
I was awarded a B.Sc. and a Ph.D. (From the same place.) +
+The lower case letter at the end of “B.Sc.” is confusing TEX into thinking that the full stop +after it marks the end of the sentence. Whereas the upper case letter at the end of “Ph.D.” +has confused TEX into thinking that the following full stop is just part of the abbreviation. +These can be corrected: + + +

+
+I was awarded a B.Sc.\ and a Ph.D\@. (From the same place.) +
+

+

This situation is a bit problematic for glossaries. The full stops can form part of +the ⟨short⟩ argument of \newacronym and the B.Sc.\␣ part can be dealt with by +remembering to add \␣ (for example, \gls{bsc}\␣) but the end of sentence case is +more troublesome as you need to omit the sentence terminating full stop (to avoid +two dots) which can make the source code look a little strange but you also need +to adjust the space factor, which is usually done by inserting \@ before the full +stop. +

The next example shows one way of achieving this. (Note that the supplemental +glossaries-extra package provides a much simpler way of doing this, which you may prefer to +use. See the initialisms example.) + +

Example 25 (Abbreviations with Full Stops (Periods)) +

As from version 4.16, there’s now a hook (\glspostlinkhook) that’s called at the very +end of the \gls-like and \glstext-like commands. This can be redefined to check if the +following character is a full stop. The amsgen package (which is automatically loaded by +glossaries) provides an internal command called \new@ifnextchar that can be used to +determine if the given character appears next. (For more information see the amsgen +documentation.) +

It’s possible that I may also want acronyms or contractions in my document, so I need +some way to differentiate between them. Here I’m going to use the same method as in +example 4 where a new field is defined to indicate the type of abbreviation: + + +

+
+\glsaddstoragekey{abbrtype}{word}{\abbrtype} + 
\newcommand*{\newabbr}[1][]{\newacronym[abbrtype=initials,#1]} +
+

Now I just use \newacronym for the acronyms, for example, + + +

+
+\newacronym{laser}{laser}{light amplification by stimulated + 
emission of radiation} +
+

and my new command \newabbr for initials, for example, + + +

+
+\newabbr{eg}{e.g.}{exempli gratia} + 
\newabbr{ie}{i.e.}{id est} + 
\newabbr{bsc}{B.Sc.}{Bachelor of Science} + 
\newabbr{ba}{B.A.}{Bachelor of Arts} + 
\newabbr{agm}{A.G.M.}{annual general meeting} +
+

Within \glspostlinkhook the entry’s label can be accessed using \glslabel and +\ifglsfieldeq can be used to determine if the current entry has the new abbrtype field set +to “initials”. If it doesn’t, then nothing needs to happen, but if it does, a check is performed +to see if the next character is a full stop. If it is, this signals the end of a sentence otherwise +it’s mid-sentence. +

Remember that internal commands within the document file (rather than in a class or +package) need to be placed between \makeatletter and \makeatother: + + +

+
+\makeatletter + 
\renewcommand{\glspostlinkhook}{% + 
 \ifglsfieldeq{\glslabel}{abbrtype}{initials}% + 
 {\new@ifnextchar.\doendsentence\doendword} + 
 {}% + 
} + 
\makeatother +
+

In the event that a full stop is found \doendsentence is performed but it will be followed by +the full stop, which needs to be discarded. Otherwise \doendword will be done but it won’t be +followed by a full stop so there’s nothing to discard. The definitions for these commands +are: + + +

+
+\newcommand{\doendsentence}[1]{\spacefactor=10000{}} + 
\newcommand{\doendword}{\spacefactor=1000{}} +
+

Now, I can just do \gls{bsc} mid-sentence and \gls{phd}. at the end of the +sentence. The terminating full stop will be discarded in the latter case, but it won’t be +discarded in, say, \gls{laser}. as that doesn’t have the abbrtype field set to +“initials”. +

This also works on first use when the style is set to one of the ⟨long⟩ (⟨short⟩) styles but it +will fail with the ⟨short⟩ (⟨long⟩) styles as in this case the terminating full stop shouldn’t be +discarded. Since \glspostlinkhook is used after the first use flag has been unset for the +entry, this can’t be fixed by simply checking with \ifglsused. One possible solution to this is +to redefine \glslinkpostsetkeys to check for the first use flag and define a macro that can +then be used in \glspostlinkhook. +

The other thing to consider is what to do with plurals. One possibility is to check for +plural use within \doendsentence (using \glsifplural) and put the full stop back if the +plural has been used. +

The complete document is contained in the sample file sample-dot-abbr.tex. +

+
+

+

____________________________

+

+

+

Top

13.2 Displaying the List of Acronyms

+

The list of acronyms is just like any other type of glossary and can be displayed on its own +using: +

+Option 1:
+
+
+ \printnoidxglossary[type=\acronymtype] +
+
+ + +
+Options 2 and 3:
+
+
+ \printglossary[type=\acronymtype] +
+
+

(If you use the acronym package option you can also use

+
+ \printacronyms[options] +
+
as a synonym for
+
+ \printglossary[type=\acronymtype,options] +
+
See §2.5 Acronym Options.) +
+

Alternatively the list of acronyms can be displayed with all the other glossaries using: +

+Option 1:
\printnoidxglossaries +
+Options 2 and 3:
\printglossaries
+

However, care must be taken to choose a glossary style that’s appropriate to your acronym +style. Alternatively, you can define your own custom style (see §15.2 Defining your own +glossary style for further details). +

+

+

Top

13.3 Upgrading From the glossary Package

+

Users of the obsolete glossary package may recall that the syntax used to define new +acronyms has changed with the replacement glossaries package. In addition, the +old glossary package created the command \acr-name⟩ when defining the acronym +⟨acr-name⟩. + + +

In order to facilitate migrating from the old package to the new one, the glossaries +package13.1 +provides the command: +


\oldacronym  \oldacronym[label]{abbrv}{long}{key-val list}

+

+This uses the same syntax as the glossary package’s method of defining acronyms. It is +equivalent to: +
\newacronym[key-val list]{label}{abbrv}{long} +
+In addition, \oldacronym also defines the commands \label⟩, which is equivalent to \gls +{label}, and \label*, which is equivalent to \Gls{label}. If ⟨label⟩ is omitted, ⟨abbrv⟩ is used. +Since commands names must consist only of alphabetical characters, ⟨label⟩ must also only +consist of alphabetical characters. Note that \label⟩ doesn’t allow you to use the first optional +argument of \gls or \Gls — you will need to explicitly use \gls or \Gls to change the +settings. +

Recall that, in general, LATEX ignores spaces following command names consisting of +alphabetical characters. This is also true for \label⟩ unless you additionally load the xspace +package, but be aware that there are some issues with using xspace.13.2
+

+ +

The glossaries package doesn’t load the xspace package since there are both advantages +and disadvantages to using \xspace in \label⟩. If you don’t use the xspace package +you need to explicitly force a space using \␣ (backslash space) however you can +follow \label⟩ with additional text in square brackets (the final optional argument +to \gls). If you use the xspace package you don’t need to escape the spaces but +you can’t use the optional argument to insert text (you will have to explicitly use +\gls). +

To illustrate this, suppose I define the acronym “abc” as follows: + + +

+
+\oldacronym{abc}{example acronym}{} +
+

This will create the command \abc and its starred version \abc*. Table 13.2 illustrates the +effect of \abc (on subsequent use) according to whether or not the xspace package has been +loaded. As can be seen from the final row in the table, the xspace package prevents the +optional argument from being recognised. +

+
+ + +


+ + +
Table 13.2: The effect of using xspace with \oldacronym
+
+ + + + +
Code With xspace Without xspace
\abc. abc. abc.
\abc xyz abc xyz abcxyz
\abc\ xyz abc xyz abc xyz
\abc* xyz Abc xyz Abc xyz
\abc[’s] xyz abc [’s] xyz abc’s xyz
+
+ + +

+
+ + +

+

Top

14. Unsetting and Resetting Entry Flags

+

When using the \gls-like commands it is possible that you may want to use the +value given by the first key, even though you have already used the glossary entry. +Conversely, you may want to use the value given by the text key, even though you +haven’t used the glossary entry. The former can be achieved by one of the following +commands: +


\glsreset  \glsreset{label}

+

+


\glslocalreset  \glslocalreset{label}

+

+while the latter can be achieved by one of the following commands: +


\glsunset  \glsunset{label}

+

+


\glslocalunset  \glslocalunset{label}

+

+You can also reset or unset all entries for a given glossary or list of glossaries using: +


\glsresetall  \glsresetall[glossary list]

+

+


\glslocalresetall  \glslocalresetall[glossary list]

+

+


\glsunsetall  \glsunsetall[glossary list]

+

+


\glslocalunsetall  \glslocalunsetall[glossary list]

+

+where ⟨glossary list⟩ is a comma-separated list of glossary labels. If omitted, all defined +glossaries are assumed (except for the ignored ones). For example, to reset all entries in the +main glossary and the list of acronyms: + + +

+
+\glsresetall[main,acronym] +
+

+

You can determine whether an entry’s first use flag is set using: +


\ifglsused  \ifglsused{label}{true part}{false part}

+

+where ⟨label⟩ is the label of the required entry. If the entry has been used, ⟨true part⟩ will be +done, otherwise ⟨false part⟩ will be done. +

Be careful when using \gls-like commands within an environment or command +argument that gets processed multiple times as it can cause unwanted side-effects when the +first use displayed text is different from subsequent use.
+

+

For example, the frame environment in beamer processes its argument for each overlay. +This means that the first use flag will be unset on the first overlay and subsequent overlays +will use the non-first use form. +

Consider the following example: + + +

+
+\documentclass{beamer} + 
\usepackage{glossaries} + 
\newacronym{svm}{SVM}{support vector machine} + 
\begin{document} + 
\begin{frame} + 
 \frametitle{Frame 1} + 
 \begin{itemize} + 
  \item<+-> \gls{svm} + 
  \item<+-> Stuff. + 
 \end{itemize} + 
\end{frame} + 
\end{document} +
+

+

On the first overlay, \gls{svm} produces “support vector machine (SVM)” and then +unsets the first use flag. When the second overlay is processed, \gls{svm} now produces +“SVM”, which is unlikely to be the desired effect. I don’t know anyway around this and I can +only offer two suggestions. +

Firstly, unset all acronyms at the start of the document and explicitly use \acrfull when +you want the full version to be displayed: + + +

+
+\documentclass{beamer} + 
\usepackage{glossaries} + 
\newacronym{svm}{SVM}{support vector machine} + 
\glsunsetall + 
\begin{document} + 
\begin{frame} + 
 \frametitle{Frame 1} + 
 \begin{itemize} + 
  \item<+-> \acrfull{svm} + 
  \item<+-> Stuff. + 
 \end{itemize} + 
\end{frame} + 
\end{document} +
+

+

Secondly, explicitly reset each acronym on first use: + + +

+
+\begin{frame} + 
 \frametitle{Frame 1} + 
 \begin{itemize} + 
  \item<+-> \glsreset{svm}\gls{svm} + 
  \item<+-> Stuff. + 
 \end{itemize} + 
\end{frame} +
+

These are non-optimal, but the beamer class is too complex for me to provide +a programmatic solution. Other potentially problematic environments are some +tabular-like environments (but not tabular itself) that process the contents in order +to work out the column widths and then reprocess the contents to do the actual +typesetting. +

The amsmath environments, such as align, also process their contents multiple times, but +the glossaries package now checks for this. For tabularx, you need to explicitly patch it by +placing \glspatchtabularx in the preamble (or anywhere before the problematic use of +tabularx). +

+

Top

14.1 Counting the Number of Times an Entry has been Used (First Use Flag +Unset)

+

As from version 4.14, it’s now possible to keep track of how many times an entry is used. +That is, how many times the first use flag is unset. Note that the supplemental +glossaries-extra package improves this function and also provides per-unit counting, which isn’t +available with the glossaries package. +

This function is disabled by default as it adds extra overhead to the document build time +and also switches \newglossaryentry (and therefore \newacronym) into a preamble-only +command.
+

+

To enable this function, use +


\glsenableentrycount  \glsenableentrycount

+

+before defining your entries. This adds two extra (internal) fields to entries: currcount and +prevcount. +

The currcount field keeps track of how many times \glsunset is used within the +document. A local unset (using \glslocalunset) performs a local rather than global +increment to currcount. Remember that not all commands use \glsunset. Only the +\gls-like commands do this. The reset commands \glsreset and \glslocalreset reset this +field back to zero (where \glslocalreset performs a local change). +

The prevcount field stores the final value of the currcount field from the previous run. +This value is read from the .aux file at the beginning of the document environment. + + +

You can access these fields using +


\glsentrycurrcount  \glsentrycurrcount{label}

+

+for the currcount field, and +


\glsentryprevcount  \glsentryprevcount{label}

+

+for the prevcount field. These commands are only defined if you have used +\glsenableentrycount. +

For example: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\makeglossaries + 
\glsenableentrycount + 
\newglossaryentry{apple}{name=apple,description={a fruit}} + 
\begin{document} + 
Total usage on previous run: \glsentryprevcount{apple}. + 
\gls{apple}. \gls{apple}. \glsadd{apple}\glsentrytext{apple}. + 
\glslink{apple}{apple}. \glsdisp{apple}{apple}. \Gls{apple}. + 
Number of times apple has been used: \glsentrycurrcount{apple}. + 
\end{document} +
+

On the first LATEX run, \glsentryprevcount{apple} produces 0. At the end of the +document, \glsentrycurrcount{apple} produces 4. This is because the only commands +that have incremented the entry count are those that use \glsunset. That is: \gls, \glsdisp +and \Gls. The other commands used in the above example, \glsadd, \glsentrytext and +\glslink, don’t use \glsunset so they don’t increment the entry count. On the next +LATEX run, \glsentryprevcount{apple} now produces 4 as that was the value of the +currcount field for the apple entry at the end of the document on the previous +run. +

When you enable the entry count using \glsenableentrycount, you also enable the +following commands: +


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

+

+(no case-change, singular) +


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

+

+(no case-change, plural) +


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

+

+(first letter uppercase, singular), and +


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

+

+(first letter uppercase, plural). These all have plus and starred variants like the analogous +\gls, \glspl, \Gls and \Glspl commands. +

If you don’t use \glsenableentrycount, these commands behave like \gls, \glspl, \Gls +and \Glspl, respectively, only there will be a warning that you haven’t enabled entry +counting. If you have enabled entry counting with \glsenableentrycount then these + + +commands test if \glsentryprevcount{label} equals 1. If it doesn’t then the analogous \gls +etc will be used. If it does, then the first optional argument will be ignored and +

+
+⟨cs format{label}{insert}\glsunset{label} +
+
will be performed, where ⟨cs format⟩ is a command that takes two arguments. The command +used depends whether you have used \cgls, \cglspl, \cGls or \cGlspl. +


\cglsformat  \cglsformat{label}{insert}

+

+This command is used by \cgls and defaults to

+
+\glsentrylong{label}insert⟩ +
+
if the entry given by ⟨label⟩ has a long form or
+
+\glsentryfirst{label}insert⟩ +
+
otherwise. +


\cglsplformat  \cglsplformat{label}{insert}

+

+This command is used by \cglspl and defaults to

+
+\glsentrylongpl{label}insert⟩ +
+
if the entry given by ⟨label⟩ has a long form or
+
+\glsentryfirstplural{label}insert⟩ +
+
otherwise. +


\cGlsformat  \cGlsformat{label}{insert}

+

+This command is used by \cGls and defaults to

+ + +
+\Glsentrylong{label}insert⟩ +
+
if the entry given by ⟨label⟩ has a long form or
+
+\Glsentryfirst{label}insert⟩ +
+
otherwise. +


\cGlsplformat  \cGlsplformat{label}{insert}

+

+This command is used by \cGlspl and defaults to

+
+\Glsentrylongpl{label}insert⟩ +
+
if the entry given by ⟨label⟩ has a long form or
+
+\Glsentryfirstplural{label}insert⟩ +
+
otherwise. +

This means that if the previous count for the given entry was 1, the entry won’t be +hyperlinked with the \cgls-like commands and they won’t add a line to the external glossary +file. If you haven’t used any of the other commands that add information to glossary file (such +as \glsadd or the \glstext-like commands) then the entry won’t appear in the +glossary. +

Remember that since these commands use \glsentryprevcount you need to run +LATEX twice to ensure they work correctly. The document build order is now (at least): +(pdf)latex, (pdf)latex, makeglossaries, (pdf)latex. + +

Example 26 (Don’t index entries that are only used once) +

In this example, the abbreviations that have only been used once (on the previous run) +only have their long form shown with \cgls. + + +

+
+\documentclass{article} + 
\usepackage[colorlinks]{hyperref} + 
\usepackage[acronym]{glossaries} + 
\makeglossaries + 
\glsenableentrycount + 
\setacronymstyle{long-short} + 
\newacronym{html}{HTML}{hypertext markup language} + 
\newacronym{css}{CSS}{cascading style sheets} + 
\newacronym{xml}{XML}{extensible markup language} + 
\newacronym{sql}{SQL}{structured query language} + 
\newacronym{rdbms}{RDBMS}{relational database management system} + 
\newacronym{rdsms}{RDSMS}{relational data stream management system} + 
\begin{document} + 
These entries are only used once: \cgls{sql}, \cgls{rdbms}, + 
\cgls{xml}. These entries are used multiple times: + 
\cgls{html}, \cgls{html}, \cgls{css}, \cgls{css}, \cgls{css}, + 
\cgls{rdsms}, \cgls{rdsms}. + 
\printglossaries + 
\end{document} +
+

After a complete document build (latex, latex, makeglossaries, latex) the list of +abbrevaitions only includes the entries HTML, CSS and RDSMS. The entries SQL, +RDBMS and XML only have their long forms displayed and don’t have a hyperlink. +

+
+

+

____________________________

+

Remember that if you don’t like typing \cgls you can create a synonym. For +example + + +

+
+\let\ac\cgls +
+

+ + +

+

+

Top

15. Glossary Styles

+

Glossaries vary from lists that simply contain a symbol with a terse description to lists of +terms or phrases with lengthy descriptions. Some glossaries may have terms with associated +symbols. Some may have hierarchical entries. There is therefore no single style that fits every +type of glossary. The glossaries package comes with a number of pre-defined glossary styles, +described in §15.1 Predefined Styles. You can choose one of these that best suits your type of +glossary or, if none of them suit your document, you can defined your own style (see §15.2 +Defining your own glossary style). There are some examples of glossary styles available at +http://www.dickimaw-books.com/gallery/#glossaries. +

The glossary style can be set using the style key in the optional argument to +\printnoidxglossary (Option 1) or \printglossary (Options 2 and 3) or using the +command: +


\setglossarystyle  \setglossarystyle{style-name}

+

+(before the glossary is displayed). +

Some of the predefined glossary styles may also be set using the style package option, it +depends if the package in which they are defined is automatically loaded by the glossaries +package. +

You can use the lorum ipsum dummy entries provided in the accompanying +example-glossaries-*.tex files (described in §1.3 Dummy Entries for Testing) to test the +different styles. +

+

Top

15.1 Predefined Styles

+

The predefined styles can accommodate numbered level 0 (main) and level 1 entries. See the +package options entrycounter, counterwithin and subentrycounter described in §2.3 Glossary +Appearance Options. There is a summary of available styles in table 15.1. You can view samples of +all the predefined styles at http://www.dickimaw-books.com/gallery/glossaries-styles/. +Note that glossaries-extra provides additional styles in the supplementary packages +glossary-bookindex and glossary-longnoloc. See the glossaries-extra manual for further +details. +

Note that the group styles (such as listgroup) will have unexpected results if used with +the sort=def or sort=use options. If you don’t sort your entries alphabetically, it’s +best to set the nogroupskip package option to prevent odd vertical gaps appearing. +
+

+

The group title is obtained using \glsgetgrouptitle{label}, which is described in §15.2 +Defining your own glossary style. +

+
+ + +


+ + +
Table 15.1: Glossary Styles. An asterisk in the style name indicates anything that +matches that doesn’t match any previously listed style (e.g. long3col* matches +long3col, long3colheader, long3colborder and long3colheaderborder). A maximum level of +0 indicates a flat glossary (sub-entries are displayed in the same way as main entries). +Where the maximum level is given as — there is no limit, but note that makeindex +(Option 2) imposes a limit of 2 sub-levels. If the homograph column is checked, then +the name is not displayed for sub-entries. If the symbol column is checked, then the +symbol will be displayed.
+
+ + + + + + + + + + + + + +
Style Maximum Level Homograph Symbol
listdotted 0
sublistdotted 1
list* 1
altlist* 1 +
long*3col* 1 +
long4col* 1
altlong*4col* 1
long* 1
super*3col* 1
super4col* 1
altsuper*4col* 1
super* 1
*index* 2
treenoname*
*alttree*
*tree*
inline 1
+ + +

+
+

The tabular-like styles that allow multi-line descriptions and page lists use the length +\glsdescwidth \glsdescwidth to set the width of the description column and the +length \glspagelistwidth \glspagelistwidth to set the width of the page list +column.15.1 +These will need to be changed using \setlength if the glossary is too wide. Note that the +long4col and super4col styles (and their header and border variations) don’t use these lengths +as they are designed for single line entries. Instead you should use the analogous +altlong4col and altsuper4col styles. If you want to explicitly create a line-break within a +multi-line description in a tabular-like style it’s better to use \newline instead of +\\. +

Remember that a cell within a tabular-like environment can’t be broken across a page, so +even if a tabular-like style, such as long, allows multilined descriptions, you’ll probably +encounter page-breaking problems if you have entries with long descriptions. You may want to +consider using the alttree style instead.
+

+

Note that if you use the style key in the optional argument to \printnoidxglossary +(Option 1) or \printglossary (Options 2 and 3), it will override any previous style settings +for the given glossary, so if, for example, you do + + +

+
+\renewcommand*{\glsgroupskip}{} + 
\printglossary[style=long] +
+

then the new definition of \glsgroupskip will not have an affect for this glossary, as +\glsgroupskip is redefined by style=long. Likewise, \setglossarystyle will also override +any previous style definitions, so, again + + +

+
+\renewcommand*{\glsgroupskip}{} + 
\setglossarystyle{long} +
+

will reset \glsgroupskip back to its default definition for the named glossary style +(long in this case). If you want to modify the styles, either use \newglossarystyle +(described in the next section) or make the modifications after \setglossarystyle, +e.g.: + + +

+
+\setglossarystyle{long} + 
\renewcommand*{\glsgroupskip}{} +
+

As from version 3.03, you can now use the package option nogroupskip to suppress the gap +between groups for the default styles instead of redefining \glsgroupskip. +

All the styles except for the three- and four-column styles and the listdotted style use the +command +


\glspostdescription  \glspostdescription

+

+after the description. This simply displays a full stop by default. To eliminate this full +stop (or replace it with something else, say, a comma) you will need to redefine +\glspostdescription before the glossary is displayed. Alternatively, you can suppress it +for a given entry by placing \nopostdesc in the entry’s description. Note that +\longnewglossaryentry puts \nopostdesc at the end of the description. The glossaries-extra +package provides a starred version that doesn’t. +

As from version 3.03 you can now use the package option nopostdot to suppress this full +stop. This is the better option if you want to use the glossaries-extra package. The +glossaries-extra-stylemods package provides some adjustments some of to the predefined styles +listed here, allowing for greater flexibility. See the glossaries-extra documentation for further +details. +

+

Top

15.1.1 List Styles

+

The styles described in this section are all defined in the package glossary-list. Since +they all use the description environment, they are governed by the same parameters +as that environment. These styles all ignore the entry’s symbol. Note that these +styles will automatically be available unless you use the nolist or nostyles package +options. +

Note that, except for the listdotted style, these list styles are incompatible with +classicthesis. They may also be incompatible with other classes or packages that modify the +description environment.
+

+

+list
The list style uses the description environment. The entry name is placed in the + optional argument of the \item command (so it will usually appear in bold by + default). The description follows, and then the associated number list for that + entry. The symbol is ignored. If the entry has child entries, the description and + number list follows (but not the name) for each child entry. Groups are separated + using \indexspace. + + +

The closest matching non-list style is the index style. +

+listgroup
The listgroup style is like list but the glossary groups have headings obtained + using \glsgetgrouptitle{label}, which is described in §15.2 Defining your own + glossary style. +
+listhypergroup
The listhypergroup style is like listgroup but has a navigation line + at the start of the glossary with links to each group that is present in the + glossary. This requires an additional run through LATEX to ensure the group + information is up to date. In the navigation line, each group is separated + by +


\glshypernavsep  \glshypernavsep

+

+ which defaults to a vertical bar with a space on either side. For example, to simply have + a space separating each group, do: + + +

+
+ \renewcommand*{\glshypernavsep}{\space} +
+

+

Note that the hyper-navigation line is now (as from version 1.14) set inside the optional + argument to \item instead of after it to prevent a spurious space at the start. This can + cause a problem if the navigation line is too long. As from v4.22, if you need to adjust + this, you can redefine +


\glslistnavigationitem  \glslistnavigationitem{navigation line}

+

+ The default definition is \item[navigation line] but may be redefined independently of + setting the style. For example: + + +

+
+ \renewcommand*{\glslistnavigationitem}[1]{\item \textbf{#1}} +
+

+

You may prefer to use the tree-like styles, such as treehypergroup instead. +

+altlist
The altlist style is like list but the description starts on the line following the name. + (As with the list style, the symbol is ignored.) Each child entry starts a new + line, but as with the list style, the name associated with each child entry is + ignored. +

The closest matching non-list style is the index style with the following adjustment: + + +

+
+ \renewcommand{\glstreepredesc}{% +  
 \glstreeitem\parindent\hangindent} +
+

+

+altlistgroup
The altlistgroup style is like altlist but the glossary groups have headings. +
+altlisthypergroup
The altlisthypergroup style is like altlistgroup but has a set of links to the + glossary groups. The navigation line is the same as that for listhypergroup, described + above. +
+listdotted
This style uses the description + environment.15.2 + Each entry starts with \item[], followed by the name followed by a dotted line, + followed by the description. Note that this style ignores both the number list and the + symbol. The length +


\glslistdottedwidth  \glslistdottedwidth

+

+ governs where the description should start. This is a flat style, so child entries are + formatted in the same way as the parent entries. +

A non-list alternative is to use the index style with + + +

+
+ \renewcommand{\glstreepredesc}{\dotfill} +  
\renewcommand{\glstreechildpredesc}{\dotfill} +
+

Note that this doesn’t use \glslistdottedwidth and causes the description + to be flush-right and will display the symbol, if provided. (It also doesn’t + suppress the number list, but that can be achieved with the nonumberlist + option.) +

+sublistdotted
This is a variation on the listdotted style designed for hierarchical glossaries. + The main entries have just the name displayed. The sub entries are displayed in the + same manner as listdotted. Unlike the listdotted style, this style is incompatible with + classicthesis.
+

+

+

Top

15.1.2 Longtable Styles

+

The styles described in this section are all defined in the package glossary-long. Since they all +use the longtable environment, they are governed by the same parameters as that +environment. Note that these styles will automatically be available unless you use the +nolong or nostyles package options. These styles fully justify the description and page +list columns. If you want ragged right formatting instead, use the analogous styles +described in §15.1.3 Longtable Styles (Ragged Right). If you want to incorporate rules +from the booktabs package, try the styles described in §15.1.4 Longtable Styles +(booktabs). +

+long
The long style uses the longtable environment (defined by the longtable package). + It has two columns: the first column contains the entry’s name and the second + column contains the description followed by the number list. The entry’s symbol is + ignored. Sub groups are separated with a blank row. The width of the first column + is governed by the widest entry in that column. The width of the second column + is governed by the length \glsdescwidth. Child entries have a similar format to + the parent entries except that their name is suppressed. +
+longborder
The longborder style is like long but has horizontal and vertical lines around + it. + + +
+longheader
The longheader style is like long but has a header row. +
+longheaderborder
The longheaderborder style is like longheader but has horizontal + and vertical lines around it. +
+long3col
The long3col style is like long but has three columns. The first column contains + the entry’s name, the second column contains the description and the third column + contains the number list. The entry’s symbol is ignored. The width of the first + column is governed by the widest entry in that column, the width of the second + column is governed by the length \glsdescwidth, and the width of the third + column is governed by the length \glspagelistwidth. +
+long3colborder
The long3colborder style is like the long3col style but has horizontal + and vertical lines around it. +
+long3colheader
The long3colheader style is like long3col but has a header row. +
+long3colheaderborder
The long3colheaderborder style is like long3colheader but has + horizontal and vertical lines around it. +
+long4col
The long4col style is like long3col but has an additional column in which + the entry’s associated symbol appears. This style is used for brief single line + descriptions. The column widths are governed by the widest entry in the given + column. Use altlong4col for multi-line descriptions. +
+long4colborder
The long4colborder style is like the long4col style but has horizontal + and vertical lines around it. +
+long4colheader
The long4colheader style is like long4col but has a header row. +
+long4colheaderborder
The long4colheaderborder style is like long4colheader but has + horizontal and vertical lines around it. +
+altlong4col
The altlong4col style is like long4col but allows multi-line descriptions + and page lists. The width of the description column is governed by the length + \glsdescwidth and the width of the page list column is governed by the length + \glspagelistwidth. The widths of the name and symbol columns are governed + by the widest entry in the given column. + + +
+altlong4colborder
The altlong4colborder style is like the long4colborder but allows + multi-line descriptions and page lists. +
+altlong4colheader
The altlong4colheader style is like long4colheader but allows + multi-line descriptions and page lists. +
+altlong4colheaderborder
The altlong4colheaderborder style is like + long4colheaderborder but allows multi-line descriptions and page lists.
+

+

+

Top

15.1.3 Longtable Styles (Ragged Right)

+

The styles described in this section are all defined in the package glossary-longragged. These +styles are analogous to those defined in glossary-long but the multiline columns are left +justified instead of fully justified. Since these styles all use the longtable environment, they are +governed by the same parameters as that environment. The glossary-longragged package +additionally requires the array package. Note that these styles will only be available if you +explicitly load glossary-longragged: + + +

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

Note that you can’t set these styles using the style package option since the styles aren’t +defined until after the glossaries package has been loaded. If you want to incorporate rules +from the booktabs package, try the styles described in §15.1.4 Longtable Styles +(booktabs). +

+longragged
The longragged style has two columns: the first column contains the entry’s + name and the second column contains the (left-justified) description followed by + the number list. The entry’s symbol is ignored. Sub groups are separated with a + blank row. The width of the first column is governed by the widest entry in that + column. The width of the second column is governed by the length \glsdescwidth. + Child entries have a similar format to the parent entries except that their name + is suppressed. +
+longraggedborder
The longraggedborder style is like longragged but has horizontal + and vertical lines around it. +
+longraggedheader
The longraggedheader style is like longragged but has a header row. +
+longraggedheaderborder
The longraggedheaderborder style is like longraggedheader + but has horizontal and vertical lines around it. +
+longragged3col
The longragged3col style is like longragged but has three columns. + The first column contains the entry’s name, the second column contains the (left + justified) description and the third column contains the (left justified) number + list. The entry’s symbol is ignored. The width of the first column is governed by + the widest entry in that column, the width of the second column is governed by + the length \glsdescwidth, and the width of the third column is governed by the + length \glspagelistwidth. +
+longragged3colborder
The longragged3colborder style is like the longragged3col style + but has horizontal and vertical lines around it. +
+longragged3colheader
The longragged3colheader style is like longragged3col but has + a header row. + + +
+longragged3colheaderborder
The longragged3colheaderborder style is like + longragged3colheader but has horizontal and vertical lines around it. +
+altlongragged4col
The altlongragged4col style is like longragged3col but has an + additional column in which the entry’s associated symbol appears. The width of + the description column is governed by the length \glsdescwidth and the width of + the page list column is governed by the length \glspagelistwidth. The widths + of the name and symbol columns are governed by the widest entry in the given + column. +
+altlongragged4colborder
The altlongragged4colborder style is like the + altlongragged4col but has horizontal and vertical lines around it. +
+altlongragged4colheader
The altlongragged4colheader style is like altlongragged4col + but has a header row. +
+altlongragged4colheaderborder
The altlongragged4colheaderborder style is like + altlongragged4colheader but has horizontal and vertical lines around it. +
+

+

+

Top

15.1.4 Longtable Styles (booktabs)

+

The styles described in this section are all defined in the package glossary-longbooktabs. +

Since these styles all use the longtable environment, they are governed by the same +parameters as that environment. The glossary-longbooktabs package automatically loads the +glossary-long (§15.1.2 Longtable Styles) and glossary-longragged (§15.1.3 Longtable Styles +(Ragged Right)) packages. Note that these styles will only be available if you explicitly load +glossary-longbooktabs: + + +

+
+\usepackage{glossaries} + 
\usepackage{glossary-longbooktabs} +
+

Note that you can’t set these styles using the style package option since the styles aren’t +defined until after the glossaries package has been loaded. +

These styles are similar to the “header” styles in the glossary-long and glossary-ragged +packages, but they add the rules provided by the booktabs package, \toprule, \midrule and +\bottomrule. Additionally these styles patch the longtable environment to check for instances +of the group skip occurring at a page break. If you don’t want this patch to affect any other +use of longtable in your document, you can scope the effect by only setting the style through +the style key in the optional argument of \printglossary. (The nogroupskip package option +is checked by these styles.) +

Alternatively, you can restore the original longtable behaviour with: +


\glsrestoreLToutput  \glsrestoreLToutput

+

+For more information about the patch, see the documented code (glossaries-code.pdf). +

+long-booktabs
This style is similar to the longheader style but adds rules above and + below the header (\toprule and \midrule) and inserts a rule at the bottom of + the table (\bottomrule). +
+long3col-booktabs
This style is similar to the long3colheader style but adds rules as + per long-booktabs. +
+long4col-booktabs
This style is similar to the long4colheader style but adds rules as + above. +
+altlong4col-booktabs
This style is similar to the altlong4colheader style but adds rules + as above. +
+longragged-booktabs
This style is similar to the longraggedheader style but adds rules + as above. +
+longragged3col-booktabs
This style is similar to the longragged3colheader style but + adds rules as above. + + +
+altlongragged4col-booktabs
This style is similar to the altlongragged4colheader style + but adds rules as above. +
+

+

+

Top

15.1.5 Supertabular Styles

+

The styles described in this section are all defined in the package glossary-super. +Since they all use the supertabular environment, they are governed by the same +parameters as that environment. Note that these styles will automatically be available +unless you use the nosuper or nostyles package options. In general, the longtable +environment is better, but there are some circumstances where it is better to use +supertabular.15.3 +These styles fully justify the description and page list columns. If you want ragged right +formatting instead, use the analogous styles described in §15.1.6 Supertabular Styles (Ragged +Right). +

+super
The super style uses the supertabular environment (defined by the supertabular + package). It has two columns: the first column contains the entry’s name and the + second column contains the description followed by the number list. The entry’s + symbol is ignored. Sub groups are separated with a blank row. The width of the + first column is governed by the widest entry in that column. The width of the + second column is governed by the length \glsdescwidth. Child entries have a + similar format to the parent entries except that their name is suppressed. +
+superborder
The superborder style is like super but has horizontal and vertical lines + around it. +
+superheader
The superheader style is like super but has a header row. +
+superheaderborder
The superheaderborder style is like superheader but has horizontal + and vertical lines around it. +
+super3col
The super3col style is like super but has three columns. The first column + contains the entry’s name, the second column contains the description and the + third column contains the number list. The entry’s symbol is ignored. The width + of the first column is governed by the widest entry in that column. The width of + the second column is governed by the length \glsdescwidth. The width of the + third column is governed by the length \glspagelistwidth. + + +
+super3colborder
The super3colborder style is like the super3col style but has + horizontal and vertical lines around it. +
+super3colheader
The super3colheader style is like super3col but has a header row. +
+super3colheaderborder
The super3colheaderborder style is like the super3colheader + style but has horizontal and vertical lines around it. +
+super4col
The super4col style is like super3col but has an additional column in which + the entry’s associated symbol appears. This style is designed for entries with brief + single line descriptions. The column widths are governed by the widest entry in + the given column. Use altsuper4col for multi-line descriptions. +
+super4colborder
The super4colborder style is like the super4col style but has + horizontal and vertical lines around it. +
+super4colheader
The super4colheader style is like super4col but has a header row. +
+super4colheaderborder
The super4colheaderborder style is like the super4colheader + style but has horizontal and vertical lines around it. +
+altsuper4col
The altsuper4col style is like super4col but allows multi-line descriptions + and page lists. The width of the description column is governed by the length + \glsdescwidth and the width of the page list column is governed by the length + \glspagelistwidth. The width of the name and symbol columns is governed by + the widest entry in the given column. +
+altsuper4colborder
The altsuper4colborder style is like the super4colborder style but + allows multi-line descriptions and page lists. +
+altsuper4colheader
The altsuper4colheader style is like super4colheader but allows + multi-line descriptions and page lists. +
+altsuper4colheaderborder
The altsuper4colheaderborder style is like + super4colheaderborder but allows multi-line descriptions and page lists.
+ + +

+

+

Top

15.1.6 Supertabular Styles (Ragged Right)

+

The styles described in this section are all defined in the package glossary-superragged. These +styles are analogous to those defined in glossary-super but the multiline columns are left +justified instead of fully justified. Since these styles all use the supertabular environment, they +are governed by the same parameters as that environment. The glossary-superragged package +additionally requires the array package. Note that these styles will only be available if you +explicitly load glossary-superragged: + + +

+
+\usepackage{glossaries} + 
\usepackage{glossary-superragged} +
+

Note that you can’t set these styles using the style package option since the styles aren’t +defined until after the glossaries package has been loaded. +

+superragged
The superragged style uses the supertabular environment (defined by the + supertabular package). It has two columns: the first column contains the entry’s + name and the second column contains the (left justified) description followed by + the number list. The entry’s symbol is ignored. Sub groups are separated with a + blank row. The width of the first column is governed by the widest entry in that + column. The width of the second column is governed by the length \glsdescwidth. + Child entries have a similar format to the parent entries except that their name + is suppressed. +
+superraggedborder
The superraggedborder style is like superragged but has horizontal + and vertical lines around it. +
+superraggedheader
The superraggedheader style is like superragged but has a header + row. +
+superraggedheaderborder
The superraggedheaderborder style is like + superraggedheader but has horizontal and vertical lines around it. +
+superragged3col
The superragged3col style is like superragged but has three columns. + The first column contains the entry’s name, the second column contains the (left + justified) description and the third column contains the (left justified) number list. + The entry’s symbol is ignored. The width of the first column is governed by the + widest entry in that column. The width of the second column is governed by the + length \glsdescwidth. The width of the third column is governed by the length + \glspagelistwidth. +
+superragged3colborder
The superragged3colborder style is like the superragged3col + style but has horizontal and vertical lines around it. +
+superragged3colheader
The superragged3colheader style is like superragged3col but + has a header row. + + +
+superragged3colheaderborder
The + superragged3colheaderborder style is like superragged3colheader but has horizontal + and vertical lines around it. +
+altsuperragged4col
The altsuperragged4col style is like superragged3col but has an + additional column in which the entry’s associated symbol appears. The column + widths for the name and symbol column are governed by the widest entry in the + given column. +
+altsuperragged4colborder
The altsuperragged4colborder style is like the + altsuperragged4col style but has horizontal and vertical lines around it. +
+altsuperragged4colheader
The altsuperragged4colheader style is like + altsuperragged4col but has a header row. +
+altsuperragged4colheaderborder
The altsuperragged4colheaderborder style is like + altsuperragged4colheader but has horizontal and vertical lines around it. +
+

+

+

Top

15.1.7 Tree-Like Styles

+

The styles described in this section are all defined in the package glossary-tree. These styles +are designed for hierarchical glossaries but can also be used with glossaries that don’t have +sub-entries. These styles will display the entry’s symbol if it exists. Note that these +styles will automatically be available unless you use the notree or nostyles package +options. +

These styles all format the entry name using: +


\glstreenamefmt  \glstreenamefmt{name}

+

+This defaults to \textbf{name}, but note that ⟨name⟩ includes \glsnamefont so the +bold setting in \glstreenamefont may be counteracted by another font change in +\glsnamefont (or in \acronymfont). The tree-like styles that also display the header +use +


\glstreegroupheaderfmt  \glstreegroupheaderfmt{text}

+

+to format the heading. This defaults to \glstreenamefmt{text}. The tree-like styles that +display navigation links to the groups (such as indexhypergroup), format the navigation line +using +


\glstreenavigationfmt  \glstreenavigationfmt{text}

+ + +

+which defaults to \glstreenamefmt{text}. Note that this is different from +\glslistnavigationitem, provided with the styles such as listhypergroup, as that also +includes \item. +

With the exception of the alttree style (and those derived from it), the space before the +description for top-level entries is produced with +


\glstreepredesc  \glstreepredesc

+

+This defaults to \space. +

With the exception of the treenoname and alttree styles (and those derived from them), +the space before the description for child entries is produced with +


\glstreechildpredesc  \glstreechildpredesc

+

+This defaults to \space. +

Most of these styles are not designed for multi-paragraph descriptions. (The tree style +isn’t too bad for multi-paragraph top-level entry descriptions, or you can use the index style +with the adjustment shown below.)
+

+

+index
The index style is similar to the way indices are usually formatted in that it has + a hierarchical structure up to three levels (the main level plus two sub-levels). The + name is typeset in bold, and if the symbol is present it is set in parentheses after + the name and before the description. Sub-entries are indented and also include + the name, the symbol in brackets (if present) and the description. Groups are + separated using \indexspace. +

Each main level item is started with +


\glstreeitem  \glstreeitem

+

+ The level 1 entries are started with +


\glstreesubitem  \glstreesubitem

+

+

The level 2 entries are started with +


\glstreesubsubitem  \glstreesubsubitem

+

+

Note that the index style automatically sets + + +

+
+ \let\item\glstreeitem +  
\let\subitem\glstreesubitem +  
\let\subsubitem\glstreesubsubitem +
+

at the start of the glossary for backward compatibility. +

The index style isn’t suitable for multi-paragraph descriptions, but this limitation can be + overcome by redefining the above commands. For example: + + +

+
+ \renewcommand{\glstreeitem}{% +  
 \parindent0pt\par\hangindent40pt +  
 \everypar{\parindent50pt\hangindent40pt}} +
+

+

+indexgroup
The indexgroup style is similar to the index style except that each group has a + heading obtained using \glsgetgrouptitle{label}, which is described in §15.2 Defining + your own glossary style. +
+indexhypergroup
The indexhypergroup style is like indexgroup but has a set of links to the + glossary groups. The navigation line is the same as that for listhypergroup, described + above, but is formatted using \glstreenavigationfmt. +
+tree
The tree style is similar to the index style except that it can have arbitrary levels. (Note + that makeindex is limited to three levels, so you will need to use xindy if you want + more than three levels.) Each sub-level is indented by \glstreeindent \glstreeindent. + Note that the name, symbol (if present) and description are placed in the same + paragraph block. If you want the name to be apart from the description, use the alttree + style instead. (See below.) +
+treegroup
The treegroup style is similar to the tree style except that each group has a + heading. +
+treehypergroup
The treehypergroup style is like treegroup but has a set of links to the + glossary groups. The navigation line is the same as that for listhypergroup, described + above, but is formatted using \glstreenavigationfmt. +
+treenoname
The treenoname style is like the tree style except that the name for each + sub-entry is ignored. +
+treenonamegroup
The treenonamegroup style is similar to the treenoname style except that + each group has a heading. +
+treenonamehypergroup
The treenonamehypergroup style is like treenonamegroup but has a + set of links to the glossary groups. The navigation line is the same as that for + listhypergroup, described above, but is formatted using \glstreenavigationfmt. + + +
+alttree
The alttree style is similar to the tree style except that the indentation for each level + is determined by the width of the text specified by +


\glssetwidest  \glssetwidest[level]{text}

+

+ The optional argument ⟨level⟩ indicates the level, where 0 indicates the top-most level, 1 + indicates the first level sub-entries, etc. If \glssetwidest hasn’t been used for a + given sub-level, the level 0 widest text is used instead. If ⟨level⟩ is omitted, 0 is + assumed. +

As from v4.22, the glossary-tree package also provides +


\glsfindwidesttoplevelname  \glsfindwidesttoplevelname[glossary list] +

+

+ This iterates over all parentless entries in the given glossary lists and determines the + widest entry. If the optional argument is omitted, all glossaries are assumed (as per + \forallglossaries). +

For example, to have the same name width for all glossaries: + + +

+
+ \glsfindwidesttoplevelname +  
\setglossarystyle{alttree} +  
\printglossaries +
+

Alternatively, to compute the widest entry for each glossary before it’s displayed: + + +

+
+ \renewcommand{\glossarypreamble}{% +  
  \glsfindwidesttoplevelname[\currentglossary]} +  
\setglossarystyle{alttree} +  
\printglossaries +
+

+

These commands only affects the alttree styles, including those listed below and the + ones in the glossary-mcols package. If you forget to set the widest entry name, the + description will overwrite the name.
+

+

For each level, the name is placed to the left of the paragraph block containing the + symbol (optional) and the description. If the symbol is present, it is placed in + parentheses before the description. +

The name is placed inside a left-aligned \makebox. As from v4.19, this can now be + adjusted by redefining +


\glstreenamebox  \glstreenamebox{width}{text}

+

+ where ⟨width⟩ is the width of the box and ⟨text⟩ is the contents of the box. For example, to + make the name right-aligned: + + +

+
+ \renewcommand*{\glstreenamebox}[2]{% +  
  \makebox[#1][r]{#2}% +  
} +
+

+

+alttreegroup
The alttreegroup is like the alttree style except that each group has a + heading. +
+alttreehypergroup
The alttreehypergroup style is like alttreegroup but has a set of links to + the glossary groups. The navigation line is the same as that for listhypergroup, described + above. +
+

+

+

Top

15.1.8 Multicols Style

+

The glossary-mcols package provides tree-like styles that are in the multicols environment +(defined by the multicol package). The style names are as their analogous tree styles (as +defined in §15.1.7 Tree-Like Styles) but are prefixed with “mcol”. For example, the mcolindex +style is essentially the index style but put in a multicols environment. For the complete list, see +table 15.2. The glossary-tree package is automatically loaded by glossary-mcols (even if the +notree package option is used when loading glossaries). The formatting commands +\glstreenamefmt, \glstreegroupheaderfmt and \glstreenavigationfmt are all used by +the corresponding glossary-mcols styles. +

Note that glossary-mcols is not loaded by glossaries. If you want to use any of the multicol +styles in that package you need to load it explicitly with \usepackage and set the required +glossary style using \setglossarystyle.
+

+

The default number of columns is 2, but can be changed by redefining +


\glsmcols  \glsmcols

+

+to the required number. For example, for a three column glossary: + + +

+
+\usepackage{glossary-mcols} + 
\renewcommand*{\glsmcols}{3} + 
\setglossarystyle{mcolindex} +
+

+

+
+ + +


+ + +
Table 15.2: Multicolumn Styles
+
+ + + + + + + + + +
glossary-mcols Style Analogous Tree Style
mcolindex index
mcolindexgroup indexgroup
mcolindexhypergroup or mcolindexspannav indexhypergroup
mcoltree tree
mcoltreegroup treegroup
mcoltreehypergroup or mcoltreespannav treehypergroup
mcoltreenoname treenoname
mcoltreenonamegroup treenonamegroup
mcoltreenonamehypergroup or mcoltreenonamespannav treenonamehypergroup
mcolalttree alttree
mcolalttreegroup alttreegroup
mcolalttreehypergroup or mcolalttreespannav alttreehypergroup
+ + +

+
+

The styles with a navigation line, such as mcoltreehypergroup, now have a variant (as from +v4.22) with “hypergroup” replaced with “spannav” in the style name. The original +“hypergroup” styles place the navigation line at the start of the first column. The newer +“spannav” styles put the navigation line in the optional argument of the multicols +environment so that it spans across all the columns. +

+

Top

15.1.9 In-Line Style

+

This section covers the glossary-inline package that supplies the inline style. This is a style that +is designed for in-line use (as opposed to block styles, such as lists or tables). This style +doesn’t display the number list. +

You will most likely need to redefine \glossarysection with this style. For example, +suppose you are required to have your glossaries and list of acronyms in a footnote, you can +do: + + +

+
+ \usepackage{glossary-inline} + 
 \renewcommand*{\glossarysection}[2][]{\textbf{#1}: } + 
 \setglossarystyle{inline} +
+

+

Note that you need to include glossary-inline with \usepackage as it’s not automatically +included by the glossaries package and then set the style using \setglossarystyle. +
+

+

Where you need to include your glossaries as a footnote you can do: + + +

+
+\footnote{\printglossaries} +
+

+

The inline style is governed by the following: +


\glsinlineseparator  \glsinlineseparator

+

+This defaults to “; ” and is used between main (i.e. level 0) entries. +


\glsinlinesubseparator  \glsinlinesubseparator

+

+This defaults to “, ” and is used between sub-entries. +


\glsinlineparentchildseparator  \glsinlineparentchildseparator

+

+This defaults to “: ” and is used between a parent main entry and its first sub-entry. +


\glspostinline  \glspostinline

+

+This defaults to “; ” and is used at the end of the glossary. +


\glsinlinenameformat  \glsinlinenameformat{label}{name}

+

+This is used to format the entry name and defaults to \glstarget{label}{name}, where +⟨name⟩ is provided in the form \glossentryname{label} and ⟨label⟩ is the entry’s label. For +example, if you want the name to appear in smallcaps: + + +

+
+\renewcommand*{\glsinlinenameformat}[2]{\glstarget{#1}{\textsc{#2}}} +
+

Sub-entry names are formatted according to +


\glsinlinesubnameformat  \glsinlinesubnameformat{label}{name}

+

+This defaults to \glstarget{label}{} so the sub-entry name is ignored. +

If the description has been suppressed (according to \ifglsdescsuppressed) +then +


\glsinlineemptydescformat  \glsinlineemptydescformat{symbol}{number list} +

+

+(which defaults to nothing) is used, otherwise the description is formatted according +to +


\glsinlinedescformat  \glsinlinedescformat{description}{symbol}{number list} +

+

+This defaults to just \spacedescription⟩ so the symbol and location list are ignored. If the +description is missing (according to \ifglshasdesc), then \glsinlineemptydescformat is +used instead. +

For example, if you want a colon between the name and the description: + + +

+
+\renewcommand*{\glsinlinedescformat}[3]{: #1} +
+

+

The sub-entry description is formatted according to: +


\glsinlinesubdescformat  \glsinlinesubdescformat{description}{symbol}{number +list}

+

+This defaults to just ⟨description⟩. +

+

+

Top

15.2 Defining your own glossary style

+

If the predefined styles don’t fit your requirements, you can define your own style +using: +


\newglossarystyle  \newglossarystyle{name}{definitions}

+

+where ⟨name⟩ is the name of the new glossary style (to be used in \setglossarystyle). The +second argument ⟨definitions⟩ needs to redefine all of the following: +


theglossary  theglossary

+

+This environment defines how the main body of the glossary should be typeset. Note that this +does not include the section heading, the glossary preamble (defined by \glossarypreamble) +or the glossary postamble (defined by \glossarypostamble). For example, the list style uses +the description environment, so the theglossary environment is simply redefined to begin and +end the description environment. +


\glossaryheader  \glossaryheader

+

+This macro indicates what to do at the start of the main body of the glossary. Note that this +is not the same as \glossarypreamble, which should not be affected by changes in the +glossary style. The list glossary style redefines \glossaryheader to do nothing, +whereas the longheader glossary style redefines \glossaryheader to do a header +row. +


\glsgroupheading  \glsgroupheading{label}

+

+This macro indicates what to do at the start of each logical block within the main body of +the glossary. If you use makeindex the glossary is sub-divided into a maximum of +twenty-eight logical blocks that are determined by the first character of the sort key (or +name key if the sort key is omitted). The sub-divisions are in the following order: +symbols, numbers, A, …, Z. If you use xindy, the sub-divisions depend on the language +settings. + + +

Note that the argument to \glsgroupheading is a label not the group title. The group +title can be obtained via +


\glsgetgrouptitle  \glsgetgrouptitle{label}

+

+This obtains the title as follows: if ⟨label⟩ consists of a single non-active character or ⟨label⟩ is +equal to glssymbols or glsnumbers and \labelgroupname exists, this is taken to be the title, +otherwise the title is just ⟨label⟩. (The “symbols” group has the label glssymbols, so the +command \glssymbolsgroupname is used, and the “numbers” group has the label +glsnumbers, so the command \glsnumbersgrouptitle is used.) If you are using xindy, +⟨label⟩ may be an active character (for example ø), in which case the title will be set +to just ⟨label⟩. You can redefine \glsgetgrouptitle if this is unsuitable for your +document. +

A navigation hypertarget can be created using +


\glsnavhypertarget  \glsnavhypertarget{label}{text}

+

+This typically requires \glossaryheader to be redefined to use +


\glsnavigation  \glsnavigation

+

+which displays the navigation line. +

For further details about \glsnavhypertarget, see the documented code +(glossaries-code.pdf). +

Most of the predefined glossary styles redefine \glsgroupheading to simply ignore its +argument. The listhypergroup style redefines \glsgroupheading as follows: + + +

+
+\renewcommand*{\glsgroupheading}[1]{% + 
\item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]} +
+

See also \glsgroupskip below. (Note that command definitions within \newglossarystyle +must use ##1 instead of #1 etc.) +


\glsgroupskip  \glsgroupskip

+

+This macro determines what to do after one logical group but before the header for the +next logical group. The list glossary style simply redefines \glsgroupskip to be +\indexspace, whereas the tabular-like styles redefine \glsgroupskip to produce a blank +row. +

As from version 3.03, the package option nogroupskip can be used to suppress this default +gap for the predefined styles. +


\glossentry  \glossentry{label}{number list}

+

+This macro indicates what to do for each top-level (level 0) glossary entry. The entry label is +given by ⟨label⟩ and the associated number list is given by ⟨number list⟩. You can redefine +\glossentry to use commands like \glossentryname{label}, \glossentrydesc{label} and +\glossentrysymbol{label} to display the name, description and symbol fields, or +to access other fields, use commands like \glsentryuseri{label}. (See §9 Using +Glossary Terms Without Links for further details.) You can also use the following +commands: +


\glsentryitem  \glsentryitem{label}

+

+This macro will increment and display the associated counter for the main (level 0) entries if +the entrycounter or counterwithin package options have been used. This macro is typically +called by \glossentry before \glstarget. The format of the counter is controlled by the +macro +


\glsentrycounterlabel  \glsentrycounterlabel

+

+

Each time you use a glossary entry it creates a hyperlink (if hyperlinks are enabled) to the +relevant line in the glossary. Your new glossary style must therefore redefine \glossentry to +set the appropriate target. This is done using +


\glstarget  \glstarget{label}{text}

+

+where ⟨label⟩ is the entry’s label. Note that you don’t need to worry about whether the hyperref +package has been loaded, as \glstarget won’t create a target if \hypertarget hasn’t been +defined. +

For example, the list style defines \glossentry as follows: + + +

+
+  \renewcommand*{\glossentry}[2]{% + 
    \item[\glsentryitem{##1}% + 
          \glstarget{##1}{\glossentryname{##1}}] + 
       \glossentrydesc{##1}\glspostdescription\space ##2} +
+

+

Note also that ⟨number list⟩ will always be of the form +


\glossaryentrynumbers{\relax
\setentrycounter[Hprefix]{counter name}format cmd{number(s)}}

+

+where ⟨number(s)⟩ may contain \delimN (to delimit individual numbers) and/or \delimR (to +indicate a range of numbers). There may be multiple occurrences of \setentrycounter +[Hprefix]{counter name}format cmd{number(s)}, but note that the entire number list is +enclosed within the argument of \glossaryentrynumbers. The user can redefine this to +change the way the entire number list is formatted, regardless of the glossary style. +However the most common use of \glossaryentrynumbers is to provide a means of +suppressing the number list altogether. (In fact, the nonumberlist option redefines +\glossaryentrynumbers to ignore its argument.) Therefore, when you define a new glossary +style, you don’t need to worry about whether the user has specified the nonumberlist package +option. +


\subglossentry  \subglossentry{level}{label}{number list}

+

+This is used to display sub-entries. The first argument, ⟨level⟩, indicates the sub-entry level. +This must be an integer from 1 (first sub-level) onwards. The remaining arguments are +analogous to those for \glossentry described above. +


\glssubentryitem  \glssubentryitem{label}

+

+This macro will increment and display the associated counter for the level 1 entries if the +subentrycounter package option has been used. This macro is typically called by +\subglossentry before \glstarget. The format of the counter is controlled by the +macro +


\glssubentrycounterlabel  \glssubentrycounterlabel

+

+

Note that \printglossary (which \printglossaries calls) sets +


\currentglossary  \currentglossary

+

+to the current glossary label, so it’s possible to create a glossary style that varies according to +the glossary type. +

For further details of these commands, see “Displaying the glossary” in the documented +code (glossaries-code.pdf). + + + +

Example 27 (Creating a completely new style) +

If you want a completely new style, you will need to redefine all of the commands and the +environment listed above. +

For example, suppose you want each entry to start with a bullet point. This +means that the glossary should be placed in the itemize environment, so theglossary +should start and end that environment. Let’s also suppose that you don’t want +anything between the glossary groups (so \glsgroupheading and \glsgroupskip +should do nothing) and suppose you don’t want anything to appear immediately +after \begin{theglossary} (so \glossaryheader should do nothing). In addition, +let’s suppose the symbol should appear in brackets after the name, followed by the +description and last of all the number list should appear within square brackets +at the end. Then you can create this new glossary style, called, say, mylist, as +follows: + + +

+
+ \newglossarystyle{mylist}{% + 
 % put the glossary in the itemize environment: + 
 \renewenvironment{theglossary}% + 
   {\begin{itemize}}{\end{itemize}}% + 
 % have nothing after \begin{theglossary}: + 
 \renewcommand*{\glossaryheader}{}% + 
 % have nothing between glossary groups: + 
 \renewcommand*{\glsgroupheading}[1]{}% + 
 \renewcommand*{\glsgroupskip}{}% + 
 % set how each entry should appear: + 
 \renewcommand*{\glossentry}[2]{% + 
 \item % bullet point + 
 \glstarget{##1}{\glossentryname{##1}}% the entry name + 
 \space (\glossentrysymbol{##1})% the symbol in brackets + 
 \space \glossentrydesc{##1}% the description + 
 \space [##2]% the number list in square brackets + 
 }% + 
 % set how sub-entries appear: + 
 \renewcommand*{\subglossentry}[3]{% + 
   \glossentry{##2}{##3}}% + 
 } +
+

Note that this style creates a flat glossary, where sub-entries are displayed in exactly the +same way as the top level entries. It also hasn’t used \glsentryitem or \glssubentryitem so +it won’t be affected by the entrycounter, counterwithin or subentrycounter package +options. +

Variations:

+
    +
  • You might want the entry name to be capitalised, in which case use + \Glossentryname instead of \glossentryname. +
  • +
  • You might want to check if the symbol hasn’t been set and omit the parentheses if + the symbol is absent. In this case you can use \ifglshassymbol (see §16 + Utilities): + + +
    +  \renewcommand*{\glossentry}[2]{% +  
     \item % bullet point +  
     \glstarget{##1}{\glossentryname{##1}}% the entry name +  
     \ifglshassymbol{##1}% check if symbol exists +  
     {% +  
       \space (\glossentrysymbol{##1})% the symbol in brackets +  
     }% +  
     {}% no symbol so do nothing +  
     \space \glossentrydesc{##1}% the description +  
     \space [##2]% the number list in square brackets +  
     }% +
    +

+
+

+

____________________________

+ +

Example 28 (Creating a new glossary style based on an existing +style) +

If you want to define a new style that is a slightly modified version of an existing style, +you can use \setglossarystyle within the second argument of \newglossarystyle followed +by whatever alterations you require. For example, suppose you want a style like +the list style but you don’t want the extra vertical space created by \indexspace +between groups, then you can create a new glossary style called, say, mylist as +follows: + + +

+
+\newglossarystyle{mylist}{% + 
\setglossarystyle{list}% base this style on the list style + 
\renewcommand{\glsgroupskip}{}% make nothing happen + 
                              % between groups + 
} +
+

(In this case, you can actually achieve the same effect using the list style in combination with +the package option nogroupskip.)

+
+

+

____________________________

+ +

Example 29 (Example: creating a glossary style that uses the user1, +…, user6 keys) +

Suppose each entry not only has an associated symbol, but also units (stored in user1) and +dimension (stored in user2). Then you can define a glossary style that displays each entry in a +longtable as follows: + + +

+
+\newglossarystyle{long6col}{% + 
 % put the glossary in a longtable environment: + 
 \renewenvironment{theglossary}% + 
  {\begin{longtable}{lp{\glsdescwidth}cccp{\glspagelistwidth}}}% + 
  {\end{longtable}}% + 
 % Set the table's header: + 
 \renewcommand*{\glossaryheader}{% + 
  \bfseries Term & \bfseries Description & \bfseries Symbol & + 
  \bfseries Units & \bfseries Dimensions & \bfseries Page List + 
  \\\endhead}% + 
 % No heading between groups: + 
  \renewcommand*{\glsgroupheading}[1]{}% + 
 % Main (level 0) entries displayed in a row optionally numbered: + 
  \renewcommand*{\glossentry}[2]{% + 
    \glsentryitem{##1}% Entry number if required + 
    \glstarget{##1}{\glossentryname{##1}}% Name + 
    & \glossentrydesc{##1}% Description + 
    & \glossentrysymbol{##1}% Symbol + 
    & \glsentryuseri{##1}% Units + 
    & \glsentryuserii{##1}% Dimensions + 
    & ##2% Page list + 
    \tabularnewline % end of row + 
  }% + 
 % Similarly for sub-entries (no sub-entry numbers): + 
 \renewcommand*{\subglossentry}[3]{% + 
    % ignoring first argument (sub-level) + 
    \glstarget{##2}{\glossentryname{##2}}% Name + 
    & \glossentrydesc{##2}% Description + 
    & \glossentrysymbol{##2}% Symbol + 
    & \glsentryuseri{##2}% Units + 
    & \glsentryuserii{##2}% Dimensions + 
    & ##3% Page list + 
    \tabularnewline % end of row + 
  }% + 
 % Nothing between groups: + 
 \renewcommand*{\glsgroupskip}{}% + 
} +
+

+
+

+

____________________________

+ + +

+

Top

16. Utilities

+

This section describes some utility commands. Additional commands can be found in the +documented code (glossaries-code.pdf). +

+

Top

16.1 Loops

+

Some of the commands described here take a comma-separated list as an argument. As with +LATEX’s \@for command, make sure your list doesn’t have any unwanted spaces in it as +they don’t get stripped. (Discussed in more detail in §2.7.2 of “LATEX for Administrative +Work”.)
+

+


\forallglossaries  \forallglossaries[glossary list]{cs}{body}

+

+This iterates through ⟨glossary list⟩, a comma-separated list of glossary labels (as +supplied when the glossary was defined). At each iteration ⟨cs⟩ (which must be a control +sequence) is set to the glossary label for the current iteration and ⟨body⟩ is performed. If +⟨glossary list⟩ is omitted, the default is to iterate over all glossaries (except the ignored +ones). +


\forallacronyms  \forallacronyms{cs}{body}

+

+This is like \forallglossaries but only iterates over the lists of acronyms (that have +previously been declared using \DeclareAcronymList or the acronymlists package option). +This command doesn’t have an optional argument. If you want to explicitly say which lists to +iterate over, just use the optional argument of \forallglossaries. +


\forglsentries  \forglsentries[glossary label]{cs}{body}

+

+This iterates through all entries in the glossary given by ⟨glossary label⟩. At each iteration ⟨cs⟩ +(which must be a control sequence) is set to the entry label for the current iteration and ⟨body⟩ +is performed. If ⟨glossary label⟩ is omitted, \glsdefaulttype (usually the main glossary) is +used. +


\forallglsentries  \forallglsentries[glossary list]{cs}{body}

+

+This is like \forglsentries but for each glossary in ⟨glossary list⟩ (a comma-separated list of +glossary labels). If ⟨glossary list⟩ is omitted, the default is the list of all defined glossaries +(except the ignored ones). At each iteration ⟨cs⟩ is set to the entry label and ⟨body⟩ is +performed. (The current glossary label can be obtained using \glsentrytype{cs} within +⟨body⟩.) +

+

+

Top

16.2 Conditionals

+


\ifglossaryexists  \ifglossaryexistslabel⟩⟨true part⟩⟨false part

+ + +

+This checks if the glossary given by ⟨label⟩ exists. If it does ⟨true part⟩ is performed, otherwise +⟨false part⟩. +


\ifglsentryexists  \ifglsentryexistslabel⟩⟨true part⟩⟨false part

+

+This checks if the glossary entry given by ⟨label⟩ exists. If it does ⟨true part⟩ is performed, +otherwise ⟨false part⟩. (Note that \ifglsentryexists will always be true after the containing +glossary has been displayed via \printglossary or \printglossaries even if the entry is +explicitly defined later in the document. This is because the entry has to be defined +before it can be displayed in the glossary, see §4.8.1 Technical Issues for further +details.) +


\glsdoifexists  \glsdoifexists{label}{code}

+

+Does ⟨code⟩ if the entry given by ⟨label⟩ exists. If it doesn’t exist, an error is generated. (This +command uses \ifglsentryexists.) +


\glsdoifnoexists  \glsdoifnoexists{label}{code}

+

+Does the reverse of \glsdoifexists. (This command uses \ifglsentryexists.) +


\glsdoifexistsorwarn  \glsdoifexistsorwarn{label}{code}

+

+As \glsdoifexists but issues a warning rather than an error if the entry doesn’t +exist. +


\glsdoifexistsordo  \glsdoifexistsordo{label}{code}{else code}

+

+Does ⟨code⟩ if the entry given by ⟨label⟩ exists otherwise generate an error and do ⟨else +code⟩. +


\glsdoifnoexistsordo  \glsdoifnoexistsordo{label}{code}{else code}

+

+Does ⟨code⟩ if the entry given by ⟨label⟩ doesn’t exist otherwise generate an error and do ⟨else +code⟩. +


\ifglsused  \ifglsusedlabel⟩⟨true part⟩⟨false part

+

+See §14 Unsetting and Resetting Entry Flags. +


\ifglshaschildren  \ifglshaschildrenlabel⟩⟨true part⟩⟨false part

+

+This checks if the glossary entry given by ⟨label⟩ has any sub-entries. If it does, ⟨true part⟩ is +performed, otherwise ⟨false part⟩. +


\ifglshasparent  \ifglshasparentlabel⟩⟨true part⟩⟨false part

+

+This checks if the glossary entry given by ⟨label⟩ has a parent entry. If it does, ⟨true part⟩ is +performed, otherwise ⟨false part⟩. +


\ifglshassymbol  \ifglshassymbol{label}{true part}{false part}

+

+This checks if the glossary entry given by ⟨label⟩ has had the symbol field set. If it has, ⟨true part⟩ +is performed, otherwise ⟨false part⟩. +


\ifglshaslong  \ifglshaslong{label}{true part}{false part}

+ + +

+This checks if the glossary entry given by ⟨label⟩ has had the long field set. If it has, ⟨true part⟩ is +performed, otherwise ⟨false part⟩. This should be true for any entry that has been defined via +\newacronym. There is no check for the existence of ⟨label⟩. +


\ifglshasshort  \ifglshasshort{label}{true part}{false part}

+

+This checks if the glossary entry given by ⟨label⟩ has had the short field set. If it has, ⟨true part⟩ +is performed, otherwise ⟨false part⟩. This should be true for any entry that has been defined via +\newacronym. There is no check for the existence of ⟨label⟩. +


\ifglshasdesc  \ifglshasdesc{label}{true part}{false part}

+

+This checks if the description field is non-empty for the entry given by ⟨label⟩. If it has, ⟨true part⟩ +is performed, otherwise ⟨false part⟩. Compare with: +


\ifglsdescsuppressed  \ifglsdescsuppressed{label}{true part}{false part} +

+

+This checks if the description field has been set to just \nopostdesc for the entry given by +⟨label⟩. If it has, ⟨true part⟩ is performed, otherwise ⟨false part⟩. There is no check for the existence +of ⟨label⟩. +

For all other fields you can use: +


\ifglshasfield  \ifglshasfield{field}{label}{true part}{false part} +

+

+This tests the value of the field given by ⟨field⟩ for the entry identified by ⟨label⟩. If the value is +empty or the default value, then ⟨false part⟩ is performed, otherwise ⟨true part⟩ is performed. If +the field supplied is unrecognised ⟨false part⟩ is performed and a warning is issued. +Unlike the above commands, such as \ifglshasshort, an error occurs if the entry is +undefined. +

As from version 4.23, within ⟨true part⟩ you can use +


\glscurrentfieldvalue  \glscurrentfieldvalue

+

+to access the field value. This command is initially defined to nothing but has no +relevance outside ⟨true part⟩. This saves re-accessing the field if the test is true. For +example: + + +

+
+\ifglshasfield{useri}{sample}{, \glscurrentfieldvalue}{} +
+

will insert a comma, space and the field value if the user1 key has been set for the entry +whose label is sample. +

You can test if the value of the field is equal to a given string using: +


\ifglsfieldeq  \ifglsfieldeq{label}{field}{string}{true}{false} +

+

+In this case the ⟨field⟩ must be the field name not the key (see table 4.1). If the +field isn’t recognised, an error will occur. This command internally uses etoolbox’s +\ifcsstring to perform the comparison. The string is not expanded during the +test. +

The result may vary depending on whether or not expansion is on for the given field +(when the entry was defined). For example: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\newcommand*{\foo}{FOO} + 
\newglossaryentry{sample1}{name={sample1},description={an example}, + 
user1={FOO}} + 
\newglossaryentry{sample2}{name={sample2},description={an example}, + 
user1={\foo}} + 
\begin{document} + 
\ifglsfieldeq{sample1}{useri}{FOO}{TRUE}{FALSE}. + 
\ifglsfieldeq{sample2}{useri}{FOO}{TRUE}{FALSE}. + 
\end{document} +
+

This will produce “TRUE” in both cases since expansion is on, so \foo was expanded to +“FOO” when sample2 was defined. If the tests are changed to: + + +

+
+\ifglsfieldeq{sample1}{useri}{\foo}{TRUE}{FALSE}. + 
\ifglsfieldeq{sample2}{useri}{\foo}{TRUE}{FALSE}. +
+

then this will produce “FALSE” in both cases. Now suppose expansion is switched off for the +user1 key: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\newcommand*{\foo}{FOO} + 
\glssetnoexpandfield{useri} + 
\newglossaryentry{sample1}{name={sample1},description={an example}, + 
user1={FOO}} + 
\newglossaryentry{sample2}{name={sample2},description={an example}, + 
user1={\foo}} + 
\begin{document} + 
\ifglsfieldeq{sample1}{useri}{FOO}{TRUE}{FALSE}. + 
\ifglsfieldeq{sample2}{useri}{FOO}{TRUE}{FALSE}. + 
\end{document} +
+

This now produces “TRUE” for the first case (comparing “FOO” with “FOO”) and +“FALSE” for the second case (comparing “\foo” with “FOO”). +

The reverse happens in the following: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\newcommand*{\foo}{FOO} + 
\glssetnoexpandfield{useri} + 
\newglossaryentry{sample1}{name={sample1},description={an example}, + 
user1={FOO}} + 
\newglossaryentry{sample2}{name={sample2},description={an example}, + 
user1={\foo}} + 
\begin{document} + 
\ifglsfieldeq{sample1}{useri}{\foo}{TRUE}{FALSE}. + 
\ifglsfieldeq{sample2}{useri}{\foo}{TRUE}{FALSE}. + 
\end{document} +
+

This now produces “FALSE” for the first case (comparing “FOO” with “\foo”) and +“TRUE” for the second case (comparing “\foo” with “\foo”). +

You can test if the value of a field is equal to the replacement text of a command +using: +


\ifglsfielddefeq  \ifglsfielddefeq{label}{field}{command}{true}{false} +

+

+This internally uses etoolbox’s \ifdefstrequal command to perform the comparison. The +argument ⟨command⟩ must be a macro. +

For example: + + +

+
+\documentclass{article} + 
\usepackage{glossaries} + 
\newcommand*{\foo}{FOO} + 
\glssetnoexpandfield{useri} + 
\newglossaryentry{sample1}{name={sample1},description={an example}, + 
user1={FOO}} + 
\newglossaryentry{sample2}{name={sample2},description={an example}, + 
user1={\foo}} + 
\begin{document} + 
\ifglsfielddefeq{sample1}{useri}{\foo}{TRUE}{FALSE}. + 
\ifglsfielddefeq{sample2}{useri}{\foo}{TRUE}{FALSE}. + 
\end{document} +
+

Here, the first case produces “TRUE” since the value of the useri field (“FOO”) is the same +as the replacement text (definition) of \foo (“FOO”). We have the result “FOO” is equal to +“FOO”. +

The second case produces “FALSE” since the value of the useri field (“\foo”) is not the +same as the replacement text (definition) of \foo (“FOO”). No expansion has been +performed on the value of the useri field. We have the result “\foo” is not equal to +“FOO”. +

If we add: + + +

+
+\newcommand{\FOO}{\foo} + 
\ifglsfielddefeq{sample2}{useri}{\FOO}{TRUE}{FALSE}. +
+

we now get “TRUE” since the value of the useri field (“\foo”) is the same as the +replacement text (definition) of \FOO (“\foo”). We have the result “\foo” is equal to +“\foo”. +

There is a similar command that requires the control sequence name (without the leading +backslash) instead of the actual control sequence: +


\ifglsfieldcseq  \ifglsfieldcseq{label}{field}{csname}{true}{false} +

+

+This internally uses etoolbox’s \ifcsstrequal command instead of \ifdefstrequal. +

+

+

Top

16.3 Fetching and Updating the Value of a Field

+

You can fetch the value of a given field and store it in a control sequence using: +


\glsfieldfetch  \glsfieldfetch{label}{field}{cs}

+

+where ⟨label⟩ is the label identifying the glossary entry, ⟨field⟩ is the field label (see +table 4.1) and ⟨cs⟩ is the control sequence in which to store the value. Remember that +⟨field⟩ is the internal label and is not necessarily the same as the key used to set +that field in the argument of \newglossaryentry (or the optional argument of +\newacronym). +

You can change the value of a given field using one of the following commands. Note that +these commands only change the value of the given field. They have no affect on any related +field. For example, if you change the value of the text field, it won’t modify the value given by +the name, plural, first or any other related key. +

In all the four related commands below, ⟨label⟩ and ⟨field⟩ are as above and ⟨definition⟩ is the +new value of the field. +


\glsfielddef  \glsfielddef{label}{field}{definition}

+

+This uses \def to change the value of the field (so it will be localised by any grouping). +


\glsfieldedef  \glsfieldedef{label}{field}{definition}

+

+This uses \edef to change the value of the field (so it will be localised by any grouping). Any +fragile commands contained in the ⟨definition⟩ must be protected. +


\glsfieldgdef  \glsfieldgdef{label}{field}{definition}

+

+This uses \gdef to change the value of the field. + + +


\glsfieldxdef  \glsfieldxdef{label}{field}{definition}

+

+This uses \xdef to change the value of the field. Any fragile commands contained in the +⟨definition⟩ must be protected. + + +

+

+

Top

17. Prefixes or Determiners

+

The glossaries-prefix package that comes with the glossaries package provides additional +keys that can be used as prefixes. For example, if you want to specify determiners (such as +“a”, “an” or “the”). The glossaries-prefix package automatically loads the glossaries package +and has the same package options. +

The extra keys for \newglossaryentry are as follows: +

+prefix
The prefix associated with the text key. This defaults to nothing. +
+prefixplural
The prefix associated with the plural key. This defaults to nothing. +
+prefixfirst
The prefix associated with the first key. If omitted, this defaults to the value + of the prefix key. +
+prefixfirstplural
The prefix associated with the firstplural key. If omitted, this defaults + to the value of the prefixplural key.
+ +

Example 30 (Defining Determiners) +

Here’s the start of my example document: + + +

+
+documentclass{article} + 
\usepackage[colorlinks]{hyperref} + 
\usepackage[toc,acronym]{glossaries-prefix} +
+

Note that I’ve simply replaced glossaries from previous sample documents with glossaries-prefix. Now for a +sample definition17.1: + + +

+
+\newglossaryentry{sample}{name={sample},% + 
  description={an example},% + 
  prefix={a~},% + 
  prefixplural={the\space}% + 
} +
+

Note that I’ve had to explicitly insert a space after the prefix. This allows for the possibility +of prefixes that shouldn’t have a space, such as: + + +

+
+\newglossaryentry{oeil}{name={oeil}, + 
  plural={yeux}, + 
  description={eye}, + 
  prefix={l'}, + 
  prefixplural={les\space}} +
+

Where a space is required at the end of the prefix, you must use a spacing command, such as +\space, \␣ (backslash space) or ~ due to the automatic spacing trimming performed in +⟨key⟩=⟨value⟩ options. +

The prefixes can also be used with acronyms. For example: + + +

+
+\newacronym + 
 [% + 
   prefix={an\space},prefixfirst={a~}% + 
 ]{svm}{SVM}{support vector machine} +
+

+
+

+

____________________________

+

The glossaries-prefix package provides convenient commands to use these prefixes with +commands such as \gls. Note that the prefix is not considered part of the link text, so it’s +not included in the hyperlink (where hyperlinks are enabled). The options and any star or +plus modifier are passed on to the \gls-like command. (See §6 Links to Glossary Entries for +further details.) +


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

+

+This is inserts the value of the prefix key (or prefixfirst key, on first use) in front of \gls +[options]{label}[insert]. +


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

+

+If the prefix key (or prefixfirst, on first use) has been set, this displays the value of that +key with the first letter converted to upper case followed by \gls[options]{label} +[insert]. If that key hasn’t been set, this is equivalent to \Gls[options]{label} +[insert]. +


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

+

+As \pgls but converts the prefix to upper case and uses \GLS instead of \gls. +


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

+

+This is inserts the value of the prefixplural key (or prefixfirstplural key, on first use) in front of +\glspl[options]{label}[insert]. +


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

+

+If the prefixplural key (or prefixfirstplural, on first use) has been set, this displays the value of +that key with the first letter converted to upper case followed by \glspl[options]{label} +[insert]. If that key hasn’t been set, this is equivalent to \Glspl[options]{label} +[insert]. +


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

+

+As \pglspl but converts the prefix to upper case and uses \GLSpl instead of \glspl. + + + +

Example 31 (Using Prefixes) +

Continuing from Example 30, now that I’ve defined my entries, I can use them in the text +via the above commands: + + +

+
+First use: \pgls{svm}. Next use: \pgls{svm}. + 
Singular: \pgls{sample}, \pgls{oeil}. + 
Plural: \pglspl{sample}, \pglspl{oeil}. +
+

which produces: +

+

First use: a support vector machine (SVM). Next use: an SVM. Singular: + a sample, l’oeil. Plural: the samples, les yeux.

+

For a complete document, see sample-prefix.tex.

+
+

+

____________________________

+

This package also provides the commands described below, none of which perform any +check to determine the entry’s existence. +


\ifglshasprefix  \ifglshasprefix{label}{true part}{false part}

+

+Does ⟨true part⟩ if the entry identified by ⟨label⟩ has a non-empty value for the prefix +key. +

This package also provides the following commands: +


\ifglshasprefixplural  \ifglshasprefixplural{label}{true part}{false part} +

+

+Does ⟨true part⟩ if the entry identified by ⟨label⟩ has a non-empty value for the prefixplural +key. +


\ifglshasprefixfirst  \ifglshasprefixfirst{label}{true part}{false part} +

+

+Does ⟨true part⟩ if the entry identified by ⟨label⟩ has a non-empty value for the prefixfirst +key. +


\ifglshasprefixfirstplural  \ifglshasprefixfirstplural{label}{true part} +{false part}

+

+Does ⟨true part⟩ if the entry identified by ⟨label⟩ has a non-empty value for the prefixfirstplural +key. +


\glsentryprefix  \glsentryprefix{label}

+

+Displays the value of the prefix key for the entry given by ⟨label⟩. +


\glsentryprefixfirst  \glsentryprefixfirst{label}

+

+Displays the value of the prefixfirst key for the entry given by ⟨label⟩. + + +


\glsentryprefixplural  \glsentryprefixplural{label}

+

+Displays the value of the prefixplural key for the entry given by ⟨label⟩. (No check is performed +to determine if the entry exists.) +


\glsentryprefixfirstplural  \glsentryprefixfirstplural{label}

+

+Displays the value of the prefixfirstplural key for the entry given by ⟨label⟩. (No check is +performed to determine if the entry exists.) +

There are also variants that convert the first letter to upper +case17.2: +


\Glsentryprefix  \Glsentryprefix{label}

+

+


\Glsentryprefixfirst  \Glsentryprefixfirst{label}

+

+


\Glsentryprefixplural  \Glsentryprefixplural{label}

+

+


\Glsentryprefixfirstplural  \Glsentryprefixfirstplural{label}

+

+

As with analogous commands such as \Glsentrytext, these commands aren’t +expandable so can’t be used in PDF bookmarks.
+

+ +

Example 32 (Adding Determiner to Glossary Style) +

You can use the above commands to define a new glossary style that uses the determiner. +For example, the following style is a slight modification of the list style that inserts the prefix +before the name: + + +

+
+\newglossarystyle{plist}{% + 
  \setglossarystyle{list}% + 
  \renewcommand*{\glossentry}[2]{% + 
    \item[\glsentryitem{##1}% + 
          \Glsentryprefix{##1}% + 
          \glstarget{##1}{\glossentryname{##1}}] + 
       \glossentrydesc{##1}\glspostdescription\space ##2}% + 
} +
+

+
+

+

____________________________

+ + +

+

Top

18. Accessibility Support

+

Limited accessibility support is provided by the accompanying glossaries-accsupp package, +but note that this package is experimental and it requires the accsupp package which is also +listed as experimental. This package defines additional keys that may be used when defining +glossary entries. The keys are as follows: +

+access
The replacement text corresponding to the name key. +
+textaccess
The replacement text corresponding to the text key. +
+firstaccess
The replacement text corresponding to the first key. +
+pluralaccess
The replacement text corresponding to the plural key. +
+firstpluralaccess
The replacement text corresponding to the firstplural key. +
+symbolaccess
The replacement text corresponding to the symbol key. +
+symbolpluralaccess
The replacement text corresponding to the symbolplural key. +
+descriptionaccess
The replacement text corresponding to the description key. +
+descriptionpluralaccess
The replacement text corresponding to the descriptionplural + key. +
+longaccess
The replacement text corresponding to the long key (used by \newacronym). +
+shortaccess
The replacement text corresponding to the short key (used by + \newacronym). +
+longpluralaccess
The replacement text corresponding to the longplural key (used by + \newacronym). +
+shortpluralaccess
The replacement text corresponding to the shortplural key (used by + \newacronym). +
+

For example: + + +

+
+\newglossaryentry{tex}{name={\TeX},description={Document + 
preparation language},access={TeX}} +
+

Now \gls{tex} will be equivalent to + + +

+
+\BeginAccSupp{ActualText=TeX}\TeX\EndAccSupp{} +
+

The sample file sampleaccsupp.tex illustrates the glossaries-accsupp package. +

See the documented code (glossaries-code.pdf) for further details. I recommend that +you also read the accsupp documentation. + + +

+

+

Top

19. Troubleshooting

+

In addition to the sample files listed in §1.2 Sample Documents, the glossaries package +comes with some minimal example files, minimalgls.tex, mwe-gls.tex, mwe-acr.tex and +mwe-acr-desc.tex, which can be used for testing. These should be located in the samples +subdirectory (folder) of the glossaries documentation directory. The location varies according to +your operating system and TEX installation. For example, on my Linux partition it can be found +in /usr/local/texlive/2014/texmf-dist/doc/latex/glossaries/. The makeglossariesgui +application can also be used to test for various problems. Further information on debugging +LATEX code is available at http://www.dickimaw-books.com/latex/minexample/. +

If you have any problems, please first consult the glossaries FAQ. If that doesn’t +help, try posting your query to somewhere like the comp.text.tex newsgroup, the +LATEX Community Forum or TEX on StackExchange. Bug reports can be submitted via +my package bug report form. + + +

+

+

Top

Index

+ Symbols +
\@gls@codepage  1
+\@glsorder  2
+\@istfilename  3
+\@newglossary  4
+\@xdylanguage  5
+

A +accsupp package  6, 7
+\ACRfull  8
+\Acrfull  9
+\acrfull  10
+\acrfullfmt  11
+\acrfullformat  12
+\ACRfullpl  13
+\Acrfullpl  14
+\acrfullpl  15
+\ACRlong  16
+\Acrlong  17
+\acrlong  18
+\ACRlongpl  19
+\Acrlongpl  20
+\acrlongpl  21
+acronym styles:
+    dua  22, 23, 24, 25
+    dua-desc  26, 27
+    footnote  28, 29, 30
+    footnote-desc  31
+    footnote-sc  32
+    footnote-sc-desc  33, 34, 35, 36
+    footnote-sm  37
+    footnote-sm-desc  38
+    long-sc-short  39, 40, 41, 42
+ + +    long-sc-short-desc  43
+    long-short  44, 45, 46, 47, 48, 49
+    long-short-desc  50, 51, 52
+    long-sm-short  53, 54, 55
+    long-sm-short-desc  56
+    long-sp-short  57, 58, 59
+    long-sp-short-desc  60
+    sc-short-long  61
+    sc-short-long-desc  62
+    short-long  63
+    short-long-desc  64
+    sm-short-long  65
+    sm-short-long-desc  66
+\acronymentry  67
+\acronymfont  68
+\acronymsort  69
+\acronymtype  70
+\ACRshort  71
+\Acrshort  72
+\acrshort  73
+\ACRshortpl  74
+\Acrshortpl  75
+\acrshortpl  76
+\altnewglossary  77
+amsgen package  78, 79, 80, 81, 82
+amsmath package  83, 84
+arara  85, 86, 87, 88
+array package  89, 90
+

B +babel package  91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117
+beamer class  118, 119, 120, 121
+beamer package  122
+bib2gls  123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
+booktabs package  154, 155, 156
+

C +\cGls  157
+\cgls  158
+\cGlsformat  159
+\cglsformat  160
+\cGlspl  161
+\cglspl  162
+ + +\cGlsplformat  163
+\cglsplformat  164
+classicthesis package  165, 166, 167, 168, 169
+\currentglossary  170
+

D +datatool package  171, 172, 173, 174, 175
+datatool-base package  176, 177
+\DeclareAcronymList  178
+\defglsentryfmt  179
+\DefineAcronymSynonyms  180
+doc package  181, 182, 183, 184
+

E +encap  185
+entry location  186
+environments:
+    theglossary  187
+etoolbox package  188, 189, 190, 191, 192, 193
+Extended Latin Alphabet  194
+extended Latin character  195, 196, 197, 198, 199, 200, 201
+

F +file types
+    .alg  202
+    .aux  203, 204, 205, 206, 207
+    .glg  208, 209, 210
+    .glg2  211
+    .glo  212, 213, 214
+    .gls  215, 216
+    .glsdefs  217, 218, 219, 220
+    .ist  221, 222, 223, 224, 225, 226
+    .tex  227, 228, 229, 230
+    .xdy  231, 232, 233, 234, 235, 236, 237, 238
+    glo2  239
+    gls2  240
+first use  241
+    flag  242
+    text  243
+\firstacronymfont  244
+flowfram package  245
+fmtcount package  246, 247, 248, 249
+fontspec package  250, 251
+ + +\forallacronyms  252
+\forallglossaries  253
+\forallglsentries  254
+\forglsentries  255
+

G +\Genacrfullformat  256
+\genacrfullformat  257
+\GenericAcronymFields  258
+\Genplacrfullformat  259
+\genplacrfullformat  260
+glossaries package  261, 262, 263, 264, 265, 266, 267, 268, 269, 270
+glossaries-accsupp package  271, 272, 273, 274
+glossaries-babel package  275, 276
+glossaries-extra package  277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301
+glossaries-extra-stylemods package  302
+glossaries-polyglossia package  303
+glossaries-prefix package  304, 305, 306, 307
+glossary counters:
+    glossaryentry  308
+    glossarysubentry  309
+glossary package  310, 311, 312, 313, 314, 315
+glossary styles:
+    altlist  316, 317, 318, 319, 320
+    altlistgroup  321, 322
+    altlisthypergroup  323
+    altlong4col  324, 325, 326
+    altlong4col-booktabs  327
+    altlong4colborder  328
+    altlong4colheader  329, 330
+    altlong4colheaderborder  331
+    altlongragged4col  332, 333, 334
+    altlongragged4col-booktabs  335
+    altlongragged4colborder  336
+    altlongragged4colheader  337, 338, 339
+    altlongragged4colheaderborder  340
+    altsuper4col  341, 342, 343
+    altsuper4colborder  344
+    altsuper4colheader  345
+    altsuper4colheaderborder  346
+    altsuperragged4col  347, 348, 349
+    altsuperragged4colborder  350
+    altsuperragged4colheader  351, 352
+    altsuperragged4colheaderborder  353
+ + +    alttree  354, 355, 356, 357, 358, 359, 360, 361
+    alttreegroup  362, 363, 364
+    alttreehypergroup  365, 366
+    index  367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378
+    indexgroup  379, 380, 381
+    indexhypergroup  382, 383, 384
+    inline  385, 386, 387
+    list  388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400
+    listdotted  401, 402, 403, 404, 405
+    listgroup  406, 407, 408, 409
+    listhypergroup  410, 411, 412, 413, 414, 415, 416, 417
+    long  418, 419, 420, 421, 422, 423
+    long-booktabs  424, 425
+    long3col  426, 427, 428, 429, 430
+    long3col-booktabs  431
+    long3colborder  432, 433
+    long3colheader  434, 435, 436, 437
+    long3colheaderborder  438, 439
+    long4col  440, 441, 442, 443, 444
+    long4col-booktabs  445
+    long4colborder  446, 447
+    long4colheader  448, 449, 450, 451
+    long4colheaderborder  452, 453
+    longborder  454
+    longheader  455, 456, 457, 458
+    longheaderborder  459, 460
+    longragged  461, 462, 463, 464
+    longragged-booktabs  465
+    longragged3col  466, 467, 468, 469
+    longragged3col-booktabs  470
+    longragged3colborder  471
+    longragged3colheader  472, 473, 474
+    longragged3colheaderborder  475
+    longraggedborder  476
+    longraggedheader  477, 478, 479
+    longraggedheaderborder  480
+    mcolalttree  481
+    mcolalttreegroup  482
+    mcolalttreehypergroup  483
+    mcolalttreespannav  484
+    mcolindex  485, 486
+    mcolindexgroup  487
+    mcolindexhypergroup  488
+    mcolindexspannav  489
+    mcoltree  490
+    mcoltreegroup  491
+ + +    mcoltreehypergroup  492, 493
+    mcoltreenoname  494
+    mcoltreenonamegroup  495
+    mcoltreenonamehypergroup  496
+    mcoltreenonamespannav  497
+    mcoltreespannav  498
+    super  499, 500, 501, 502
+    super3col  503, 504, 505, 506
+    super3colborder  507
+    super3colheader  508, 509
+    super3colheaderborder  510
+    super4col  511, 512, 513, 514, 515
+    super4colborder  516, 517
+    super4colheader  518, 519, 520
+    super4colheaderborder  521, 522
+    superborder  523
+    superheader  524, 525
+    superheaderborder  526, 527
+    superragged  528, 529, 530, 531
+    superragged3col  532, 533, 534, 535
+    superragged3colborder  536
+    superragged3colheader  537, 538
+    superragged3colheaderborder  539
+    superraggedborder  540
+    superraggedheader  541, 542
+    superraggedheaderborder  543
+    tree  544, 545, 546, 547, 548, 549, 550
+    treegroup  551, 552, 553
+    treehypergroup  554, 555, 556
+    treenoname  557, 558, 559, 560
+    treenonamegroup  561, 562, 563
+    treenonamehypergroup  564, 565
+glossary-bookindex package  566
+glossary-inline package  567, 568
+glossary-list package  569, 570, 571, 572, 573
+glossary-long package  574, 575, 576, 577, 578, 579, 580, 581
+glossary-longbooktabs package  582, 583, 584
+glossary-longnoloc package  585
+glossary-longragged package  586, 587, 588, 589
+glossary-mcols package  590, 591, 592, 593, 594, 595, 596
+glossary-ragged package  597
+glossary-super package  598, 599, 600, 601, 602, 603
+glossary-superragged package  604, 605, 606
+glossary-tree package  607, 608, 609, 610, 611, 612, 613, 614
+glossaryentry (counter)  615, 616, 617, 618
+\glossaryheader  619
+ + +\glossarypostamble  620
+\glossarypreamble  621
+glossarysubentry (counter)  622
+\glossentry  623
+\Glossentrydesc  624
+\glossentrydesc  625
+\Glossentryname  626
+\glossentryname  627
+\Glossentrysymbol  628
+\glossentrysymbol  629
+\GLS  630
+\Gls  631
+\gls  632
+\glsacspace  633
+\glsadd  634
+\glsaddall  635
+\glsaddall options
+    types  636
+\glsaddallunused  637
+\glsaddkey  638
+\glsaddprotectedpagefmt  639
+\glsaddstoragekey  640
+\GlsAddXdyAttribute  641
+\GlsAddXdyCounters  642
+\GlsAddXdyLocation  643
+\glsautoprefix  644
+\glsbackslash  645
+\glscapscase  646
+\glsclearpage  647
+\glsclosebrace  648
+\glscurrentfieldvalue  649
+\glscustomtext  650
+\GLSdesc  651
+\Glsdesc  652
+\glsdesc  653
+\glsdescwidth  654
+\glsdisablehyper  655
+\glsdisp  656
+\glsdisplaynumberlist  657
+\glsdoifexists  658
+\glsdoifexistsordo  659
+\glsdoifexistsorwarn  660
+\glsdoifnoexists  661
+\glsdoifnoexistsordo  662
+\glsdosanitizesort  663
+\glsenableentrycount  664
+ + +\glsenablehyper  665
+\glsentrycounterlabel  666
+\GlsEntryCounterLabelPrefix  667
+\glsentrycurrcount  668
+\Glsentrydesc  669
+\glsentrydesc  670
+\Glsentrydescplural  671
+\glsentrydescplural  672
+\Glsentryfirst  673
+\glsentryfirst  674
+\Glsentryfirstplural  675
+\glsentryfirstplural  676
+\glsentryfmt  677
+\Glsentryfull  678
+\glsentryfull  679
+\Glsentryfullpl  680
+\glsentryfullpl  681
+\glsentryitem  682
+\Glsentrylong  683
+\glsentrylong  684
+\Glsentrylongpl  685
+\glsentrylongpl  686
+\Glsentryname  687
+\glsentryname  688
+\glsentrynumberlist  689
+\Glsentryplural  690
+\glsentryplural  691
+\Glsentryprefix  692
+\glsentryprefix  693
+\Glsentryprefixfirst  694
+\glsentryprefixfirst  695
+\Glsentryprefixfirstplural  696
+\glsentryprefixfirstplural  697
+\Glsentryprefixplural  698
+\glsentryprefixplural  699
+\glsentryprevcount  700
+\Glsentryshort  701
+\glsentryshort  702
+\Glsentryshortpl  703
+\glsentryshortpl  704
+\Glsentrysymbol  705
+\glsentrysymbol  706
+\Glsentrysymbolplural  707
+\glsentrysymbolplural  708
+\Glsentrytext  709
+\glsentrytext  710
+ + +\glsentrytitlecase  711
+\Glsentryuseri  712
+\glsentryuseri  713
+\Glsentryuserii  714
+\glsentryuserii  715
+\Glsentryuseriii  716
+\glsentryuseriii  717
+\Glsentryuseriv  718
+\glsentryuseriv  719
+\Glsentryuserv  720
+\glsentryuserv  721
+\Glsentryuservi  722
+\glsentryuservi  723
+\glsexpandfields  724
+\glsfielddef  725
+\glsfieldedef  726
+\glsfieldfetch  727
+\glsfieldgdef  728
+\glsfieldxdef  729
+\glsfindwidesttoplevelname  730
+\GLSfirst  731
+\Glsfirst  732
+\glsfirst  733
+\GLSfirstplural  734
+\Glsfirstplural  735
+\glsfirstplural  736
+\glsgenacfmt  737
+\glsgenentryfmt  738
+\glsgetgrouptitle  739
+\glsglossarymark  740, 741
+\glsgroupheading  742
+\glsgroupskip  743
+\glshyperlink  744
+\glshypernavsep  745
+\glsifhyperon  746
+\glsIfListOfAcronyms  747
+\glsifplural  748
+\glsinlinedescformat  749
+\glsinlineemptydescformat  750
+\glsinlinenameformat  751
+\glsinlineparentchildseparator  752
+\glsinlineseparator  753
+\glsinlinesubdescformat  754
+\glsinlinesubnameformat  755
+\glsinlinesubseparator  756
+\glsinsert  757
+ + +\glslabel  758
+\glslabeltok  759
+\glsletentryfield  760
+\glslink  761
+\glslink options
+    counter  762, 763
+    format  764, 765, 766, 767, 768, 769, 770, 771
+    hyper  772, 773, 774, 775, 776, 777, 778
+    local  779
+\glslinkcheckfirsthyperhook  780
+\glslinkpostsetkeys  781
+\glslinkvar  782
+\glslistdottedwidth  783
+\glslistnavigationitem  784
+\glslocalreset  785
+\glslocalresetall  786
+\glslocalunset  787
+\glslocalunsetall  788
+\glslongtok  789
+\glsmcols  790
+\glsmoveentry  791
+\GLSname  792
+\Glsname  793
+\glsname  794
+\glsnamefont  795
+\glsnavhypertarget  796
+\glsnavigation  797
+\glsnoexpandfields  798
+\glsnoidxdisplayloc  799
+\glsnumberlistloop  800
+\glsnumlistlastsep  801
+\glsnumlistsep  802
+\glsopenbrace  803
+\glspagelistwidth  804
+\glspar  805
+\glspatchtabularx  806
+\glspercentchar  807
+\GLSpl  808
+\Glspl  809
+\glspl  810
+\GLSplural  811
+\Glsplural  812
+\glsplural  813
+\glspluralsuffix  814
+\glspostdescription  815
+\glspostinline  816
+ + +\glspostlinkhook  817
+\glsprestandardsort  818
+\glsquote  819
+\glsrefentry  820
+\glsreset  821
+\glsresetall  822
+\glsresetentrycounter  823
+\glsrestoreLToutput  824
+\glssee  825
+\glsseeformat  826
+\glsseeitemformat  827
+\glsseelastsep  828
+\glsseesep  829
+\glsSetAlphaCompositor  830
+\glsSetCompositor  831
+\glssetexpandfield  832
+\glssetnoexpandfield  833
+\GlsSetQuote  834
+\glsSetSuffixF  835
+\glsSetSuffixFF  836
+\glssetwidest  837
+\GlsSetWriteIstHook  838
+\GlsSetXdyCodePage  839
+\GlsSetXdyFirstLetterAfterDigits  840
+\GlsSetXdyLanguage  841
+\GlsSetXdyLocationClassOrder  842
+\GlsSetXdyMinRangeLength  843
+\GlsSetXdyNumberGroupOrder  844
+\glsshorttok  845
+\glsshowtarget  846
+\glssortnumberfmt  847
+\glssubentrycounterlabel  848
+\glssubentryitem  849
+\GLSsymbol  850
+\Glssymbol  851
+\glssymbol  852
+\glstarget  853
+\GLStext  854
+\Glstext  855
+\glstext  856
+\glstextformat  857
+\glstextup  858
+\glstildechar  859
+\glstocfalse  860
+\glstoctrue  861
+\glstreechildpredesc  862
+ + +\glstreegroupheaderfmt  863
+\glstreeindent  864
+\glstreeitem  865
+\glstreenamebox  866
+\glstreenamefmt  867
+\glstreenavigationfmt  868
+\glstreepredesc  869
+\glstreesubitem  870
+\glstreesubsubitem  871
+\glstype  872
+\glsunset  873
+\glsunsetall  874
+\GlsUseAcrEntryDispStyle  875
+\GlsUseAcrStyleDefs  876
+\GLSuseri  877
+\Glsuseri  878
+\glsuseri  879
+\GLSuserii  880
+\Glsuserii  881
+\glsuserii  882
+\GLSuseriii  883
+\Glsuseriii  884
+\glsuseriii  885
+\GLSuseriv  886
+\Glsuseriv  887
+\glsuseriv  888
+\GLSuserv  889
+\Glsuserv  890
+\glsuserv  891
+\GLSuservi  892
+\Glsuservi  893
+\glsuservi  894
+\glswrallowprimitivemodsfalse  895
+\glswrite  896
+\glswriteentry  897
+

H +html package  898
+hyperref package  899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921
+

I +\ifglossaryexists  922
+\ifglsdescsuppressed  923
+\ifglsentryexists  924
+ + +\ifglsfieldcseq  925
+\ifglsfielddefeq  926
+\ifglsfieldeq  927
+\ifglshaschildren  928
+\ifglshasdesc  929
+\ifglshasfield  930
+\ifglshaslong  931
+\ifglshasparent  932
+\ifglshasprefix  933
+\ifglshasprefixfirst  934
+\ifglshasprefixfirstplural  935
+\ifglshasprefixplural  936
+\ifglshasshort  937
+\ifglshassymbol  938
+\ifglsucmark  939
+\ifglsused  940, 941
+\ifignoredglossary  942
+imakeidx package  943
+index package  944
+inputenc package  945, 946, 947, 948, 949, 950, 951
+internal fields:
+    location  952
+

L +latex  953, 954
+latexmk  955, 956, 957
+Latin alphabet  958, 959, 960
+Latin character  961, 962, 963, 964, 965, 966, 967
+link text  968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016
+\loadglsentries  1017
+location list  see number list
+\longnewglossaryentry  1019
+\longprovideglossaryentry  1020
+longtable package  1021, 1022
+

M +makeglossaries  1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103
+    -d  1104
+    -k  1105
+    -m  1106
+    -Q  1107
+    -q  1108
+    -x  1109
+ + +\makeglossaries  1110
+makeglossaries-lite  1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127
+makeglossariesgui  1128, 1129, 1130
+makeidx package  1131
+makeindex  1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245
+    -g  1246, 1247, 1248
+    -l  1249, 1250, 1251, 1252, 1253
+\makenoidxglossaries  1254
+memoir class  1255, 1256, 1257, 1258
+mfirstuc package  1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266
+multicol package  1267
+mwe package  1268
+

N +nameref package  1269
+\newacronym  1270
+\newacronymstyle  1271
+\newglossary  1272
+\newglossary*  1273
+\newglossaryentry  1274
+\newglossaryentry options
+    access  1275
+    description  1276, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, 1293
+    descriptionaccess  1294
+    descriptionplural  1295, 1296, 1297, 1298
+    descriptionpluralaccess  1299
+    entrycounter  1300, 1301
+    first  1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326
+    firstaccess  1327
+    firstplural  1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345
+    firstpluralaccess  1346
+    format  1347
+    long  1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360
+    longaccess  1361
+    longplural  1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1372
+    longpluralaccess  1373
+    name  1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409
+    nonumberlist  1410
+    parent  1411, 1412, 1413, 1414
+    plural  1415, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431
+    pluralaccess  1432
+    prefix  1433, 1434, 1435, 1436, 1437, 1438, 1439
+ + +    prefixfirst  1440, 1441, 1442, 1443, 1444
+    prefixfirstplural  1445, 1446, 1447, 1448, 1449
+    prefixplural  1450, 1451, 1452, 1453, 1454, 1455
+    see  1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474
+    short  1475, 1476, 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485
+    shortaccess  1486
+    shortplural  1487, 1488, 1489, 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498
+    shortpluralaccess  1499
+    sort  1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533
+    subentrycounter  1534
+    symbol  1535, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547
+    symbolaccess  1548
+    symbolplural  1549, 1550, 1551
+    symbolpluralaccess  1552
+    text  1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, 1573
+    textaccess  1574
+    type  1575, 1576, 1577
+    user1  1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588
+    user2  1589, 1590, 1591, 1592
+    user3  1593, 1594, 1595
+    user4  1596, 1597, 1598
+    user5  1599, 1600, 1601
+    user6  1602, 1603, 1604, 1605
+\newglossarystyle  1606
+\newignoredglossary  1607
+\newterm  1608
+ngerman package  1609, 1610, 1611, 1612
+\noist  1613
+Non-Latin Alphabet  1614
+non-Latin character  1615, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625
+\nopostdesc  1626
+number list  1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693
+

O +\oldacronym  1694
+

P +package options:
+    acronym  1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718
+        true  1719, 1720
+ + +    acronymlists  1721, 1722, 1723, 1724, 1725, 1726, 1727
+    acronyms  1728, 1729
+    automake  1730, 1731, 1732, 1733
+        false  1734
+        immediate  1735, 1736, 1737
+        true  1738, 1739
+    compatible-2.07  1740, 1741, 1742
+    compatible-3.07  1743, 1744, 1745
+    counter  1746, 1747, 1748, 1749, 1750
+        page  1751
+    counterwithin  1752, 1753, 1754, 1755, 1756
+    debug  1757, 1758, 1759
+        false  1760
+        showtargets  1761, 1762, 1763
+        true  1764, 1765, 1766
+    description  1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1775
+    dua  1776, 1777
+    entrycounter  1778, 1779, 1780, 1781, 1782
+        false  1783
+        true  1784
+    esclocations  1785
+        false  1786, 1787, 1788
+        true  1789
+    footnote  1790, 1791, 1792, 1793, 1794, 1795
+    hyperfirst  1796, 1797, 1798, 1799
+        false  1800, 1801, 1802, 1803, 1804
+        true  1805, 1806
+    index  1807, 1808, 1809, 1810, 1811, 1812, 1813
+    indexonlyfirst  1814, 1815, 1816
+        false  1817
+    kernelglossredefs  1818
+        false  1819
+    makeindex  1820, 1821, 1822
+    ngerman  1823
+    noglossaryindex  1824
+    nogroupskip  1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832
+        false  1833
+    nohypertypes  1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842
+        index  1843
+    nolangwarn  1844, 1845
+    nolist  1846, 1847, 1848
+    nolong  1849, 1850, 1851, 1852
+    nomain  1853, 1854, 1855, 1856, 1857, 1858, 1859, 1860, 1861
+    nonumberlist  1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871
+    nopostdot  1872, 1873
+        false  1874
+ + +    noredefwarn  1875
+    nostyles  1876, 1877, 1878, 1879, 1880, 1881, 1882
+    nosuper  1883, 1884, 1885, 1886
+    notranslate  1887, 1888, 1889
+    notree  1890, 1891, 1892, 1893
+    nowarn  1894, 1895, 1896
+    numberedsection  1897, 1898, 1899, 1900, 1901
+        autolabel  1902, 1903
+        false  1904
+        nameref  1905
+        nolabel  1906
+    numberline  1907, 1908
+    numbers  1909, 1910, 1911
+    order  1912, 1913, 1914
+        letter  1915, 1916, 1917, 1918, 1919
+        word  1920, 1921, 1922
+    record  1923
+    sanitizesort  1924, 1925, 1926
+        false  1927, 1928, 1929, 1930, 1931, 1932
+        true  1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941
+    savenumberlist  1942, 1943
+        false  1944
+    savewrites  1945, 1946, 1947
+        false  1948
+    section  1949, 1950
+    seeautonumberlist  1951, 1952, 1953, 1954
+    seenoindex  1955, 1956
+        ignore  1957
+        warn  1958
+    shortcuts  1959, 1960
+    smallcaps  1961, 1962, 1963, 1964, 1965, 1966
+    smaller  1967, 1968, 1969, 1970, 1971
+    sort  1972
+        def  1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983
+        none  1984, 1985, 1986, 1987
+        standard  1988, 1989, 1990
+        use  1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+    style  2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+        index  2010
+        list  2011
+    subentrycounter  2012, 2013, 2014, 2015, 2016, 2017
+        false  2018
+    symbols  2019, 2020, 2021
+    toc  2022, 2023, 2024, 2025, 2026, 2027
+    translate  2028, 2029, 2030, 2031
+        babel  2032, 2033, 2034, 2035, 2036, 2037
+ + +        false  2038, 2039, 2040, 2041
+        true  2042, 2043, 2044, 2045
+    ucfirst  2046
+    ucmark  2047, 2048
+        false  2049
+        true  2050
+    xindy  2051, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064
+    xindygloss  2065, 2066
+    xindynoglsnumbers  2067, 2068
+page (counter)  2069, 2070
+page type precedence  2071
+pdflatex  2072, 2073
+\PGLS  2074
+\Pgls  2075
+\pgls  2076
+\PGLSpl  2077
+\Pglspl  2078
+\pglspl  2079
+pod2man  2080
+polyglossia package  2081, 2082, 2083, 2084, 2085, 2086, 2087
+\printacronyms  2088
+\printglossaries  2089
+\printglossary  2090
+\printglossary options
+    entrycounter  2091
+    nogroupskip  2092
+    nonumberlist  2093
+    nopostdot  2094
+    numberedsection  2095
+    style  2096, 2097, 2098, 2099, 2100
+    subentrycounter  2101
+    title  2102, 2103, 2104, 2105, 2106
+    toctitle  2107
+    type  2108, 2109
+\printindex  2110
+\printnoidxglossaries  2111
+\printnoidxglossary  2112
+\printnoidxglossary options
+    sort  2113, 2114, 2115, 2116
+\printnumbers  2117
+\printsymbols  2118
+\provideglossaryentry  2119
+

R +relsize package  2120, 2121
+ + +

S +sanitize  2122, 2123, 2124, 2125, 2126
+scrwfile package  2127
+\SetAcronymLists  2128
+\setacronymstyle  2129
+\setglossarypreamble  2130
+\setglossarysection  2131
+\setglossarystyle  2132
+\setStyleFile  2133
+\setupglossaries  2134
+stix package  2135
+\subglossentry  2136
+supertabular package  2137, 2138, 2139
+

T +tabularx package  2140, 2141, 2142, 2143
+textcase package  2144, 2145, 2146
+theglossary (environment)  2147
+tracklang package  2148, 2149, 2150
+translator package  2151, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175
+

X +xfor package  2176
+xindy  2177, 2178, 2179, 2180, 2181, 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2190, 2191, 2192, 2193, 2194, 2195, 2196, 2197, 2198, 2199, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221, 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 2313, 2314, 2315, 2316, 2317, 2318, 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332
+    -C  2333, 2334, 2335, 2336, 2337
+    -I  2338, 2339
+    -L  2340, 2341, 2342, 2343
+    -M  2344
+xkeyval package  2345, 2346, 2347
+xspace package  2348, 2349, 2350, 2351, 2352, 2353, 2354
+

+ + +

1.1That is, if the term has been referenced using any of the commands described in §6 Links to Glossary +Entries and §7 Adding an Entry to the Glossary Without Generating Text or via \glssee (or the see key) or +commands such as \acrshort.

+

1.2Except for Klingon, which is supported by xindy, but not by the CLDR.

+

1.3Note that although I’ve written latex in this section, it’s better to use pdflatex, where possible, for +the reasons given earlier.

+

1.4deprecated, use babel instead

+

1.5Added to version makeglossaries 2.18.

+

1.6As from v3.01 \gls is no longer fragile and doesn’t need protecting.

+

1.7The batch file makeglossaries.bat has been removed since the TEX distributions for Windows +provide makeglossaries.exe.

+

2.1bug fix in v4.16 has corrected the code to ensure this.

+

2.2unless memoir is loaded, which case it uses \markboth

+

2.3Actually it uses \mfirstucMakeUppercase which is set to textcase’s \MakeTextUppercase by the glossaries +package. This makes it consistent with \makefirstuc. (The textcase package is automatically loaded by +glossaries.)

+

2.4Actually it sets \acronymtype to \glsdefaulttype if the acronym package option is not used, but +\glsdefaulttype usually has the value main unless the nomain option has been used.

+

4.1This is because \acronymtype is set to \glsdefaulttype if the acronym package option is not +used.

+

6.1See also “Displaying the glossary” in the documented code, glossaries-code.pdf.

+

6.2I’ve used \MakeUppercase in all the examples for clarity, but it will actually use \mfirstucMakeUppercase.

+

6.3\glsdisplayfirst and \glsdisplay are now deprecated. Backwards compatibility should be preserved +but you may need to use the compatible-3.07 option

+

8.1makeindex will always assign a location number, even if it’s not needed, so it needs to be +discarded.

8.2If you redefine \glsseeformat, keep the default value of the optional argument as \seename as +both see and \glssee explicitly write [\seename] in the output file if no optional argument is +given.

+

8.3In versions before 3.0, \glsentryname was used, but this could cause problems when the name key was +sanitized.

9.1versions before 3.0 used \glsentryname as the default, but this could cause problems when name had +been sanitized.

10.1you can’t use the longheaderborder style for this example as you can’t use the longtable environment in +two column mode.

11.1see \glsSetCompositor described in §3 Setting Up

+

11.2see \glsSetAlphaCompositor described in §3 Setting Up

+

11.3With glossaries-extra seealso is appended to the end of the list.

+

13.1as from version 1.18

13.2See David Carlisle’sexplanation in http://tex.stackexchange.com/questions/86565/drawbacks-of-xspace

+

15.1These lengths will not be available if you use both the nolong and nosuper package options or if you +use the nostyles package option unless you explicitly load the relevant package.

+

15.2This style was supplied by Axel Menzel.

+

15.3e.g. with the flowfram package.

+

17.1Single letter words, such as “a” and “I” should typically not appear at the end of a line, hence the +non-breakable space after “a” in the prefix field.

+

17.2The earlier caveats about initial non-Latin characters apply.

+ + + + + + diff --git a/macros/latex/contrib/glossaries/glossaries-user.pdf b/macros/latex/contrib/glossaries/glossaries-user.pdf new file mode 100644 index 0000000000..7f160c9fb7 Binary files /dev/null and b/macros/latex/contrib/glossaries/glossaries-user.pdf differ diff --git a/macros/latex/contrib/glossaries/glossaries-user.tex b/macros/latex/contrib/glossaries/glossaries-user.tex new file mode 100644 index 0000000000..698933ac27 --- /dev/null +++ b/macros/latex/contrib/glossaries/glossaries-user.tex @@ -0,0 +1,13059 @@ +\documentclass[report,inlinetitle,widecs]{nlctdoc} + +\usepackage[inner=0.5in,includemp]{geometry} + +\usepackage{array} +\usepackage{alltt} +\usepackage{pifont} +\usepackage{textcomp} +\usepackage{amssymb} +\ifpdf + \usepackage{lmodern} + \usepackage{mathpazo} + \usepackage[scaled=.88]{helvet} + \usepackage{courier} + \usepackage{metalogo} +\else + \newcommand{\grimace}{{\fontencoding {U}\fontfamily{futs}\selectfont \char77}} + \providecommand{\XeLaTeX}{XeLaTeX} + \providecommand{\XeTeX}{XeTeX} +\fi +\usepackage[colorlinks, + bookmarks, + linkcolor=blue, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, + pdftitle={User Manual for glossaries.sty}, + pdfkeywords={LaTeX,package,glossary,acronyms}]{hyperref} +\usepackage{xr-hyper} +\usepackage[ + xindy, + nonumberlist, + toc, + nopostdot, + nogroupskip, + style=altlist +]{glossaries} +\usepackage{glossary-inline} + +\pagestyle{headings} + +\glsnoexpandfields + +\renewcommand*{\glsseeformat}[3][\seename]{% + (\xmakefirstuc{#1} \glsseelist{#2}.)% +} + +\renewcommand*{\glossarypreamble}{% +\emph{This glossary style was setup using:} +\begin{ttfamily} +\begin{tabbing} +\cs{usepackage}[\=xindy,\\ +\+\>nonumberlist,\\ + toc,\\ + nopostdot,\\ + style=altlist,\\ + nogroupskip]\{glossaries\} +\end{tabbing} +\end{ttfamily} +} + +\ifpdf +\else + % Need an extra line break in the html version + % (Don't have time to fiddle with cfg files!) + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{#1}\glstarget{#1}{\glossentryname{#1}}]\mbox{}\newline + \glossentrydesc{#1}\glspostdescription\space #2\newline}% +\fi + +\makeglossaries + +\renewcommand*{\main}[1]{\hyperpage{#1}} +\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}} +\newcommand*{\itermdef}[1]{\index{#1|htextbf}} + +\newcommand{\itempar}[1]{\item[{#1}]\mbox{}\par} + +\newcommand{\pkgoptdef}[1]{\hypertarget{pkgopt:#1}{\pkgopt{#1}}} + +\newcommand{\glslike}{\hyperref[sec:gls-like]{\cs{gls}-like}} +\newcommand{\glstextlike}{\hyperref[sec:glstext-like]{\cs{glstext}-like}} + +\IndexPrologue{\chapter*{\indexname} + \addcontentsline{toc}{chapter}{\indexname}% + \markboth{\indexname}{\indexname}} + +\longnewglossaryentry{indexingapp}% +{ + name={Indexing application}, + text={indexing application} +}% +{% + An application (piece of software) separate from + \TeX/\LaTeX\ that collates and sorts information that has an + associated page reference. Generally the information is an index + entry but in this case the information is a glossary entry. + There are two main indexing applications that are used with \TeX: + \gls{makeindex} and \gls{xindy}. These are both + \gls{cli} applications. +} + +\longnewglossaryentry{cli} +{ + name={Command Line Interface (CLI)}, + first={command line interface (CLI)}, + text={CLI} +} +{% + An application that doesn't have a graphical user + interface. That is, an application that doesn't have any windows, + buttons or menus and can be run in + \href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{a command + prompt or terminal}. +} + +\longnewglossaryentry{xindy}{% + name={\appfmt{xindy}\index{xindy=\appfmt{xindy}|htextbf}}, + sort={xindy}, + text={\appfmt{xindy}\iapp{xindy}} +}% +{% + A flexible \gls{indexingapp} with multilingual + support written in Perl. +} + +\newglossaryentry{makeindex}{% +name={\appfmt{makeindex}\index{makeindex=\appfmt{makeindex}|htextbf}},% +sort={makeindex},% +text={\appfmt{makeindex}\iapp{makeindex}},% +description={An \gls{indexingapp}.} +} + +\newglossaryentry{bib2gls}{% +name={\appfmt{bib2gls}\index{bib2gls=\appfmt{bib2gls}|htextbf}},% +sort={bib2gls},% +text={\appfmt{bib2gls}\iapp{bib2gls}},% +description={An \gls{indexingapp} that combines two functions in +one: (1) fetches entry definition from a \texttt{.bib} file +based on information provided in the \texttt{.aux} file (similar +to \appfmt{bibtex}); (2) hierarchically sorts and collates location +lists (similar to \appfmt{makeindex} and \appfmt{xindy}). +This application is designed for use with \styfmt{glossaries-extra} +and can't be used with just the base \styfmt{glossaries} package.} +} + +\newglossaryentry{makeglossaries}{% +name={\appfmt{makeglossaries}\index{makeglossaries=\appfmt{makeglossaries}|htextbf}},% +sort={makeglossaries},% +text={\appfmt{makeglossaries}\iapp{makeglossaries}},% +description={A custom designed Perl script interface +to \gls{xindy} and \gls{makeindex} provided with the \styfmt{glossaries} +package. \TeX\ distributions on Windows convert the original +\texttt{makeglossaries} script into an executable +\texttt{makeglossaries.exe} for convenience (but Perl is still +required).} +} + +\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 actually distributed 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.} +} + +\longnewglossaryentry{makeglossariesgui}{% +name={\appfmt{makeglossariesgui}\index{makeglossariesgui=\appfmt{makeglossariesgui}|htextbf}},% +sort={makeglossariesgui},% +text={\appfmt{makeglossariesgui}\iapp{makeglossariesgui}}% +}% +{% + A Java GUI alternative to \gls{makeglossaries} that + also provides diagnostic tools. Available separately on + \href{http://ctan.org/pkg/makeglossariesgui}{CTAN}. +} + +\newglossaryentry{numberlist}{% +name={Number list\itermdef{number list}},% +sort={number list},% +text={number list\iterm{number list}},% +description={A list of \glslink{entrylocation}{entry locations} (also +called a location list). The number list can be suppressed using the +\pkgopt{nonumberlist} package option.} +} + +\newglossaryentry{entrylocation}{% +name={Entry location\itermdef{entry location}},% +sort={entry location},% +text={entry location\iterm{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},% +text={location list}, +sort={location list},% +description={A list of \glslink{entrylocation}{entry locations}. +See \gls{numberlist}.}% +} + +\newglossaryentry{linktext}{% +name={Link text\itermdef{link text}}, +sort={link text},% +text={link text\iterm{link text}}, +description={The text produced by commands such as \ics{gls}. It may +or may not be a hyperlink to the glossary.} +} + +\let\glsd\glsuseri +\let\glsation\glsuserii + +\longnewglossaryentry{firstuse}{% +name={First use\ifirstuse}, +sort={first use},% +text={first use},% +user1={first used}} +{% + 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}. + \glsseeformat{firstuseflag,firstusetext}{} +} + +\longnewglossaryentry{firstuseflag}{% +name={First use flag\ifirstuseflag}, +sort={first use flag},% +text={first use flag}% +} +{% + A conditional that determines whether or not the entry + has been used according to the rules of \gls{firstuse}. Commands + to unset or reset this conditional are described in + \sectionref{sec:glsunset}. +} + +\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} or by \ics{defglsentry}.)}% +} + +\longnewglossaryentry{sanitize}{% +name={Sanitize\itermdef{sanitize}},% +sort={sanitize}, +text={sanitize\iterm{sanitize}},% +user1={sanitized\protect\iterm{sanitize}},% +user2={sanitization\protect\iterm{sanitize}}% +}% +{% + Converts command names into character sequences. That is, a command called, + say, \cs{foo}, is converted into the sequence of characters: + \cs{}, \texttt{f}, \texttt{o}, \texttt{o}. Depending on the font, + the backslash character may appear as a dash when used in the + main document text, so \cs{foo} will appear as: ---foo. + + Earlier versions of \styfmt{glossaries} used this technique to write + information to the files used by the indexing applications to + prevent problems caused by fragile commands. Now, this is only used + for the \gloskey{sort} key. +} + +\newglossaryentry{latinchar}{% + name={Latin Character\itermdef{Latin character}}, + text={Latin character\iterm{Latin character}}, + sort={Latin character}, + description={One of the letters \texttt{a}, \ldots, \texttt{z}, + \texttt{A}, \ldots, \texttt{Z}\@. + See also \gls{exlatinchar}.} +} + +\newglossaryentry{exlatinchar}{% + name={Extended Latin Character\itermdef{extended Latin character}}, + text={extended Latin character\iterm{extended Latin character}}, + sort={extended Latin character}, + description={A character that's created by combining \glspl{latinchar} + to form ligatures (e.g.\ \ae) or by applying diacritical marks + to a~\gls*{latinchar} or characters (e.g.\ \'a or \o). + See also \gls{nonlatinchar}.} +} + +\newglossaryentry{latexexlatinchar}{% + name={Standard \LaTeX\ Extended Latin Character\itermdef{standard +\LaTeX\ extended Latin character}}, + text={standard \LaTeX\ extended Latin character\iterm{standard +\LaTeX\ extended Latin character}}, + sort={standard LaTeX extended Latin character}, + description={An \gls{exlatinchar} that can be created by a~core +\LaTeX\ command, such as \cs{o} (\o) or \cs{'}\texttt{e} (\'e). + That is, the character can be produced without the need to load + a~particular package.} +} + +\newglossaryentry{nonlatinchar}{% + name={Non-Latin Character\itermdef{non-Latin character}}, + text={non-Latin character\iterm{non-Latin character}}, + sort={non-Latin character}, + description={An \gls{exlatinchar} or a~character that isn't + a~\gls{latinchar}.} +} + +\newglossaryentry{latinalph}{% + name={Latin Alphabet\itermdef{Latin alphabet}}, + text={Latin alphabet\iterm{Latin alphabet}}, + sort={Latin alphabet}, + description={The alphabet consisting of \glspl{latinchar}. + See also \gls{exlatinalph}.} +} + +\newglossaryentry{exlatinalph}{% + name={Extended Latin Alphabet\itermdef{Extended Latin Alphabet}}, + text={extended Latin alphabet}, + sort={extended Latin alphabet}, + description={An alphabet consisting of \glspl{latinchar} + and \glspl{exlatinchar}.} +} + +\newglossaryentry{nonlatinalph}{% + name={Non-Latin Alphabet\itermdef{Non-Latin Alphabet}}, + text={non-Latin alphabet}, + sort={non-Latin alphabet}, + description={An alphabet consisting of \glspl{nonlatinchar}.} +} + +\newglossaryentry{glossaries-extra}{% + name={\styfmt{glossaries-extra}}, + sort={glossaries-extra}, + description={A separate package that extends the + \styfmt{glossaries} package, providing new features or improving + existing features. If you want to use \styfmt{glossaries-extra}, + you must have both the \styfmt{glossaries} package and the + \styfmt{glossaries-extra} package installed.} +} + +\ifpdf +\externaldocument{glossaries-code} +\fi + +\doxitem{Option}{option}{package options} +\doxitem{GlsKey}{key}{glossary keys} +\doxitem{Style}{style}{glossary styles} +\doxitem{Counter}{counter}{glossary counters} + +\setcounter{IndexColumns}{2} + +\newcommand*{\tick}{\ding{51}} + +\newcommand*{\yes}{\ding{52}} +\newcommand*{\no}{\ding{56}} + +\newcommand*{\proyes}{\textcolor{green}{\yes}} +\newcommand*{\prono}{\textcolor{red}{\no}} + +\newcommand*{\conyes}{\textcolor{red}{\yes}} +\newcommand*{\conno}{\textcolor{green}{\no}} + +\makeatletter +\newcommand{\fnsymmark}[1]{#1} +\newcommand*{\fnsym}[1]{\textsuperscript{\fnsymmark{% + \ifcase#1\or \textasteriskcentered \or \textdagger + \or \textdaggerdbl \or \textsection + \or $\lozenge$ \or \textparagraph + \or \#\or {\fontfamily{cmr}\selectfont\textreferencemark}% + \or \@nlctdoc@if@usingtexht{\HCode{&\#x2051;}}{\shortstack{*\\[-1.5ex]*}}% + \or $\star$ + \or \ding{94}% + \else + \number#1 + \fi +}}}% +\newcommand*{\optionlabel}[1]{% + \@glstarget{option#1}{Option~#1}} +\makeatother + +\newcounter{option} +\newcommand{\optionsec}[2][\opttitle]{% + \def\opttitle{\appfmt{#2}}% + \refstepcounter{option}% + \pdfbookmark[2]{Option~\theoption\space (#2)}{option\theoption}% + \subsection*{\protect\optionlabel{\theoption} (#1)}% +} + +\newcommand*{\opt}[1]{\hyperlink{option#1}{Option~#1}} +\newcommand*{\optsor}[2]{Options~\hyperlink{option#1}{#1} +or~\hyperlink{option#2}{#2}} +\newcommand*{\optsand}[2]{Options~\hyperlink{option#1}{#1} +and~\hyperlink{option#2}{#2}} + + +\newcommand*{\ifirstuse}{\iterm{first use}} +\newcommand*{\ifirstuseflag}{\iterm{first use>flag}} +\newcommand*{\ifirstusetext}{\iterm{first use>text}} + +\newcommand*{\firstuse}{\gls{firstuse}} +\newcommand*{\firstuseflag}{\gls{firstuseflag}} +\newcommand*{\firstusetext}{\gls{firstusetext}} + + +\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*{\mkidxopt}[1]{\texttt{-#1}\index{makeindex=\appfmt{makeindex}>#1=\texttt{-#1}|hyperpage}} + +\newcommand*{\xdyopt}[1]{\texttt{-#1}\index{xindy=\appfmt{xindy}>#1=\texttt{-#1}|hyperpage}} + +\newcommand*{\mkglsopt}[1]{\texttt{-#1}\index{makeglossaries=\appfmt{makeglossaries}>#1=\texttt{-#1}|hyperpage}} + +\newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}} +\newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}} +\newcommand*{\optfmt}[1]{\textsf{#1}} +\newcommand*{\field}[1]{\optfmt{#1}\index{internal fields:>#1=\protect\optfmt{#1}|main}} + +\newcommand*{\glostyle}[1]{\textsf{#1}\index{glossary styles:>#1={\protect\ttfamily#1}|main}} + +\newcommand*{\acrstyle}[1]{\textsf{#1}\index{acronym styles:>#1={\protect\ttfamily#1}|main}} + +\newcounter{sample} +\newcommand{\exitem}[2][sample]{% + \item[\texttt{#1#2.tex}]% + \refstepcounter{sample}\label{ex:#1#2}} + +\newenvironment{samplelist}% +{\begin{description}}% +{\end{description}} + +\newcommand*{\samplefile}[2][sample]{% + \hyperref[ex:#1#2]{\texttt{#1#2.tex}}} + +\ifpdf + \newcommand*{\htmldoc}[2]{\qt{#1}} +\else + \newcommand*{\htmldoc}[2]{\href{#2.html}{\qt{#1}}} +\fi + +\begin{document} +\MakeShortVerb{"} +\DeleteShortVerb{\|} + + \title{User Manual for glossaries.sty v4.42} + \author{Nicola L.C. Talbot\\% + \url{http://www.dickimaw-books.com/}} + + \date{2019-01-06} + \maketitle + +\begin{abstract} +The \styfmt{glossaries} package provides a means to define terms or +abbreviations or symbols that can be referenced within your document. +Sorted lists with collated \glslink{entrylocation}{locations} can be +generated either using \TeX\ or using a supplementary \gls{indexingapp}. + +Additional features not provided here may be available through +the extension package \gls{glossaries-extra} which, if required, +needs to be installed separately. New features will be added to +\gls*{glossaries-extra}. Versions of the \styfmt{glossaries} +package after v4.21 will mostly be just bug fixes. Note that +\gls{glossaries-extra} provides an extra indexing option +(\gls{bib2gls}) which isn't available with just the base +\sty{glossaries} package. +\end{abstract} + +If you require multilingual support you must also separately install +the relevant language module. Each language module is distributed +under the name \texttt{glossaries-}\meta{language}, where \meta{language} is the +root language name. For example, \texttt{glossaries-french} +or \texttt{glossaries-german}. If a language module is required, +the \styfmt{glossaries} package will automatically try to load it and +will give a warning if the module isn't found. See +\sectionref{sec:languages} for further details. +If there isn't any support available for your language, use +the \pkgopt{nolangwarn} package option to suppress the warning +and provide your own translations. (For example, use +the \gloskey[printglossary]{title} key in \cs{printglossary}.) + +The \styfmt{glossaries} package requires a number of other packages +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} (part of the \sty{datatool} bundle) and \sty{amsgen}. These +packages are all available in the latest \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 (for Linux users) +\href{http://tex.stackexchange.com/questions/14925/updating-tex-on-linux}{Updating +\TeX\ on Linux}. + +Note that occasionally you may find that certain packages need to be +loaded \emph{after} packages that are required by \styfmt{glossaries}. For +example, a package \meta{X} might need to be loaded after \sty{amsgen}. In +which case, load the required package first (for example, +\sty{amsgen}), then \meta{X}, and finally load \styfmt{glossaries}. + +\begin{important} +Documents have wide-ranging styles when it comes to presenting glossaries +or lists of terms or notation. People have their own preferences and +to a large extent this is determined by the kind of information that +needs to go in the glossary. They may just have symbols with +terse descriptions or they may have long technical words with +complicated descriptions. The \styfmt{glossaries} package is +flexible enough to accommodate such varied requirements, but this +flexibility comes at a price: a~big manual. + +\aargh\ If you're freaking out at the size of this manual, start with +\texttt{glossariesbegin.pdf} (\qt{The glossaries package: a guide +for beginnners}). You should find it in the same directory as this +document or try \texttt{texdoc glossariesbegin.pdf}. Once you've got +to grips with the basics, then come back to this manual to find out +how to adjust the settings. +\end{important} + +\noindent +The \styfmt{glossaries} bundle comes with the following documentation: +\begin{description} +\item[\url{glossariesbegin.pdf}] +If you are a complete beginner, start with +\htmldoc{The glossaries package: a guide for +beginners}{glossariesbegin}. + +\item[\url{glossary2glossaries.pdf}] +If you are moving over from the obsolete \sty{glossary} package, +read \htmldoc{Upgrading from the glossary package to the +glossaries package}{glossary2glossaries}. + +\item[glossaries-user.pdf] +This document is the main user guide for the \styfmt{glossaries} +package. + +\item[\url{glossaries-code.pdf}] +Advanced users wishing to know more about the inner workings of all the +packages provided in the \styfmt{glossaries} bundle should read +\qt{Documented Code for glossaries v4.42}. + +\item[INSTALL] Installation instructions. + +\item[CHANGES] Change log. + +\item[README] Package summary. + +\end{description} +Related resources: +\begin{itemize} +\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{http://www.dickimaw-books.com/faqs/glossariesfaq.html}{\styfmt{glossaries} +FAQ} + +\item \href{http://www.dickimaw-books.com/gallery/#glossaries}{\styfmt{glossaries} +gallery} + +\item +\href{http://www.dickimaw-books.com/gallery/glossaries-styles/}{a +summary of all glossary styles provided by \styfmt{glossaries}} + +\item +\href{http://www.dickimaw-books.com/gallery/glossaries-performance.shtml}{\styfmt{glossaries} +performance} (comparing document build times for the different +options provided by \styfmt{glossaries} and \styfmt{glossaries-extra}). + +\item \href{http://www.dickimaw-books.com/latex/thesis/}{Using LaTeX to Write a PhD Thesis} +(chapter 6). + +\item +\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build} + +\item The +\href{http://ctan.org/pkg/glossaries-extra}{\styfmt{glossaries-extra} package} + +\item \href{http://ctan.org/pkg/bib2gls}{\appfmt{bib2gls}} +\end{itemize} + +\begin{important} +If you use \sty{hyperref} and \styfmt{glossaries}, you must load +\sty{hyperref} \emph{first}. Similarly the \sty{doc} package must +also be loaded before \styfmt{glossaries}. (If \sty{doc} is loaded, +the file extensions for the default main glossary are changed to +\filetype{gls2}, \filetype{glo2} and \filetype{.glg2} to avoid +conflict with \sty{doc}'s changes +glossary.)\hypertarget{pdflatexnote}{}% + +If you are using \sty{hyperref}, it's best to use \app{pdflatex} +rather than \app{latex} (DVI format) as \appfmt{pdflatex} deals with +hyperlinks much better. If you use the DVI format, you will +encounter problems where you have long hyperlinks or hyperlinks in +subscripts or superscripts. This is an issue with the DVI format not +with \styfmt{glossaries}. If you really need to use the DVI format +and have a problem with hyperlinks in maths mode, I recommend you use +\gls{glossaries-extra} with the \texttt{hyperoutside} and +\texttt{textformat} attributes set to appropriate values +for problematic entries. +\end{important} + +\clearpage +\pdfbookmark[0]{Contents}{contents} +\tableofcontents +\clearpage +\pdfbookmark[0]{List of Examples}{examples} +\listofexamples +\clearpage +\pdfbookmark[0]{List of Tables}{tables} +\listoftables + +\clearpage +\printglossaries + +\glsresetall + + \chapter{Introduction} +\label{sec:intro} + +The \styfmt{glossaries} package is provided to assist generating +lists of terms, symbols or abbreviations. (For convenience, these +lists are all referred to as glossaries in this manual.) +The package has a certain amount of flexibility, allowing the +user to customize the format of the glossary and define multiple +glossaries. It also supports glossary styles that +include symbols (in addition to a name and description) for glossary +entries. There is provision for loading a database of glossary +terms. Only those terms indexed\footnote{That is, if the term has been +referenced using any of the commands described in +\sectionref{sec:glslink} and \sectionref{sec:glsadd} or via +\ics{glssee} (or the \gloskey{see} key) or commands such as +\ics{acrshort}.}\ in the document will be added to the glossary. + +The \styfmt{glossaries-extra} package, which is distributed as a +separated bundle, extends the capabilities of +the \styfmt{glossaries} package. The simplest document can be +created with \styfmt{glossaries-extra} (which internally loads the +\styfmt{glossaries} package): +\begin{verbatim} +\documentclass{article} + +\usepackage[ + sort=none,% no sorting or indexing required + abbreviations,% create list of abbreviations + symbols,% create list of symbols + postdot % append a full stop after the descriptions +]{glossaries-extra} + +\newglossaryentry % provided by glossaries.sty + {cafe}% label + {% definition: + name={caf\'e}, + description={small restaurant selling refreshments} + } + +\newabbreviation % provided by glossaries-extra.sty + {html}% label + {HTML}% short form + {hypertext markup language}% long form + +\glsxtrnewsymbol % provided by glossaries-extra.sty 'symbols' option + [description={Archimedes' constant}]% options + {pi}% label + {\ensuremath{\pi}}% symbol + +\begin{document} +First use: \gls{cafe}, \gls{html}, \gls{pi}. +Next use: \gls{cafe}, \gls{html}, \gls{pi}. + +\printunsrtglossaries % list all defined entries +\end{document} +\end{verbatim} + +\textbf{The \styfmt{glossaries} package replaces the \sty{glossary} +package which is now obsolete.} Please see the document +\qtdocref{Upgrading from the glossary package to the glossaries +package}{glossary2glossaries} for assistance in upgrading. + +One of the strengths of this package is its flexibility, however +the drawback of this is the necessity of having a large manual +that covers all the various settings. If you are daunted by the +size of the manual, try starting off with the much shorter +\docref{guide for beginners}{glossariesbegin}. + +\begin{important} +There's a~common misconception that you have to have Perl installed +in order to use the \styfmt{glossaries} package. Perl is \emph{not} +a~requirement but it does increase the available options, +particularly if you use an \gls{exlatinalph} or a~\gls{nonlatinalph}. +\end{important} + +This document uses the \styfmt{glossaries} package. For example, +when viewing the PDF version of this document in a +hyperlinked-enabled PDF viewer (such as Adobe Reader or Okular) if +you click on the word \qt{\gls{xindy}} you'll be taken to the entry +in the glossary where there's a brief description of +the term \qt{\gls*{xindy}}. This is the way the \styfmt{glossaries} +mechanism works. An \gls{indexingapp} is used to generated the +sorted list of terms. The \glspl{indexingapp} are \gls{cli} tools, +which means they can be run directly from a command prompt or terminal, or can +be integrated into some text editors, or you can use a build tool +such as \app{arara} to run them. + +The remainder of this introductory section covers the following: +\begin{itemize} +\item \sectionref{sec:indexingoptions} lists the available indexing +options. + +\item \sectionref{sec:samples} lists the sample documents provided +with this package. + +\item \sectionref{sec:lipsum} lists the dummy glossary files that +may be used for testing. + +\item \sectionref{sec:languages} provides information for users who +wish to write in a language other than English. + +\item \sectionref{sec:makeglossaries} describes how to use an +\gls{indexingapp} to create the sorted glossaries for your document +(\optsor23). + +\end{itemize} + +\section{Indexing Options} +\label{sec:indexingoptions} + +The basic idea behind the \styfmt{glossaries} package is that you +first define your entries (terms, symbols or abbreviations). Then +you can reference these within your document (like \cs{cite} or +\cs{ref}). You can also, optionally, display a~list of the entries +you have referenced in your document (the glossary). This last part, +displaying the glossary, is the part that most new users find +difficult. There are three options available with the base +\styfmt{glossaries} package and two further options with the +extension package \gls{glossaries-extra}. +An overview of these options is given in +\tableref{tab:options}. + +If you are developing a class or package that loads +\styfmt{glossaries}, I recommend that you don't force the user into +a particular indexing method by adding an unconditional \cs{makeglossaries} +into your class or package code. Aside from forcing the user into a +particular indexing method, it means that they're unable to use any +commands that must come before \cs{makeglossaries} (such as +\cs{newglossary}) and they can't switch off the indexing whilst +working on a draft document. + +For a comparison of the various methods when used with large entry +sets or when used with symbols such as \cs{alpha}, see the +\href{http://www.dickimaw-books.com/gallery/glossaries-performance.shtml}{\styfmt{glossaries} performance page}. + +\begin{table}[htbp] + \caption{Glossary Options: Pros and Cons} + \label{tab:options} + {% + \renewcommand{\fnsymmark}[1]{\rlap{#1}}% + \setlength{\tabcolsep}{3pt}% + \centering + \begin{tabular}{@{}>{\raggedright\small}p{0.35\textwidth}ccccc@{}} + & \bfseries \opt1 & \bfseries \opt2 & \bfseries \opt3 + & \bfseries \opt4 & \bfseries \opt5\\ + Requires \gls{glossaries-extra}? & + \conno & \conno & \conno & \conyes & \conyes\\ + Requires an external application? & + \conno & \conyes & \conyes & \conyes & \conno\\ + Requires Perl? & + \conno & \conno & \conyes & \conno & \conno\\ + Requires Java? & + \conno & \conno & \conno & \conyes & \conno\\ + Can sort \glspl{exlatinalph} + or \glspl{nonlatinalph}? & + \prono\fnsym{1} & \prono & \proyes & \proyes & N/A\\ + Efficient sort algorithm? & + \prono & \proyes & \proyes & \proyes & N/A\\ + Can use a different sort method for each glossary? & + \proyes + & \prono\fnsym{2} + & \prono\fnsym{2} & \proyes & N/A\\ + Any problematic sort values? & + \conyes & \conyes & \conyes & \conno & \conno\fnsym{3}\\ + Are entries with identical sort values treated as separate unique + entries? & + \proyes & \proyes & \prono\fnsym{4} & \proyes & \proyes\\ + Can automatically form ranges in the location lists? & + \prono & \proyes & \proyes & \proyes & \prono\\ + Can have non-standard locations in the location lists? & + \proyes & \prono + & \proyes\fnsym{5} + & \proyes + & \proyes\fnsym{6}\\ + Maximum hierarchical depth (style-dependent) & + $\infty$\fnsym{7} & 3 & $\infty$ & $\infty$ & $\infty$\\ + \ics{glsdisplaynumberlist} reliable? & + \proyes & \prono & \prono & \proyes & \prono\\ + \ics{newglossaryentry} allowed in \env{document} environment? + (Not recommended.) & + \no & \yes & \yes & \no\fnsym{8} & \yes\fnsym{9}\\ + Requires additional write registers? & + \conno & \conyes & \conyes & \conno & \conno\fnsym{10}\\ + Default value of \pkgopt{sanitizesort} package option & + \texttt{false} & \texttt{true} & \texttt{true} + & \texttt{true}\fnsym{11} + & \texttt{true}\fnsym{11} + \end{tabular} + \par + }\par + \smallskip + \hrulefill\par + \smallskip\footnotesize + \fnsym{1} Strips standard \LaTeX\ accents +(that is, accents generated by core \LaTeX\ commands) so, +for example, \ics{AA} is treated the same as A.\par + \fnsym{2} Only with the hybrid method provided with \sty{glossaries-extra}.\par + \fnsym{3} Provided \pkgopt[none]{sort} is used.\par + \fnsym{4} Entries with the same sort value are merged.\par + \fnsym{5} Requires some setting up.\par + \fnsym{6} The locations must be set explicitly +through the custom \field{location} field provided by +\styfmt{glossaries-extra}.\par + \fnsym{7} Unlimited but unreliable.\par + \fnsym{8} Entries are defined in \texttt{.bib} +format. \cs{newglossaryentry} should not be used explicitly.\par + \fnsym{9} Provided \pkgoptfmt{docdefs=true} or +\pkgoptfmt{docdefs=restricted} but not recommended.\par + \fnsym{10} Provided \pkgoptfmt{docdefs=false} or +\pkgoptfmt{docdefs=restricted}.\par + \fnsym{11} Irrelevant with \pkgopt[none]{sort}. (The \optfmt{record=only} + option automatically switches this on.) +\par +\end{table} + +\optionsec[\TeX]{TeX} + +This option doesn't require an external \gls{indexingapp} but, with +the default alphabetic sorting, it's very slow with severe limitations. +If you want a sorted list, it doesn't work well for +\glspl{exlatinalph} or \glspl{nonlatinalph}. However, if you use +the \pkgopt[false]{sanitizesort} package option (the default for +Option~1) then the \glslink{latexexlatinchar}{standard \LaTeX\ +accent commands} will be ignored, so if an entry's name is set to +\verb|{\'e}lite| then the sort value will default to \texttt{elite} if +\pkgopt[false]{sanitizesort} is used and will default to +\verb|\'elite| if \pkgopt[true]{sanitizesort} is used. If you have +any other kinds of commands that don't expand to ASCII characters, +such as \cs{alpha} or \cs{si}, then you must use +\pkgopt[true]{sanitizesort} or change the sort method +(\pkgopt[use]{sort} or \pkgopt[def]{sort}) in the package options +or explicitly set the \gloskey{sort} key when you define the +relevant entries. For example: +\begin{verbatim} +\newglossaryentry{alpha}{name={\ensuremath{\alpha}}, + sort={alpha},description={...}} +\end{verbatim} + +This option works best with the \pkgopt[def]{sort} or +\pkgopt[use]{sort} setting. For any +other setting, be prepared for a long document build time, +especially if you have a lot of entries defined. \textbf{This +option is intended as a last resort for alphabetical sorting.} +This option allows a mixture of sort methods. (For example, +sorting by word order for one glossary and order of use for another.) +This option is not suitable for hierarchical glossaries and does +not form ranges in the \glspl{numberlist}. If you really can't use an +\gls{indexingapp} consider using \opt{5} instead. + + \begin{enumerate} + \item Add +\begin{verbatim} +\makenoidxglossaries +\end{verbatim} + to your preamble (before you start defining your entries, as described in + \sectionref{sec:newglosentry}). + + \item Put +\begin{verbatim} +\printnoidxglossary +\end{verbatim} + where you want your list of entries to appear (described in + \sectionref{sec:printglossary}). Alternatively, to display all + glossaries use the iterative command: +\begin{verbatim} +\printnoidxglossaries +\end{verbatim} + + \item Run \LaTeX\ twice on your document. (As you would do to + make a~table of contents appear.) For example, click twice on + the \qt{typeset} or \qt{build} or \qt{PDF\LaTeX} button in your editor. + \end{enumerate} + +Complete example: +\begin{verbatim} +\documentclass{article} +\usepackage{glossaries} +\makenoidxglossaries % use TeX to sort +\newglossaryentry{sample}{name={sample}, + description={an example}} +\begin{document} +\gls{sample}. +\printnoidxglossary +\end{document} +\end{verbatim} + +\optionsec{makeindex} + +This option uses a~\gls{cli} application called \gls{makeindex} to sort +the entries. This application comes with all modern \TeX\ distributions, +but it's hard-coded for the non-extended \gls{latinalph}. It can't +correctly sort accent commands (such as \cs{'} or \cs{c}) and fails +with UTF-8 characters, especially for any sort values that start +with a UTF-8 character (as it separates the octets resulting in an +invalid file encoding). This process involves making \LaTeX\ write +the glossary information to a temporary file which \gls{makeindex} +reads. Then \gls{makeindex} writes a~new file containing the code +to typeset the glossary. Then \cs{printglossary} reads this file in +on the next run. + +This option works best if you want to sort entries according to the +English alphabet and you don't want to install Perl (or Java or +you don't want to use \gls{glossaries-extra}). This method can +also work with the restricted shell escape since \gls{makeindex} +is considered a trusted application. (So you should be able to +use the \pkgopt{automake} package option provided the shell +escape hasn't been completely disabled.) + +This method can form ranges in the \gls{numberlist} but only +accepts limited number formats: \cs{arabic}, \cs{roman}, +\cs{Roman}, \cs{alph} and \cs{Alph}. + +This option does not allow a mixture of sort methods. +All glossaries must be sorted according to the same method: +word\slash letter ordering or order of use or order of definition. +If you need word ordering for one glossary and letter ordering +for another you'll have to explicitly call \gls{makeindex} for +each glossary type. +(The \sty{glossaries-extra} package allows a hybrid mix of +\optsand12 to provide word\slash letter ordering with \opt2 and order +of use\slash definition with \opt1. See the \sty{glossaries-extra} +documentation for further details.) + + \begin{enumerate} + \item If you want to use \gls{makeindex}['s] \mkidxopt{g} option + you must change the quote character using \ics{GlsSetQuote}. For example: +\begin{verbatim} +\GlsSetQuote{+} +\end{verbatim} + This must be used before \cs{makeglossaries}. + Note that if you are using \sty{babel}, the shorthands aren't + enabled until the start of the document, so you won't be able to use + the shorthands in definitions made in the preamble. + + \item Add +\begin{verbatim} +\makeglossaries +\end{verbatim} +to your preamble (before you start + defining your entries, as described in + \sectionref{sec:newglosentry}). + + \item Put +\begin{verbatim} +\printglossary +\end{verbatim} + where you want your list of entries to appear (described in + \sectionref{sec:printglossary}). Alternatively, to display all + glossaries use the iterative command: +\begin{verbatim} +\printglossaries +\end{verbatim} + + \item Run \LaTeX\ on your document. This creates files with the + extensions \texttt{.glo} and \texttt{.ist} (for example, if your + \LaTeX\ document is called \texttt{myDoc.tex}, then you'll have + two extra files called \texttt{myDoc.glo} and \texttt{myDoc.ist}). + If you look at your document at this point, you won't see the + glossary as it hasn't been created yet. (If you use + \sty{glossaries-extra} you'll see the section heading and some + boilerplate text.) + + \item Run \gls{makeindex} with the \texttt{.glo} file as the + input file and the \texttt{.ist} file as the style so that + it creates an output file with the extension \texttt{.gls}. If + you have access to a terminal or a command prompt (for example, the + MSDOS command prompt for Windows users or the bash console for + Unix-like users) then you need to run the command: +\begin{verbatim} +makeindex -s myDoc.ist -o myDoc.gls myDoc.glo +\end{verbatim} + (Replace \texttt{myDoc} with the base name of your \LaTeX\ + document file. Avoid spaces in the file name if possible.) If you don't know + how to use the command prompt, then you can probably access + \gls{makeindex} via your text editor, but each editor has a + different method of doing this, so I~can't give a~general + description. You will have to check your editor's manual. The + simplest approach is to use \app{arara} and add the following + comment lines to the start of your document: +\begin{alltt} +\% arara:\ pdflatex +\% arara:\ makeglossaries +\% arara:\ pdflatex +\end{alltt} + (Replace \texttt{makeglossaries} with + \texttt{makeglossaries-lite} if you don't have Perl installed.) + + The default sort is word order (\qt{sea lion} comes before \qt{seal}). + If you want letter ordering you need to add the \mkidxopt{l} + switch: +\begin{verbatim} +makeindex -l -s myDoc.ist -o myDoc.gls myDoc.glo +\end{verbatim} + (See \sectionref{sec:makeindexapp} for further details on using + \gls*{makeindex} explicitly.) If you use \gls{makeglossaries} + or \gls{makeglossaries-lite.lua} then use the \pkgopt[letter]{order} + package option and the \mkidxopt{l} option will be added + automatically. + + \item Once you have successfully completed the previous step, + you can now run \LaTeX\ on your document again. You'll need to + repeat the process if you have used the \pkgopt{toc} option + (unless you're using \sty{glossaries-extra}) to ensure the + section heading is added to the table of contents. You'll also + need to repeat the process if you have any cross-references + which can't be indexed until the glossary file has been created. + \end{enumerate} + +Complete example: +\begin{verbatim} +\documentclass{article} +\usepackage{glossaries} +\makeglossaries % open glossary files +\newglossaryentry{sample}{name={sample}, + description={an example}} +\begin{document} +\gls{sample}. +\printglossary +\end{document} +\end{verbatim} + +\optionsec{xindy} + +This option uses a~\gls{cli} application called +\gls{xindy} to sort the entries. This application is more flexible than +\texttt{makeindex} and is able to sort \glspl{exlatinalph} or +\glspl{nonlatinalph}, however it does still have some limitations. + +The \gls{xindy} application comes with both \TeX~Live and +MiK\TeX, but since \gls{xindy} is a Perl script, you will also need +to install Perl, if you don't already have it. In a~similar way to +\opt2, this option involves making \LaTeX\ write the glossary +information to a~temporary file which \gls{xindy} reads. Then +\gls{xindy} writes a~new file containing the code to typeset the +glossary. Then \cs{printglossary} reads this file in on the next run. + +This is the best option with just the base \styfmt{glossaries} +package if you want to sort according to a~language other than +English or if you want non-standard location lists, but it can +require some setting up (see \sectionref{sec:xindy}). There are +some problems with certain sort values: +\begin{itemize} + \item entries with the same sort value are merged by \gls*{xindy} + into a single glossary line so you must make sure that each entry + has a unique sort value; + \item \gls*{xindy} forbids empty sort values; + \item \gls*{xindy} automatically strips control sequences, the math-shift + character \verb|$| and braces \verb|{}| from the sort value, + which is usually desired but this can cause the sort value to + collapse to an empty string which \gls*{xindy} forbids. +\end{itemize} +In these problematic cases, you must set the \gloskey{sort} field +explicitly. For example: +\begin{verbatim} +\newglossaryentry{alpha}{name={\ensuremath{\alpha}}, + sort={alpha},description={...}} +\end{verbatim} + +All glossaries must be sorted according to the same method +(word/letter ordering, order of use, or order of definition). +(The \sty{glossaries-extra} package allows a hybrid mix of +\optsand13 to provide word\slash letter ordering with \opt3 and order +of use\slash definition with \opt1. See the \sty{glossaries-extra} +documentation for further details.) + +\begin{enumerate} + \item Add the \pkgopt{xindy} option to the \styfmt{glossaries} +package option list: +\begin{verbatim} +\usepackage[xindy]{glossaries} +\end{verbatim} + If you are using a non-Latin script you'll also need to either + switch off the creation of the number group: +\begin{verbatim} +\usepackage[xindy={glsnumbers=false}]{glossaries} +\end{verbatim} + or use either \cs{GlsSetXdyFirstLetterAfterDigits}\marg{letter} or + \cs{GlsSetXdyNumberGroupOrder}\marg{spec} to indicate where the number + group should be placed (see \sectionref{sec:xindy}). + + \item Add \cs{makeglossaries} to your preamble (before you start + defining your entries, as described in \sectionref{sec:newglosentry}). + + \item Run \LaTeX\ on your document. This creates files with the + extensions \texttt{.glo} and \texttt{.xdy} (for example, if your + \LaTeX\ document is called \texttt{myDoc.tex}, then you'll have + two extra files called \texttt{myDoc.glo} and \texttt{myDoc.xdy}). + If you look at your document at this point, you won't see the + glossary as it hasn't been created yet. (If you're using the + extension package \sty{glossaries-extra}, you'll see the section + header and some boilerplate text.) + + \item Run \gls{xindy} with the \texttt{.glo} file as the + input file and the \texttt{.xdy} file as a~module so that + it creates an output file with the extension \texttt{.gls}. You + also need to set the language name and input encoding. If + you have access to a terminal or a command prompt (for example, the + MSDOS command prompt for Windows users or the bash console for + Unix-like users) then you need to run the command (all on one + line): +\begin{verbatim} +xindy -L english -C utf8 -I xindy -M myDoc +-t myDoc.glg -o myDoc.gls myDoc.glo +\end{verbatim} + (Replace \texttt{myDoc} with the base name of your \LaTeX\ + document file. Avoid spaces in the file name. If necessary, also replace + \texttt{english} with the name of your language and \texttt{utf8} + with your input encoding, for example, + \xdyopt{L}\texttt{ german }\xdyopt{C}\texttt{ din5007-utf8}.) + Note that it's much simpler to use \gls{makeglossaries} instead: +\begin{verbatim} +makeglossaries myDoc +\end{verbatim} + (Remember that \gls{xindy} is a Perl script so if you can use + \gls{xindy} then you can also use \gls{makeglossaries}, and if + you don't want to use \gls{makeglossaries} because you don't + want to install Perl, then you can't use \gls{xindy} either.) + + If you don't know how to use the command prompt, then you can + probably access \gls{xindy} or \gls{makeglossaries} via your text editor, + but each editor has a different method of doing this, so I~can't give + a~general description. You will have to check your editor's manual. Again, + a convenient method is to use \appfmt{arara} and add the follow comment + lines to the start of your document: +\begin{alltt} +\% arara:\ pdflatex +\% arara:\ makeglossaries +\% arara:\ pdflatex +\end{alltt} + + The default sort is word order (\qt{sea lion} comes before \qt{seal}). + If you want letter ordering you need to add the + \pkgopt[letter]{order} package option: +\begin{verbatim} +\usepackage[xindy,order=letter]{glossaries} +\end{verbatim} + (and return to the previous step). This option is picked up + by \gls{makeglossaries}. If you are explicitly using \gls{xindy} + then you'll need to add \texttt{-M ord/letorder} to the options list. + See \sectionref{sec:xindyapp} for further details on using + \gls*{xindy} explicitly. + + \item Once you have successfully completed the previous step, + you can now run \LaTeX\ on your document again. As with the + previous option, you may need to repeat the process to ensure + the table of contents and cross-references are resolved. + +\end{enumerate} + +Complete example: +\begin{verbatim} +\documentclass{article} +\usepackage[xindy]{glossaries} +\makeglossaries % open glossary files +\newglossaryentry{sample}{name={sample}, + description={an example}} +\begin{document} +\gls{sample}. +\printglossary +\end{document} +\end{verbatim} + +\optionsec{bib2gls} + +This option is only available with the extension package +\gls{glossaries-extra}. This method uses \gls{bib2gls} to both +fetch entry definitions from \texttt{.bib} files and to +hierarchically sort and collate. + +All entries must be provided in one or more \texttt{.bib} files. +(See the \gls{bib2gls} user manual for the required format.) The +\sty{glossaries-extra} package needs to be loaded with the +\pkgoptfmt{record} package option +\begin{verbatim} +\usepackage[record]{glossaries-extra} +\end{verbatim} +or (equivalently) +\begin{verbatim} +\usepackage[record=only]{glossaries-extra} +\end{verbatim} +(It's possible to use a hybrid of this method and \optsor23 with +\pkgoptfmt{record=alsoindex} but in general there is little need +for this and it complicates the build process.) + +Each resource set is loaded with \cs{GlsXtrLoadResources}\oarg{options}. +For example: +\begin{verbatim} +\GlsXtrLoadResources +[% definitions in entries1.bib and entries2.bib: + src={entries1,entries2}, + sort={de-CH-1996}% sort according to this locale +] +\end{verbatim} +You can have multiple resource commands. + +The glossary is displayed using +\begin{verbatim} +\printunsrtglossary +\end{verbatim} +Alternatively all glossaries can be displayed using the iterative +command: +\begin{verbatim} +\printunsrtglossaries +\end{verbatim} +The document is build using: +\begin{verbatim} +pdflatex myDoc +bib2gls myDoc +pdflatex myDoc +\end{verbatim} +If letter groups are required, you need the \verb|--group| switch: +\begin{verbatim} +bib2gls --group myDoc +\end{verbatim} +Unlike \optsand23, this method doesn't create a file containing +the typeset glossary but simply determines which entries are +needed for the document, their associated locations and (if +required) their associated letter group. This option allows +a mixture of sort methods. (For example, sorting by word order +for one glossary and order of use for another or even sorting +one block of the glossary differently to another block in the +same glossary.) + +This method supports Unicode and (with at least Java~8) uses +the Common Locale Data Repository, which provides more extensive +language support than \gls{xindy}.\footnote{Except for Klingon, +which is supported by \gls{xindy}, but not by the +CLDR.}\ The locations in the +\gls{numberlist} may be in any format. If \gls{bib2gls} can +deduce a numerical value it will attempt to form ranges otherwise +it will simply list the locations. + +Complete example: +\begin{verbatim} +\documentclass{article} +\usepackage[record]{glossaries-extra} +\GlsXtrLoadResources[src={entries}] +\begin{document} +\gls{sample}. +\printunsrtglossary +\end{document} +\end{verbatim} +where \texttt{entries.bib} contains +\begin{verbatim} +@entry{sample, + name={sample}, + description={an example} +} +\end{verbatim} +See the \gls{bib2gls} user manual for further details. + +\optionsec[no sorting]{no sorting} + +This option is only available with the extension package +\gls{glossaries-extra}. No \gls{indexingapp} is required. This +method is best used with the package option \pkgopt[none]{sort}. +\begin{verbatim} +\usepackage[sort=none]{glossaries-extra} +\end{verbatim} +There's no \qt{activation} command (such as \cs{makeglossaries} +for \optsand23). + +All entries must be defined before the glossary is displayed +(preferably in the preamble) in the required order, and child +entries must be defined immediately after their parent entry +if they must be kept together in the glossary + +The glossary is displayed using +\begin{verbatim} +\printunsrtglossary +\end{verbatim} +Alternatively all glossaries can be displayed using the iterative +command: +\begin{verbatim} +\printunsrtglossaries +\end{verbatim} +This will display \emph{all} defined entries, regardless of +whether or not they have been used in the document. The +\glspl{numberlist} have to be set explicitly otherwise they won't +appear. Note that this uses the same command for displaying the +glossary as \opt4. This is because \gls{bib2gls} takes advantage +of this method by defining the wanted entries in the required order and +setting the locations (and letter group information, if required). + +This just requires a single \LaTeX\ call +\begin{verbatim} +pdflatex myDoc +\end{verbatim} +unless the glossary needs to appear in the table of contents, in which case +a second run is required. +\begin{verbatim} +pdflatex myDoc +pdflatex myDoc +\end{verbatim} +(Naturally if the document also contains citations, and so on, +then additional steps are required. Similarly for all the other +options above.) + +Complete example: +\begin{verbatim} +\documentclass{article} +\usepackage[sort=none]{glossaries-extra} +\newglossaryentry{sample}{name={sample}, + description={an example}} +\begin{document} +\gls{sample}. +\printunsrtglossary +\end{document} +\end{verbatim} +See the \sty{glossaries-extra} documentation for +further details. + +\section{Sample Documents} +\label{sec:samples} + +The \styfmt{glossaries} package is provided with some sample +documents that illustrate the various functions. These should +be located in the \texttt{samples} subdirectory (folder) of the +\styfmt{glossaries} documentation directory. This location varies +according to your operating system and \TeX\ distribution. You +can use \texttt{texdoc} to locate the main glossaries documentation. +For example, in a +\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{terminal or command prompt}, type: +\begin{prompt} +texdoc -l glossaries +\end{prompt} +This should display a list of all the files in the glossaries +documentation directory with their full pathnames. (The GUI version +of \texttt{texdoc} may also provide you with the information.) + +If you can't find the sample files on your computer, they are also available +from your nearest CTAN mirror at +\url{http://mirror.ctan.org/macros/latex/contrib/glossaries/samples/}. + +The sample documents are listed below\footnote{Note that although I've written +\texttt{latex} in this section, it's better to use \texttt{pdflatex}, where +possible, for the reasons given \hyperlink{pdflatexnote}{earlier}.} +If you prefer to use UTF-8 aware engines (\texttt{xelatex} or +\texttt{lualatex}) remember that you'll need to switch from +\styfmt{fontenc} \& \styfmt{inputenc} to \styfmt{fontspec} where +appropriate. The \gls{glossaries-extra} package provides some +additional sample files. + +\begin{samplelist} +\exitem[minimal]{gls} This document is a +minimal working example. You can test your installation using this +file. To create the complete document you will need to do the +following steps: + \begin{enumerate} + \item Run \texttt{minimalgls.tex} through \LaTeX\ either by + typing +\begin{prompt} +latex minimalgls +\end{prompt} + in a terminal or by using the relevant button or menu item in + your text editor or front-end. This will create the required + associated files but you will not see the glossary. If you use + PDF\LaTeX\ you will also get warnings about non-existent + references that look something like: +\begin{verbatim} +pdfTeX warning (dest): name{glo:aca} has been +referenced but does not exist, +replaced by a fixed one +\end{verbatim} + These warnings may be ignored on the first run. + + If you get a \verb"Missing \begin{document}" error, then + it's most likely that your version of \sty{xkeyval} is + out of date. Check the log file for a warning of that nature. + If this is the case, you will need to update the \styfmt{xkeyval} + package. + + \item If you have Perl installed, run \gls{makeglossaries} on the document (\sectionref{sec:makeglossaries}). This can + be done on a terminal by typing +\begin{prompt} +makeglossaries minimalgls +\end{prompt} + otherwise do +\begin{prompt} +makeglossaries-lite minimalgls +\end{prompt} + If for some reason you want to call \gls{makeindex} explicitly, you can do this + in a terminal by typing (all on one line): +\begin{prompt} +makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo +\end{prompt} + (See \sectionref{sec:makeindexapp} for further details on using + \gls*{makeindex} explicitly.) + + Note that if the file name contains spaces, you will need to use + the double-quote character to delimit the name. + + \item Run \texttt{minimalgls.tex} through \LaTeX\ again (as step~1) + \end{enumerate} +You should now have a complete document. The number following +each entry in the glossary is the location number. By default, this +is the page number where the entry was referenced. + +There are three other files that can be used as a +\href{http://www.dickimaw-books.com/latex/minexample/}{minimal working +example}: \texttt{mwe-gls.tex}, \texttt{mwe-acr.tex} and +\texttt{mwe-acr-desc.tex}. + +\exitem{-noidxapp} This document illustrates how to use the +\styfmt{glossaries} package without an external \gls{indexingapp} (\opt1). +To create the complete document, you need to do: +\begin{prompt} +latex sample-noidxapp +latex sample-noidxapp +\end{prompt} + +\exitem{-noidxapp-utf8} As the previous example, except that it uses +the \sty{inputenc} package. +To create the complete document, you need to do: +\begin{prompt} +latex sample-noidxapp-utf8 +latex sample-noidxapp-utf8 +\end{prompt} + +\exitem{4col} This document illustrates +a four column glossary where the entries have a symbol in addition +to the name and description. To create the complete document, you +need to do: +\begin{prompt} +latex sample4col +makeglossaries sample4col +latex sample4col +\end{prompt} +or +\begin{prompt} +latex sample4col +makeglossaries-lite sample4col +latex sample4col +\end{prompt} +The vertical gap between entries is the +gap created at the start of each group. This can be suppressed +using the \pkgopt{nogroupskip} package option. + +\exitem{Acr} This document has some +sample abbreviations. It also adds the glossary to the table of contents, +so an extra run through \LaTeX\ is required to ensure the document +is up to date: +\begin{prompt} +latex sampleAcr +makeglossaries sampleAcr +latex sampleAcr +latex sampleAcr +\end{prompt} +(or use \gls{makeglossaries-lite.lua}). + +\exitem{AcrDesc} This is similar to +the previous example, except that the abbreviations have an associated +description. As with the previous example, the glossary is added to +the table of contents, so an extra run through \LaTeX\ is required: +\begin{prompt} +latex sampleAcrDesc +makeglossaries sampleAcrDesc +latex sampleAcrDesc +latex sampleAcrDesc +\end{prompt} + +\exitem{Desc} This is similar to the +previous example, except that it defines the abbreviations using +\ics{newglossaryentry} instead of \ics{newacronym}. As with the +previous example, the glossary is added to the table of contents, so +an extra run through \LaTeX\ is required: +\begin{prompt} +latex sampleDesc +makeglossaries sampleDesc +latex sampleDesc +latex sampleDesc +\end{prompt} + +\exitem{CustomAcr} This document has some sample abbreviations with a +custom acronym style. It also adds the glossary to the table of +contents, so an extra run through \LaTeX\ is required: +\begin{prompt} +latex sampleCustomAcr +makeglossaries sampleCustomAcr +latex sampleCustomAcr +latex sampleCustomAcr +\end{prompt} + +\exitem{FnAcrDesc} This is similar to \samplefile{AcrDesc}, except that it +uses the \acrstyle{footnote-sc-desc} style. As with the previous example, +the glossary is added to the table of contents, so an extra run through +\LaTeX\ is required: +\begin{prompt} +latex sampleFnAcrDesc +makeglossaries sampleFnAcrDesc +latex sampleFnAcrDesc +latex sampleFnAcrDesc +\end{prompt} + +\exitem{-FnDesc} This example +defines a custom display format that puts the description in a +footnote on first use. +\begin{prompt} +latex sample-FnDesc +makeglossaries sample-FnDesc +latex sample-FnDesc +\end{prompt} + +\exitem{-custom-acronym} +This document illustrates how to define your own acronym style if +the predefined styles don't suit your requirements. +\begin{prompt} +latex sample-custom-acronym +makeglossaries sample-custom-acronym +latex sample-custom-acronym +\end{prompt} + +\exitem{-crossref} +This document illustrates how to cross-reference entries in the +glossary. +\begin{prompt} +latex sample-crossref +makeglossaries sample-crossref +latex sample-crossref +\end{prompt} + +\exitem{-dot-abbr} This document illustrates how to use the +post link hook to adjust the space factor after abbreviations. +\begin{prompt} +latex sample-dot-abbr +makeglossaries sampledot-abbrf +latex sample-dot-abbr +\end{prompt} + +\exitem{DB} This document illustrates how +to load external files containing the glossary definitions. It also +illustrates how to define a new glossary type. This document has the +\gls{numberlist} suppressed and uses \ics{glsaddall} to add all +the entries to the glossaries without referencing each one +explicitly. To create the document do: +\begin{prompt} +latex sampleDB +makeglossaries sampleDB +latex sampleDB +\end{prompt} +or +\begin{prompt} +latex sampleDB +makeglossaries-lite sampleDB +latex sampleDB +\end{prompt} +The glossary definitions are stored in the accompanying files +\texttt{database1.tex} and \texttt{database2.tex}. If for some +reason you want to call \gls{makeindex} explicitly you must +have a separate call for each glossary: +\begin{enumerate} +\item Create the main glossary (all on one line): +\begin{prompt}\raggedright +makeindex -s sampleDB.ist -t sampleDB.glg -o sampleDB.gls sampleDB.glo +\end{prompt} +\item Create the secondary glossary (all on one line): +\begin{prompt}\raggedright +makeindex -s sampleDB.ist -t sampleDB.nlg -o sampleDB.not sampleDB.ntn +\end{prompt} +Note that both \gls{makeglossaries} and \gls{makeglossaries-lite.lua} do +this all in one call, so they not only make it easier because you +don't need to supply all the switches and remember all the +extensions but they also call \gls{makeindex} the appropriate number of times. +\end{enumerate} + +\exitem{Eq} This document illustrates how +to change the location to something other than the page number. In +this case, the \texttt{equation} counter is used since all glossary +entries appear inside an \env{equation} environment. To create +the document do: +\begin{prompt} +latex sampleEq +makeglossaries sampleEq +latex sampleEq +\end{prompt} + +\exitem{EqPg} This is similar to the +previous example, but the \glspl{numberlist} are a +mixture of page numbers and equation numbers. This example adds the +glossary to the table of contents, so an extra \LaTeX\ run is +required: +\begin{prompt} +latex sampleEqPg +makeglossaries sampleEqPg +latex sampleEqPg +latex sampleEqPg +\end{prompt} + +\exitem{Sec} This document also +illustrates how to change the location to something other than the +page number. In this case, the \texttt{section} counter is used. +This example adds the glossary to the table of contents, so an extra +\LaTeX\ run is required: +\begin{prompt} +latex sampleSec +makeglossaries sampleSec +latex sampleSec +latex sampleSec +\end{prompt} + +\exitem{Ntn} This document illustrates +how to create an additional glossary type. This example adds the +glossary to the table of contents, so an extra \LaTeX\ run is +required: +\begin{prompt} +latex sampleNtn +makeglossaries sampleNtn +latex sampleNtn +latex sampleNtn +\end{prompt} +Note that if you want to call \gls{makeindex} explicitly instead of +using \gls{makeglossaries} or \gls{makeglossaries-lite.lua} then you +need to call \gls{makeindex} twice: +\begin{enumerate} +\item Create the main glossary (all on one line): +\begin{prompt}\raggedright +makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo +\end{prompt} +\item Create the secondary glossary (all on one line): +\begin{prompt}\raggedright +makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.not sampleNtn.ntn +\end{prompt} +\end{enumerate} + +\exitem{} This document illustrates some of +the basics, including how to create child entries that use the same +name as the parent entry. This example adds the glossary to the +table of contents and it also uses \ics{glsrefentry}, so an extra \LaTeX\ +run is required: +\begin{prompt} +latex sample +makeglossaries sample +latex sample +latex sample +\end{prompt} +You can see the difference between word and letter ordering if you +substitute \pkgopt[word]{order} with \pkgopt[letter]{order}. (Note +that this will only have an effect if you use +\gls{makeglossaries} or \gls{makeglossaries-lite.lua}. +If you use \gls{makeindex} explicitly, you will need to use the +\mkidxopt{l} switch to indicate letter ordering.) + +\exitem{-inline} This document is +like \texttt{sample.tex}, above, but uses the \glostyle{inline} +glossary style to put the glossary in a footnote. + +\exitem{tree} This document illustrates +a hierarchical glossary structure where child entries have different +names to their corresponding parent entry. To create the document +do: +\begin{prompt} +latex sampletree +makeglossaries sampletree +latex sampletree +\end{prompt} + +\exitem{-dual} This document +illustrates how to define an entry that both appears in the list of +acronyms and in the main glossary. To create the document do: +\begin{prompt} +latex sample-dual +makeglossaries sample-dual +latex sample-dual +\end{prompt} + +\exitem{-langdict} This document +illustrates how to use the glossaries package to create English +to French and French to English dictionaries. To create the document +do: +\begin{prompt} +latex sample-langdict +makeglossaries sample-langdict +latex sample-langdict +\end{prompt} + +\exitem{xdy} This document illustrates +how to use the \styfmt{glossaries} package with \gls{xindy} instead +of \gls{makeindex}. The document uses UTF8 encoding (with the +\sty{inputenc} package). The encoding is picked up by +\gls{makeglossaries}. By default, this document will create a +\gls{xindy} style file called \texttt{samplexdy.xdy}, but if you +uncomment the lines +\begin{verbatim} +\setStyleFile{samplexdy-mc} +\noist +\GlsSetXdyLanguage{} +\end{verbatim} +it will set the style file to \texttt{samplexdy-mc.xdy} instead. +This provides an additional letter group for entries starting with +\qt{Mc} or \qt{Mac}. If you use \gls{makeglossaries} or +\gls{makeglossaries-lite.lua}, you don't +need to supply any additional information. If you don't use +\gls*{makeglossaries}, you will need to specify the required +information. Note that if you set the style file to +\texttt{samplexdy-mc.xdy} you must also specify \ics{noist}, +otherwise the \styfmt{glossaries} package will overwrite +\texttt{samplexdy-mc.xdy} and you will lose the \qt{Mc} letter +group. + +To create the document do: +\begin{prompt} +latex samplexdy +makeglossaries samplexdy +latex samplexdy +\end{prompt} +If you don't have Perl installed then you can't use +\gls{makeglossaries}, but you also can't use \gls{xindy}! +However, if for some reason you want to call +\gls{xindy} explicitly instead of using \gls{makeglossaries} (or +\gls{makeglossaries-lite.lua}): +\begin{itemize} +\item if you are using the default style file \texttt{samplexdy.xdy}, then +do (no line breaks): +\begin{prompt}\raggedright +xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo +\end{prompt} +\item if you are using \texttt{samplexdy-mc.xdy}, then do +(no line breaks): +\begin{prompt}\raggedright +xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo +\end{prompt} +\end{itemize} + +\exitem{xdy2} This document illustrates +how to use the \styfmt{glossaries} package where the location +numbers don't follow a standard format. This example will only work +with \gls{xindy}. To create the document do: +\begin{prompt} +pdflatex samplexdy2 +makeglossaries samplexdy2 +pdflatex samplexdy2 +\end{prompt} +The explicit \gls{xindy} call is: +\begin{prompt}\raggedright +xindy -L english -C utf8 -I xindy -M samplexdy2 -t samplexdy2.glg -o samplexdy2.gls samplexdy2.glo +\end{prompt} +See \sectionref{sec:xindyloc} for further details. + +\exitem{xdy3} This document is like \samplefile{xdy} but uses the +command \cs{Numberstring} from the \sty{fmtcount} package to +format the page numbers. + +\exitem{utf8} This is another example +that uses \gls{xindy}. Unlike \gls{makeindex}, +\gls{xindy} can cope with \glspl{nonlatinchar}. This +document uses UTF8 encoding. To create the document do: +\begin{prompt} +latex sampleutf8 +makeglossaries sampleutf8 +latex sampleutf8 +\end{prompt} +The explicit \gls{xindy} call is +(no line breaks): +\begin{prompt}\raggedright +xindy -L english -C utf8 -I xindy -M sampleutf8 -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo +\end{prompt} + +If you remove the \pkgopt{xindy} option from \texttt{sampleutf8.tex} +and do: +\begin{prompt} +latex sampleutf8 +makeglossaries sampleutf8 +latex sampleutf8 +\end{prompt} +or +\begin{prompt} +latex sampleutf8 +makeglossaries-lite sampleutf8 +latex sampleutf8 +\end{prompt} +you will see that the entries that start with an \gls{exlatinchar} +now appear in the symbols group, and the word \qt{man\oe uvre} is now +after \qt{manor} instead of before it. If you want to explicitly +call \gls{makeindex} (no line breaks): +\begin{prompt}\raggedright +makeindex -s sampleutf8.ist -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo +\end{prompt} + +\exitem{-index} This document uses +the \styfmt{glossaries} package to create both a glossary and an +index. This requires two \gls{makeglossaries} (or +\gls{makeglossaries-lite.lua}) calls to ensure the +document is up to date: +\begin{prompt} +latex sample-index +makeglossaries sample-index +latex sample-index +makeglossaries sample-index +latex sample-index +\end{prompt} + +\exitem{-newkeys} This document illustrates how add custom keys +(using \cs{glsaddkey}). + +\exitem{-storage-abbr} This document illustrates how add custom +storage keys (using \cs{glsaddstoragekey}). + +\exitem{-storage-abbr-desc} An extension of the previous example +where the user needs to provide a~description. + +\exitem{-chap-hyperfirst} This document illustrates how to add +a~custom key using \cs{glsaddstoragekey} and hook into the \glslike\ +and \glstextlike\ mechanism used to determine whether or not to +hyperlink an entry. + +\exitem{-font-abbr} This document illustrates how to different fonts +for abbreviations within the style. + +\exitem{-numberlist} This document illustrates how to reference the +\gls{numberlist} in the document text. This requires an additional +\LaTeX\ run: +\begin{prompt} +latex sample-numberlist +makeglossaries sample-numberlist +latex sample-numberlist +latex sample-numberlist +\end{prompt} + +\exitem{People} This document illustrates how you can hook into the +standard sort mechanism to adjust the way the sort key is set. This +requires an additional run to ensure the table of contents is +up-to-date: +\begin{prompt} +latex samplePeople +makeglossaries samplePeople +latex samplePeople +latex samplePeople +\end{prompt} + +\exitem{Sort} This is another document that illustrates how to hook +into the standard sort mechanism. An additional run is required to +ensure the table of contents is up-to-date: +\begin{prompt} +latex sampleSort +makeglossaries sampleSort +latex sampleSort +latex sampleSort +\end{prompt} + +\exitem{-nomathhyper} This document illustrates how to selectively +enable and disable entry hyperlinks in \ics{glsentryfmt}. + +\exitem{-entryfmt} This document illustrates how to change the +way an entry is displayed in the text. + +\exitem{-prefix} This document illustrates the use of the +\sty{glossaries-prefix} package. An additional run is required to +ensure the table of contents is up-to-date: +\begin{prompt} +latex sample-prefix +makeglossaries sample-prefix +latex sample-prefix +latex sample-prefix +\end{prompt} + +\exitem{accsupp} This document +uses the experimental \sty{glossaries-accsupp} package. The +symbol is set to the replacement text. Note that some PDF +viewers don't use the accessibility support. Information +about the \styfmt{glossaries-accsupp} package can be found in +\sectionref{sec:accsupp}. + +\exitem{-ignored} This document defines an ignored glossary for +common terms that don't need a definition. + +\exitem{-entrycount} This document uses \ics{glsenableentrycount} +and \ics{cgls} (described in \sectionref{sec:enableentrycount}) +so that acronyms only used once don't appear in the list of +acronyms. +\end{samplelist} + +\section{Dummy Entries for Testing} +\label{sec:lipsum} + +In addition to the sample files described above, \sty{glossaries} also provides +some files containing lorum ipsum dummy entries. These are provided +for testing purposes and are on \TeX's path (in +\texttt{tex\slash latex\slash glossaries\slash test-entries}) so they can be included +via \ics{input} or \ics{loadglsentries}. The files are as follows: +\begin{description} +\item[example-glossaries-brief.tex] These entries all have brief +descriptions. For example: +\begin{verbatim} +\newglossaryentry{lorem}{name={lorem},description={ipsum}} +\end{verbatim} + +\item[example-glossaries-long.tex] These entries all have long +descriptions. For example: +\begin{verbatim} +\newglossaryentry{loremipsum}{name={lorem ipsum}, +description={dolor sit amet, consectetuer adipiscing +elit. Ut purus elit, vestibulum ut, placerat ac, +adipiscing vitae, felis. Curabitur dictum gravida +mauris.}} +\end{verbatim} + +\item[example-glossaries-multipar.tex] These entries all have +multi-paragraph descriptions. + +\item[example-glossaries-symbols.tex] These entries all use the +\gloskey{symbol} key. For example: +\begin{verbatim} +\newglossaryentry{alpha}{name={alpha}, +symbol={\ensuremath{\alpha}}, +description={Quisque ullamcorper placerat ipsum.}} +\end{verbatim} + +\item[example-glossaries-symbolnames.tex] Similar to the previous +file but the \gloskey{symbol} key isn't used. Instead the symbol +is stored in the \gloskey{name} key. For example: +\begin{verbatim} +\newglossaryentry{sym.alpha}{sort={alpha}, +name={\ensuremath{\alpha}}, +description={Quisque ullamcorper placerat ipsum.}} +\end{verbatim} + +\item[example-glossaries-images.tex] These entries use the +\gloskey{user1} key to store the name of an image file. (The images +are provided by the \sty{mwe} package and should be on \TeX's path.) +One entry doesn't have an associated image to help test for a~missing key. + +\item[example-glossaries-acronym.tex] These entries are all +abbreviations. For example: +\begin{verbatim} +\newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum +dolor} +\end{verbatim} + +\item[example-glossaries-acronym-desc.tex] These entries are all +abbreviations that use the \gloskey{description} key. +For example: +\begin{verbatim} +\newacronym[type=\glsdefaulttype, + description={fringilla a, euismod sodales, + sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula} +\end{verbatim} + +\item[example-glossaries-acronyms-lang.tex] These entries are all +abbreviations, where some of them have a~translation supplied in the +\gloskey{user1} key. +For example: +\begin{verbatim} +\newacronym[type=\glsdefaulttype,user1={love itself}] + {li}{LI}{lorem ipsum} +\end{verbatim} + +\item[example-glossaries-parent.tex] These are hierarchical entries +where the child entries use the \gloskey{name} key. +For example: +\begin{verbatim} +\newglossaryentry{sedmattis}{name={sed mattis}, +description={erat sit amet} + +\newglossaryentry{gravida}{parent={sedmattis}, + name={gravida},description={malesuada}} +\end{verbatim} + +\item[example-glossaries-childnoname.tex] These are hierarchical entries +where the child entries don't use the \gloskey{name} key. +For example: +\begin{verbatim} +\newglossaryentry{scelerisque}{name={scelerisque}, + description={at}} +\end{verbatim} + +\item[example-glossaries-cite.tex] These entries use the +\gloskey{user1} key to store a citation key (or comma-separated list +of citation keys). The citations are defined in \texttt{xampl.bib}, +which should be available on all modern \TeX\ distributions. +One entry doesn't have an associated citation to help test for a~missing +key. +For example: +\begin{verbatim} +\newglossaryentry{fusce}{name={fusce}, +description={suscipit cursus sem},user1={article-minimal}} +\end{verbatim} + +\item[example-glossaries-url.tex] These entries use the +\gloskey{user1} key to store an URL associated with the entry. +For example: +\begin{verbatim} +\newglossaryentry{aenean-url}{name={aenean}, + description={adipiscing auctor est}, + user1={http://uk.tug.org/}} +\end{verbatim} +\end{description} + +The sample file \texttt{glossary-lipsum-examples.tex} in the +\texttt{doc\slash latex\slash glossaries\slash samples} directory +uses all these files. See also +\url{http://www.dickimaw-books.com/gallery/#glossaries}. +The \sty{glossaries-extra} package provides additional test files. + +\section{Multi-Lingual Support} +\label{sec:languages} + +As from version 1.17, the \styfmt{glossaries} package can be +used with \gls{xindy} as well as \gls{makeindex}. If you +are writing in a language that uses an \gls{exlatinalph} or +\gls{nonlatinalph} it's best to use \opt3 (\gls*{xindy}) +or \opt4 (\gls{bib2gls}) +as \gls*{makeindex} (\opt2) is hard-coded for the non-extended +\gls{latinalph} and \opt1 can performed limited ASCII comparisons. + +This means that with \optsor34 you are not restricted to the A, +\ldots, Z letter groups. If you want to use \gls*{xindy}, remember +to use the \pkgopt{xindy} package option. For example: +\begin{verbatim} +\documentclass[frenchb]{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{babel} +\usepackage[xindy]{glossaries} +\end{verbatim} +If you want to use \gls*{bib2gls}, you need to use the +\pkgopt{record} option with \sty{glossaries-extra} and supply the +definitions in \texttt{.bib} files. (See the \gls{bib2gls} user +manual for further details.) + +\begin{important} +Note that although a~\gls{nonlatinchar}, such as \'e, looks like a plain +character in your \filetype{.tex} file, with standard \LaTeX\ it's actually a~macro and can therefore +cause expansion problems. You may need to switch off the field +expansions with \cs{glsnoexpandfields}. This issue doesn't occur +with \XeLaTeX\ or Lua\LaTeX. +\end{important} + +With \sty{inputenc}, if you use a~\gls{nonlatinchar} (or other expandable) +character at the start of an entry name, you must place it in a group, +or it will cause a problem for commands that convert the first letter +to upper case (e.g.\ \ics{Gls}). For example: +\begin{alltt} +\verb|\newglossaryentry}{elite}{name={{|\'e\verb|}lite},| +description=\verb|{select group or class}}| +\end{alltt} +(With newer versions of \sty{mfirstuc} and \sty{datatool-base} you +may be able to omit this grouping.) +For further details, see the \qt{UTF-8} section in the +\sty{mfirstuc} user manual. + +If you are using \gls{xindy} or \gls{bib2gls}, the application needs +to know the encoding of the \filetype{.tex} file. This information +is added to the \filetype{.aux} file and can be picked up by +\gls{makeglossaries} and \gls{bib2gls}. If you use +\gls{xindy} explicitly instead of via \gls*{makeglossaries}, +you may need to specify the encoding using the \xdyopt{C} +option. Read the \gls*{xindy} manual for further details of this +option. + +As from v4.24, if you are writing in German (for example, using the \sty{ngerman} +package\footnote{deprecated, use \styfmt{babel} instead} or \sty{babel} with the \pkgopt{ngerman} package option), +and you want to use \gls{makeindex}['s] \mkidxopt{g} option, you'll +need to change \gls{makeindex}['s] quote character using: +\begin{definition}[\DescribeMacro\GlsSetQuote] +\cs{GlsSetQuote}\marg{character} +\end{definition} +Note that \meta{character} may not be one of \verb"?" (question +mark), \verb"|" (pipe) or \verb"!" (exclamation mark). +For example: +\begin{verbatim} +\GlsSetQuote{+} +\end{verbatim} +This must be done before \ics{makeglossaries} and any entry +definitions. It's only applicable for \app{makeindex}. This option +in conjunction with \sty{ngerman} will also cause +\app{makeglossaries} to use the \mkidxopt{g} switch when invoking +\app{makeindex}. + +\begin{important} +Be careful of \sty{babel}'s shorthands. These aren't switched +on until the start of the document, so any entries defined +in the preamble won't be able to use those shorthands. +However, if you define the entries in the document and any +of those shorthands happen to be special characters for +\gls{makeindex} or \gls{xindy} (such as the double-quote) +then this will interfere with code that tries to escape +any of those characters that occur in the \gloskey{sort} key. +\end{important} + +In general, it's best not to use \sty{babel}'s shorthands +in entry definitions. For example: +\begin{verbatim} +\documentclass{article} + +\usepackage[ngerman]{babel} +\usepackage{glossaries} + +\GlsSetQuote{+} + +\makeglossaries + +\newglossaryentry{rna}{name={ribonukleins\"aure}, + sort={ribonukleins"aure}, + description={eine Nukleins\"aure}} + +\begin{document} +\gls{rna} + +\printglossaries +\end{document} +\end{verbatim} + +The \sty{ngerman} package has the shorthands on in the preamble, so +they can be used if \cs{GlsSetQuote} has changed the \gls{makeindex} +quote character. Example: +\begin{verbatim} +\documentclass{article} + +\usepackage[ngerman]{babel} +\usepackage{glossaries} + +\GlsSetQuote{+} + +\makeglossaries + +\newglossaryentry{rna}{name={ribonukleins"aure}, + description={eine Nukleins"aure}} + +\begin{document} +\gls{rna} + +\printglossaries +\end{document} +\end{verbatim} + +\subsection{Changing the Fixed Names} +\label{sec:fixednames} + +The fixed names are produced using the commands listed in +\tableref{tab:predefinednames}. If you aren't using a language +package such as \sty{babel} or \sty{polyglossia} that uses caption +hooks, you can just redefine these commands as appropriate. If you +are using \sty{babel} or \sty{polyglossia}, you need to use their +caption hooks to change the defaults. See \urlref{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords}{changing +the words babel uses} or read the \sty{babel} or \sty{polyglossia} +documentation. If you have loaded \sty{babel}, then \sty{glossaries} +will attempt to load \sty{translator}, unless you have used the +\pkgopt{notranslate}, \pkgopt[false]{translate} or \pkgopt[babel]{translate} +package options. If the \sty{translator} package is loaded, the +translations are provided by dictionary files (for example, +\texttt{glossaries-dictionary-English.dict}). See the +\sty{translator} package for advice on changing translations provided by +\sty{translator} dictionaries. If you can't work out how to modify +these dictionary definitions, try switching to \sty{babel}'s +interface using \pkgopt[babel]{translate}: +\begin{verbatim} +\documentclass[english,french]{article} +\usepackage{babel} +\usepackage[translate=babel]{glossaries} +\end{verbatim} +and then use \sty{babel}'s caption hook mechanism. Note that if you +pass the language options directly to \sty{babel} rather that using +the document class options or otherwise passing the same options to +\sty{translator}, then \sty{translator} won't pick up the +language and no dictionaries will be loaded and \sty{babel}'s +caption hooks will be used instead. + +\begin{table}[htbp] +\caption{Customised Text} +\label{tab:predefinednames} +\centering +\setlength{\tabcolsep}{3pt} +\begin{tabular}{@{}l>{\raggedright}p{0.3\linewidth}>{\raggedright}p{0.4\linewidth}@{}} +\bfseries Command Name & \bfseries Translator Key Word & +\bfseries Purpose\cr +\ics{glossaryname} & \texttt{Glossary} & Title of the main glossary.\cr +\ics{acronymname} & \texttt{Acronyms} & Title of the list of acronyms +(when used with package option \pkgopt{acronym}).\cr +\ics{entryname} & \texttt{Notation (glossaries)} & +Header for first column in the glossary (for 2, 3 or 4 column glossaries +that support headers).\cr +\ics{descriptionname} & \texttt{Description (glossaries)} & +Header for second column in the glossary (for 2, 3 or 4 column glossaries +that support headers).\cr +\ics{symbolname} & \texttt{Symbol (glossaries)} & Header for symbol +column in the glossary for glossary styles that support this option.\cr +\ics{pagelistname} & \texttt{Page List (glossaries)} & +Header for page list column in the glossary for glossaries that support +this option.\cr +\ics{glssymbolsgroupname} & \texttt{Symbols (glossaries)} & +Header for symbols section of the glossary for glossary styles that +support this option.\cr +\ics{glsnumbersgroupname} & \texttt{Numbers (glossaries)} & Header for +numbers section of the glossary for glossary styles that support +this option. +\end{tabular} +\end{table} + +As from version 4.12, multilingual support is provided by separate +language modules that need to be installed in addition to installing +the \styfmt{glossaries} package. You only need to install the +modules for the languages that you require. If the language module +has an unmaintained status, you can volunteer to take over the +maintenance by contacting me at +\url{http://www.dickimaw-books.com/contact.html}. The +\sty{translator} dictionary files for \styfmt{glossaries} are now +provided by the appropriate language module. For further details +about information specific to a given language, please see the +documentation for that language module. + +Examples of use: +\begin{itemize} +\item Using \sty{babel} and \sty{translator}: +\begin{verbatim} +\documentclass[english,french]{article} +\usepackage{babel} +\usepackage{glossaries} +\end{verbatim} +(\sty{translator} is automatically loaded). + +\item Using \sty{babel}: +\begin{verbatim} +\documentclass[english,french]{article} +\usepackage{babel} +\usepackage[translate=babel]{glossaries} +\end{verbatim} +(\sty{translator} isn't loaded). + +\item Using \sty{polyglossia}: +\begin{verbatim} +\documentclass{article} +\usepackage{polyglossia} +\setmainlanguage{english} +\usepackage{glossaries} +\end{verbatim} + +\end{itemize} + +Due to the varied nature of glossaries, it's likely that the +predefined translations may not be appropriate. If you are using the +\sty{babel} package and the \styfmt{glossaries} package option \pkgopt[babel]{translate}, you need to be familiar with the advice given in +\urlref{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=latexwords}{changing +the words babel uses}. If you are using the \sty{translator} +package, then you can provide your own dictionary with the necessary +modifications (using \cs{deftranslation}) and load it using +\cs{usedictionary}. If you simply want to change the title of a +glossary, you can use the \gloskey[printglossary]{title} key in +commands like \cs{printglossary} (but not the iterative commands +like \cs{printglossaries}). + +\begin{important} +Note that the \sty{translator} dictionaries are loaded at the beginning of the +document, so it won't have any effect if you put \cs{deftranslation} +in the preamble. It should be put in your personal dictionary +instead (as in the example below). See the \sty{translator} +documentation for further details. (Now with \sty{beamer} +documentation.) +\end{important} + +Your custom dictionary doesn't have to be just a translation from +English to another language. You may prefer to have a dictionary for +a particular type of document. For example, suppose your +institution's in-house reports have to have the glossary labelled as +\qt{Nomenclature} and the page list should be labelled +\qt{Location}, then you can create a file called, say, +\begin{verbatim} +myinstitute-glossaries-dictionary-English.dict +\end{verbatim} +that contains the following: +\begin{verbatim} +\ProvidesDictionary{myinstitute-glossaries-dictionary}{English} +\deftranslation{Glossary}{Nomenclature} +\deftranslation{Page List (glossaries)}{Location} +\end{verbatim} +You can now load it using: +\begin{verbatim} +\usedictionary{myinstitute-glossaries-dictionary} +\end{verbatim} +(Make sure that \texttt{myinstitute-glossaries-dictionary-English.dict} +can be found by \TeX.) If you want to share your custom dictionary, +you can upload it to \href{http://www.ctan.org/}{CTAN}. + +If you are using \sty{babel} and don't want to use the +\sty{translator} interface, you can use the package +option \pkgopt[babel]{translate}. For example: +\begin{verbatim} +\documentclass[british]{article} + +\usepackage{babel} +\usepackage[translate=babel]{glossaries} + +\addto\captionsbritish{% + \renewcommand*{\glossaryname}{List of Terms}% + \renewcommand*{\acronymname}{List of Acronyms}% +} +\end{verbatim} + +Note that \gls{xindy} and \gls{bib2gls} provide much better multi-lingual support +than \gls{makeindex}, so I~recommend that you use \optsor34 +if you have glossary entries that contain +\glspl{nonlatinchar}. See \sectionref{sec:xindy} for further +details on \gls{xindy}, and see the \gls{bib2gls} user manual for +further details of that application. + +\subsubsection{Creating a New Language Module} +\label{sec:newlang} + +The \styfmt{glossaries} package now uses the \sty{tracklang} package +to determine which language modules need to be loaded. If you want +to create a new language module, you should first read the +\sty{tracklang} documentation. + +To create a new language module, you need to at least create two +files: \texttt{glossaries-}\meta{lang}\texttt{.ldf} and +\texttt{glossaries-dictionary-}\meta{Lang}\texttt{.dict} where +\meta{lang} is the root language name (for example, +\texttt{english}) and \meta{Lang} is the language name used by +\sty{translator} (for example, \texttt{English}). + +Here's an example of \texttt{glossaries-dictionary-English.dict}: +\begin{verbatim} +\ProvidesDictionary{glossaries-dictionary}{English} + +\providetranslation{Glossary}{Glossary} +\providetranslation{Acronyms}{Acronyms} +\providetranslation{Notation (glossaries)}{Notation} +\providetranslation{Description (glossaries)}{Description} +\providetranslation{Symbol (glossaries)}{Symbol} +\providetranslation{Page List (glossaries)}{Page List} +\providetranslation{Symbols (glossaries)}{Symbols} +\providetranslation{Numbers (glossaries)}{Numbers} +\end{verbatim} +You can use this as a template for your dictionary file. Change +\texttt{English} to the \sty{translator} name for your language +(so that it matches the file name +\texttt{glossaries-dictionary-}\meta{Lang}\texttt{.dict}) +and, for each \cs{providetranslation}, change the second argument to +the appropriate translation. + +Here's an example of \texttt{glossaries-english.ldf}: +\begin{verbatim} +\ProvidesGlossariesLang{english} + +\glsifusedtranslatordict{English} +{% + \addglossarytocaptions{\CurrentTrackedLanguage}% + \addglossarytocaptions{\CurrentTrackedDialect}% +} +{% + \@ifpackageloaded{polyglossia}% + {% + \newcommand*{\glossariescaptionsenglish}{% + \renewcommand*{\glossaryname}{\textenglish{Glossary}}% + \renewcommand*{\acronymname}{\textenglish{Acronyms}}% + \renewcommand*{\entryname}{\textenglish{Notation}}% + \renewcommand*{\descriptionname}{\textenglish{Description}}% + \renewcommand*{\symbolname}{\textenglish{Symbol}}% + \renewcommand*{\pagelistname}{\textenglish{Page List}}% + \renewcommand*{\glssymbolsgroupname}{\textenglish{Symbols}}% + \renewcommand*{\glsnumbersgroupname}{\textenglish{Numbers}}% + }% + }% + {% + \newcommand*{\glossariescaptionsenglish}{% + \renewcommand*{\glossaryname}{Glossary}% + \renewcommand*{\acronymname}{Acronyms}% + \renewcommand*{\entryname}{Notation}% + \renewcommand*{\descriptionname}{Description}% + \renewcommand*{\symbolname}{Symbol}% + \renewcommand*{\pagelistname}{Page List}% + \renewcommand*{\glssymbolsgroupname}{Symbols}% + \renewcommand*{\glsnumbersgroupname}{Numbers}% + }% + }% + \ifcsdef{captions\CurrentTrackedDialect} + {% + \csappto{captions\CurrentTrackedDialect}% + {% + \glossariescaptionsenglish + }% + }% + {% + \ifcsdef{captions\CurrentTrackedLanguage} + { + \csappto{captions\CurrentTrackedLanguage}% + {% + \glossariescaptionsenglish + }% + }% + {% + }% + }% + \glossariescaptionsenglish +} +\renewcommand*{\glspluralsuffix}{s} +\renewcommand*{\glsacrpluralsuffix}{\glspluralsuffix} +\renewcommand*{\glsupacrpluralsuffix}{\glstextup{\glspluralsuffix}} +\end{verbatim} +This is a somewhat longer file, but again you can use it as a +template. Replace \texttt{English} with the \sty{translator} +language label \meta{Lang} used for the dictionary file and +replace \texttt{english} with the root language name \meta{lang}. Within the +definition of \cs{glossariescaptions}\meta{lang}, replace the +English text (such as \qt{Glossaries}) with the appropriate +translation. + +\label{pluralsuffix}% +\textbf{Note:} the suffixes used to generate the plural forms when +the plural hasn't been specified are given by +\cs{glspluralsuffix} (for general entries) and +\cs{glsupacrpluralsuffix} for acronyms where the suffix needs to be +set using \cs{glstextup} to counteract the effects of \cs{textsc} +and \cs{glsacrpluralsuffix} for other acronym styles. There's no +guarantee when these commands will be expanded. They may be expanded +on definition or they may be expanded on use, depending on the +\styfmt{glossaries} configuration. + +\begin{important} +Therefore these plural suffix command definitions +aren't included in the caption mechanism as that's typically not switched on +until the start of the document. \textbf{This means that the suffix in +effect will be for the last loaded language that redefined these +commands.} It's best to initialise these commands to the most common +suffix required in your document and use the \gloskey{plural}, +\gloskey{longplural}, \gloskey{shortplural} etc keys to override +exceptions. +\end{important} + +If you want to add a regional variation, create a file called +\texttt{glossaries-}\meta{iso lang}\texttt{-}\meta{iso +country}\texttt{.ldf}, where \meta{iso lang} is the ISO language +code and \meta{iso country} is the ISO country code. For example, +\texttt{glossaries-en-GB.ldf}. This file can load the root +language file and make the appropriate changes, for example: +\begin{verbatim} + \ProvidesGlossariesLang{en-GB} + \RequireGlossariesLang{english} + \glsifusedtranslatordict{British} + {% + \addglossarytocaptions{\CurrentTrackedLanguage}% + \addglossarytocaptions{\CurrentTrackedDialect}% + } + {% + \@ifpackageloaded{polyglossia}% + {% + % Modify \glossariescaptionsenglish as appropriate for + % polyglossia + }% + {% + % Modify \glossariescaptionsenglish as appropriate for + % non-polyglossia + }% + } +\end{verbatim} + +If the translations includes \glspl{nonlatinchar}, it's necessary to +provide code that's independent of the input encoding. Remember that +while some users may use UTF-8, others may use Latin-1 or any other +supported encoding, but while users won't appreciate you enforcing +your preference on them, it's useful to provide a UTF-8 version for +\XeLaTeX\ users. + +The \texttt{glossaries-irish.ldf} file provides this as follows: +\begin{verbatim} +\ProvidesGlossariesLang{irish} + +\glsifusedtranslatordict{Irish} +{% + \addglossarytocaptions{\CurrentTrackedLanguage}% + \addglossarytocaptions{\CurrentTrackedDialect}% +} +{% + \ifdefstring{\inputencodingname}{utf8} + {\input{glossaries-irish-utf8.ldf}}% + {% + \ifdef{\XeTeXinputencoding}% XeTeX defaults to UTF-8 + {\input{glossaries-irish-utf8.ldf}}% + {\input{glossaries-irish-noenc.ldf}} + } + \ifcsdef{captions\CurrentTrackedDialect} + {% + \csappto{captions\CurrentTrackedDialect}% + {% + \glossariescaptionsirish + }% + }% + {% + \ifcsdef{captions\CurrentTrackedLanguage} + { + \csappto{captions\CurrentTrackedLanguage}% + {% + \glossariescaptionsirish + }% + }% + {% + }% + }% + \glossariescaptionsirish +} +\end{verbatim} +(Again you can use this as a template. Replace \texttt{irish} with +your root language label and \texttt{Irish} with the +\sty{translator} dictionary label.) + +There are now two extra files: \texttt{glossaries-irish-noenc.ldf} +and \texttt{glossaries-irish-utf8.ldf}. + +These both define \cs{glossariescaptionsirish} but the \texttt{*-noenc.ldf} uses +\LaTeX\ accent commands: +\begin{verbatim} +\@ifpackageloaded{polyglossia}% +{% + \newcommand*{\glossariescaptionsirish}{% + \renewcommand*{\glossaryname}{\textirish{Gluais}}% + \renewcommand*{\acronymname}{\textirish{Acrainmneacha}}% + \renewcommand*{\entryname}{\textirish{Ciall}}% + \renewcommand*{\descriptionname}{\textirish{Tuairisc}}% + \renewcommand*{\symbolname}{\textirish{Comhartha}}% + \renewcommand*{\glssymbolsgroupname}{\textirish{Comhartha\'{\i}}}% + \renewcommand*{\pagelistname}{\textirish{Leathanaigh}}% + \renewcommand*{\glsnumbersgroupname}{\textirish{Uimhreacha}}% + }% +}% +{% + \newcommand*{\glossariescaptionsirish}{% + \renewcommand*{\glossaryname}{Gluais}% + \renewcommand*{\acronymname}{Acrainmneacha}% + \renewcommand*{\entryname}{Ciall}% + \renewcommand*{\descriptionname}{Tuairisc}% + \renewcommand*{\symbolname}{Comhartha}% + \renewcommand*{\glssymbolsgroupname}{Comhartha\'{\i}}% + \renewcommand*{\pagelistname}{Leathanaigh}% + \renewcommand*{\glsnumbersgroupname}{Uimhreacha}% + }% +} +\end{verbatim} +whereas the \texttt{*-utf8.ldf} replaces the accent commands with +the appropriate UTF-8 characters. + + +\section{Generating the Associated Glossary Files} +\label{sec:makeglossaries} + +\begin{important} +This section is only applicable if you have chosen \optsor23. You can +ignore this section if you have chosen any of the other options. If you want to +alphabetically sort your entries always remember to use the +\gloskey{sort} key if the \gloskey{name} contains any \LaTeX\ commands. +\end{important} + +If this section seriously confuses you, and you can't work out how +to run external tools like \gls{makeglossaries} or \gls{makeindex}, you can try using +the \pkgopt{automake} package option, described in +\sectionref{sec:pkgopts-sort}, but you will need \TeX's shell escape +enabled. + +In order to generate a sorted glossary with compact +\glspl{numberlist}, it is necessary to use an external +\gls{indexingapp} as an intermediate step (unless you have chosen +\opt1, which uses \TeX\ to do the sorting or \opt5, which doesn't +perform any sorting). It is this application +that creates the file containing the code required to typeset the +glossary. \textbf{If this step is omitted, the glossaries will not +appear in your document.} The two \glspl*{indexingapp} that are most +commonly used with \LaTeX\ are \gls{makeindex} and \gls{xindy}. As +from version 1.17, the \styfmt{glossaries} package can be used with +either of these applications. Previous versions were designed to be +used with \gls*{makeindex} only. With the \sty{glossaries-extra} package, you +can also use \gls{bib2gls} as the indexing application. (See +the \sty{glossaries-extra} and \gls{bib2gls} user manuals for +further details.) Note that \gls*{xindy} and \gls*{bib2gls} have much +better multi-lingual support than \gls*{makeindex}, so \gls*{xindy} +or \gls*{bib2gls} are recommended if you're not writing in English. +Commands that only have an effect when \gls*{xindy} is used are +described in \sectionref{sec:xindy}. + +\begin{important} +This is a multi-stage process, but there are methods of automating +document compilation using applications such as \app{latexmk} and +\app{arara}. With \app{arara} you can just add special comments to +your document source: +\begin{alltt} +\% arara: pdflatex +\% arara: makeglossaries +\% arara: pdflatex +\end{alltt} +With \app{latexmk} you need to set up the required dependencies. +\end{important} + +The \styfmt{glossaries} package comes with the Perl script +\gls{makeglossaries} which will run \gls{makeindex} or \gls{xindy} +on all the glossary files using a customized style file (which is +created by \ics{makeglossaries}). See +\sectionref{sec:makeglossariesapp} for further +details. Perl is stable, cross-platform, open source software that +is used by a number of \TeX-related applications (including +\gls*{xindy} and \app{latexmk}). Most Unix-like +operating systems come with a~Perl interpreter. \TeX~Live also comes +with a~Perl interpreter. MiK\TeX\ doesn't come with a~Perl +interpreter so if you are a~Windows MiK\TeX\ user you will need to +install Perl if you want to use \gls{makeglossaries} or \gls{xindy}. +Further information is available at \url{http://www.perl.org/about.html} +and +\href{http://tex.stackexchange.com/questions/158796/miktex-and-perl-scripts-and-one-python-script}{MiKTeX and Perl scripts (and one Python script)}. + +The advantages of using \gls*{makeglossaries}: +\begin{itemize} +\item It automatically detects whether to use \gls*{makeindex} or +\gls*{xindy} and sets the relevant application switches. + +\item One call of \gls*{makeglossaries} will run +\gls*{makeindex}\slash\gls*{xindy} for each glossary type. + +\item If things go wrong, \gls{makeglossaries} will scan the +messages from \gls{makeindex} or \gls{xindy} and attempt to diagnose +the problem in relation to the \styfmt{glossaries} package. This +will hopefully provide more helpful messages in some cases. If it +can't diagnose the problem, you will have to read the relevant transcript +file and see if you can work it out from the \gls*{makeindex} or +\gls*{xindy} messages. + +\item If \gls{makeindex} warns about multiple encap values, +\gls{makeglossaries} will detect this and attempt to correct the +problem.\footnote{Added to version \gls{makeglossaries} 2.18.} This +correction is only provided by \gls{makeglossaries} when +\gls{makeindex} is used since \gls{xindy} uses the order of the +attributes list to determine which format should take precedence. +(See \cs{GlsAddXdyAttribute} in \sectionref{sec:xindyloc}.) + +\end{itemize} + +As from version 4.16, the \styfmt{glossaries} package also comes +with a~Lua script called \gls{makeglossaries-lite.lua}. This is a +\emph{trimmed-down} alternative to the \gls{makeglossaries} Perl +script. It doesn't have some of the options that the Perl version +has and it doesn't attempt to diagnose any problems, but since +modern \TeX\ distributions come with Lua\TeX\ (and therefore have +a~Lua interpreter) you don't need to install anything else in order +to use \gls{makeglossaries-lite.lua} so it's an alternative to +\gls{makeglossaries} if you want to use \opt2 (\gls{makeindex}). + +If things go wrong and you can't work out why your glossaries +aren't being generated correctly, you can use +\gls{makeglossariesgui} as a diagnostic tool. Once you've +fixed the problem, you can then go back to using +\gls{makeglossaries} or \gls{makeglossaries-lite.lua}. + +Whilst I strongly recommended that you use the \gls{makeglossaries} +Perl script or the \gls{makeglossaries-lite.lua} Lua script, it is +possible to use the \styfmt{glossaries} package without using those +applications. However, note that some commands and package options +have no effect if you explicitly run \gls{makeindex}\slash\gls{xindy}. +These are listed in \tableref{tab:makeglossariesCmds}. + +\begin{important} +If you are choosing not to use \gls*{makeglossaries} because you +don't want to install Perl, you will only be able to use +\gls*{makeindex} as \gls*{xindy} also requires Perl. (Other useful +Perl scripts include \appfmt{epstopdf} and \appfmt{latexmk}, so it's +well-worth the effort to install Perl.) +\end{important} + +Note that if any of your entries use an entry +that is not referenced outside the glossary, you will need to +do an additional \gls{makeglossaries}, \gls{makeindex} +or \gls{xindy} run, as appropriate. For example, +suppose you have defined the following entries:\footnote{As from +v3.01 \ics{gls} is no longer fragile and doesn't need protecting.} +\begin{verbatim} +\newglossaryentry{citrusfruit}{name={citrus fruit}, +description={fruit of any citrus tree. (See also +\gls{orange})}} + +\newglossaryentry{orange}{name={orange}, +description={an orange coloured fruit.}} +\end{verbatim} +and suppose you have \verb|\gls{citrusfruit}| in your document +but don't reference the \texttt{orange} entry, then the +\texttt{orange} entry won't appear in your glossary until +you first create the glossary and then do another run +of \gls{makeglossaries}, \gls{makeindex} or \gls{xindy}. +For example, if the document is called \texttt{myDoc.tex}, then +you must do: +\begin{prompt} +latex myDoc +makeglossaries myDoc +latex myDoc +makeglossaries myDoc +latex myDoc +\end{prompt} +(Note that if you use \gls{glossaries-extra}, this will be done +automatically for you if the \pkgoptfmt{indexcrossrefs} feature is +enabled. See the \gls*{glossaries-extra} user guide for further +details.) + +Likewise, an additional \gls{makeglossaries} and \LaTeX\ run +may be required if the document pages shift with re-runs. For +example, if the page numbering is not reset after the table of +contents, the insertion of the table of contents on the second +\LaTeX\ run may push glossary entries across page boundaries, which +means that the \glspl{numberlist} in the glossary may +need updating. + +The examples in this document assume that you are accessing +\gls{makeglossaries}, \gls{xindy} or \gls{makeindex} via a terminal. +Windows users can use the MSDOS Prompt which is usually accessed via +the \menu{Start}\submenu{All Programs} menu or +\menu{Start}\submenu{All Programs}\submenu{Accessories} menu. + +Alternatively, your text editor may have the facility to create a +function that will call the required application. See +\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating +makeglossaries or makeglossaries-lite or bib2gls into the document +build}. + +If any problems occur, remember to check the transcript files +(e.g.\ \filetype{.glg} or \filetype{.alg}) for messages. + +\begin{table}[htbp] +\caption[Commands and package options that have no effect when +using xindy or makeindex explicitly]{Commands and package options that have no effect when +using \gls{xindy} or \gls{makeindex} explicitly} +\label{tab:makeglossariesCmds} +\vskip\baselineskip +\begin{tabular}{@{}lll@{}} +\bfseries Command or Package Option & \gls{makeindex} & +\gls{xindy}\\ +\pkgopt[letter]{order} & use \mkidxopt{l} & + use \xdyopt{M}\texttt{ ord/letorder}\\ +\pkgopt[word]{order} & default & default\\ +\pkgopt{xindy}=\{\pkgoptfmt{language=}\meta{lang}\pkgoptfmt{,codename=}\meta{code}\} & +N/A & use \xdyopt{L} \meta{lang} \xdyopt{C} \meta{code}\\ +\ics{GlsSetXdyLanguage}\marg{lang} & N/A & +use \xdyopt{L} \meta{lang}\\ +\ics{GlsSetXdyCodePage}\marg{code} & N/A & +use \xdyopt{C} \meta{code} +\end{tabular} +\par +\end{table} + + +\subsection{Using the makeglossaries Perl Script} +\label{sec:makeglossariesapp} + +The \gls{makeglossaries} script picks up the relevant information +from the auxiliary (\filetype{.aux}) file and will either call +\gls{xindy} or \gls{makeindex}, depending on the supplied +information. Therefore, you only need to pass the document's name +without the extension to \gls*{makeglossaries}. For example, if your +document is called \texttt{myDoc.tex}, type the following in your +terminal: +\begin{prompt} +latex myDoc +makeglossaries myDoc +latex myDoc +\end{prompt} +You may need to explicitly load \gls{makeglossaries} into Perl: +\begin{prompt} +perl makeglossaries myDoc +\end{prompt} + +Windows users: \TeX~Live on Windows has its own internal Perl +interpreter and provides \texttt{makeglossaries.exe} as a~convenient +wrapper for the \gls{makeglossaries} Perl script. MiKTeX also +provides a~wrapper \texttt{makeglossaries.exe} but doesn't provide +a~Perl interpreter, which is still required even if you run MiKTeX's +\texttt{makeglossaries.exe}, so with MiKTeX you'll need to install +Perl.\footnote{The batch file \texttt{makeglossaries.bat} has been +removed since the \TeX\ distributions for Windows provide +\texttt{makeglossaries.exe}.} There's more information about this at +\url{http://tex.stackexchange.com/q/158796/19862} on the TeX.SX +site. + +The \gls{makeglossaries} script attempts to fork the +\gls{makeindex}\slash\gls{xindy} process using \texttt{open()} on the +piped redirection \verb"2>&1 |" and parses the processor output to +help diagnose problems. If this method fails \gls{makeglossaries} +will print an \qt{Unable to fork} warning and will retry without +redirection. If you run \gls{makeglossaries} on an operating system +that doesn't support this form of redirection, then you can use the +\mkglsopt{Q} switch to suppress this warning or you can use the +\mkglsopt{k} switch to make \gls{makeglossaries} automatically use +the fallback method without attempting the redirection. Without this +redirection, the \mkglsopt{q} (quiet) switch doesn't work as well. + +You can specify in which directory the \filetype{.aux}, +\filetype{.glo} etc files are located using the \texttt{-d} switch. +For example: +\begin{prompt} +pdflatex -output-directory myTmpDir myDoc +makeglossaries -d myTmpDir myDoc +\end{prompt} +Note that \gls*{makeglossaries} assumes by default that +\gls*{makeindex}\slash\gls*{xindy} is on your operating system's +path. If this isn't the case, you can specify the full pathname +using \mkglsopt{m} \meta{path/to/makeindex} for \gls*{makeindex} +or \mkglsopt{x} \meta{path/to/xindy} for \gls*{xindy}. + +As from \gls{makeglossaries} v2.18, if you are using +\gls{makeindex}, there's a check for \gls*{makeindex}['s] multiple +encap warning. This is where different encap values (location formats) are +used on the same location for the same entry. For example: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} +\makeglossaries + +\newglossaryentry{sample}{name={sample},description={an example}} + +\begin{document} +\gls{sample}, \gls[format=textbf]{sample}. +\printglossaries +\end{document} +\end{verbatim} +If you explicitly use \gls{makeindex}, this will cause a warning and +the location list will be \qt{1, \textbf{1}}. That is, the page +number will be repeated with each format. As from v2.18, +\gls{makeglossaries} will check for this warning and, if found, will +attempt to correct the problem by removing duplicate locations and +retrying. There's no similar check for \gls{xindy} as \gls*{xindy} +won't produce any warning and will simply discard duplicates. + +The \gls{makeglossaries} script contains POD (Plain Old +Documentation). If you want, you can create a man page for +\gls*{makeglossaries} using \app{pod2man} and move the +resulting file onto the man path. Alternatively do +\texttt{makeglossaries -{}-help} for a list of all options or +\texttt{makeglossaries -{}-version} for the version number. + +\begin{important} +When upgrading the \styfmt{glossaries} package, make sure you also +upgrade your version of \gls{makeglossaries}. The current version is +4.41. +\end{important} + +\subsection{Using the makeglossaries-lite Lua Script} +\label{sec:makeglossarieslua} + +The Lua alternative to the \gls{makeglossaries} Perl script requires +a~Lua interpreter, which should already be available if you have +a~modern \TeX\ distribution that includes Lua\TeX. Lua is +a~light-weight, cross-platform scripting language, but because it's +light-weight it doesn't have the full-functionality of heavy-weight +scripting languages, such as Perl. The \gls{makeglossaries-lite.lua} +script is therefore limited by this and some of the options +available to the \gls{makeglossaries} Perl script aren't available +here. (In particular the \mkglsopt{d} option.) + +\begin{important} +Note that \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, so you may not need to +supply the extension. +\end{important} + +The \gls{makeglossaries-lite.lua} script can be invoked in the same way +as \gls{makeglossaries}. For example, if your document is called +\texttt{myDoc.tex}, then do +\begin{prompt} +makeglossaries-lite.lua myDoc +\end{prompt} +or +\begin{prompt} +makeglossaries-lite myDoc +\end{prompt} + +\emph{Some} of the options available with \gls{makeglossaries} are +also available with \gls{makeglossaries-lite.lua}. For a complete list of +available options, do +\begin{prompt} +makeglossaries-lite.lua -{}-help +\end{prompt} + + +\subsection[Using xindy explicitly (Option~3)]{Using +\gls{xindy} explicitly (\ifpdf \opt3\else Option 3\fi)} +\label{sec:xindyapp} + +\Gls{xindy} comes with \TeX~Live. It has also been added +to Mik\TeX, but if you don't have it installed, see +\href{http://tex.stackexchange.com/questions/71167/how-to-use-xindy-with-miktex}{How +to use Xindy with MikTeX} on +\urlfootref{http://www.stackexchange.com/}{\TeX\ on StackExchange}. + +If you want to use \gls{xindy} to process the glossary +files, you must make sure you have used the +\pkgopt{xindy} package option: +\begin{verbatim} +\usepackage[xindy]{glossaries} +\end{verbatim} +This is required regardless of whether you use \gls{xindy} +explicitly or whether it's called implicitly via applications such +as \gls{makeglossaries}. This causes the glossary +entries to be written in raw \gls*{xindy} format, so you need to +use \xdyopt{I}\texttt{ xindy} \emph{not} \xdyopt{I}\texttt{ tex}. + +To run \gls{xindy} type the following in your terminal +(all on one line): +\begin{prompt} +xindy -L \meta{language} -C \meta{encoding} -I xindy -M \meta{style} -t \meta{base}.glg -o \meta{base}.gls \meta{base}.glo +\end{prompt} +where \meta{language} is the required language name, \meta{encoding} +is the encoding, \meta{base} is the name of the document without the +\filetype{.tex} extension and \meta{style} is the name of the +\gls{xindy} style file without the \filetype{.xdy} extension. +The default name for this style file is \meta{base}\filetype{.xdy} +but can be changed via \ics{setStyleFile}\marg{style}. You may need +to specify the full path name depending on the current working +directory. If any of the file names contain spaces, you must delimit +them using double-quotes. + +For example, if your document is called \texttt{myDoc.tex} and +you are using UTF8 encoding in English, then type the +following in your terminal: +\begin{prompt} +xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo +\end{prompt} + +Note that this just creates the main glossary. You need to do +the same for each of the other glossaries (including the +list of acronyms if you have used the \pkgopt{acronym} +package option), substituting \filetype{.glg}, \filetype{.gls} +and \filetype{.glo} with the relevant extensions. For example, +if you have used the \pkgopt{acronym} package option, then +you would need to do: +\begin{prompt} +xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.alg -o myDoc.acr myDoc.acn +\end{prompt} +For additional glossaries, the extensions are those supplied +when you created the glossary with \ics{newglossary}. + +Note that if you use \gls{makeglossaries} instead, you can +replace all those calls to \gls{xindy} with just one call +to \gls*{makeglossaries}: +\begin{prompt} +makeglossaries myDoc +\end{prompt} +Note also that some commands and package options have no effect if +you use \gls{xindy} explicitly instead of using +\gls*{makeglossaries}. These are listed in +\tableref{tab:makeglossariesCmds}. + + +\subsection[Using makeindex explicitly (Option~2)]{Using +\gls{makeindex} explicitly (\ifpdf \opt2\else Option 2\fi)} +\label{sec:makeindexapp} + +If you want to use \gls{makeindex} explicitly, you must +make sure that you haven't used the \pkgopt{xindy} package +option or the glossary entries will be written in the wrong +format. To run \gls*{makeindex}, type the following in +your terminal: +\begin{prompt} +makeindex -s \meta{style}.ist -t \meta{base}.glg -o \meta{base}.gls \meta{base}.glo +\end{prompt} +where \meta{base} is the name of your document without the +\filetype{.tex} extension and \meta{style}\filetype{.ist} is the +name of the \gls{makeindex} style file. By default, this is +\meta{base}\filetype{.ist}, but may be changed via +\ics{setStyleFile}\marg{style}. Note that there are other options, +such as \mkidxopt{l} (letter ordering). See the \gls*{makeindex} +manual for further details. + +For example, if your document is called \texttt{myDoc.tex}, then +type the following at the terminal: +\begin{prompt} +makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo +\end{prompt} +Note that this only creates the main glossary. If you have +additional glossaries (for example, if you have used the +\pkgopt{acronym} package option) then you must call +\gls{makeindex} for each glossary, substituting +\filetype{.glg}, \filetype{.gls} and \filetype{.glo} with the +relevant extensions. For example, if you have used the +\pkgopt{acronym} package option, then you need to type the +following in your terminal: +\begin{prompt} +makeindex -s myDoc.ist -t myDoc.alg -o myDoc.acr myDoc.acn +\end{prompt} +For additional glossaries, the extensions are those supplied +when you created the glossary with \ics{newglossary}. + +Note that if you use \gls{makeglossaries} instead, you can +replace all those calls to \gls{makeindex} with just one call +to \gls*{makeglossaries}: +\begin{prompt} +makeglossaries myDoc +\end{prompt} +Note also that some commands and package options have no effect if +you use \gls*{makeindex} explicitly instead of using +\gls{makeglossaries}. These are listed in +\tableref{tab:makeglossariesCmds}. + + +\subsection{Note to Front-End and Script Developers} +\label{sec:notedev} + +The information needed to determine whether to use \gls{xindy} +or \gls{makeindex} and the information needed to call those +applications is stored in the auxiliary file. This information can +be gathered by a front-end, editor or script to make the glossaries +where appropriate. This section describes how the information is +stored in the auxiliary file. + +The file extensions used by each defined glossary are given by +\begin{definition}[\DescribeMacro{\@newglossary}] +\cs{@newglossary}\marg{label}\marg{log}\marg{out-ext}\marg{in-ext} +\end{definition} +where \meta{in-ext} is the extension of the +\emph{\gls{indexingapp}['s]} input file (the output file from the +\styfmt{glossaries} package's point of view), \meta{out-ext} is the +extension of the \emph{\gls*{indexingapp}['s]} output file (the +input file from the \styfmt{glossaries} package's point of view) and +\meta{log} is the extension of the \gls*{indexingapp}['s] transcript +file. The label for the glossary is also given for information +purposes only, but is not required by the \glspl*{indexingapp}. For +example, the information for the default main glossary is written +as: +\begin{verbatim} +\@newglossary{main}{glg}{gls}{glo} +\end{verbatim} + +The \gls{indexingapp}['s] style file is specified by +\begin{definition}[\DescribeMacro{\@istfilename}] +\cs{@istfilename}\marg{filename} +\end{definition} +The file extension indicates whether to use \gls{makeindex} +(\filetype{.ist}) or \gls{xindy} (\filetype{.xdy}). Note that +the glossary information is formatted differently depending on +which \gls*{indexingapp} is supposed to be used, so it's +important to call the correct one. + +Word or letter ordering is specified by: +\begin{definition}[\DescribeMacro{\@glsorder}] +\cs{@glsorder}\marg{order} +\end{definition} +where \meta{order} can be either \texttt{word} or \texttt{letter}. + +If \gls{xindy} should be used, the language and code page +for each glossary is specified by +\begin{definition}[\DescribeMacro{\@xdylanguage}\DescribeMacro{\@gls@codepage}] +\cs{@xdylanguage}\marg{label}\marg{language}\\ +\cs{@gls@codepage}\marg{label}\marg{code} +\end{definition} +where \meta{label} identifies the glossary, \meta{language} is +the root language (e.g.\ \texttt{english}) and \meta{code} +is the encoding (e.g.\ \texttt{utf8}). These commands are omitted +if \gls{makeindex} should be used. + +If \opt1 has been used, the \texttt{.aux} file will contain +\begin{definition} +\cs{@gls@reference}\marg{type}\marg{label}\marg{location} +\end{definition} +for every time an entry has been referenced. If \opt4 has been +used, the \texttt{.aux} file will contain one or more instances of +\begin{definition} +\cs{glsxtr@resource}\marg{options}\marg{basename} +\end{definition} + +\chapter{Package Options} +\label{sec:pkgopts} + +This section describes the available \styfmt{glossaries} package +options. You may omit the \texttt{=true} for boolean options. (For +example, \pkgopt{acronym} is equivalent to \pkgopt[true]{acronym}). +The \gls{glossaries-extra} package has additional options described +in the \gls*{glossaries-extra} manual. + +\begin{important} +Note that \meta{key}=\meta{value} package options can't be passed via the +document class options. (This includes options where the +\meta{value} part may be omitted, such as \pkgopt{acronym}.) This is +a general limitation not restricted to the \styfmt{glossaries} +package. Options that aren't \meta{key}=\meta{value} (such as +\pkgopt{makeindex}) may be passed via the document class options. +\end{important} + +\section{General Options} +\label{sec:pkgopts-general} + +\begin{description} +\item[\pkgoptdef{nowarn}] This suppresses all warnings generated by +the \styfmt{glossaries} package. Don't use this option if you're new to using +\styfmt{glossaries} as the warnings are designed to help detect +common mistakes (such as forgetting to use \ics{makeglossaries}). +Note that the \pkgopt[true]{debug} and \pkgopt[showtargets]{debug} will override this option. + +\item[\pkgoptdef{nolangwarn}] This suppresses the warning generated by +a missing language module. + +\item[\pkgoptdef{noredefwarn}] If you load \styfmt{glossaries} with +a~class or another package that already defines glossary related +commands, by default \styfmt{glossaries} will warn you that it's +redefining those commands. If you are aware of the consequences of +using \styfmt{glossaries} with that class or package and you don't +want to be warned about it, use this option to suppress those +warnings. Other warnings will still be issued unless you use the +\pkgopt{nowarn} option described above. + +\item[\pkgoptdef{debug}] Introduced in version 4.24. +The default setting is \pkgopt[false]{debug}. +This was a boolean option but as from v4.32 it now accepts the +values: \pkgoptfmt{false}, \pkgoptfmt{true} and +\pkgoptfmt{showtargets}. If no value is given, \pkgopt[true]{debug} is assumed. +Both \pkgopt[true]{debug} and \pkgopt[showtargets]{debug} +switch on the debug mode (and will automatically +cancel the \pkgopt{nowarn} option). The \pkgopt[showtargets]{debug} +option will additionally use +\begin{definition}[\DescribeMacro\glsshowtarget] +\cs{glsshowtarget}\marg{target name} +\end{definition} +to show the hypertarget or hyperlink name in the margin when +\cs{glsdohypertarget} is used by commands like \cs{glstarget} +and when \cs{glsdohyperlink} is used by commands like \cs{gls}. +This puts the information in the margin using \ics{marginpar} unless +math mode or inner mode are detected, in which case it puts the +information in line enclosed by square brackets. The +\gls{glossaries-extra} package provides an additional setting that +may be used to show where the indexing is occurring. See the +\gls{glossaries-extra} manual for further details. + +The purpose of the debug mode can be demonstrated with +the following example document: +\begin{verbatim} +\documentclass{article} +\usepackage{glossaries} +\newglossaryentry{sample1}{name={sample1}, + description={example}} +\newglossaryentry{sample2}{name={sample2}, + description={example}} +\glsadd{sample2} +\makeglossaries +\begin{document} +\gls{sample1}. +\printglossaries +\end{document} +\end{verbatim} +In this case, only the \texttt{sample1} entry has been indexed, even +though \verb|\glsadd{sample2}| appears in the source code. +This is because \verb|\glsadd{sample2}| has been used before the +associated file is opened by \ics{makeglossaries}. Since the file +isn't open yet, the information can't be written to it, which is why +the \texttt{sample2} entry doesn't appear in the glossary. + +This situation doesn't cause any errors or warnings as it's +perfectly legitimate for a user to want to use \styfmt{glossaries} +to format the entries (e.g.\ abbreviation expansion) but not display +any lists of terms, abbreviations, symbols etc. +Without \cs{makeglossaries} the indexing is suppressed but, other +than that, commands like \cs{gls} behave as usual. It's also +possible that the user may want to temporarily comment out +\cs{makeglossaries} in order to suppress the indexing while working +on a draft version to speed compilation. Therefore +\cs{makeglossaries} can't be used to enable \cs{newglossaryentry} +and \cs{glsadd}. They must be enabled by default. (It does, however, +enable the \gloskey{see} key as that's a more common problem. See +below.) + +The debug mode, enabled with the \pkgopt{debug} option, +\begin{verbatim} +\usepackage[debug]{glossaries} +\end{verbatim} +will write information to the log file when the indexing +can't occur because the associated file isn't open. +The message is written in the form +\begin{quote} +Package glossaries Info: wrglossary(\meta{type})(\meta{text}) on +input line \meta{line number}. +\end{quote} +where \meta{type} is the glossary label and \meta{text} is the line +of text that would've been written to the associated file if +it had been open. So if any entries haven't appeared in the +glossary but you're sure you used commands like \cs{glsadd} +or \cs{glsaddall}, try switching on the \pkgopt{debug} option +and see if any information has been written to the log file. + +\item[\pkgoptdef{seenoindex}] Introduced in version 4.24, this option +may take one of three values: \pkgoptfmt{error}, \pkgoptfmt{warn} or +\pkgoptfmt{ignore}. The \gloskey{see} key automatically indexes the +cross-referenced entry using \cs{glsadd}. This means that it suffers +from the same problem as the above. If used before the relevant +glossary file has been opened, the indexing can't be performed. +Since this is easy to miss, the \styfmt{glossaries} package by +default issues an error message if the \gloskey{see} key is used +before \cs{makeglossaries}. This option allows you to change the +error into just a warning (\pkgopt[warn]{seenoindex}) or +ignore it (\pkgopt[ignore]{seenoindex}) if, for example, you want +to temporarily comment out \cs{makeglossaries} to speed up the +compilation of a draft document by omitting the indexing. + +\item[\pkgoptdef{nomain}] This suppresses the creation of the main +glossary and associated \texttt{.glo} file, if unrequired. Note that +if you use this option, you must create another glossary in which to +put all your entries (either via the \pkgopt{acronym} (or +\pkgopt{acronyms}) package option described in +\sectionref{sec:pkgopts-acronym} or via the \pkgopt{symbols}, +\pkgopt{numbers} or \pkgopt{index} options described in +\sectionref{sec:pkgopts-other} or via \ics{newglossary} described in +\sectionref{sec:newglossary}). + +\begin{important} +If you don't use the main glossary and you don't use this option, +\gls{makeglossaries} will produce a warning. +\end{important} +\begin{alltt} +Warning: File '\emph{filename}.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{alltt} +If you did actually want to use the main glossary and you see this +warning, check that you have referenced the entries in that glossary +via commands such as \ics{gls}. + +\item[\pkgoptdef{sanitizesort}] This is a boolean option that +determines whether or not to \gls{sanitize} the sort value when +writing to the external glossary file. For example, suppose you +define an entry as follows: +\begin{verbatim} +\newglossaryentry{hash}{name={\#},sort={#}, + description={hash symbol}} +\end{verbatim} +The sort value (\verb|#|) must be sanitized before writing it to the +glossary file, otherwise \LaTeX\ will try to interpret it as a +parameter reference. If, on the other hand, you want the sort value +expanded, you need to switch off the sanitization. For example, +suppose you do: +\begin{verbatim} +\newcommand{\mysortvalue}{AAA} +\newglossaryentry{sample}{% + name={sample}, + sort={\mysortvalue}, + description={an example}} +\end{verbatim} +and you actually want \cs{mysortvalue} expanded, so that the entry +is sorted according to \texttt{AAA}, then use the package option +\pkgopt[false]{sanitizesort}. + +The default for \optsand23 is \pkgopt[true]{sanitizesort}, and the +default for \opt1 is \pkgopt[false]{sanitizesort}. + +\item[\pkgoptdef{savewrites}] This is a boolean option to minimise the +number of write registers used by the \styfmt{glossaries} package. +(Default is \pkgopt[false]{savewrites}.) There are only a limited +number of write registers, and if you have a large number of +glossaries or if you are using a class or other packages that +create a lot of external files, you may exceed the maximum number +of available registers. If \pkgopt{savewrites} is set, the glossary +information will be stored in token registers until the end of the +document when they will be written to the external files. + +\begin{important} +This option can significantly slow document compilation and may +cause the indexing to fail. Page numbers in the \gls{numberlist} +will be incorrect on page boundaries due to \TeX's asynchronous +output routine. As an alternative, you can use the \sty{scrwfile} +package (part of the KOMA-Script bundle) and not use this option. +\end{important} + +You can also reduce the number of write registers by using +\optsor14 or by ensuring you define all your glossary entries in the +preamble. + +\begin{important} +If you want to use \TeX's \ics{write18} mechanism to call +\gls{makeindex} or \gls{xindy} from your document and use +\pkgopt{savewrites}, you must create the external files with +\cs{glswritefiles} before you call \gls*{makeindex}/\gls*{xindy}. Also set +\cs{glswritefiles} to nothing or \cs{relax} before the end of the +document to avoid rewriting the files. For example: +\begin{verbatim} +\glswritefiles +\write18{makeindex -s \istfilename\space +-t \jobname.glg -o \jobname.gls \jobname} +\let\glswritefiles\relax +\end{verbatim} +\end{important} +In general, this package option is best avoided. + +\item[\pkgoptdef{translate}] This can take the following values: + + \begin{description} + \item[{\pkgopt[true]{translate}}] If \sty{babel} has been loaded + and the \sty{translator} package is installed, \sty{translator} + will be loaded and the translations will be provided by the + \sty{translator} package interface. You can modify the + translations by providing your own dictionary. If the + \sty{translator} package isn't installed and \sty{babel} is + loaded, the \sty{glossaries-babel} package will + be loaded and the translations will be provided using \styfmt{babel}'s + \cs{addto}\cs{caption}\meta{language} mechanism. If + \sty{polyglossia} has been loaded, \sty{glossaries-polyglossia} + will be loaded. + + \item[{\pkgopt[false]{translate}}] Don't provide translations, even + if \sty{babel} or \sty{polyglossia} has been loaded. + (Note that \sty{babel} provides the command \ics{glossaryname} + so that will still be translated if you have loaded \sty{babel}.) + + \item[{\pkgopt[babel]{translate}}] Don't load the \sty{translator} +package. Instead load \sty{glossaries-babel}. + +\begin{important} +I recommend you use \pkgopt[babel]{translate} if you have any +problems with the translations or with PDF bookmarks, but to maintain backward +compatibility, if \sty{babel} has been loaded the default is +\pkgopt[true]{translate}. +\end{important} + + \end{description} + + If \pkgopt{translate} is specified without a value, + \pkgopt[true]{translate} is assumed. If \pkgopt{translate} isn't +specified, \pkgopt[true]{translate} is assumed if \sty{babel}, +\sty{polyglossia} or \sty{translator} have been loaded. Otherwise +\pkgopt[false]{translate} is assumed. + +See \sectionref{sec:fixednames} for further details. + +\item[\pkgoptdef{notranslate}] This is equivalent to +\pkgopt[false]{translate} and may be passed via the document class +options. + +\item[\pkgoptdef{nohypertypes}] Use this option if you have multiple +glossaries and you want to suppress the entry hyperlinks for a +particular glossary or glossaries. The value of this option should +be a comma-separated list of glossary types where \ics{gls} etc +shouldn't have hyperlinks by default. Make sure you enclose the +value in braces if it contains any commas. Example: +\begin{verbatim} +\usepackage[acronym,nohypertypes={acronym,notation}] + {glossaries} +\newglossary[nlg]{notation}{not}{ntn}{Notation} +\end{verbatim} +The values must be fully expanded, so \textbf{don't} try +\texttt{nohypertypes\discretionary{}{}{}=\ics{acronymtype}}. You may also use +\begin{definition} +\ics{GlsDeclareNoHyperList}\marg{list} +\end{definition} +instead or additionally. +See \sectionref{sec:glslink} for further details. + +\item[\pkgoptdef{hyperfirst}] This is a boolean option that specifies +whether each term has a hyperlink on \firstuse. The default is +\pkgopt[true]{hyperfirst} (terms on \gls{firstuse} have a hyperlink, +unless explicitly suppressed using starred versions of commands +such as \ics{gls*} or by identifying the glossary with +\pkgopt{nohypertypes}, described above). Note that +\pkgopt{nohypertypes} overrides \pkgopt[true]{hyperfirst}. +This option only affects commands that check the \firstuseflag, such +as the \glslike\ commands (for example, \ics{gls} or +\ics{glsdisp}), but not the \glstextlike\ commands +(for example, \ics{glslink} or \ics{glstext}). + +The \pkgopt{hyperfirst} setting applies to +all glossary types (unless identified by \pkgopt{nohypertypes} or +defined with \ics{newignoredglossary}). It can be overridden on an +individual basis by explicitly setting the \gloskey[glslink]{hyper} key +when referencing an entry (or by using the plus or starred +version of the referencing command). + +It may be that you only want to apply this to just the acronyms +(where the first use explains the meaning of the acronym) but not +for ordinary glossary entries (where the first use is identical to +subsequent uses). In this case, you can use \pkgopt[false]{hyperfirst} and +apply \cs{glsunsetall} to all the regular (non-acronym) glossaries. +For example: +\begin{verbatim} + \usepackage[acronym,hyperfirst=false]{glossaries} + % acronym and glossary entry definitions + + % at the end of the preamble + \glsunsetall[main] +\end{verbatim} + +Alternatively you can redefine the hook +\begin{definition}[\DescribeMacro\glslinkcheckfirsthyperhook] +\cs{glslinkcheckfirsthyperhook} +\end{definition} +which is used by the commands that check the \firstuseflag, such +as \ics{gls}. Within the definition of this command, you can use +\ics{glslabel} to reference the entry label and \ics{glstype} to +reference the glossary type. You can also use \ics{ifglsused} +to determine if the entry has been used. You can test if an entry is +an acronym by checking if it has the \gloskey{long} key set using +\ics{ifglshaslong}. For example, to switch off the hyperlink on +first use just for acronyms: +\begin{verbatim} +\renewcommand*{\glslinkcheckfirsthyperhook}{% + \ifglsused{\glslabel}{}% + {% + \ifglshaslong{\glslabel}{\setkeys{glslink}{hyper=false}}{}% + }% +} +\end{verbatim} + +Note that this hook isn't used by the commands that don't check the +\firstuseflag, such as \ics{glstext}. (You can, instead, redefine +\ics{glslinkpostsetkeys}, which is used by both the \glslike\ and +\glstextlike\ commands.) + +\item[\pkgoptdef{indexonlyfirst}] This is a boolean option that specifies +whether to only add information to the external glossary file on +\gls{firstuse}. The default is \pkgopt[false]{indexonlyfirst}, +which will add a line to the file every time one of the +\glslike\ or \glstextlike\ commands are used. Note that \ics{glsadd} +will always add information to the external glossary +file\footnote{bug fix in v4.16 has corrected the code to ensure +this.}\ (since that's the purpose of that command). + +You can customise this by redefining +\begin{definition}[\DescribeMacro\glswriteentry] +\cs{glswriteentry}\marg{label}\marg{wr-code} +\end{definition} +where \meta{label} is the entry's label and \meta{wr-code} is the +code that writes the entry's information to the external file. +The default definition of \cs{glswriteentry} is: +\begin{verbatim} +\newcommand*{\glswriteentry}[2]{% + \ifglsindexonlyfirst + \ifglsused{#1}{}{#2}% + \else + #2% + \fi +} +\end{verbatim} +This checks the \pkgopt{indexonlyfirst} package option (using +\cs{ifglsindexonlyfirst}) and does \meta{wr-code} if this is +\pkgoptfmt{false} otherwise it only does \meta{wr-code} of the entry +hasn't been used. + +For example, suppose you only want to index the first use for +entries in the \texttt{acronym} glossary and not in the +\texttt{main} (or any other) glossary: +\begin{verbatim} +\renewcommand*{\glswriteentry}[2]{% + \ifthenelse{\equal{\glsentrytype{#1}}{acronym}} + {\ifglsused{#1}{}{#2}}% + {#2}% +} +\end{verbatim} +Here I've used \cs{ifthenelse} to ensure the arguments of +\cs{equal} are fully expanded before the comparison is made. + +\item[\pkgoptdef{savenumberlist}] This is a boolean option that +specifies whether or not to gather and store the \gls{numberlist} +for each entry. The default is \pkgopt[false]{savenumberlist}. (See +\ics{glsentrynumberlist} and \ics{glsdisplaynumberlist} in +\sectionref{sec:glsnolink}.) This is always true if you +use \opt1. + +\end{description} + +\section{Sectioning, Headings and TOC Options} +\label{sec:pkgopts-sec} + +\begin{description} +\item[\pkgoptdef{toc}] Add the glossaries to the table of contents. +Note that an extra \LaTeX\ run is required with this option. +Alternatively, you can switch this function on and off using +\begin{definition}[\DescribeMacro{\glstoctrue}] +\cs{glstoctrue} +\end{definition} +and +\begin{definition}[\DescribeMacro{\glstocfalse}] +\cs{glstocfalse} +\end{definition} + +\item[\pkgoptdef{numberline}] When used with \pkgopt{toc}, this will +add \ics{numberline}\verb|{}| in the final argument of +\ics{addcontentsline}. This will align the table of contents entry +with the numbered section titles. Note that this option has no +effect if the \pkgopt{toc} option is omitted. If \pkgopt{toc} is +used without \pkgopt{numberline}, the title will be aligned with +the section numbers rather than the section titles. + +\item[\pkgoptdef{section}] This is a \meta{key}=\meta{value} option. Its +value should be the name of a sectional unit (e.g.\ chapter). +This will make the glossaries appear in the named sectional unit, +otherwise each glossary will appear in a chapter, if chapters +exist, otherwise in a section. Unnumbered sectional units will be used +by default. Example: +\begin{verbatim} +\usepackage[section=subsection]{glossaries} +\end{verbatim} +You can omit the value if you want to use sections, i.e.\ +\begin{verbatim} +\usepackage[section]{glossaries} +\end{verbatim} +is equivalent to +\begin{verbatim} +\usepackage[section=section]{glossaries} +\end{verbatim} +You can change this value later in the document using +\begin{definition}[\DescribeMacro{\setglossarysection}] +\cs{setglossarysection}\marg{name} +\end{definition} +where \meta{name} is the sectional unit. + +The start of each glossary adds information to the page header via +\begin{definition}[\DescribeMacro{\glsglossarymark}] +\cs{glsglossarymark}\marg{glossary title} +\end{definition} +By default this uses \cs{@mkboth}\footnote{unless \cls{memoir} is +loaded, which case it uses \ics{markboth}} but you may +need to redefine it. +For example, to only change the right header: +\begin{verbatim} +\renewcommand{\glsglossarymark}[1]{\markright{#1}} +\end{verbatim} +or to prevent it from changing the headers: +\begin{verbatim} +\renewcommand{\glsglossarymark}[1]{} +\end{verbatim} +If you want \cs{glsglossarymark} to use \cs{MakeUppercase} in the header, use the +\pkgopt{ucmark} option described below. + +Occasionally you may find that another package defines +\cs{cleardoublepage} when it is not required. This may cause an +unwanted blank page to appear before each glossary. This can +be fixed by redefining \DescribeMacro\glsclearpage\cs{glsclearpage}: +\begin{verbatim} +\renewcommand*{\glsclearpage}{\clearpage} +\end{verbatim} + +\item[\pkgoptdef{ucmark}] This is a boolean option (default: +\pkgopt[false]{ucmark}, unless \cls{memoir} has been loaded, in +which case it defaults to \pkgopt[true]{ucmark}). If +set, \ics{glsglossarymark} uses +\ics{MakeTextUppercase}\footnote{Actually it uses +\ics{mfirstucMakeUppercase} which is set to \sty{textcase}'s \cs{MakeTextUppercase} +by the +\styfmt{glossaries} package. This makes it consistent with +\ics{makefirstuc}. (The \sty{textcase} package is automatically +loaded by \styfmt{glossaries}.)}. +You can test whether this option has been set or not using +\begin{definition}[\DescribeMacro\ifglsucmark] +\cs{ifglsucmark} \meta{true part}\cs{else} \meta{false part}\cs{fi} +\end{definition} +For example: +\begin{verbatim} +\renewcommand{\glsglossarymark}[1]{% + \ifglsucmark + \markright{\MakeTextUppercase{#1}}% + \else + \markright{#1}% + \fi} +\end{verbatim} +If \cls{memoir} has been loaded and \pkgopt{ucfirst} is set, then +\cls{memoir}'s \ics{memUChead} is used. + +\item[\pkgoptdef{numberedsection}] +The glossaries are placed in unnumbered sectional units by default, +but this can be changed using \pkgopt{numberedsection}. This option can take +one of the following values: +\begin{itemize} +\item \pkgoptval{false}{numberedsection}: no number, i.e.\ use starred form +of sectioning command (e.g.\ \cs{chapter*} or \cs{section*}); + +\item \pkgoptval{nolabel}{numberedsection}: +use a numbered section, i.e.\ the unstarred form of sectioning +command (e.g.\ \cs{chapter} or \cs{section}), but +the section not labelled; + +\item \pkgoptval{autolabel}{numberedsection}: numbered with automatic +labelling. Each glossary uses the unstarred form of a sectioning +command (e.g.\ \cs{chapter} or \cs{section}) and is assigned a label +(via \ics{label}). The label is formed from +\begin{definition}[\DescribeMacro{\glsautoprefix}] +\cs{glsautoprefix} \meta{type} +\end{definition} +where +\meta{type} is the label identifying that glossary. The default +value of \cs{glsautoprefix} is empty. For example, if you load \styfmt{glossaries} +using: +\begin{verbatim} +\usepackage[section,numberedsection=autolabel] + {glossaries} +\end{verbatim} +then each glossary will appear in a numbered section, and can +be referenced using something like: +\begin{verbatim} +The main glossary is in section~\ref{main} and +the list of acronyms is in section~\ref{acronym}. +\end{verbatim} +If you can't decide whether to have the acronyms in the main +glossary or a separate list of acronyms, you can use +\ics{acronymtype} which is set to \texttt{main} if the +\pkgopt{acronym} option is not used and is set to \texttt{acronym} +if the \pkgopt{acronym} option is used. For example: +\begin{verbatim} +The list of acronyms is in section~\ref{\acronymtype}. +\end{verbatim} +You can redefine the prefix if the default label clashes with +another label in your document. +For example: +\begin{verbatim} +\renewcommand*{\glsautoprefix}{glo:} +\end{verbatim} +will add \texttt{glo:} to the automatically generated label, so +you can then, for example, refer to the list of acronyms as follows: +\begin{verbatim} +The list of acronyms is in +section~\ref{glo:\acronymtype}. +\end{verbatim} +Or, if you are undecided on a prefix: +\begin{verbatim} +The list of acronyms is in +section~\ref{\glsautoprefix\acronymtype}. +\end{verbatim} + +\item \pkgoptval{nameref}{numberedsection}: this is like +\pkgoptval{autolabel}{numberedsection} but uses an unnumbered +sectioning command (e.g.\ \ics{chapter*} or \ics{section*}). It's +designed for use with the \sty{nameref} package. For example: +\begin{verbatim} +\usepackage{nameref} +\usepackage[numberedsection=nameref]{glossaries} +\end{verbatim} +Now \verb|\nameref{main}| will display the (TOC) section title +associated with the \texttt{main} glossary. As above, you can +redefine \cs{glsautoprefix} to provide a prefix for the label. +\end{itemize} + +\end{description} + +\section{Glossary Appearance Options} +\label{sec:pkgopts-printglos} + +\begin{description} +\item[\pkgoptdef{entrycounter}] This is a boolean option. (Default +is \pkgopt[false]{entrycounter}.) If set, each main (level~0) +glossary entry will be numbered when using the standard glossary +styles. This option creates the counter +\DescribeCounter{glossaryentry}\ctrfmt{glossaryentry}. + +If you use this option, you can reference the entry number +within the document using +\begin{definition}[\DescribeMacro{\glsrefentry}] +\cs{glsrefentry}\marg{label} +\end{definition} +where \meta{label} is the label associated with that glossary entry. +The labelling systems uses \meta{prefix}\meta{label}, where +\meta{label} is the entry's label and \meta{prefix} is given by +\begin{definition}[\DescribeMacro\GlsEntryCounterLabelPrefix] +\cs{GlsEntryCounterLabelPrefix} +\end{definition} +(which defaults to \texttt{glsentry-}). + +\begin{important} +If you use \cs{glsrefentry}, you must run \LaTeX\ twice after +creating the glossary files using \gls{makeglossaries}, +\gls{makeindex} or \gls{xindy} to ensure the cross-references are +up-to-date. +\end{important} + +\item[\pkgoptdef{counterwithin}] This is a \meta{key}=\meta{value} +option where \meta{value} is the name of a counter. If used, this +option will automatically set \pkgopt[true]{entrycounter} and the +\ctr{glossaryentry} counter will be reset every time \meta{value} is +incremented. + + +\begin{important} +The \ctr{glossaryentry} counter isn't automatically reset at the +start of each glossary, except when glossary section numbering is on +and the counter used by \pkgopt{counterwithin} is the same as the +counter used in the glossary's sectioning command. +\end{important} + +If you want the counter reset at the start of each glossary, you can +redefine \ics{glossarypreamble} to use +\begin{definition}[\DescribeMacro{\glsresetentrycounter}] +\cs{glsresetentrycounter} +\end{definition} +which sets \ctr{glossaryentry} to zero: +\begin{verbatim} +\renewcommand{\glossarypreamble}{% + \glsresetentrycounter +} +\end{verbatim} +or if you are using \ics{setglossarypreamble}, add it to each +glossary preamble, as required. For example: +\begin{verbatim} +\setglossarypreamble[acronym]{% + \glsresetentrycounter + The preamble text here for the list of acronyms. +} +\setglossarypreamble{% + \glsresetentrycounter + The preamble text here for the main glossary. +} +\end{verbatim} + +\item[\pkgoptdef{subentrycounter}] This is a boolean option. (Default +is \pkgopt[false]{subentrycounter}.) If set, each level~1 +glossary entry will be numbered when using the standard glossary +styles. This option creates the counter +\DescribeCounter{glossarysubentry}\ctrfmt{glossarysubentry}. +The counter is reset with each main (level~0) entry. Note that this +package option is independent of \pkgopt{entrycounter}. You can +reference the number within the document using +\ics{glsrefentry}\marg{label} where \meta{label} is the label +associated with the sub-entry. + +\item[\pkgoptdef{style}] This is a \meta{key}=\meta{value} option. +(Default is \pkgopt[list]{style}, unless \sty{classicthesis} +has been loaded, in which case the default is \pkgopt[index]{style}.) Its value should be the name of +the glossary style to use. This key may only be used for styles +defined in \sty{glossary-list}, \sty{glossary-long}, +\sty{glossary-super} or \sty{glossary-tree}. Alternatively, you can +set the style using +\begin{definition} +\cs{setglossarystyle}\marg{style name} +\end{definition} +(See \sectionref{sec:styles} for further details.) + +\item[\pkgoptdef{nolong}] This prevents the \styfmt{glossaries} package +from automatically loading \sty{glossary-long} (which means that +the \sty{longtable} package also won't be loaded). This reduces +overhead by not defining unwanted styles and commands. Note that if +you use this option, you won't be able to use any of the +glossary styles defined in the \styfmt{glossary-long} package (unless +you explicitly load \sty{glossary-long}). + +\item[\pkgoptdef{nosuper}] This prevents the \styfmt{glossaries} package +from automatically loading \sty{glossary-super} (which means that +the \sty{supertabular} package also won't be loaded). This reduces +overhead by not defining unwanted styles and commands. Note that if +you use this option, you won't be able to use any of the +glossary styles defined in the \styfmt{glossary-super} package +(unless you explicitly load \sty{glossary-super}). + +\item[\pkgoptdef{nolist}] This prevents the \styfmt{glossaries} package +from automatically loading \sty{glossary-list}. This reduces +overhead by not defining unwanted styles. Note that if +you use this option, you won't be able to use any of the +glossary styles defined in the \styfmt{glossary-list} package +(unless you explicitly load \sty{glossary-list}). +Note that since the default style is \glostyle{list} (unless +\sty{classicthesis} has been loaded), you will +also need to use the \pkgopt{style} option to set the style to +something else. + +\item[\pkgoptdef{notree}] This prevents the \styfmt{glossaries} package +from automatically loading \sty{glossary-tree}. This reduces +overhead by not defining unwanted styles. Note that if +you use this option, you won't be able to use any of the +glossary styles defined in the \styfmt{glossary-tree} package +(unless you explicitly load \sty{glossary-tree}). Note that if +\sty{classicthesis} has been loaded, the default style is +\glostyle{index}, which is provided by \sty{glossary-tree}. + +\item[\pkgoptdef{nostyles}] This prevents all the predefined styles +from being loaded. If you use this option, you need to load a +glossary style package (such as \sty{glossary-mcols}). Also if you +use this option, you can't use the \pkgopt{style} package option. +Instead you must either use \ics{setglossarystyle}\marg{style} or the +\gloskey[printglossary]{style} key in the optional argument to +\ics{printglossary}. Example: +\begin{verbatim} +\usepackage[nostyles]{glossaries} +\usepackage{glossary-mcols} +\setglossarystyle{mcoltree} +\end{verbatim} + +\item[\pkgoptdef{esclocations}] This is a boolean option. (The default +is \pkgopt[true]{esclocations}, but \ics{makenoidxglossaries} +changes it to \pkgopt[false]{esclocations}.) Both \gls{makeindex} and \gls{xindy} +are fussy about the location formats (\gls{makeindex} more so than +\gls{xindy}) so the \styfmt{glossaries} package tries to ensure that +special characters are escaped and allows for the location to be +substituted for a format that's more acceptable to the indexing +application. This requires a bit of trickery to circumvent the +problem posed by \TeX's asynchronous output routine, which can go +wrong and also adds to the complexity of the document build. + +If you're sure that your locations will always expand to an +acceptable format (or you're prepared to post-process the glossary +file before passing it to the relevant indexing application) then +use \pkgopt[false]{esclocations} to avoid the complex escaping +of location values. (See \ifpdf section~\ref*{sec:wrgloss}\fi \qt{Writing information to associated files} in the documented +code for further details.) + +\item[\pkgoptdef{nonumberlist}] This option will suppress the +associated \glspl{numberlist} in the glossaries (see also +\sectionref{sec:numberlists}). Note that if you use \optsor23 +(\gls{makeindex} or \gls{xindy}) then the locations must still be +valid. This package option merely prevents the \gls{numberlist} +from being displayed, but both \gls{makeindex} and \gls{xindy} +still require a location or cross-reference for each term that's +indexed. Remember that \gls{numberlist} includes any +cross-references, so suppressing the \gls{numberlist} will also hide +the cross-references (see below). + +\item[\pkgoptdef{seeautonumberlist}] If you suppress the +\glspl{numberlist} with \pkgopt{nonumberlist}, described above, this +will also suppress any cross-referencing information supplied by the +\gloskey{see} key in \ics{newglossaryentry} or \ics{glssee}. If you +use \pkgopt{seeautonumberlist}, the \gloskey{see} key will +automatically implement \gloskey{nonumberlist=false} for that entry. +(Note this doesn't affect \cs{glssee}.) For further details see +\sectionref{sec:crossref}. + +\item[\pkgoptdef{counter}] This is a \meta{key}=\meta{value} option. +(Default is \pkgopt[page]{counter}.) The value should be the name of +the default counter to use in the \glspl{numberlist} +(see \sectionref{sec:numberlists}). + +\item[\pkgoptdef{nopostdot}] This is a boolean option. If no value is +specified, \texttt{true} is assumed. When set to \texttt{true}, this +option suppresses the default post description dot used by some of +the predefined styles. The default setting is +\pkgopt[false]{nopostdot}. + +\item[\pkgoptdef{nogroupskip}] This is a boolean option. If no value is +specified, \texttt{true} is assumed. When set to \texttt{true}, this +option suppresses the default vertical gap between groups used by +some of the predefined styles. The default setting is +\pkgopt[false]{nogroupskip}. + +\end{description} + +\section{Sorting Options} +\label{sec:pkgopts-sort} + +\begin{description} +\item[\pkgoptdef{sort}] If you use \optsor23, this package option is +the only way of specifying how to sort the glossaries. Only \opt1 +allows you to specify sort methods for individual glossaries +via the \gloskey[printnoidxglossary]{sort} key in the optional +argument of \ics{printnoidxglossary}. If you have multiple +glossaries in your document and you are using \opt1, only use +the package options +\pkgopt[def]{sort} or \pkgopt[use]{sort} if you want to set this +sort method for \emph{all} your glossaries. + +This is a \meta{key}=\meta{value} option where +\meta{value} may be one of the following: +\begin{itemize} +\item \pkgoptval{standard}{sort} : entries are sorted according to +the value of the \gloskey{sort} key used in \ics{newglossaryentry} +(if present) or the \gloskey{name} key (if \gloskey{sort} key is +missing); + +\item \pkgoptval{def}{sort} : entries are sorted in the order in +which they were defined (the \gloskey{sort} key in +\cs{newglossaryentry} is ignored); + +\item \pkgoptval{use}{sort} : entries are sorted according to the +order in which they are used in the document (the \gloskey{sort} key +in \cs{newglossaryentry} is ignored). + +Both \pkgopt[def]{sort} and \pkgopt[use]{sort} set the sort key to a +six digit number via +\begin{definition}[\DescribeMacro\glssortnumberfmt] +\cs{glssortnumberfmt}\marg{number} +\end{definition} +(padded with leading zeros, where necessary). This can be +redefined, if required, before the entries are defined (in the +case of \pkgopt[def]{sort}) or before the entries are used +(in the case of \pkgopt[use]{sort}). + +\item \pkgoptval{none}{sort} : this setting is new to version 4.30 +and is only for documents that don't use \cs{makeglossaries} (\optsor23) +or \cs{makenoidxglossaries} (\opt1). It omits the code used to sanitize +or escape the sort value, since it's not required. This can help to +improve the document build speed, especially if there are a large +number of entries. This option +can't be used with \cs{printglossary} or \cs{printnoidxglossary} +(or the iterative versions \cs{printglossaries} or +\cs{printnoidxglossaries}). It may be used with +\sty{glossaries-extra}'s \cs{printunsrtglossary} (\opt5). +\end{itemize} +Note that the group styles (such as \glostyle{listgroup}) are +incompatible with the \pkgopt[use]{sort} and \pkgopt[def]{sort} +options. + +The default is \pkgopt[standard]{sort}. When the standard sort +option is in use, you can hook into the sort mechanism by +redefining: +\begin{definition}[\DescribeMacro{\glsprestandardsort}] +\cs{glsprestandardsort}\marg{sort cs}\marg{type}\marg{label} +\end{definition} +where \meta{sort cs} is a temporary control sequence that stores the +sort value (which was either explicitly set via the \gloskey{sort} +key or implicitly set via the \gloskey{name} key) before any escaping of the +\gls{makeindex}\slash\gls{xindy} special characters is performed. +By default \cs{glsprestandardsort} just does: +\begin{definition}[\DescribeMacro{\glsdosanitizesort}] +\cs{glsdosanitizesort} +\end{definition} +which \gls{sanitize}[s] \meta{sort cs} if the \pkgopt{sanitizesort} package +option is set (or does nothing if the package option +\pkgopt[false]{sanitizesort} is used). + +The other arguments, \meta{type} and \meta{label}, are the +glossary type and the entry label for the current entry. Note that +\meta{type} will always be a control sequence, but \meta{label} will +be in the form used in the first argument of \ics{newglossaryentry}. + +\begin{important} +Redefining \cs{glsprestandardsort} won't affect any entries that +have already been defined and will have no effect at all if you +are using \pkgopt[def]{sort} or \pkgopt[use]{sort}. +\end{important} + +\begin{example}{Mixing Alphabetical and Order of Definition Sorting}{ex:diffsorts} +Suppose I have three glossaries: \texttt{main}, +\texttt{acronym} and \texttt{notation}, and let's suppose +I want the \texttt{main} and \texttt{acronym} glossaries to be +sorted alphabetically, but the \texttt{notation} type should be +sorted in order of definition. + +For \opt1, I~just need to set the \gloskey[printnoidxglossary]{sort} key in +the optional argument of \ics{printnoidxglossary}: +\begin{verbatim} +\printnoidxglossary[sort=word] +\printnoidxglossary[type=acronym,sort=word] +\printnoidxglossary[type=notation,sort=def] +\end{verbatim} + +For \optsor23, I can set the sort to \texttt{standard} +(which is the default, but can be explicitly set via the +package option \pkgopt[standard]{sort}), and I can either define +all my \texttt{main} and \texttt{acronym} entries, then +redefine \cs{glsprestandardsort} to set \meta{sort cs} to +an incremented integer, and then define all my +\texttt{notation} entries. Alternatively, I can redefine +\cs{glsprestandardsort} to check for the glossary type and only +modify \meta{sort cs} if \meta{type} is \texttt{notation}. + +The first option can be achieved as follows: +\begin{verbatim} +\newcounter{sortcount} + +\renewcommand{\glsprestandardsort}[3]{% + \stepcounter{sortcount}% + \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% +} +\end{verbatim} +The second option can be achieved as follows: +\begin{verbatim} +\newcounter{sortcount} + +\renewcommand{\glsprestandardsort}[3]{% + \ifdefstring{#2}{notation}% + {% + \stepcounter{sortcount}% + \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% + }% + {% + \glsdosanitizesort + }% +} +\end{verbatim} +(\cs{ifdefstring} is defined by the \sty{etoolbox} package.) +For a complete document, see the sample file \samplefile{Sort}. +\end{example} + +\begin{example}{Customizing Standard Sort (Options 2 or 3)}{ex:customsort} +Suppose you want a glossary of people and you want the names listed +as \meta{first-name} \meta{surname} in the glossary, but you want the names +sorted by \meta{surname}, \meta{first-name}. You can do this by +defining a command called, say, +\cs{name}\marg{first-name}\marg{surname} that you can use in the +\gloskey{name} key when you define the entry, but hook into the +standard sort mechanism to temporarily redefine \cs{name} while the +sort value is being set. + +First, define two commands to set the person's name: +\begin{verbatim} +\newcommand{\sortname}[2]{#2, #1} +\newcommand{\textname}[2]{#1 #2} +\end{verbatim} +and \cs{name} needs to be initialised to \cs{textname}: +\begin{verbatim} +\let\name\textname +\end{verbatim} +Now redefine \cs{glsprestandardsort} so that it temporarily sets +\cs{name} to \cs{sortname} and expands the sort value, then sets +\cs{name} to \cs{textname} so that the person's name appears as +\meta{first-name} \meta{surname} in the text: +\begin{verbatim} +\renewcommand{\glsprestandardsort}[3]{% + \let\name\sortname + \edef#1{\expandafter\expandonce\expandafter{#1}}% + \let\name\textname + \glsdosanitizesort +} +\end{verbatim} +(The somewhat complicate use of \cs{expandafter} etc helps to +protect fragile commands, but care is still needed.) + +Now the entries can be defined: +\begin{verbatim} +\newglossaryentry{joebloggs}{name={\name{Joe}{Bloggs}}, + description={some information about Joe Bloggs}} + +\newglossaryentry{johnsmith}{name={\name{John}{Smith}}, + description={some information about John Smith}} +\end{verbatim} +For a complete document, see the sample file \samplefile{People}. +\end{example} + +\item[\pkgoptdef{order}] This may take two values: +\pkgoptval{word}{order} or \pkgoptval{letter}{order}. The default +is word ordering. + +\begin{important} +Note that the \pkgopt{order} option has no effect if you don't use +\gls{makeglossaries}. +\end{important} + +If you use \opt1, this setting will be used if you use +\gloskey[printnoidxglossary]{sort}\texttt{=standard} in +the optional argument of \ics{printnoidxglossary}: +\begin{verbatim} +\printnoidxglossary[sort=standard] +\end{verbatim} +Alternatively, you can specify the order for individual glossaries: +\begin{verbatim} +\printnoidxglossary[sort=word] +\printnoidxglossary[type=acronym,sort=letter] +\end{verbatim} + +\item[\pkgoptdef{makeindex}] (\opt2) The glossary information and +indexing style file will be written in \gls{makeindex} format. If +you use \gls{makeglossaries}, it will automatically detect that it +needs to call \gls*{makeindex}. If you don't use +\gls*{makeglossaries}, you need to remember to use \gls*{makeindex} +not \gls{xindy}. The indexing style file will been given +a~\filetype{.ist} extension. + +You may omit this package option if you are using \opt2 as this is the +default. It's available in case you need to override the effect of an earlier +occurrence of \pkgopt{xindy} in the package option list. + +\item[\pkgoptdef{xindy}] (\opt3) The glossary information and indexing style +file will be written in \gls{xindy} format. If you use +\gls{makeglossaries}, it will automatically detect that it needs to +call \gls*{xindy}. If you don't use \gls*{makeglossaries}, you need to +remember to use \gls*{xindy} not \gls{makeindex}. The indexing style +file will been given a \filetype{.xdy} extension. + +This package option may additionally have a value that +is a \meta{key}=\meta{value} comma-separated list to override the +language and codepage. For example: +\begin{verbatim} +\usepackage[xindy={language=english,codepage=utf8}] + {glossaries} +\end{verbatim} +You can also specify whether you want a number group in the +glossary. This defaults to true, but can be suppressed. For example: +\begin{verbatim} +\usepackage[xindy={glsnumbers=false}]{glossaries} +\end{verbatim} +If no value is supplied to this package option (either simply +writing \texttt{xindy} or writing \verb|xindy={}|) then the +language, codepage and number group settings are unchanged. See +\sectionref{sec:xindy} for further details on using \gls{xindy} with +the \styfmt{glossaries} package. + +\item[\pkgoptdef{xindygloss}] (\opt3) This is equivalent to +\verb|xindy={}| (that is, the \pkgopt{xindy} option without any value +supplied) and may be used as a document class option. The language +and code page can be set via \ics{GlsSetXdyLanguage} and +\ics{GlsSetXdyCodePage} (see \sectionref{sec:langenc}.) + +\item[\pkgoptdef{xindynoglsnumbers}] (\opt3) This is equivalent to +\verb|xindy={glsnumbers=false}| and may be used as a document class +option. + +\item[\pkgoptdef{automake}] This is option was introduced to +version 4.08 as a boolean option. As from version 4.42 it may now +take three values: \texttt{false} (default), \texttt{true} +or \texttt{immediate}. If no option is supplied, \texttt{immediate} +is assumed. +The option \pkgopt[true]{automake} will attempt to run \gls{makeindex} or \gls{xindy} using +\TeX's \ics{write18} mechanism at the end of the document. +The option \pkgopt[immediate]{automake} will attempt to +run \gls{makeindex} or \gls{xindy} at the start of +\ics{makeglossaries} using \cs{immediate} (before the glossary files have been opened). + +In the case of \pkgopt[true]{automake}, the associated files +are created at the end of the document ready for the next \LaTeX\ +run. Since there is a possibility of commands such as \cs{gls} +occurring on the last page of the document, it's not possible +to use \cs{immediate} to close the associated file or with +\cs{write18} since the writing of the final indexing lines may +have been delayed. In certain situations this can mean that +the \cs{write18} fails. In such cases, you will need to use +\pkgopt[immediate]{automake} instead. + +With \pkgopt[immediate]{automake}, you will get a warning on +the first \LaTeX\ run as the associated glossary files don't exist +yet. + +Since this mechanism can be a security risk, some \TeX\ +distributions disable it completely, in which case this option won't +have an effect. (If this option doesn't appear to work, search the +log file for \qt{runsystem} and see if it is followed by +\qt{enabled} or \qt{disabled}.) + +Some distributions allow \cs{write18} in a restricted mode. +This mode has a~limited number of trusted applications, which +usually includes \gls{makeindex} but may not include \gls{xindy}. So +if you have the restricted mode on, \pkgopt{automake} should work +with \gls*{makeindex} but may not work with \gls{xindy}. + +However even in unrestricted mode this option may not work with +\gls*{xindy} as \gls*{xindy} uses language names that don't always +correspond with \ics{babel}'s language names. (The +\gls{makeglossaries} script applies mappings to assist you.) +Note that you still need at least two \LaTeX\ runs to ensure the document +is up-to-date with this setting. + +Since this package option attempts to run the \gls{indexingapp} on +every \LaTeX\ run, its use should be considered a last resort for +those who can't work out how to incorporate the \gls*{indexingapp} +into their document build. The default value for this option is +\pkgopt[false]{automake}. + +\end{description} + +\section{Acronym Options} +\label{sec:pkgopts-acronym} + +\begin{description} +\item[\pkgoptdef{acronym}] This creates a new glossary with the +label \texttt{acronym}. This is equivalent to: +\begin{verbatim} +\newglossary[alg]{acronym}{acr}{acn}{\acronymname} +\end{verbatim} +It will also define +\begin{definition}[\DescribeMacro\printacronyms] +\cs{printacronyms}\oarg{options} +\end{definition} +that's equivalent to +\begin{alltt} +\ics{printglossary}[type=acronym,\meta{options}] +\end{alltt} +(unless that command is already defined before the beginning of the +document or the package option \pkgopt{compatible-3.07} is used). + +If you are using \opt1, you need to use +\begin{alltt} +\ics{printnoidxglossary}[type=acronym,\meta{options}] +\end{alltt} +to display the list of acronyms. + +If the \pkgopt{acronym} package option is used, \ics{acronymtype} +is set to \texttt{acronym} otherwise it is set to +\texttt{main}.\footnote{Actually it sets \ics{acronymtype} to +\ics{glsdefaulttype} if the \pkgopt{acronym} package option is +not used, but \ics{glsdefaulttype} usually has the value +\texttt{main} unless the \pkgopt{nomain} option has been used.} +Entries that are defined using \ics{newacronym} are placed in +the glossary whose label is given by \ics{acronymtype}, unless +another glossary is explicitly specified. + +\begin{important} +Remember to use the \pkgopt{nomain} package option if you're only +interested in using this \texttt{acronym} glossary. (That is, you +don't intend to use the \texttt{main} glossary.) +\end{important} + +\item[\pkgoptdef{acronyms}] This is equivalent to +\pkgopt[true]{acronym} and may be used in the document class option +list. + +\item[\pkgoptdef{acronymlists}] By default, only the \cs{acronymtype} +glossary is considered to be a list of acronyms. If you have other +lists of acronyms, you can specify them as a comma-separated list +in the value of \pkgopt{acronymlists}. For example, if you use the +\pkgopt{acronym} package option but you also want the \texttt{main} +glossary to also contain a list of acronyms, you can do: +\begin{verbatim} +\usepackage[acronym,acronymlists={main}]{glossaries} +\end{verbatim} +No check is performed to determine if the listed glossaries exist, +so you can add glossaries you haven't defined yet. For example: +\begin{verbatim} +\usepackage[acronym,acronymlists={main,acronym2}] + {glossaries} +\newglossary[alg2]{acronym2}{acr2}{acn2}% + {Statistical Acronyms} +\end{verbatim} +You can use +\begin{definition}[\DescribeMacro\DeclareAcronymList] +\cs{DeclareAcronymList}\marg{list} +\end{definition} +instead of or in addition to the \pkgopt{acronymlists} option. +This will add the glossaries given in \meta{list} to the list of glossaries +that are identified as lists of acronyms. To replace the list of acronym lists +with a new list use: +\begin{definition}[\DescribeMacro\SetAcronymLists] +\cs{SetAcronymLists}\marg{list} +\end{definition} + +You can determine if a glossary has been identified as being a list +of acronyms using: +\begin{definition}[\DescribeMacro\glsIfListOfAcronyms] +\cs{glsIfListOfAcronyms}\marg{label}\marg{true part}\marg{false part} +\end{definition} + +\item[\pkgoptdef{shortcuts}] This option provides shortcut commands +for acronyms. See \sectionref{sec:acronyms} for further details. +Alternatively you can use: +\begin{definition}[\DescribeMacro\DefineAcronymSynonyms] +\cs{DefineAcronymSynonyms} +\end{definition} +\end{description} + +\subsection{Deprecated Acronym Style Options} +\label{sec:pkgopts-old-acronym} + +The package options listed in this section are now deprecated but +are kept for backward-compatibility. Use \ics{setacronymstyle} +instead. See \sectionref{sec:acronyms} for further details. + +\begin{description} +\item[\pkgoptdef{description}] This option changes the definition of +\ics{newacronym} to allow a description. +This option may be replaced by +\begin{verbatim} +\setacronymstyle{long-short-desc} +\end{verbatim} +or (with \pkgopt{smallcaps}) +\begin{verbatim} +\setacronymstyle{long-sc-short-desc} +\end{verbatim} +or (with \pkgopt{smaller}) +\begin{verbatim} +\setacronymstyle{long-sm-short-desc} +\end{verbatim} +or (with \pkgopt{footnote}) +\begin{verbatim} +\setacronymstyle{footnote-desc} +\end{verbatim} +or (with \pkgopt{footnote} and \pkgopt{smallcaps}) +\begin{verbatim} +\setacronymstyle{footnote-sc-desc} +\end{verbatim} +or (with \pkgopt{footnote} and \pkgopt{smaller}) +\begin{verbatim} +\setacronymstyle{footnote-sm-desc} +\end{verbatim} +or (with \pkgopt{dua}) +\begin{verbatim} +\setacronymstyle{dua-desc} +\end{verbatim} + +\item[\pkgoptdef{smallcaps}] This option changes the definition of +\ics{newacronym} and the way that acronyms are displayed. +This option may be replaced by: +\begin{verbatim} +\setacronymstyle{long-sc-short} +\end{verbatim} +or (with \pkgopt{description}) +\begin{verbatim} +\setacronymstyle{long-sc-short-desc} +\end{verbatim} +or (with \pkgopt{description} and \pkgopt{footnote}) +\begin{verbatim} +\setacronymstyle{footnote-sc-desc} +\end{verbatim} + +\item[\pkgoptdef{smaller}] This option changes the definition of +\ics{newacronym} and the way that acronyms are displayed. +\begin{important} +If you use this option, you will need to include the \sty{relsize} +package or otherwise define \ics{textsmaller} or redefine +\ics{acronymfont}. +\end{important} +This option may be replaced by: +\begin{verbatim} +\setacronymstyle{long-sm-short} +\end{verbatim} +or (with \pkgopt{description}) +\begin{verbatim} +\setacronymstyle{long-sm-short-desc} +\end{verbatim} +or (with \pkgopt{description} and \pkgopt{footnote}) +\begin{verbatim} +\setacronymstyle{footnote-sm-desc} +\end{verbatim} + +\item[\pkgoptdef{footnote}] This option changes the definition of +\ics{newacronym} and the way that acronyms are displayed. +This option may be replaced by: +\begin{verbatim} +\setacronymstyle{footnote} +\end{verbatim} +or (with \pkgopt{smallcaps}) +\begin{verbatim} +\setacronymstyle{footnote-sc} +\end{verbatim} +or (with \pkgopt{smaller}) +\begin{verbatim} +\setacronymstyle{footnote-sm} +\end{verbatim} +or (with \pkgopt{description}) +\begin{verbatim} +\setacronymstyle{footnote-desc} +\end{verbatim} +or (with \pkgopt{smallcaps} and \pkgopt{description}) +\begin{verbatim} +\setacronymstyle{footnote-sc-desc} +\end{verbatim} +or (with \pkgopt{smaller} and \pkgopt{description}) +\begin{verbatim} +\setacronymstyle{footnote-sm-desc} +\end{verbatim} + + +\item[\pkgoptdef{dua}] This option changes the definition of +\ics{newacronym} so that acronyms are always expanded. +This option may be replaced by: +\begin{verbatim} +\setacronymstyle{dua} +\end{verbatim} +or (with \pkgopt{description}) +\begin{verbatim} +\setacronymstyle{dua-desc} +\end{verbatim} + +\end{description} + +\section{Other Options} +\label{sec:pkgopts-other} + +Other available options that don't fit any of the above categories +are: +\begin{description} +\item[\pkgoptdef{symbols}] This option defines a new glossary type with +the label \texttt{symbols} via +\begin{verbatim} +\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname} +\end{verbatim} +It also defines +\begin{definition}[\DescribeMacro\printsymbols] +\cs{printsymbols}\oarg{options} +\end{definition} +which is a synonym for +\begin{alltt} +\ics{printglossary}[type=symbols,\meta{options}] +\end{alltt} + +If you use \opt1, you need to use: +\begin{alltt} +\ics{printnoidxglossary}[type=symbols,\meta{options}] +\end{alltt} +to display the list of symbols. + +\begin{important} +Remember to use the \pkgopt{nomain} package option if you're only +interested in using this \texttt{symbols} glossary and don't intend +to use the \texttt{main} glossary. +\end{important} + +The \styfmt{glossaries-extra} package has a slightly modified +version of this option which additionally provides \ics{glsxtrnewsymbol} +as a convenient shortcut method for defining symbols. See the +\styfmt{glossaries-extra} manual for further details. + +\item[\pkgoptdef{numbers}] This option defines a new glossary type with +the label \texttt{numbers} via +\begin{verbatim} +\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname} +\end{verbatim} +It also defines +\begin{definition}[\DescribeMacro\printnumbers] +\cs{printnumbers}\oarg{options} +\end{definition} +which is a synonym for +\begin{alltt} +\ics{printglossary}[type=numbers,\meta{options}] +\end{alltt} + +If you use \opt1, you need to use: +\begin{alltt} +\ics{printnoidxglossary}[type=numbers,\meta{options}] +\end{alltt} +to display the list of numbers. + +\begin{important} +Remember to use the \pkgopt{nomain} package option if you're only +interested in using this \texttt{numbers} glossary and don't intend +to use the \texttt{main} glossary. +\end{important} + +The \styfmt{glossaries-extra} package has a slightly modified +version of this option which additionally provides \ics{glsxtrnewnumber} +as a convenient shortcut method for defining numbers. See the +\styfmt{glossaries-extra} manual for further details. + +\item[\pkgoptdef{index}] This option defines a new glossary type with +the label \texttt{index} via +\begin{verbatim} +\newglossary[ilg]{index}{ind}{idx}{\indexname}% +\end{verbatim} +It also defines +\begin{definition}[\DescribeMacro\newterm] +\cs{newterm}\oarg{options}\marg{term} +\end{definition} +which is a synonym for +\begin{alltt} +\ics{newglossaryentry}\marg{term}[type=index,name=\marg{term},% +description=\ics{nopostdesc},\meta{options}] +\end{alltt} +and +\begin{definition}[\DescribeMacro\printindex] +\cs{printindex}\oarg{options} +\end{definition} +which is a synonym for +\begin{alltt} +\ics{printglossary}[type=index,\meta{options}] +\end{alltt} + +If you use \opt1, you need to use: +\begin{alltt} +\ics{printnoidxglossary}[type=index,\meta{options}] +\end{alltt} +to display this glossary. + +\begin{important} +Remember to use the \pkgopt{nomain} package option if you're only +interested in using this \texttt{index} glossary and don't intend to +use the \texttt{main} glossary. Note that you +can't mix this option with \ics{index}. Either use +\styfmt{glossaries} for the indexing or use a~custom indexing +package, such as \sty{makeidx}, \sty{index} or \sty{imakeidx}. +(You can, of course, load one of those packages and +load \styfmt{glossaries} without the \pkgopt{index} package option.) +\end{important} + +Since the index isn't designed for terms with descriptions, you +might also want to disable the hyperlinks for this glossary using +the package option \pkgopt[index]{nohypertypes} or the command +\begin{display} +\ics{GlsDeclareNoHyperList}\verb|{index}| +\end{display} + +The example file \samplefile{-index} illustrates the use of the +\pkgopt{index} package option. + +\item[\pkgoptdef{noglossaryindex}] This option switches off \pkgopt{index} +if \pkgopt{index} has been passed implicitly (for example, +through global document options). This option can't be used +in \cs{setupglossaries}. + +\item[\pkgoptdef{compatible-2.07}] Compatibility mode for old documents +created using version 2.07 or below. + +\item[\pkgoptdef{compatible-3.07}] Compatibility mode for old documents +created using version 3.07 or below. + +\item[\pkgoptdef{kernelglossredefs}] As a legacy from the precursor +\sty{glossary} package, the standard glossary commands provided +by the \LaTeX\ kernel (\cs{makeglossary} and \cs{glossary}) are +redefined in terms of the \styfmt{glossaries} package's commands. +However, they were never documented in this user manual, and the +conversion guide (\htmldoc{Upgrading from the glossary package to the +glossaries package}{glossary2glossaries}) explicitly discourages +their use. + +The use of those kernel commands (instead of the appropriate +commands documented in this user guide) are deprecated, and you will +now get a warning if you try using them. + +In the event that you require the original form of these kernel +commands, for example, if you need to use the \styfmt{glossaries} +package with another class or package that also performs +glossary-style indexing, then you can restore these commands to +their previous definition (that is, their definitions prior to +loading the \styfmt{glossaries} package) with the package option +\pkgopt[false]{kernelglossredefs}. You may also need to use the +\pkgopt{nomain} option in the event of file extension conflicts. +(In which case, you must provide a new default glossary for use with +the \sty{glossaries} package.) + +This option may take one of three values: \pkgoptfmt{true} +(redefine with warnings, default), \pkgoptfmt{false} (restore +previous definitions) or \pkgoptfmt{nowarn} (redefine without +warnings, not recommended). + +Note that the only glossary-related commands provided by the \LaTeX\ +kernel are \cs{makeglossary} and \cs{glossary}. Other packages +or classes may provide additional glossary-related commands or +environments that conflict with \styfmt{glossaries} (such as +\cs{printglossary} and \env{theglossary}). These non-kernel commands +aren't affected by this package option, and you will have to find +some way to resolve the conflict if you require both glossary +mechanisms. (The \sty{glossaries} package will override the existing +definitions of \cs{printglossary} and \env{theglossary}.) + +In general, if possible, it's best to stick with just one package that +provides a glossary mechanism. (The \styfmt{glossaries} package does +check for the \sty{doc} package and patches \cs{PrintChanges}.) + +\end{description} + +\section{Setting Options After the Package is Loaded} +\label{sec:setupglossaries} + +Some of the options described above may also be set after the +\styfmt{glossaries} package has been loaded using +\begin{definition}[\DescribeMacro{\setupglossaries}] +\cs{setupglossaries}\marg{key-val list} +\end{definition} +The following package options \textbf{can't} be used in +\cs{setupglossaries}: \pkgopt{xindy}, \pkgopt{xindygloss}, +\pkgopt{xindynoglsnumbers}, \pkgopt{makeindex}, +\pkgopt{nolong}, \pkgopt{nosuper}, \pkgopt{nolist}, +\pkgopt{notree}, \pkgopt{nostyles}, \pkgopt{nomain}, +\pkgopt{compatible-2.07}, \pkgopt{translate}, \pkgopt{notranslate}, +\pkgopt{acronym}. These options have to be set while the package is +loading, except for the \pkgopt{xindy} sub-options which can be set +using commands like \ics{GlsSetXdyLanguage} (see +\sectionref{sec:xindy} for further details). + +\begin{important} +If you need to use this command, use it as soon as +possible after loading \styfmt{glossaries} otherwise you might +end up using it too late for the change to take effect. For example, +if you try changing the acronym styles (such as \pkgopt{smallcaps}) +after you have started defining your acronyms, you are likely to get +unexpected results. If you try changing the sort option after you have +started to define entries, you may get unexpected results. +\end{important} + +\chapter{Setting Up} +\label{sec:setup} + +In the preamble you need to indicate whether you want to use \opt1, +\opt2 or \opt3. It's not possible to mix these options within +a~document, although some combinations are possible with +\gls*{glossaries-extra}. (For \optsand45 see the \gls{bib2gls} and +\gls{glossaries-extra} manuals.) + +\section[Option 1]{\ifpdf\opt1\else Option 1\fi} +\label{sec:setupopt1} + +The command +\begin{definition}[\DescribeMacro{\makenoidxglossaries}] +\cs{makenoidxglossaries} +\end{definition} +must be placed in the preamble. This sets up the internal commands +required to make \opt1 work. +\textbf{If you omit \cs{makenoidxglossaries} none of +the glossaries will be displayed.} + +\section[Options 2 and 3]{\ifpdf\optsand23\else Options 2 and 3\fi} +\label{sec:setupopt23} + +The command +\begin{definition}[\DescribeMacro{\makeglossaries}] +\cs{makeglossaries} +\end{definition} +must be placed in the preamble in order to create the customised +\gls{makeindex} (\filetype{.ist}) or \gls{xindy} (\filetype{.xdy}) +style file (for \optsor23, respectively) and to ensure that glossary +entries are written to the appropriate output files. +\textbf{If you omit \cs{makeglossaries} none of +the glossary files will be created.} + +\begin{important} +Note that some of the commands provided by the \styfmt{glossaries} +package must not be used after \cs{makeglossaries} as they are +required when creating the customised style file. If you attempt +to use those commands after \cs{makeglossaries} you will generate +an error. + +Similarly, there are some commands that must not be used before +\cs{makeglossaries}. +\end{important} + +You can suppress the creation of the customised \gls{xindy} +or \gls{makeindex} style file using +\begin{definition}[\DescribeMacro{\noist}] +\cs{noist} +\end{definition} +That this command must not be used after \cs{makeglossaries}. +\begin{important} +Note that if you have a custom \filetype{.xdy} file created when using +\styfmt{glossaries} version 2.07 or below, you will need to use the +\pkgopt{compatible-2.07} package option with it. +\end{important} + +The default name for the customised style file is given by +\ics{jobname}\filetype{.ist} (\opt2) or +\ics{jobname}\filetype{.xdy} (\opt3). This name may be +changed using: +\begin{definition}[\DescribeMacro{\setStyleFile}] +\cs{setStyleFile}\marg{name} +\end{definition} +where \meta{name} is the name of the style file without the +extension. Note that this command must not be used after +\cs{makeglossaries}. + +Each glossary entry is assigned a \gls{numberlist} that lists all +the locations in the document where that entry was used. By default, +the location refers to the page number but this may be overridden +using the \pkgopt{counter} package option. The default form of +the location number assumes a full stop compositor (e.g.\ 1.2), +but if your location numbers use a different compositor (e.g. 1-2) +you need to set this using +\begin{definition}[\DescribeMacro{\glsSetCompositor}] +\cs{glsSetCompositor}\marg{symbol} +\end{definition} +For example: +\begin{verbatim} +\glsSetCompositor{-} +\end{verbatim} +This command must not be used after \cs{makeglossaries}. + +If you use \opt3, you can have a different compositor for page +numbers starting with an upper case alphabetical character using: +\begin{definition}[\DescribeMacro{\glsSetAlphaCompositor}] +\cs{glsSetAlphaCompositor}\marg{symbol} +\end{definition} +This command has no effect if you use \opt2. For example, if you want +\glspl{numberlist} containing a mixture of A-1 and 2.3 style +formats, then do: +\begin{verbatim} +\glsSetCompositor{.}\glsSetAlphaCompositor{-} +\end{verbatim} +See \sectionref{sec:numberlists} for further information about +\glspl{numberlist}. + +\chapter{Defining Glossary Entries} +\label{sec:newglosentry} + +All glossary entries must be defined before they are used, so it is +better to define them in the preamble to ensure this. In fact, some +commands such as \cs{longnewglossaryentry} +may only be used in the preamble. See \sectionref{sec:docdefs} for +a discussion of the problems with defining entries within the +document instead of in the preamble. (The \gls{glossaries-extra} +package has an option that provides a restricted form of document +definitions that avoids some of the issues discussed in +\sectionref{sec:docdefs}.) +\begin{important} +\opt1 enforces the preamble-only restriction on +\ics{newglossaryentry}. \opt4 requires that definitions are provided +in \texttt{.bib} format. \opt5 requires either preamble-only +definitions or the use of the \sty{glossaries-extra} package option +\optfmt{docdef=restricted}. +\end{important} + +Only those entries that are indexed in the document +(using any of the commands described in +\sectionref{sec:glslink}, \sectionref{sec:glsadd} or +\sectionref{sec:crossref}) will appear in the glossary. See +\sectionref{sec:printglossary} to find out how to display the +glossary. + + +New glossary entries are defined using the command: +\begin{definition}[\DescribeMacro{\newglossaryentry}] +\cs{newglossaryentry}\marg{label}\marg{key=value list} +\end{definition} +This is a short command, so values in \meta{key-val list} can't +contain any paragraph breaks. Take care to enclose values containing +any commas (\texttt{,}) or equal signs (\texttt{=}) with braces to hide them +from the key=value list parser. Be careful to ensure that no +spurious spaces are included at the start and end of the braces. + +If you have a long description that +needs to span multiple paragraphs, use +\begin{definition}[\DescribeMacro{\longnewglossaryentry}] +\cs{longnewglossaryentry}\marg{label}\marg{key=value +list}\marg{long description} +\end{definition} +instead. Note that this command may only be used in the preamble. +Be careful of unwanted spaces. \cs{longnewglossaryentry} +will remove trailing spaces in the description (via \cs{unskip}) +but won't remove leading spaces (otherwise it would interfere with +commands like \cs{Glsentrydesc}). This command also appends +\cs{nopostdesc} to the end of the description, which suppresses the +post-description hook. The \sty{glossaries-extra} package provides +a starred version of \cs{longnewglossaryentry} that doesn't append +either \cs{unskip} or \cs{nopostdesc}. + +There are also commands that will only define the entry if it +hasn't already been defined: +\begin{definition}[\DescribeMacro\provideglossaryentry] +\cs{provideglossaryentry}\marg{label}\marg{key=value list} +\end{definition} +and +\begin{definition}[\DescribeMacro\longprovideglossaryentry] +\cs{longprovideglossaryentry}\marg{label}\marg{key=value +list}\marg{long description} +\end{definition} +(These are both preamble-only commands.) + +For all the above commands, the first argument, \meta{label}, must be +a~unique label with which to identify this entry. \textbf{This can't contain +any non-expandable commands or active characters.} The reason for +this restriction is that the label is used to construct internal commands +that store the associated information (similarly to commands +like \cs{label}) and therefore must be able to expand to a valid +control sequence name. + +\begin{important} +Note that although an \gls{exlatinchar} or other \gls{nonlatinchar}, +such as \'e or \ss, looks like a plain character in your +\texttt{.tex} file, it's actually a~macro (an active character) and +therefore can't be used in the label. (This applies to \LaTeX\ +rather than \XeLaTeX.) Also be careful of +\sty{babel}'s options that change certain punctuation characters +(such as \texttt{:} or \texttt{-}) to active characters. +\end{important} + +The second argument, \meta{key=value list}, is +a \meta{key}=\meta{value} list that supplies the relevant +information about this entry. There are two required fields: +\gloskey{description} and either \gloskey{name} or \gloskey{parent}. +The description is set in the third argument of +\cs{longnewglossaryentry} and \cs{longprovideglossaryentry}. With +the other commands it's set via the \gloskey{description} key. +As is typical with \meta{key}=\meta{value} lists, values that contain +a comma or equal sign must be enclosed in braces. Available fields +are listed below. Additional fields are provided by the +supplementary packages \sty{glossaries-prefix} +(\sectionref{sec:prefix}) and \sty{glossaries-accsupp} +(\sectionref{sec:accsupp}) and also by \gls{glossaries-extra}. +You can also define your own custom keys (see +\sectionref{sec:addkey}). + +\begin{description} +\item[{\gloskey{name}}] The name of the entry (as it will appear in +the glossary). If this key is omitted and the \gloskey{parent} +key is supplied, this value will be the same as the parent's name. + +\begin{important} +If the \gloskey{name} key contains any commands, you must also +use the \gloskey{sort} key (described below) if you intend sorting the entries +alphabetically, otherwise the entries can't be sorted correctly. +\end{important} + +\item[{\gloskey{description}}] A brief description of this term (to +appear in the glossary). Within this value, you can use +\begin{definition}[\DescribeMacro{\nopostdesc}] +\cs{nopostdesc} +\end{definition} +to suppress the +description terminator for this entry. For example, if this +entry is a parent entry that doesn't require a description, you +can do \verb|description={\nopostdesc}|. If you want a paragraph +break in the description use +\begin{definition}[\DescribeMacro{\glspar}] +\cs{glspar} +\end{definition} +or, better, use \cs{longnewglossaryentry}. +However, note that not all glossary styles support multi-line +descriptions. If you are using one of the tabular-like glossary +styles that permit multi-line descriptions, use \ics{newline} +not \verb"\\" if you want to force a line break. + +\item[{\gloskey{parent}}] The label of the parent entry. Note that +the parent entry must be defined before its sub-entries. +See \sectionref{sec:subentries} for further details. + +\item[{\gloskey{descriptionplural}}] The plural form of the +description, if required. If omitted, the value +is set to the same as the \gloskey{description} key. + +\item[{\gloskey{text}}] How this entry will appear in the document text +when using \ics{gls} (or one of its upper case variants). If this +field is omitted, the value of the \gloskey{name} key is used. + +\item[{\gloskey{first}}] How the entry will appear in the document text +on \firstuse\ with \ics{gls} (or one of its upper case +variants). If this field is omitted, the value of the \gloskey{text} +key is used. Note that if you use \ics{glspl}, \ics{Glspl}, +\ics{GLSpl}, \ics{glsdisp} before using \ics{gls}, the +\gloskey{firstplural} value won't be used with \ics{gls}. + +\item[{\gloskey{plural}}] How the entry will appear in the document text +when using \ics{glspl} (or one of its upper case variants). If this +field is omitted, the value is obtained by appending +\ics{glspluralsuffix} to the value of the \gloskey{text} field. The +default value of \ics{glspluralsuffix} is the letter \qt{s}. + +\item[{\gloskey{firstplural}}] How the entry will appear in the +document text on \firstuse\ with \ics{glspl} (or one of its +upper case variants). If this field is omitted, the value is obtained +from the \gloskey{plural} key, if the \gloskey{first} key is omitted, +or by appending \ics{glspluralsuffix} to the value of the +\gloskey{first} field, if the \gloskey{first} field is present. Note +that if you use \ics{gls}, \ics{Gls}, \ics{GLS}, \cs{glsdisp} before +using \ics{glspl}, the \gloskey{firstplural} value won't be used +with \ics{glspl}. + +\textbf{Note:} prior to version 1.13, the default value of +\gloskey{firstplural} was always taken by appending \qt{s} to the +\gloskey{first} key, which meant that you had to specify both +\gloskey{plural} and \gloskey{firstplural}, even if you hadn't +used the \gloskey{first} key. + +\item[{\gloskey{symbol}}] This field is provided to allow the user +to specify an associated symbol. If omitted, the value is set to +\cs{relax}. Note that not all glossary styles display the symbol. + +\item[{\gloskey{symbolplural}}] This is the plural form of the +symbol (as passed to \ics{glsdisplay} and \ics{glsdisplayfirst} +by \ics{glspl}, \ics{Glspl} and \ics{GLSpl}). If omitted, the value +is set to the same as the \gloskey{symbol} key. + +\item[{\gloskey{sort}}] This value indicates how this entry should +be sorted. If omitted, the value is given +by the \gloskey{name} field unless one of the package options +\pkgopt[def]{sort} and \pkgopt[use]{sort} have been used. In +general, it's best to use the \gloskey{sort} key if the +\gloskey{name} contains commands (e.g.\ \verb|\ensuremath{\alpha}|). +You can also override the \gloskey{sort} key by redefining +\ics{glsprestandardsort} (see \sectionref{sec:pkgopts-sort}). + +\opt1 by default strips the \glslink{latexexlatinchar}{standard +\LaTeX\ accents} (that is, accents generated by core \LaTeX\ commands) from the +\gloskey{name} key when it sets the \gloskey{sort} key. So with +\opt1: +\begin{verbatim} +\newglossaryentry{elite}{% + name={{\'e}lite}, + description={select group of people} +} +\end{verbatim} +This is equivalent to: +\begin{verbatim} +\newglossaryentry{elite}{% + name={{\'e}lite}, + description={select group of people}, + sort={elite} +} +\end{verbatim} +Unless you use the package option \pkgopt[true]{sanitizesort}, in +which case it's equivalent to: +\begin{verbatim} +\newglossaryentry{elite}{% + name={{\'e}lite}, + description={select group of people}, + sort={\'elite} +} +\end{verbatim} +This will place the entry before the \qt{A} letter group since the +sort value starts with a symbol. + +Similarly if you use the \sty{inputenc} package: +\begin{alltt} +\verb|\newglossaryentry{elite}{%| + name=\verb|{{|\'e\verb|}|lite\verb|}|, + description=\verb|{select group of people}| +\verb|}| +\end{alltt} +This is equivalent to +\begin{alltt} +\verb|\newglossaryentry{elite}{%| + name=\verb|{{|\'e\verb|}|lite\verb|}|, + description=\verb|{select group of people}|, + sort=elite +\verb|}| +\end{alltt} +Unless you use the package option \pkgopt[true]{sanitizesort}, in +which case it's equivalent to: +\begin{alltt} +\verb|\newglossaryentry{elite}{%| + name=\verb|{{|\'e\verb|}|lite\verb|}|, + description=\verb|{select group of people}|, + sort=\'elite +\verb|}| +\end{alltt} +Again, this will place the entry before the \qt{A} group. + +With \optsand23, the default value of \gloskey{sort} will either be +set to the \gloskey{name} key (if \pkgopt[true]{sanitizesort}) or it +will set it to the expansion of the \gloskey{name} key (if +\pkgopt[false]{sanitizesort}). + +\begin{important} +Take care with \gls{xindy} (\opt3): if you have entries with the same +\gloskey{sort} value they will be treated as the +same entry. If you use \gls{xindy} and aren't using the \texttt{def} +or \texttt{use} sort methods, \textbf{always} use the \gloskey{sort} +key for entries where the name just consists of a control sequence +(for example \texttt{name=\{\cs{alpha}\}}). + +Take care if you use \opt1 and the \gloskey{name} contains fragile +commands. You will either need to explicitly set the \gloskey{sort} +key or use the \pkgopt[true]{sanitizesort} package option (unless +you use the \texttt{def} or \texttt{use} sort methods). +\end{important} + +\item[{\gloskey{type}}] This specifies the label of the glossary in +which this entry belongs. If omitted, the default glossary is +assumed unless \ics{newacronym} is used (see +\sectionref{sec:acronyms}). + +\item[{\gloskey{user1}, \ldots, \gloskey{user6}% +\igloskey{user2}\igloskey{user3}\igloskey{user4}\igloskey{user5}}] +Six keys provided for any additional information the user may want +to specify. (For example, an associated dimension or an alternative +plural or some other grammatical construct.) Alternatively, you can +add new keys using \ics{glsaddkey} or \ics{glsaddstoragekey} (see \sectionref{sec:addkey}). + +\item[{\gloskey{nonumberlist}}] A boolean key. If the value is +missing or is \texttt{true}, this will suppress the \gls{numberlist} just for +this entry. Conversely, if you have used the package option +\pkgopt{nonumberlist}, you can activate the \gls*{numberlist} just +for this entry with \gloskey{nonumberlist=false}. +(See \sectionref{sec:numberlists}.) + +\item[{\gloskey{see}}] Cross-reference another entry. Using the +\gloskey{see} key will \emph{automatically add this entry to the +glossary}, but will not automatically add the cross-referenced entry. +The referenced entry should be supplied as the value to this key. +If you want to override the \qt{see} tag, you can supply the new +tag in square brackets before the label. For example +\verb|see=[see also]{anotherlabel}|. \textbf{Note that if you have +suppressed the \gls{numberlist}, the cross-referencing information +won't appear in the glossary, as it forms part of the +\gls*{numberlist}.} You can override this for individual +glossary entries using \gloskey{nonumberlist=false} (see above). +Alternatively, you can use the \pkgopt{seeautonumberlist} package +option. For further details, see \sectionref{sec:crossref}. + +This key essentially provides a convenient shortcut that performs +\begin{alltt} +\cs{glssee}\oarg{tag}\marg{label}\marg{xr-label list} +\end{alltt} +after the entry has been defined. + +\begin{important} +For \optsand23, \ics{makeglossaries} must be used before any occurrence of +\ics{newglossaryentry} that contains the \gloskey{see} key. This key +should not be used with entries defined in the \env{document} environment. +\end{important} +Since it's useful to suppress the indexing while working on a draft +document, consider using the \pkgopt{seenoindex} package option to +warn or ignore the \gloskey{see} key while \cs{makeglossaries} is +commented out. + +If you use the \gloskey{see} key, you may want to consider using the +\gls{glossaries-extra} package which additionally +provides a \texttt{seealso} and \texttt{alias} key. If you want to +avoid the automatic indexing triggered by the \gloskey{see} key, +consider using \opt4. + +\end{description} + +The following keys are reserved for \ics{newacronym} (see +\sectionref{sec:acronyms}): \gloskey{long}, \gloskey{longplural}, +\gloskey{short} and \gloskey{shortplural}. + +\begin{important} +Avoid using any of the \glslike\ or \glstextlike\ commands within +the \gloskey{text}, \gloskey{first}, \gloskey{short} or +\gloskey{long} keys (or their plural equivalent) or any +other key that you plan to access through those commands. +(For example, the \gloskey{symbol} key if you intend to use +\cs{glssymbol}.) Otherwise you end up with nested links, which +can cause complications and they won't work with the case-changing +commands. You can use them within the value of keys +that won't be accessed through those commands. For example, +the \gloskey{description} key if you don't use \cs{glsdesc}. +Additionally, they'll confuse the entry formatting commands, such as +\cs{glslabel}. +\end{important} + +Note that if the name starts with +\gls{nonlatinchar}, you must group the character, otherwise it will +cause a problem for commands like \ics{Gls} and \ics{Glspl}. +For example: +\begin{verbatim} +\newglossaryentry{elite}{name={{\'e}lite}, +description={select group or class}} +\end{verbatim} +Note that the same applies if you are using the \sty{inputenc} +package: +\begin{alltt} +\verb|\newglossaryentry{elite}{name={{|\'e\verb|}lite},| +description=\verb|{select group or class}}| +\end{alltt} +(This doesn't apply for \XeLaTeX\ documents using the \sty{fontspec} +package. For further details, see the \qt{UTF-8} section in the +\sty{mfirstuc} user manual.) + +Note that in both of the above examples, you will also need to +supply the \gloskey{sort} key if you are using \opt2 +whereas \gls{xindy} (\opt3) is usually able to sort +\glspl{nonlatinchar} +correctly. \opt1 discards accents from +\glspl{latexexlatinchar} unless you use the \pkgopt[true]{sanitizesort}. + + +\section{Plurals} +\label{sec:plurals} + +You may have noticed from above that you can specify the plural form +when you define a term. If you omit this, the plural will be +obtained by appending +\begin{definition}[\DescribeMacro{\glspluralsuffix}] +\cs{glspluralsuffix} +\end{definition} +to the singular form. This command defaults to the letter \qt{s}. +For example: +\begin{verbatim} +\newglossaryentry{cow}{name=cow,description={a fully grown +female of any bovine animal}} +\end{verbatim} +defines a new entry whose singular form is \qt{cow} and plural form +is \qt{cows}. However, if you are writing in archaic English, you +may want to use \qt{kine} as the plural form, in which case you +would have to do: +\begin{verbatim} +\newglossaryentry{cow}{name=cow,plural=kine, +description={a fully grown female of any bovine animal}} +\end{verbatim} + +If you are writing in a language that supports +multiple plurals (for a given term) then use the \gloskey{plural} key +for one of them and one of the user keys to specify the +other plural form. For example: +\begin{verbatim} +\newglossaryentry{cow}{% + name=cow,% + description={a fully grown female of any bovine animal + (plural cows, archaic plural kine)},% + user1={kine}} +\end{verbatim} +You can then use \verb|\glspl{cow}| to produce \qt{cows} and +\verb|\glsuseri{cow}| to produce \qt{kine}. You can, of course, +define an easy to remember synonym. For example: +\begin{verbatim} +\let\glsaltpl\glsuseri +\end{verbatim} +Then you don't have to remember which key you used to store the +second plural. Alternatively, you can define your own keys using +\ics{glsaddkey}, described in \sectionref{sec:addkey}. + +If you are using a language that usually forms plurals +by appending a different letter, or sequence of letters, you can +redefine \cs{glspluralsuffix} as required. However, this must be +done \emph{before} the entries are defined. For languages that don't +form plurals by simply appending a suffix, all the plural forms must be +specified using the \gloskey{plural} key (and the \gloskey{firstplural} +key where necessary). + +\section{Other Grammatical Constructs} +\label{sec:grammar} + +You can use the six user keys to provide alternatives, such as +participles. For example: +\begin{verbatim} +\let\glsing\glsuseri +\let\glsd\glsuserii + +\newcommand*{\ingkey}{user1} +\newcommand*{\edkey}{user2} + +\newcommand*{\newword}[3][]{% + \newglossaryentry{#2}{% + name={#2},% + description={#3},% + \edkey={#2ed},% + \ingkey={#2ing},#1% + }% +} +\end{verbatim} +With the above definitions, I can now define terms like this: +\begin{verbatim} +\newword{play}{to take part in activities for enjoyment} +\newword[\edkey={ran},\ingkey={running}]{run}{to move fast using +the legs} +\end{verbatim} +and use them in the text: +\begin{verbatim} +Peter is \glsing{play} in the park today. + +Jane \glsd{play} in the park yesterday. + +Peter and Jane \glsd{run} in the park last week. +\end{verbatim} + +Alternatively, you can define your own keys using +\ics{glsaddkey}, described below in \sectionref{sec:addkey}. + +\section{Additional Keys} +\label{sec:addkey} + +You can now also define your own custom keys using the +commands described in this section. There are two types of keys: +those for use within the document and those to store information +used behind the scenes by other commands. + +For example, if you want to add a key that indicates the associated +unit for a~term, you might want to reference this unit in your +document. In this case use \cs{glsaddkey} described in +\sectionref{sec:glsaddkey}. If, on the other hand, you want to add a +key to indicate to a glossary style or acronym style that this entry +should be formatted differently to other entries, then you can use +\cs{glsaddstoragekey} described in \sectionref{sec:glsaddstoragekey}. + +In both cases, a new command \meta{no link cs} will be defined that +can be used to access the value of this key (analogous to commands +such as \cs{glsentrytext}). This can be used in an expandable +context (provided any fragile commands stored in the key have been +protected). The new keys must be added using \cs{glsaddkey} or +\cs{glsaddstoragekey} before glossary entries are defined. + +\subsection{Document Keys} +\label{sec:glsaddkey} + +A custom key that can be used in the document is defined using: +\begin{definition}[\DescribeMacro\glsaddkey] +\cs{glsaddkey}\marg{key}% +\marg{default value}% +\marg{no link cs}% +\marg{no link ucfirst cs}% +\marg{link cs}% +\marg{link ucfirst cs}% +\marg{link allcaps cs} +\end{definition} +where: +\begin{description} +\item[\meta{key}] is the new key to use in \ics{newglossaryentry} +(or similar commands such as \ics{longnewglossaryentry}); +\item[\meta{default value}] is the default value to use if this key +isn't used in an entry definition (this may reference the current +entry label via \cs{glslabel}, but you will have to switch on +expansion via the starred version of \cs{glsaddkey} and protect +fragile commands); +\item[\meta{no link cs}] is the control sequence to use analogous +to commands like \ics{glsentrytext}; +\item[\meta{no link ucfirst cs}] is the control sequence to use analogous +to commands like \ics{Glsentrytext}; +\item[\meta{link cs}] is the control sequence to use analogous +to commands like \ics{glstext}; +\item[\meta{link ucfirst cs}] is the control sequence to use analogous +to commands like \ics{Glstext}; +\item[\meta{link allcaps cs}] is the control sequence to use analogous +to commands like \ics{GLStext}. +\end{description} +The starred version of \cs{glsaddkey} switches on expansion for this +key. The unstarred version doesn't override the current expansion +setting. + +\begin{example}{Defining Custom Keys}{ex:addkey} +Suppose I want to define two new keys, \texttt{ed} and \texttt{ing}, +that default to the entry text followed by \qt{ed} and \qt{ing}, +respectively. The default value will need expanding in both cases, so +I need to use the starred form: +\begin{verbatim} + % Define "ed" key: + \glsaddkey* + {ed}% key + {\glsentrytext{\glslabel}ed}% default value + {\glsentryed}% command analogous to \glsentrytext + {\Glsentryed}% command analogous to \Glsentrytext + {\glsed}% command analogous to \glstext + {\Glsed}% command analogous to \Glstext + {\GLSed}% command analogous to \GLStext + + % Define "ing" key: + \glsaddkey* + {ing}% key + {\glsentrytext{\glslabel}ing}% default value + {\glsentrying}% command analogous to \glsentrytext + {\Glsentrying}% command analogous to \Glsentrytext + {\glsing}% command analogous to \glstext + {\Glsing}% command analogous to \Glstext + {\GLSing}% command analogous to \GLStext +\end{verbatim} +Now I can define some entries: +\begin{verbatim} + % No need to override defaults for this entry: + + \newglossaryentry{jump}{name={jump},description={}} + + % Need to override defaults on these entries: + + \newglossaryentry{run}{name={run},% + ed={ran},% + ing={running},% + description={}} + + \newglossaryentry{waddle}{name={waddle},% + ed={waddled},% + ing={waddling},% + description={}} +\end{verbatim} + +These entries can later be used in the document: +\begin{verbatim} +The dog \glsed{jump} over the duck. + +The duck was \glsing{waddle} round the dog. + +The dog \glsed{run} away from the duck. +\end{verbatim} +For a complete document, see the sample file \samplefile{-newkeys}. +\end{example} + +\subsection{Storage Keys} +\label{sec:glsaddstoragekey} + +A custom key that can be used for simply storing information is +defined using: +\begin{definition}[\DescribeMacro\glsaddstoragekey] +\cs{glsaddstoragekey}\marg{key}\marg{default value}\marg{no link cs} +\end{definition} +where the arguments are as the first three arguments of +\cs{glsaddkey}, described above in \sectionref{sec:glsaddkey}. + +This is essentially the same as \cs{glsaddkey} except that it +doesn't define the additional commands. You can access or update +the value of your new field using the commands described in +\sectionref{sec:fetchset}. + +\begin{example}{Defining Custom Storage Key (Acronyms and Initialisms)}{ex:addstoragekey} +Suppose I want to define acronyms and other forms of abbreviations, +such as initialisms, but I want them all in the same glossary and I +want the acronyms on first use to be displayed with the short form followed by +the long form in parentheses, but the opposite way round for other +forms of abbreviations. (The \gls{glossaries-extra} package +provides a simpler way of achieving this.) + +Here I can define a new key that determines whether the term is +actually an acronym rather than some other form of abbreviation. I'm +going to call this key \texttt{abbrtype} (since \texttt{type} +already exists): +\begin{verbatim} +\glsaddstoragekey + {abbrtype}% key/field name + {word}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required +\end{verbatim} + +Now I can define a style that looks up the value of this new key to +determine how to display the full form: +\begin{verbatim} +\newacronymstyle + {mystyle}% style name + {% Use the generic display + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + } + {% Put the long form in the description + \renewcommand*{\GenericAcronymFields}{% + description={\the\glslongtok}}% + % For the full format, test the value of the "abbrtype" key. + % If it's set to "word" put the short form first with + % the long form in brackets. + \renewcommand*{\genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % first letter upper case version: + \renewcommand*{\Genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % plural + \renewcommand*{\genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % plural and first letter upper case + \renewcommand*{\Genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % Just use the short form as the name part in the glossary: + \renewcommand*{\acronymentry}[1]{% + \acronymfont{\glsentryshort{##1}}}% + % Sort by the short form: + \renewcommand*{\acronymsort}[2]{##1}% + % Just use the surrounding font for the short form: + \renewcommand*{\acronymfont}[1]{##1}% + % Same for first use: + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + % Default plural suffix if the plural isn't explicitly set + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + } +\end{verbatim} +Remember that the new style needs to be set before defining any +terms: +\begin{verbatim} +\setacronymstyle{mystyle} +\end{verbatim} + +Since it's a bit confusing to use \ics{newacronym} for something +that's not technically an acronym, let's define a new command for +initialisms: +\begin{verbatim} +\newcommand*{\newinitialism}[4][]{% + \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% +} +\end{verbatim} +Now the entries can all be defined: +\begin{verbatim} +\newacronym{radar}{radar}{radio detecting and ranging} +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} +\newacronym{scuba}{scuba}{self-contained underwater breathing +apparatus} +\newinitialism{dsp}{DSP}{digital signal processing} +\newinitialism{atm}{ATM}{automated teller machine} +\end{verbatim} +On \gls{firstuse}, \verb|\gls{radar}| will produce \qt{radar (radio +detecting and ranging)} but \verb|\gls{dsp}| will produce \qt{DSP +(digital signal processing)}. + +For a complete document, see the sample file +\samplefile{-storage-abbr}. +\end{example} + +In the above example, if \cs{newglossaryentry} is explicitly used +(instead of through \cs{newacronym}) the \texttt{abbrtype} key will +be set to its default value of \qt{word} but the \cs{ifglshaslong} +test in the custom acronym style will be false (since the +\gloskey{long} key hasn't been set) so the display style will switch +to that given by \cs{glsgenentryfmt} and they'll be no test +performed on the \texttt{abbrtype} field. + +\begin{example}{Defining Custom Storage Key (Acronyms and +Non-Acronyms with Descriptions)}{ex:addstoragekey2} +The previous example can be modified if the \gloskey{description} +also needs to be provided. Here I've changed \qt{word} to +\qt{acronym}: +\begin{verbatim} +\glsaddstoragekey + {abbrtype}% key/field name + {acronym}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required +\end{verbatim} +This may seem a little odd for non-abbreviated entries defined using +\cs{newglossaryentry} directly, but \ics{ifglshaslong} can be used +to determine whether or not to reference the value of this new +\texttt{abbrtype} field. + +The new acronym style has a~minor modification that forces the user +to specify a description. In the previous example, the line: +\begin{verbatim} + \renewcommand*{\GenericAcronymFields}{% + description={\the\glslongtok}}% +\end{verbatim} +needs to be changed to: +\begin{verbatim} + \renewcommand*{\GenericAcronymFields}{}% +\end{verbatim} +Additionally, to accommodate the change in the default value of the +\texttt{abbrtype} key, all instances of +\begin{verbatim} + \ifglsfieldeq{##1}{abbrtype}{word} +\end{verbatim} +need to be changed to: +\begin{verbatim} + \ifglsfieldeq{##1}{abbrtype}{acronym} +\end{verbatim} + +Once this new style has been set, the new acronyms can be defined +using the optional argument to set the description: +\begin{verbatim} +\newacronym[description={system for detecting the position and +speed of aircraft, ships, etc}]{radar}{radar}{radio detecting +and ranging} +\end{verbatim} + +No change is required for the definition of \cs{newinitialism} but +again the optional argument is required to set the description: +\begin{verbatim} +\newinitialism[description={mathematical manipulation of an +information signal}]{dsp}{DSP}{digital signal processing} +\end{verbatim} + +We can also accommodate contractions in a similar manner to the +initialisms: +\begin{verbatim} +\newcommand*{\newcontraction}[4][]{% + \newacronym[abbrtype=contraction,#1]{#2}{#3}{#4}% +} +\end{verbatim} +The contractions can similarly been defined using this new command: +\begin{verbatim} +\newcontraction[description={front part of a ship below the +deck}]{focsle}{fo'c's'le}{forecastle} +\end{verbatim} + +Since the custom acronym style just checks if \texttt{abbrtype} is +\texttt{acronym}, the contractions will be treated the same as the +initialisms, but the style could be modified by a further test of +the \texttt{abbrtype} value if required. + +To test regular non-abbreviated entries, I've also defined a simple +word: +\begin{verbatim} +\newglossaryentry{apple}{name={apple},description={a fruit}} +\end{verbatim} + +Now for a new glossary style that provides information about the +abbreviation (in addition to the description): +\begin{verbatim} +\newglossarystyle + {mystyle}% style name + {% base it on the "list" style + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \ifglshaslong{##1}% + { (\abbrtype{##1}: \glsentrylong{##1})\space}{}% + \glossentrydesc{##1}\glspostdescription\space ##2}% + } +\end{verbatim} +This uses \ics{ifglshaslong} to determine whether or not the term is +an abbreviation. If it has an abbreviation, the full form is +supplied in parentheses and \cs{abbrtype} (defined by +\cs{glsaddstoragekey} earlier) is used to indicate the type of +abbreviation. + +With this style set, the \texttt{apple} entry is simply displayed in +the glossary as +\begin{description} +\item[apple] a fruit. +\end{description} +but the abbreviations are displayed in the form +\begin{description} +\item[laser] (acronym: light amplification by +stimulated emission of radiation) device that creates a narrow beam +of intense light. +\end{description} +(for acronyms) or +\begin{description} +\item[DSP] (initialism: digital signal processing) mathematical +manipulation of an information signal. +\end{description} +(for initalisms) or +\begin{description} +\item[fo'c's'le] (contraction: forecastle) front part of a ship +below the deck. +\end{description} +(for contractions). + +For a complete document, see \samplefile{-storage-abbr-desc}. +\end{example} + +\section{Expansion} +\label{sec:expansion} + +When you define new glossary entries expansion is performed by +default, except for the \gloskey{name}, \gloskey{description}, +\gloskey{descriptionplural}, \gloskey{symbol}, \gloskey{symbolplural} +and \gloskey{sort} keys (these keys all have expansion suppressed via +\cs{glssetnoexpandfield}). + +You can switch expansion on or off for individual keys using +\begin{definition}[\DescribeMacro\glssetexpandfield] +\cs{glssetexpandfield}\marg{field} +\end{definition} +or +\begin{definition}[\DescribeMacro\glssetnoexpandfield] +\cs{glssetnoexpandfield}\marg{field} +\end{definition} +respectively, where \meta{field} is the field tag corresponding to +the key. In most cases, this is the same as the name of the key +except for those listed in \tableref{tab:fieldmap}. + +\begin{table}[htbp] +\caption{Key to Field Mappings} +\label{tab:fieldmap} +\centering +\begin{tabular}{ll} +\bfseries Key & \bfseries Field\\ +\gloskey{sort} & \ttfamily sortvalue\\ +\gloskey{firstplural} & \ttfamily firstpl\\ +\gloskey{description} & \ttfamily desc\\ +\gloskey{descriptionplural} & \ttfamily descplural\\ +\gloskey{user1} & \ttfamily useri\\ +\gloskey{user2} & \ttfamily userii\\ +\gloskey{user3} & \ttfamily useriii\\ +\gloskey{user4} & \ttfamily useriv\\ +\gloskey{user5} & \ttfamily userv\\ +\gloskey{user6} & \ttfamily uservi\\ +\gloskey{longplural} & \ttfamily longpl\\ +\gloskey{shortplural} & \ttfamily shortpl +\end{tabular} +\end{table} + +Any keys that haven't had the expansion explicitly set using +\cs{glssetexpandfield} or \cs{glssetnoexpandfield} are governed by +\begin{definition}[\DescribeMacro\glsexpandfields] +\cs{glsexpandfields} +\end{definition} +and +\begin{definition}[\DescribeMacro\glsnoexpandfields] +\cs{glsnoexpandfields} +\end{definition} + +If your entries contain any fragile commands, I recommend you switch +off expansion via \cs{glsnoexpandfields}. (This should be used +before you define the entries.) + +\section{Sub-Entries} +\label{sec:subentries} + +As from version 1.17, it is possible to specify sub-entries. These +may be used to order the glossary into categories, in which case the +sub-entry will have a different name to its parent entry, or it may +be used to distinguish different definitions for the same word, in +which case the sub-entries will have the same name as the parent +entry. Note that not all glossary styles support hierarchical +entries and may display all the entries in a flat format. Of the +styles that support sub-entries, some display the sub-entry's name +whilst others don't. Therefore you need to ensure that you use a +suitable style. (See \sectionref{sec:styles} for a list of predefined +styles.) As from version 3.0, level~1 sub-entries are automatically +numbered in the predefined styles if you use the +\pkgopt{subentrycounter} package option (see +\sectionref{sec:pkgopts-printglos} for further details). + +Note that the parent entry will automatically be added to the +glossary if any of its child entries are used in the document. +If the parent entry is not referenced in the document, it will not +have a \gls{numberlist}. Note also that \gls{makeindex} has a +restriction on the maximum sub-entry depth. + +\subsection{Hierarchical Categories} +\label{sec:hierarchical} + +To arrange a glossary with hierarchical categories, you need to +first define the category and then define the sub-entries using the +relevant category entry as the value of the \gloskey{parent} key. + +\begin{example}{Hierarchical Categories---Greek and Roman +Mathematical Symbols}{ex:hierarchical} + +Suppose I want a glossary of mathematical symbols that +are divided into Greek letters and Roman letters. Then I can define +the categories as follows: +\begin{verbatim} +\newglossaryentry{greekletter}{name={Greek letters}, +description={\nopostdesc}} + +\newglossaryentry{romanletter}{name={Roman letters}, +description={\nopostdesc}} +\end{verbatim} + +Note that in this example, the category entries don't need a +description so I have set the descriptions to \ics{nopostdesc}. +This gives a blank description and suppresses the +description terminator. + +I can now define my sub-entries as follows: +\begin{verbatim} +\newglossaryentry{pi}{name={\ensuremath{\pi}},sort={pi}, +description={ratio of the circumference of a circle to +the diameter}, +parent=greekletter} + +\newglossaryentry{C}{name={\ensuremath{C}},sort={C}, +description={Euler's constant}, +parent=romanletter} +\end{verbatim} +For a complete document, see the sample file \samplefile{tree}. +\end{example} + +\subsection{Homographs} +\label{sec:homographs} + +Sub-entries that have the same name as the parent entry, don't need +to have the \gloskey{name} key. For example, the word \qt{glossary} +can mean a list of technical words or a collection of glosses. In +both cases the plural is \qt{glossaries}. So first define the parent +entry: +\begin{verbatim} +\newglossaryentry{glossary}{name=glossary, +description={\nopostdesc}, +plural={glossaries}} +\end{verbatim} +Again, the parent entry has no description, so the description +terminator needs to be suppressed using \ics{nopostdesc}. + +Now define the two different meanings of the word: +\begin{verbatim} +\newglossaryentry{glossarylist}{ +description={list of technical words}, +sort={1}, +parent={glossary}} + +\newglossaryentry{glossarycol}{ +description={collection of glosses}, +sort={2}, +parent={glossary}} +\end{verbatim} +Note that if I reference the parent entry, the location will be +added to the parent's \gls{numberlist}, whereas if I reference any +of the child entries, the location will be added to the child +entry's number list. Note also that since the sub-entries have the +same name, the \gloskey{sort} key is required unless you are using +the \pkgopt[use]{sort} or \pkgopt[def]{sort} package options (see +\sectionref{sec:pkgopts-sort}). You +can use the \pkgopt{subentrycounter} package option to automatically +number the first-level child entries. See +\sectionref{sec:pkgopts-printglos} for further details. + +In the above example, the plural form for both of the child entries +is the same as the parent entry, so the \gloskey{plural} key was +not required for the child entries. However, if the sub-entries +have different plurals, they will need to be specified. For example: +\begin{verbatim} +\newglossaryentry{bravo}{name={bravo}, +description={\nopostdesc}} + +\newglossaryentry{bravocry}{description={cry of approval +(pl.\ bravos)}, +sort={1}, +plural={bravos}, +parent=bravo} + +\newglossaryentry{bravoruffian}{description={hired +ruffian or killer (pl.\ bravoes)}, +sort={2}, +plural={bravoes}, +parent=bravo} +\end{verbatim} + + +\section{Loading Entries From a File} +\label{sec:loadglsentries} + +You can store all your glossary entry definitions in another +file and use: +\begin{definition}[\DescribeMacro{\loadglsentries}] +\cs{loadglsentries}\oarg{type}\marg{filename} +\end{definition} +where \meta{filename} is the name of the file containing all the +\ics{newglossaryentry} or \ics{longnewglossaryentry} commands. +The optional argument +\meta{type} is the name of the glossary to which those entries +should belong, for those entries where the \gloskey{type} key has +been omitted (or, more specifically, for those entries whose +type has been specified by \ics{glsdefaulttype}, which is what +\ics{newglossaryentry} uses by default). + +This is a~preamble-only command. You may also use \ics{input} to load +the file but don't use \ics{include}. If you find that your file is +becoming unmanageably large, you may want to consider switching to +\gls{bib2gls} and use an application such as JabRef to manage the +entry definitions. + +\begin{important} +If you want to use \ics{AtBeginDocument} to \cs{input} all your entries +automatically at the start of the document, add the +\cs{AtBeginDocument} command \emph{before} you load the +\sty{glossaries} package (and \sty{babel}, if you are also loading +that) to avoid the creation of the +\filetype{.glsdefs} file and any associated problems that are caused +by defining commands in the \env{document} environment. +(See \sectionref{sec:docdefs}.) +\end{important} + +\begin{example}{Loading Entries from Another File}{ex:loadgls} +Suppose I have a file called \texttt{myentries.tex} which contains: +\begin{verbatim} +\newglossaryentry{perl}{type=main, +name={Perl}, +description={A scripting language}} + +\newglossaryentry{tex}{name={\TeX}, +description={A typesetting language},sort={TeX}} + +\newglossaryentry{html}{type=\glsdefaulttype, +name={html}, +description={A mark up language}} +\end{verbatim} +and suppose in my document preamble I use the command: +\begin{verbatim} +\loadglsentries[languages]{myentries} +\end{verbatim} +then this will add the entries \texttt{tex} and \texttt{html} +to the glossary whose type is given by \texttt{languages}, but +the entry \texttt{perl} will be added to the main glossary, since +it explicitly sets the type to \texttt{main}. +\end{example} + +\textbf{Note:} if you use \ics{newacronym} (see +\sectionref{sec:acronyms}) the type is set as +\verb|type=\acronymtype| unless you explicitly override it. For +example, if my file \texttt{myacronyms.tex} contains: +\begin{verbatim} +\newacronym{aca}{aca}{a contrived acronym} +\end{verbatim} +then (supposing I have defined a new glossary type called +\texttt{altacronym}) +\begin{verbatim} +\loadglsentries[altacronym]{myacronyms} +\end{verbatim} +will add \texttt{aca} to the glossary type \texttt{acronym}, if the +package option \pkgopt{acronym} has been specified, or will add +\texttt{aca} to the glossary type \texttt{altacronym}, if the +package option \pkgopt{acronym} is not specified.\footnote{This is +because \ics{acronymtype} is set to \ics{glsdefaulttype} if the +\pkgopt{acronym} package option is not used.} + +If you have used the \pkgopt{acronym} package option, +there are two possible solutions to this problem: +\begin{enumerate} +\item Change \texttt{myacronyms.tex} so that entries are defined in +the form: +\begin{verbatim} +\newacronym[type=\glsdefaulttype]{aca}{aca}{a +contrived acronym} +\end{verbatim} +and do: +\begin{verbatim} +\loadglsentries[altacronym]{myacronyms} +\end{verbatim} + +\item Temporarily change \cs{acronymtype} to the target glossary: +\begin{verbatim} +\let\orgacronymtype\acronymtype +\renewcommand{\acronymtype}{altacronym} +\loadglsentries{myacronyms} +\let\acronymtype\orgacronymtype +\end{verbatim} +\end{enumerate} + +Note that only those entries that have been used +in the text will appear in the relevant glossaries. +Note also that \cs{loadglsentries} may only be used in the +preamble. + +Remember that you can use \ics{provideglossaryentry} rather than +\ics{newglossaryentry}. Suppose you want to maintain a large database +of acronyms or terms that you're likely to use in your documents, +but you may want to use a modified version of some of those entries. +(Suppose, for example, one document may require a more detailed +description.) Then if you define the entries using +\cs{provideglossaryentry} in your database file, you can override +the definition by simply using \cs{newglossaryentry} before loading +the file. For example, suppose your file (called, say, +\texttt{terms.tex}) contains: +\begin{verbatim} +\provideglossaryentry{mallard}{name=mallard, + description={a type of duck}} +\end{verbatim} +but suppose your document requires a more detailed description, you +can do: +\begin{verbatim} +\usepackage{glossaries} +\makeglossaries + +\newglossaryentry{mallard}{name=mallard, + description={a dabbling duck where the male has a green head}} + +\loadglsentries{terms} +\end{verbatim} +Now the \texttt{mallard} definition in the \texttt{terms.tex} file +will be ignored. + +\section{Moving Entries to Another Glossary} +\label{sec:moveentry} + +As from version~3.02, you can move an entry from one glossary to +another using: +\begin{definition}[\DescribeMacro{\glsmoveentry}] +\cs{glsmoveentry}\marg{label}\marg{target glossary label} +\end{definition} +where \meta{label} is the unique label identifying the required +entry and \meta{target glossary label} is the unique label +identifying the glossary in which to put the entry. + +Note that no check is performed to determine the existence of +the target glossary. If you want to move an entry to a glossary +that's skipped by \ics{printglossaries}, then define an ignored +glossary with \ics{newignoredglossary}. (See +\sectionref{sec:newglossary}.) + +\begin{important} +Unpredictable results may occur if you move an entry to a different +glossary from its parent or children. +\end{important} + +\section{Drawbacks With Defining Entries in the Document Environment} +\label{sec:docdefs} + +Originally, \ics{newglossaryentry} (and \ics{newacronym}) could only be +used in the preamble. I reluctantly removed this restriction in version 1.13, +but there are issues with defining commands in the \env{document} +environment instead of the preamble, which is why the restriction is +maintained for newer commands. This restriction is also reimposed +for \cs{newglossaryentry} by the new \opt1. (The +\gls{glossaries-extra} package automatically reimposes this restriction for +\optsand23 but provides a package option to allow document +definitions.) + +\subsection{Technical Issues} +\label{sec:techissues} + +\begin{enumerate} + \item If you define an entry mid-way through your document, but +subsequently shuffle sections around, you could end up using an +entry before it has been defined. + + \item Entry information is required when displaying the glossary. +If this occurs at the start of the document, but the entries aren't +defined until later, then the entry details are +being looked up before the entry has been defined. + + \item If you use a package, such as \sty{babel}, that makes +certain characters active at the start of the \env{document} +environment, there will be a~problem if those characters have +a~special significance when defining glossary entries. +These characters include the double-quote \verb|"| character, the +exclamation mark \texttt{!} character, the question mark \verb|?| +character, and the pipe \verb"|" character. They +must not be active when defining a~glossary entry where they occur +in the \gloskey{sort} key (and they should be avoided in the label +if they may be active at any point in the document). Additionally, +the comma \texttt{,} character and the equals \texttt{=} character +should not be active when using commands that have +\meta{key}=\meta{value} arguments. + +\end{enumerate} + +To overcome the first two problems, as from version 4.0 the +\styfmt{glossaries} package modifies the definition of +\cs{newglossaryentry} at the beginning of the \env{document} +environment so that the definitions are written to an external file +(\cs{jobname}\filetype{.glsdefs}) which is then read in at the start +of the document on the next run. The entry will then only be defined +in the \env{document} environment if it doesn't already exist. This +means that the entry can now be looked up in the glossary, even if +the glossary occurs at the beginning of the document. + +There are drawbacks to this mechanism: if you modify an entry +definition, you need a second run to see the effect of your +modification; this method requires an extra \cs{newwrite}, which may +exceed \TeX's maximum allocation; unexpected expansion issues could +occur; the \gloskey{see} key isn't stored, which means it can't be +added to the \filetype{.glsdefs} file when it's created at the end of the +document (and therefore won't be present on subsequent runs). + +The \gls{glossaries-extra} package provides a setting (but only for +\optsand23) that allows \cs{newglossaryentry} to occur in the +document environment but doesn't create the \filetype{.glsdefs} +file. This circumvents some problems but it means that you can't +display any of the glossaries before all the entries have been +defined (so it's all right if all the glossaries are at the end of +the document but not if any occur in the front matter). + +\subsection{Good Practice Issues} +\label{sec:goodpractice} + +The above section covers technical issues that can cause your document to have +compilation errors or produce incorrect output. This section +focuses on good writing practice. The main reason cited by users +wanting to define entries within the \env{document} environment rather +than in the preamble is that they want to write the definition as +they type in their document text. This suggests a \qt{stream of +consciousness} style of writing that may be acceptable in certain +literary genres but is inappropriate for factual documents. + +When you write technical documents, regardless of whether it's a PhD +thesis or an article for a~journal or proceedings, you must plan what you write +in advance. If you plan in advance, you should have a fairly good +idea of the type of terminology that your document will contain, +so while you are planning, create a new file with all your entry +definitions. If, while you're writing your document, you remember +another term you need, then you can switch over to your definition file and +add it. Most text editors have the ability to have more than one +file open at a time. The other advantage to this approach is that if +you forget the label, you can look it up in the definition file +rather than searching through your document text to find the +definition. + +\chapter{Number lists} +\label{sec:numberlists} + +Each entry in the glossary has an associated \gls{numberlist}. +By default, these numbers refer to the pages on which that entry has +been indexed (using any of the commands described in +\sectionref{sec:glslink} and \sectionref{sec:glsadd}). The number +list can be suppressed using the \pkgopt{nonumberlist} package +option, or an alternative counter can be set as the default using +the \pkgopt{counter} package option. The number list is also +referred to as the location list\index{location list|see{number list}}. + +\Glspl{numberlist} are more common with indexes rather than +glossaries (although you can use the \styfmt{glossaries} package for +indexes as well). However, the \styfmt{glossaries} package makes use +of \gls{makeindex} or \gls{xindy} to hierarchically sort and collate the +entries since they are readily available with most modern \TeX\ +distributions. Since these are both designed as \glspl{indexingapp} +they both require that terms either have a valid location or a +cross-reference. Even if you use \pkgopt{nonumberlist}, the +locations must still be provided and acceptable to the +\gls{indexingapp} or they will cause an error during the indexing +stage, which will interrupt the document build. However, if you're +not interested in the locations, each entry only needs to be indexed +once, so consider using \pkgopt{indexonlyfirst}, which can improve the +document build time by only indexing the \gls{firstuse} of each term. + +The \ics{glsaddall} command (see \sectionref{sec:glsadd}), which is used to +automatically index all entries, iterates over all defined entries +and does \cs{glsadd}\marg{label} for each entry (where \meta{label} +is that entry's label). This means that \cs{glsaddall} automatically +adds the same location to every entry's \gls{numberlist}, which +looks weird if the \gls*{numberlist} hasn't been suppressed. + +With \opt4, the indexing is performed by \gls{bib2gls}, which was +specifically designed for the \gls{glossaries-extra} package. So it +will allow any location format, and its \texttt{selection=all} +option will select all entries without adding an unwanted location to the +\gls{numberlist}. If \gls{bib2gls} can deduce a numerical value for +a location, it will attempt to form a range over consecutive +locations, otherwise it won't try to form a range and the +location will just form an individual item in the list. +\opt1 also allows any location but it doesn't form ranges. + +\section{Encap Values} +\label{sec:encap} + +Each location in the \gls{numberlist} is encapsulated with a +command formed from the \termdef{encap} value. By +default this is the \ics{glsnumberformat} command, which corresponds +to the encap \texttt{glsnumberformat}, but this may be +overridden using the \gloskey[glslink]{format} key in the optional +argument to commands like \cs{gls}. (See \sectionref{sec:glslink}.) +For example, you may want the location to appear in bold to indicate +the principle use of a term or symbol. If the encap starts with an +open parenthesis~\verb|(| this signifies the start of a range and if +the encap starts with close parenthesis~\verb|)| this signifies the +end of a range. These must always occur in matching pairs. + +The \styfmt{glossaries} package provides the command \ics{glsignore} +which ignores its argument. This is the format used by +\cs{glsaddallunused} to suppress the location, which works fine as +long as no other locations are added to the \gls{numberlist}. For +example, if you use \verb|\gls{sample}| on page~2 then reset the +\gls{firstuseflag} and then use \cs{glsaddallunused} on page~10, the +\gls{numberlist} for \texttt{sample} will be \verb|2, \glsignore{10}| +which will result in \qt{2,~} which has a spurious comma. + +This isn't a problem with \gls{bib2gls} because you'd use +\texttt{selection=all} instead of \cs{glsaddallunused}, but even if +you explicitly had, for example, +\cs{gls}\texttt{[format=glsignore]}\marg{label} +for some reason, \gls{bib2gls} will recognise \texttt{glsignore} as +a special encap indicating an ignored location, so it will select +the entry but not add that location to the \gls{numberlist}. It's a +problem for all the other options (except \opt5, which doesn't +perform any indexing). + +Complications can arise if you use different encap values for the +same location. For example, suppose on page~10 you have both the +default \texttt{glsnumberformat} and \texttt{textbf} encaps. While it may +seem apparent that \texttt{textbf} should override \texttt{glsnumberformat} +in this situation, the \gls{indexingapp} may not know it. +This is therefore something you need to be careful about if you use the +\gloskey[glslink]{format} key or if you use a command that +implicitly sets it. + +In the case of \gls{xindy}, it only accepts one encap (according to +the order of precedence given in the \gls{xindy} module) and discards the +others for identical locations (for the same entry). This can cause +a problem if a discarded location forms the start or end of a range. + +In the case of \gls{makeindex}, it accepts different encaps for the +same location, but warns about it. This leads to a \gls{numberlist} +with the same location repeated in different formats. If you use +the \gls{makeglossaries} Perl script with \opt2 it will detect +\gls{makeindex}'s warning and attempt to fix the problem, ensuring +that the \texttt{glsnumberformat} encap always has the least precedence +unless it includes a range identifier. Other conflicting encaps will +have the last one override earlier ones for the same location with +range identifiers taking priority. + +No discard occurs with \opt1 so again you get the same location +repeated in different formats. With \opt4, \gls{bib2gls} will discard +according to order of precedence, giving priority to start and end +range encaps. (See the \gls{bib2gls} manual for further details.) + +\section{Locations} +\label{sec:locationsyntax} + +Neither \opt1 nor \opt4 care about the location syntax as long as +it's valid \LaTeX\ code (and doesn't contain fragile commands). In +both cases, the indexing is performed by writing a line to the +\texttt{.aux} file. The write operation is deferred to avoid the +problems associated with \TeX's asynchronous output routine. +(See, for example, +\href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=oddpage}{Finding +if you're on an odd or an even page} for more details on this issue.) +Unfortunately \optsand23 are far more problematic and need some +complex code to deal with awkward locations. + +If you know that your locations will always expand to a format +acceptable to your chosen \gls{indexingapp} then use the package +option \pkgopt[false]{esclocations} to bypass this operation. This setting +only affects \optsand23 as the problem doesn't arise with the other +indexing options. + +Both \gls{makeindex} and \gls{xindy} are fussy about the syntax of +the locations. In the case of \gls{makeindex}, only the numbering +system obtained with \cs{arabic}, \cs{roman}, \cs{Roman}, \cs{alph} +and \cs{Alph} or composites formed from them with the same separator +(set with \cs{glsSetCompositor}\marg{char}) are accepted. +(\gls{makeindex} won't accept an empty location.) In the case of +\gls{xindy}, you can define your own location classes, but if the +location contains a robust command then the leading backslash must +be escaped. The \sty{glossaries} package tries to do this, but it's +caught between two conflicting requirements: +\begin{enumerate} +\item The location must be fully expanded before \verb|\| can be +converted to \verb|\\| (there's no point converting \verb|\thepage| +to \verb|\\thepage|); +\item The page number can't be expanded until the deferred write +operation (so \verb|\c@page| mustn't expand in the previous step +but \verb|\the\c@page| mustn't be converted to \verb|\\the\\c@page| +and \verb|\number\c@page| mustn't be converted to +\verb|\\number\\c@page| etc). +\end{enumerate} +There's a certain amount of trickery needed to deal with this +conflict and the code requires the location to be in a form that +doesn't embed the counter's internal register in commands like +\cs{value}. For example, suppose you have a robust command called +\cs{tallynum} that takes a number as the argument and an expandable +command called \cs{tally} that converts a counter name into the +associated register or number to pass to \cs{tallynum}. Let's +suppose that this command is used to represent the page number: +\begin{verbatim} +\renewcommand{\thepage}{\tally{page}} +\end{verbatim} +Now let's suppose that a term is indexed at the beginning of page~2 +at the end of a paragraph that started on page~1. With \gls{xindy}, +the location \verb|\tally{page}| needs to be written to the file +as \verb|\\tallynum{2}|. If it's written as \verb|\tallynum{2}| then +\gls{xindy} will interpret \verb|\t| as the character \qt{t} +(which means the location would appear as \qt{tallynum2}). So +\sty{glossaries} tries to expand \cs{thepage} without expanding +\cs{c@page} and then escapes all the backslashes, except for the +page counter's internal command. The following definitions of +\cs{tally} will work: +\begin{itemize} +\item In the following, \cs{arabic} works as its internal command \cs{c@arabic} is +temporarily redefined to check for \cs{c@page}: +\begin{verbatim} +\newcommand{\tally}[1]{\tallynum{\arabic{#1}}} +\end{verbatim} + +\item The form \verb|\expandafter\the\csname c@|\meta{counter}\verb|\endcsname| +also works (provided \cs{the} is allowed to be temporarily redefined, +see below): +\begin{verbatim} +\newcommand{\tally}[1]{% + \tallynum{\expandafter\the\csname c@#1\endcsname}} +\end{verbatim} + +\item \verb|\expandafter\the\value|\marg{counter} now also works +(with the same condition as above): +\begin{verbatim} +\newcommand{\tally}[1]{\tallynum{\expandafter\the\value{#1}}} +\end{verbatim} + +\item Another variation that will work: +\begin{verbatim} +\newcommand{\tally}[1]{% + \expandafter\tallynum\expandafter{\the\csname c@#1\endcsname}} +\end{verbatim} + +\item and also: +\begin{verbatim} +\newcommand{\tally}[1]{\tallynum{\the\csname c@#1\endcsname}} +\end{verbatim} +\end{itemize} +The following \emph{don't work}: +\begin{itemize} +\item This definition leads to the premature expansion of \cs{c@page} +to \qt{1} when, in this case, it should be \qt{2}: +\begin{verbatim} +\newcommand{\tally}[1]{\tallynum{\the\value{#1}}} +\end{verbatim} +\item This definition leads to \verb|\\c@page| in the glossary file: +\begin{verbatim} +\newcommand{\tally}[1]{\tallynum{\csname c@#1\endcsname}} +\end{verbatim} +\end{itemize} +If you have a numbering system where +\verb|\|\meta{cs name}\verb|{page}| expands to +\verb|\|\meta{internal cs name}\cs{c@page} (for example, if +\verb|\tally{page}| expands to \verb|\tallynum\c@page|) then you +need to use: +\begin{definition}[\DescribeMacro\glsaddprotectedpagefmt] +\cs{glsaddprotectedpagefmt}\marg{internal cs name} +\end{definition} +Note that the backslash must be omitted from \meta{internal cs name} +and the corresponding command must be able to process a count +register as the (sole) argument. + +For example, suppose you have a style \texttt{samplenum} that is +implemented as follows: +\begin{verbatim} + \newcommand*{\samplenum}[1]{% + \expandafter\@samplenum\csname c@#1\endcsname} + \newcommand*{\@samplenum}[1]{\two@digits{#1}} + +\end{verbatim} +(That is, it displays the value of the counter as a two-digit +number.) Then to ensure the location is correct for entries in +page-spanning paragraphs, you need to do: +\begin{verbatim} +\glsaddprotectedpagefmt{@samplenum} +\end{verbatim} +(If you are using a different counter for the location, such as +\texttt{section} or \texttt{equation}, you don't need to worry about +this provided the inner command is expandable.) + +If the inner macro (as given by \verb|\|\meta{internal cs name}) contains +non-expandable commands then you may need to redefine +\cs{gls}\meta{internal cs name}\texttt{page} after using +\cs{glsaddprotectedpagefmt}\marg{internal cs name}. This command doesn't take any arguments +as \emph{the location is assumed to be given by \cs{c@page}} because +that's the only occasion this command should be used. For example, +suppose now my page counter format uses small caps Roman numerals: +\begin{verbatim} + \newcommand*{\samplenum}[1]{% + \expandafter\@samplenum\csname c@#1\endcsname} + \newcommand*{\@samplenum}[1]{\textsc{\romannumeral#1}} +\end{verbatim} +Again, the inner macro needs to be identified using: +\begin{verbatim} +\glsaddprotectedpagefmt{@samplenum} +\end{verbatim} +However, since \cs{textsc} isn't fully expandable, the location +is written to the file as \verb|\textsc {i}| (for page~1), +\verb|\textsc {ii}| (for page~2), etc. This format may cause a problem for +the \gls{indexingapp} (particularly for \gls{makeindex}). +To compensate for this, the \cs{gls}\meta{internal cs +name}\texttt{page} command may be redefined so that it expands to a +format that's acceptable to the \gls*{indexingapp}. For example: +\begin{verbatim} +\renewcommand*{\gls@samplenumpage}{\romannumeral\c@page} +\end{verbatim} +While this modification means that the \gls{numberlist} in the glossary +won't exactly match the format of the page numbers (displaying +lower case Roman numbers instead of small cap Roman numerals) +this method will at least work correctly for both \gls{makeindex} +and \gls{xindy}. If you are using \gls{xindy}, the following +definition: +\begin{verbatim} + \renewcommand*{\gls@samplenumpage}{% + \glsbackslash\string\textsc{\romannumeral\c@page}} +\end{verbatim} +combined with +\begin{verbatim} +\GlsAddXdyLocation{romansc}{:sep "\string\textsc\glsopenbrace" + "roman-numbers-lowercase" :sep "\glsclosebrace"} +\end{verbatim} +will now have lowercase Roman numerals in the location list +(see \sectionref{sec:xindyloc} for further details on that command). +Take care of the backslashes. The location (which ends up in +the ":locref" attribute) needs \verb|\\| but the location class +(identified with \cs{GlsAddXdyLocation}) just has a single +backslash. Note that this example will cause problems if your +locations should be hyperlinks. + +Another possibility that may work with both \gls{makeindex} and +\gls{xindy} is to redefine \cs{gls}\meta{internal cs +name}\texttt{page} (\cs{gls@samplenumpage} in this example) +to just expand to the decimal page number (\verb|\number\c@page|) and redefine +\ics{glsnumberformat} to change the displayed format: +\begin{verbatim} +\renewcommand*{\gls@samplenumpage}{\number\c@page} +\renewcommand*{\glsnumberformat}[1]{\textsc{\romannumeral#1}} +\end{verbatim} + +\begin{important} +If you redefine \cs{gls}\meta{internal cs name}\texttt{page}, +you must make sure that \cs{c@page} is expanded when it's written to +the file. (So don't, for example, hide \cs{c@page} inside a robust +command.) +\end{important} + +The mechanism that allows this to work temporarily redefines +\ics{the} and \ics{number} while it processes the location. If this +causes a problem you can disallow it using +\begin{definition}[\DescribeMacro\glswrallowprimitivemodsfalse] +\cs{glswrallowprimitivemodsfalse} +\end{definition} +but you will need to find some other way to ensure the location expands +correctly. + +\section{Range Formations} +\label{sec:ranges} + +Both \gls{makeindex} and \gls{xindy} (\optsand23) concatenate a +sequence of~3 or more consecutive pages into~a range. With +\gls*{xindy} (\opt3) you can vary the minimum sequence length using +\ics{GlsSetXdyMinRangeLength}\marg{n} where \meta{n} is either +an integer or the keyword \texttt{none} which indicates that there +should be no range formation (see \sectionref{sec:xindyloc} for +further details). + +\begin{important} +Note that \cs{GlsSetXdyMinRangeLength} must be used before +\ics{makeglossaries} and has no effect if \ics{noist} is used. +\end{important} + +With both \gls{makeindex} and \gls{xindy} (\optsand23), you can replace +the separator and the closing number in the range using: +\begin{definition}[\DescribeMacro{\glsSetSuffixF}] +\cs{glsSetSuffixF}\marg{suffix} +\end{definition} +\begin{definition}[\DescribeMacro{\glsSetSuffixFF}] +\cs{glsSetSuffixFF}\marg{suffix} +\end{definition} +where the former command specifies the suffix to use for a 2 page +list and the latter specifies the suffix to use for longer lists. +For example: +\begin{verbatim} +\glsSetSuffixF{f.} +\glsSetSuffixFF{ff.} +\end{verbatim} +Note that if you use \gls{xindy} (\opt3), you will also need to +set the minimum range length to 1 if you want to change these +suffixes: +\begin{verbatim} +\GlsSetXdyMinRangeLength{1} +\end{verbatim} +Note that if you use the \sty{hyperref} package, you will need +to use \ics{nohyperpage} in the suffix to ensure that the hyperlinks +work correctly. For example: +\begin{verbatim} +\glsSetSuffixF{\nohyperpage{f.}} +\glsSetSuffixFF{\nohyperpage{ff.}} +\end{verbatim} + +\begin{important} +Note that \cs{glsSetSuffixF} and \cs{glsSetSuffixFF} must be used +before \ics{makeglossaries} and have no effect if \ics{noist} is +used. +\end{important} + +It's also possible to concatenate a sequence of consecutive +locations into a range or have suffixes with \opt4, but with +\gls{bib2gls} these implicit ranges can't be merged with explicit +ranges (created with the \verb|(| and \verb|)| encaps). See +the \gls{bib2gls} manual for further details. + +\opt1 doesn't form ranges. However, with this option you +can iterate over an entry's \gls{numberlist} using: +\begin{definition}[\DescribeMacro\glsnumberlistloop] +\cs{glsnumberlistloop}\marg{label}\marg{handler cs}\marg{xr handler +cs} +\end{definition} +where \meta{label} is the entry's label and \meta{handler cs} is a +handler control sequence of the form: +\begin{definition} +\meta{handler cs}\marg{prefix}\marg{counter}\marg{format}\marg{location} +\end{definition} +where \meta{prefix} is the \sty{hyperref} prefix, \meta{counter} is +the name of the counter used for the location, \meta{format} is the +format used to display the location (e.g.\ \texttt{textbf}) +and \meta{location} is the location. The third argument is the +control sequence to use for any cross-references in the list. This +handler should have the syntax: +\begin{definition} +\meta{xr handler cs}\oarg{tag}\marg{xr list} +\end{definition} +where \meta{tag} is the cross-referenced text (e.g.\ \qt{see}) and +\meta{xr list} is a~comma-separated list of labels. (This actually +has a third argument but it's always empty when used with \opt1.) + +For example, if on page~12 +I~have used +\begin{verbatim} +\gls[format=textbf]{apple} +\end{verbatim} +and on page~18 I~have used +\begin{verbatim} +\gls[format=emph]{apple} +\end{verbatim} +then +\begin{verbatim} +\glsnumberlistloop{apple}{\myhandler} +\end{verbatim} +will be equivalent to: +\begin{verbatim} +\myhandler{}{page}{textbf}{12}% +\myhandler{}{page}{emph}{18}% +\end{verbatim} +There is a predefined handler that's used to display the +\gls{numberlist} in the glossary: +\begin{definition}[\DescribeMacro\glsnoidxdisplayloc] +\cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{location} +\end{definition} +The predefined handler used for the cross-references in the glossary is: +\begin{definition} +\cs{glsseeformat}\oarg{tag}\marg{xr list}\marg{location} +\end{definition} +which is described in \sectionref{sec:customxr}. + +\begin{important} +\cs{glsnumberlistloop} is not available for \optsand23. +\end{important} + +\section{Style Hook} +\label{sec:isthook} + +As from version 4.24, there's a hook that's used near the end of +\ics{writeist} before the file is closed. You can set the code +to be performed then using: +\begin{definition}[\DescribeMacro\GlsSetWriteIstHook] +\cs{GlsSetWriteIstHook}\marg{code} +\end{definition} +If you want the \meta{code} to write any information to the +file, you need to use +\begin{definition}[\DescribeMacro\glswrite] +\cs{write}\cs{glswrite}\marg{style information} +\end{definition} +Make sure you use the correct format within \meta{style +information}. For example, if you are using \app{makeindex}: +\begin{verbatim} +\GlsSetWriteIstHook{% + \write\glswrite{page_precedence "arnAR"}% + \write\glswrite{line_max 80}% +} +\end{verbatim} +This changes the page type precedence\index{page type precedence} and the maximum line length +used by \app{makeindex}. + +Remember that if you switch to \app{xindy}, this will no longer be +valid code. + +\chapter{Links to Glossary Entries} +\label{sec:glslink} + +Once you have defined a glossary entry using \ics{newglossaryentry} +(\sectionref{sec:newglosentry}) or \ics{newacronym} (see +\sectionref{sec:acronyms}), you can refer to that entry in the +document using one of the commands listed in +\sectionref{sec:gls-like} or \sectionref{sec:glstext-like}. The text +which appears at that point in the document when using one of these +commands is referred to as the \gls{linktext} (even if there are no +hyperlinks). These commands also add a line to an external file that +is used to generate the relevant entry in the glossary. This +information includes an associated location that is added to the +\gls{numberlist} for that entry. By default, the location refers to +the page number. For further information on number lists, see +\sectionref{sec:numberlists}. These external files need to be +post-processed by \gls{makeindex} or \gls{xindy} unless you have +chosen \optsor14. If you don't use \ics{makeglossaries} these external +files won't be created. (\optsand14 write the information to the +\filetype{.aux} file.) + +Note that repeated use of these commands for the same entry can +cause the \gls{numberlist} to become quite long, which may not be +particular helpful to the reader. In this case, you can use the +non-indexing commands described in \sectionref{sec:glsnolink} or +you can use the supplemental \gls{glossaries-extra} package, which +provides a means to suppress the automated indexing of the commands listed +in this chapter. + +\begin{important} +I strongly recommend that you don't use the commands +defined in this chapter in the arguments of sectioning or caption +commands or any other command that has a moving argument. + +Aside from problems with expansion issues, PDF bookmarks and +possible nested hyperlinks in the table of contents (or list of +whatever) any use of the commands described in \sectionref{sec:gls-like} +will have their \firstuseflag\ unset when they appear in the table +of contents (or list of whatever). +\end{important} + +The above warning is particularly important if you are using the +\styfmt{glossaries} package in conjunction with the \sty{hyperref} +package. Instead, use one of the \emph{expandable} commands listed in +\sectionref{sec:glsnolink} (such as \ics{glsentrytext} \emph{but +not} the non-expandable +case changing versions like \ics{Glsentrytext}). Alternatively, provide an +alternative via the optional argument to the sectioning\slash caption +command or use \sty{hyperref}'s \ics{texorpdfstring}. Examples: +\begin{verbatim} +\chapter{An overview of \glsentrytext{perl}} +\chapter[An overview of Perl]{An overview of \gls{perl}} +\chapter{An overview of \texorpdfstring{\gls{perl}}{Perl}} +\end{verbatim} +If you want to retain the formatting that's available through +commands like \cs{acrshort} (for example, if you are using one of +the small caps styles), then you might want to consider the +\gls{glossaries-extra} package which provides commands +for this purpose. + +If you want the \gls{linktext} to produce a hyperlink to the +corresponding entry details in the glossary, you should load the +\sty{hyperref} package \emph{before} the \styfmt{glossaries} +package. That's what I've done in this document, so if you see a +hyperlinked term, such as \gls{linktext}, you can click on the word +or phrase and it will take you to a brief description in this +document's glossary. + +\begin{important} +If you use the \sty{hyperref} package, I strongly recommend you use +\app{pdflatex} rather than \app{latex} to compile your document, if +possible. The DVI format of \LaTeX\ has limitations with the +hyperlinks that can cause a problem when used with the +\styfmt{glossaries} package. Firstly, the DVI format can't break a +hyperlink across a line whereas PDF\LaTeX\ can. This means that long +glossary entries (for example, the full form of an acronym) won't be +able to break across a line with the DVI format. Secondly, the DVI +format doesn't correctly size hyperlinks in subscripts or +superscripts. This means that if you define a term that may be used +as a subscript or superscript, if you use the DVI format, it won't +come out the correct size. + +These are limitations of the DVI format not of the \sty{glossaries} +package. +\end{important} + +It may be that you only want terms in certain glossaries to have +hyperlinks, but not for other glossaries. In this case, you can use the +package option \pkgopt{nohypertypes} to identify the glossary lists +that shouldn't have hyperlinked \gls{linktext}. See +\sectionref{sec:pkgopts-general} for further details. + +The way the \gls{linktext} is displayed depends on +\begin{definition}[\DescribeMacro{\glstextformat}] +\cs{glstextformat}\marg{text} +\end{definition} +For example, to make all \gls{linktext} appear in a sans-serif +font, do: +\begin{verbatim} +\renewcommand*{\glstextformat}[1]{\textsf{#1}} +\end{verbatim} +Further customisation can be done via \ics{defglsentryfmt} or by +redefining \ics{glsentryfmt}. See \sectionref{sec:glsdisplay} for +further details. + +Each entry has an associated conditional referred to as the +\firstuseflag. Some of the commands described in this chapter +automatically unset this flag and can also use it +to determine what text should be displayed. These types of commands +are the \glslike\ commands and are described in +\sectionref{sec:gls-like}. The commands that don't reference or change +the \firstuseflag\ are \glstextlike\ commands and are described +in \sectionref{sec:glstext-like}. See \sectionref{sec:glsunset} for +commands that unset (mark the entry as having been used) or reset +(mark the entry as not used) the \firstuseflag\ without referencing +the entries. + +The \glslike\ and \glstextlike\ commands all take a first +optional argument that is a comma-separated list of +\meta{key}=\meta{value} options, described below. They also have a +star-variant, which inserts \texttt{hyper=false} at the start of the +list of options and a plus-variant, which inserts +\texttt{hyper=true} at the start of the list of options. For example +\verb|\gls*{sample}| is the same as \verb|\gls[hyper=false]{sample}| +and \verb|\gls+{sample}| is the same as +\verb|\gls[hyper=true]{sample}|, whereas just \verb|\gls{sample}| +will use the default hyperlink setting which depends on a number of +factors (such as whether the entry is in a glossary that has been +identified in the \pkgopt{nohypertypes} list). You can override the +\gloskey[glslink]{hyper} key in the variant's optional argument, for +example, \verb|\gls*[hyper=true]{sample}| but this creates +redundancy and is best avoided. The \gls{glossaries-extra} package +provides the option to add a third custom variant. + +\begin{important} +Avoid nesting these commands. For example don't do +\cs{glslink}\marg{label}\texttt{\{\cs{gls}\marg{label2}\}} +as this is likely to cause problems. By implication, this +means that you should avoid using any of these commands within +the \gloskey{text}, \gloskey{first}, \gloskey{short} or +\gloskey{long} keys (or their plural equivalent) or any +other key that you plan to access through these commands. +(For example, the \gloskey{symbol} key if you intend to use +\cs{glssymbol}.) +\end{important} + +The keys listed below are available for the optional argument. +The \gls{glossaries-extra} package provides additional keys. +(See the \gls*{glossaries-extra} manual for further details.) +\begin{description} +\item[{\gloskey[glslink]{hyper}}] This is a boolean key which can +be used to enable\slash disable the hyperlink to the relevant entry +in the glossary. If this key is omitted, the value is determined by current +settings, as indicated above. For example, when used with a \glslike\ command, if this is the first +use and the \pkgopt[false]{hyperfirst} package option has been used, +then the default value is \texttt{hyper=false}. The hyperlink can be +forced on using \texttt{hyper=true} unless the hyperlinks have been +suppressed using \ics{glsdisablehyper}. You must load the +\sty{hyperref} package before the \sty{glossaries} package to +ensure the hyperlinks work. + +\item[{\gloskey[glslink]{format}}] This specifies how to format the +associated location number for this entry in the glossary. This +value is equivalent to the \gls{makeindex} encap value, and (as +with \ics{index}) the value needs to be the name of a command +\emph{without} the initial backslash. As with \ics{index}, the +characters \verb"(" and \verb")" can also be used to specify the +beginning and ending of a number range and they must be in matching +pairs. (For example, \verb|\gls[format={(}]{sample}| on one page +to start the range and later \verb|\gls[format={)}]{sample}| to close +the range.) Again as with \ics{index}, the command should be the +name of a command which takes an argument (which will be the +associated location). Be careful not to use a declaration (such as +\texttt{bfseries}) instead of a text block command (such as +\texttt{textbf}) as the effect is not guaranteed to be localised. If +you want to apply more than one style to a given entry (e.g.\ +\textbf{bold} and \emph{italic}) you will need to create a command +that applies both formats, e.g.\ +\begin{verbatim} +\newcommand*{\textbfem}[1]{\textbf{\emph{#1}}} +\end{verbatim} +and use that command. + +In this document, the standard formats refer to the standard text +block commands such as \ics{textbf} or \ics{emph} or any of the +commands listed in \tableref{tab:hyperxx}. You can combine a range +and format using \verb|(|\meta{format} to start the range and +\verb|)|\meta{format} to end the range. The \meta{format} part must +match. For example, \verb|format={(emph}| and \verb|format={)emph}|. + +\begin{important} +If you use \gls{xindy} instead of \gls{makeindex}, you +must specify any non-standard formats that you want to use +with the \gloskey[glslink]{format} key using +\ics{GlsAddXdyAttribute}\marg{name}. So if you use +\gls*{xindy} with the above example, you would need to add: +\begin{verbatim} +\GlsAddXdyAttribute{textbfem} +\end{verbatim} +See \sectionref{sec:xindy} for further details. +\end{important} + +If you are using hyperlinks and you want to change the font of the +hyperlinked location, don't use \ics{hyperpage} (provided by the +\sty{hyperref} package) as the locations may not refer to a page +number. Instead, the \styfmt{glossaries} package provides number +formats listed in \tableref{tab:hyperxx}. + +\begin{table}[htbp] +\caption{Predefined Hyperlinked Location Formats} +\label{tab:hyperxx} +\centering +\vskip\baselineskip +\begin{tabular}{ll} +\locfmt{hyperrm} & serif hyperlink\\ +\locfmt{hypersf} & sans-serif hyperlink\\ +\locfmt{hypertt} & monospaced hyperlink\\ +\locfmt{hyperbf} & bold hyperlink\\ +\locfmt{hypermd} & medium weight hyperlink\\ +\locfmt{hyperit} & italic hyperlink\\ +\locfmt{hypersl} & slanted hyperlink\\ +\locfmt{hyperup} & upright hyperlink\\ +\locfmt{hypersc} & small caps hyperlink\\ +\locfmt{hyperemph} & emphasized hyperlink +\end{tabular} +\par +\end{table} + +Note that if the \ics{hyperlink} command hasn't been defined, the +\texttt{hyper}\meta{xx} formats are equivalent to the analogous +\texttt{text}\meta{xx} font commands (and \texttt{hyperemph} is +equivalent to \texttt{emph}). If you want to make a new format, you +will need to define a command which takes one argument and use that. +For example, if you want the location number to be in a bold +sans-serif font, you can define a command called, say, +\ics{hyperbsf}: +\begin{verbatim} +\newcommand{\hyperbsf}[1]{\textbf{\hypersf{#1}}} +\end{verbatim} +and then use \texttt{hyperbsf} as the value for the \gloskey{format} +key.\footnote{See also \ifpdf section~\ref*{sec:code:printglos} \fi +\qt{Displaying the glossary} in the documented code, +\texttt{glossaries-code.pdf}.} Remember that if you use \gls{xindy}, you +will need to add this to the list of location attributes: +\begin{verbatim} +\GlsAddXdyAttribute{hyperbsf} +\end{verbatim} + +\item[{\gloskey[glslink]{counter}}] This specifies which counter +to use for this location. This overrides the default counter +used by this entry. (See also \sectionref{sec:numberlists}.) + +\item[{\gloskey[glslink]{local}}] This is a boolean key that only +makes a difference when used with \glslike\ commands that change the +entry's \gls{firstuseflag}. If \texttt{local=true}, the change to +the \gls*{firstuseflag} will be localised to the current scope. The +default is \texttt{local=false}. + +\end{description} + +\begin{important} +The \gls{linktext} isn't scoped by default. Any unscoped +declarations in the \gls{linktext} may affect subsequent text. +\end{important} + +\section{The \cs{gls}-Like Commands (First Use Flag Queried)} +\label{sec:gls-like} + +This section describes the commands that unset (mark as used) the \firstuseflag\ on +completion, and in most cases they use the current state of the flag +to determine the text to be displayed. As described above, these +commands all have a star-variant (\texttt{hyper=false}) and +a plus-variant (\texttt{hyper=true}) and have an +optional first argument that is a \meta{key}=\meta{value} list. + +These commands use \ics{glsentryfmt} or the equivalent definition provided by +\ics{defglsentryfmt} to determine the automatically generated text +and its format (see \sectionref{sec:glsdisplay}). + +Apart from \ics{glsdisp}, the commands described in this section +also have a \emph{final} optional argument \meta{insert} which may +be used to insert material into the automatically generated text. + +\begin{important} +Since the commands have a final optional argument, take care if +you actually want to display an open square bracket after the command +when the final optional argument is absent. Insert an empty set of +braces \verb|{}| immediately before the opening square bracket to +prevent it from being interpreted as the final argument. For +example: +\begin{verbatim} +\gls{sample} {}[Editor's comment] +\end{verbatim} + +Don't use any of the \glslike\ or \glstextlike\ commands in the +\meta{insert} argument. +\end{important} + +Take care using these commands within commands or environments that +are processed multiple times as this can confuse the first use flag +query and state change. This includes frames with overlays in +\cls{beamer} and the \envfmt{tabularx} environment provided by \sty{tabularx}. +The \styfmt{glossaries} package automatically deals with this issue +in \sty{amsmath}'s \envfmt{align} environment. You can apply a patch +to \sty{tabularx} by placing the following command (new to v4.28) in +the preamble: +\begin{definition}[\DescribeMacro\glspatchtabularx] +\cs{glspatchtabularx} +\end{definition} +This does nothing if \sty{tabularx} hasn't been loaded. There's no +patch available for \cls{beamer}. See \sectionref{sec:glsunset} for +more details. + +\begin{definition}[\DescribeMacro{\gls}] +\cs{gls}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command typically determines the \gls{linktext} from the values +of the \gloskey{text} or \gloskey{first} keys supplied when the +entry was defined using \ics{newglossaryentry}. However, if the +entry was defined using \ics{newacronym} and \ics{setacronymstyle} was +used, then the \gls*{linktext} will usually be determined from the \gloskey{long} or +\gloskey{short} keys. + +There are two upper case variants: +\begin{definition}[\DescribeMacro{\Gls}] +\cs{Gls}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +and +\begin{definition}[\DescribeMacro{\GLS}] +\cs{GLS}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +which make the first letter of the link text or all the link text +upper case, respectively. For the former, the uppercasing of the +first letter is performed by \ics{makefirstuc}. + +\begin{important} +The first letter uppercasing command \cs{makefirstuc} has +limitations which must be taken into account if you use \cs{Gls} or +any of the other commands that convert the first letter to +uppercase. +\end{important} +The upper casing is performed as follows: +\begin{itemize} +\item If the first thing in the \gls{linktext} is a command follow +by a group, the upper casing is performed on the first object of the +group. For example, if an entry has been defined as +\begin{verbatim} +\newglossaryentry{sample}{ + name={\emph{sample} phrase}, + sort={sample phrase}, + description={an example}} +\end{verbatim} +Then \cs{Gls}\verb|{sample}| will set the \gls{linktext} +to\footnote{I've used \cs{MakeUppercase} in all the examples for clarity, but it +will actually use \cs{mfirstucMakeUppercase}.} +\begin{verbatim} +\emph{\MakeUppercase sample} phrase +\end{verbatim} +which will appear as \emph{\MakeUppercase sample} phrase. + +\item If the first thing in the \gls{linktext} isn't a command or is +a command but isn't followed by a group, then the upper casing will +be performed on that first thing. For example, if an entry has been +defined as: +\begin{verbatim} +\newglossaryentry{sample}{ + name={\oe-ligature}, + sort={oe-ligature}, + description={an example} +} +\end{verbatim} +Then \cs{Gls}\verb|{sample}| will set the \gls{linktext} to +\begin{verbatim} +\MakeUppercase \oe-ligature +\end{verbatim} +which will appear as \MakeUppercase \oe-ligature. + +\item If you have \sty{mfirstuc} v2.01 or above, an extra case is +added. If the first thing is \cs{protect} it will be discarded and +the above rules will then be tried. + +\end{itemize} +(Note the use of the \gloskey{sort} key in the above examples.) + +There are hundreds of \LaTeX\ packages that altogether define +thousands of commands with various syntax and it's impossible for +\sty{mfirstuc} to take them all into account. The above rules are quite +simplistic and are designed for \gls{linktext} that starts with +a~text-block command (such as \cs{emph}) or a command that produces +a character (such as \cs{oe}). This means that if your \gls{linktext} +starts with something that doesn't adhere to \sty{mfirstuc}'s assumptions +then things are likely to go wrong. + +For example, starting with a math-shift symbol: +\begin{verbatim} +\newglossaryentry{sample}{ + name={$a$}, + sort={a}, + description={an example} +} +\end{verbatim} +This falls into case~2 above, so the \gls{linktext} will be set to +\begin{verbatim} +\MakeUppercase $a$ +\end{verbatim} +This attempts to uppercase the math-shift \verb|$|, which will go +wrong. In this case it's not appropriate to perform any +case-changing, but it may be that you want to use \cs{Gls} +programmatically without checking if the text contains any maths. +In this case, the simplest solution is to insert an empty brace at +the start: +\begin{verbatim} +\newglossaryentry{sample}{ + name={{}$a$}, + sort={a}, + description={an example} +} +\end{verbatim} +Now the \gls{linktext} will be set to +\begin{verbatim} +\MakeUppercase{}$a$ +\end{verbatim} +and the \cs{uppercase} becomes harmless. + +Another issue occurs when the \gls{linktext} starts with a command +followed by an argument (case~1) but the argument is a label, +identifier or something else that shouldn't have a case-change. +A common example is when the \gls{linktext} starts with one of the +commands described in this chapter. (But you haven't done that, have +you? What with the warning not to do it at the beginning of the chapter.) +Or when the \gls{linktext} starts with one of the non-linking +commands described in \sectionref{sec:glsnolink}. For example: +\begin{verbatim} +\newglossaryentry{sample}{name={sample},description={an example}} +\newglossaryentry{sample2}{ + name={\glsentrytext{sample} two}, + sort={sample two}, + description={another example} + } +\end{verbatim} +Now the \gls{linktext} will be set to: +\begin{verbatim} +\glsentrytext{\MakeUppercase sample} two +\end{verbatim} +This will generate an error because there's no entry with the label +given by \verb|\MakeUppercase sample|. The best solution here is to +write the term out in the \gloskey{text} field and use the command +in the \gloskey{name} field. If you don't use \cs{glsname} anywhere +in your document, you can use \cs{gls} in the \gloskey{name} field: +\begin{verbatim} +\newglossaryentry{sample}{name={sample},description={an example}} +\newglossaryentry{sample2}{ + name={\gls{sample} two}, + sort={sample two}, + text={sample two}, + description={another example} + } +\end{verbatim} + +If the \gls{linktext} starts with a command that has an optional +argument or with multiple arguments where the actual text isn't in +the first argument, then \cs{makefirstuc} will also fail. For +example: +\begin{verbatim} +\newglossaryentry{sample}{ + name={\textcolor{blue}{sample} phrase}, + sort={sample phrase}, + description={an example}} +\end{verbatim} +Now the \gls{linktext} will be set to: +\begin{verbatim} +\textcolor{\MakeUppercase blue}{sample} phrase +\end{verbatim} +This won't work because \verb|\MakeUppercase blue| isn't a recognised +colour name. In this case you will have to define a helper command where +the first argument is the text. For example: +\begin{verbatim} +\newglossaryentry{sample}{ +\newcommand*{\blue}[1]{\textcolor{blue}{#1}} + name={\blue{sample} phrase}, + sort={sample phrase}, + description={an example}} +\end{verbatim} +In fact, since the whole design ethos of \LaTeX\ is the separation +of content and style, it's better to use a semantic command. For +example: +\begin{verbatim} +\newglossaryentry{sample}{ +\newcommand*{\keyword}[1]{\textcolor{blue}{#1}} + name={\keyword{sample} phrase}, + sort={sample phrase}, + description={an example}} +\end{verbatim} +For further details see the \sty{mfirstuc} user manual. + +There are plural forms that are analogous to \cs{gls}: +\begin{definition}[\DescribeMacro{\glspl}] +\cs{glspl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\Glspl}] +\cs{Glspl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSpl}] +\cs{GLSpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +These typically determine the link text from the \gloskey{plural} or +\gloskey{firstplural} keys supplied when the entry was +defined using \ics{newglossaryentry} or, if the entry is an +abbreviation and \cs{setacronymstyle} was used, from the \gloskey{longplural} or +\gloskey{shortplural} keys. + +\begin{important} +Be careful when you use glossary entries in math mode especially if you +are using \sty{hyperref} as it can affect the spacing of subscripts and +superscripts. For example, suppose you have defined the following +entry: +\begin{verbatim} +\newglossaryentry{Falpha}{name={F_\alpha}, +description=sample} +\end{verbatim} +and later you use it in math mode: +\begin{verbatim} +$\gls{Falpha}^2$ +\end{verbatim} +This will result in $F_\alpha{}^2$ instead of $F_\alpha^2$. In this +situation it's best to bring the superscript into the hyperlink using +the final \meta{insert} optional argument: +\begin{verbatim} +$\gls{Falpha}[^2]$ +\end{verbatim} +\end{important} + +\begin{definition}[\DescribeMacro{\glsdisp}] +\cs{glsdisp}\oarg{options}\marg{label}\marg{link text} +\end{definition} +This behaves in the same way as the above commands, except +that the \meta{link text} is explicitly set. There's no final +optional argument as any inserted material can be added to the +\meta{link text} argument. + +\begin{important} +Don't use any of the \glslike\ or \glstextlike\ commands in the +\meta{link text} argument of \cs{glsdisp}. +\end{important} + +\section{The \cs{glstext}-Like Commands (First Use Flag Not Queried)} +\label{sec:glstext-like} + +This section describes the commands that don't change or reference +the \firstuseflag. As described above, these commands all have a +star-variant (\texttt{hyper=false}) and a plus-variant +(\texttt{hyper=true}) and have an optional first argument +that is a \meta{key}=\meta{value} list. These commands also don't +use \ics{glsentryfmt} or the equivalent definition provided by +\ics{defglsentryfmt} (see \sectionref{sec:glsdisplay}). +Additional commands for abbreviations are described in +\sectionref{sec:acronyms}. + +Apart from \ics{glslink}, the commands described in this section +also have a \emph{final} optional argument \meta{insert} which may +be used to insert material into the automatically generated text. +See the caveat above in \sectionref{sec:gls-like}. + +\begin{definition}[\DescribeMacro{\glslink}] +\cs{glslink}\oarg{options}\marg{label}\marg{link text} +\end{definition} +This command explicitly sets the \gls{linktext} as given in the +final argument. + +\begin{important} +Don't use any of the \glslike\ or \glstextlike\ commands in the +argument of \cs{glslink}. By extension, this means that you can't +use them in the value of fields that are used to form +\gls{linktext}. +\end{important} + +\begin{definition}[\DescribeMacro{\glstext}] +\cs{glstext}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the \gloskey{text} key as the +\gls{linktext}. + +There are also analogous commands: +\begin{definition}[\DescribeMacro{\Glstext}] +\cs{Glstext}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLStext}] +\cs{GLStext}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +These convert the first character or all the characters to +uppercase, respectively. See the note on \cs{Gls} above for details +on the limitations of converting the first letter to upper case. + +There's no equivalent command for title-casing, but you +can use the more generic command \ics{glsentrytitlecase} +in combination with \cs{glslink}. For example: +\begin{verbatim} +\glslink{sample}{\glsentrytitlecase{sample}{text}} +\end{verbatim} +(See \sectionref{sec:glsnolink}.) + +\begin{definition}[\DescribeMacro{\glsfirst}] +\cs{glsfirst}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the \gloskey{first} key as the +\gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsfirst}] +\cs{Glsfirst}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSfirst}] +\cs{GLSfirst}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{important} +The value of the \gloskey{first} key (and \gloskey{firstplural} key) +doesn't necessarily match the text produced by \ics{gls} (or \ics{glspl}) on +\firstuse\ as the \gls{linktext} used by \ics{gls} may be modified +through commands like \ics{defglsentry}. (Similarly, the value of the +\gloskey{text} and \gloskey{plural} keys don't necessarily match +the \gls*{linktext} used by \cs{gls} or \cs{glspl} on subsequent +use.) +\end{important} + +\begin{definition}[\DescribeMacro{\glsplural}] +\cs{glsplural}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the \gloskey{plural} key as the +\gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsplural}] +\cs{Glsplural}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSplural}] +\cs{GLSplural}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsfirstplural}] +\cs{glsfirstplural}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the \gloskey{firstplural} key as the +\gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsfirstplural}] +\cs{Glsfirstplural}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSfirstplural}] +\cs{GLSfirstplural}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsname}] +\cs{glsname}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the \gloskey{name} key as the +\gls{linktext}. Note that this may be different from the values of +the \gloskey{text} or \gloskey{first} keys. In general it's better +to use \cs{glstext} or \cs{glsfirst} instead of \cs{glsname}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsname}] +\cs{Glsname}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSname}] +\cs{GLSname}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{important} +In general it's best to avoid \cs{Glsname} with acronyms. Instead, +consider using \cs{Acrlong}, \cs{Acrshort} or \cs{Acrfull}. +\end{important} + +\begin{definition}[\DescribeMacro{\glssymbol}] +\cs{glssymbol}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the \gloskey{symbol} key as the +\gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glssymbol}] +\cs{Glssymbol}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSsymbol}] +\cs{GLSsymbol}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsdesc}] +\cs{glsdesc}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the \gloskey{description} key as the +\gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsdesc}] +\cs{Glsdesc}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSdesc}] +\cs{GLSdesc}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +If you want the title case version you can use +\begin{verbatim} +\glslink{sample}{\glsentrytitlecase{sample}{desc}} +\end{verbatim} + +\begin{definition}[\DescribeMacro{\glsuseri}] +\cs{glsuseri}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This command always uses the value of the +\gloskey{user1} key as the \gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsuseri}] +\cs{Glsuseri}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSuseri}] +\cs{GLSuseri}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsuserii}] +\cs{glsuserii}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +This command always uses the value of the +\gloskey{user2} key as the \gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsuserii}] +\cs{Glsuserii}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSuserii}] +\cs{GLSuserii}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsuseriii}] +\cs{glsuseriii}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +This command always uses the value of the +\gloskey{user3} key as the \gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsuseriii}] +\cs{Glsuseriii}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSuseriii}] +\cs{GLSuseriii}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsuseriv}] +\cs{glsuseriv}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +This command always uses the value of the +\gloskey{user4} key as the \gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsuseriv}] +\cs{Glsuseriv}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSuseriv}] +\cs{GLSuseriv}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsuserv}] +\cs{glsuserv}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +This command always uses the value of the +\gloskey{user5} key as the \gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsuserv}] +\cs{Glsuserv}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSuserv}] +\cs{GLSuserv}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\begin{definition}[\DescribeMacro{\glsuservi}] +\cs{glsuservi}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +This command always uses the value of the +\gloskey{user6} key as the \gls{linktext}. + +There are also analogous uppercasing commands: +\begin{definition}[\DescribeMacro{\Glsuservi}] +\cs{Glsuservi}\oarg{options}\marg{text}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\GLSuservi}] +\cs{GLSuservi}\oarg{options}\marg{text}\oarg{insert} +\end{definition} + +\section{Changing the format of the link text} +\label{sec:glsdisplay} + +The default format of the \gls{linktext} for the \glslike\ commands +is governed by\footnote{\ics{glsdisplayfirst} and \ics{glsdisplay} are now +deprecated. Backwards compatibility should be preserved but +you may need to use the \pkgopt{compatible-3.07} option}: +\begin{definition}[\DescribeMacro{\glsentryfmt}] +\cs{glsentryfmt} +\end{definition} +This may be redefined but if you only want the change the display style +for a given glossary, then you need to use +\begin{definition}[\DescribeMacro{\defglsentryfmt}] +\cs{defglsentryfmt}\oarg{type}\marg{definition} +\end{definition} +instead of redefining \cs{glsentryfmt}. The optional first argument +\meta{type} is the glossary type. This defaults to +\ics{glsdefaulttype} if omitted. The second argument is the +entry format definition. + +\begin{important} +Note that \cs{glsentryfmt} is the default display format for +entries. Once the display format has been changed for an individual +glossary using \ics{defglsentryfmt}, redefining \cs{glsentryfmt} +won't have an effect on that glossary, you must instead use +\cs{defglsentryfmt} again. Note that glossaries that have +been identified as lists of acronyms (via the package option +\pkgopt{acronymlists} or the command \ics{DeclareAcronymList}, +see \sectionref{sec:pkgopts-acronym}) use +\cs{defglsentryfmt} to set their display style. +\end{important} + +Within the \meta{definition} argument of \cs{defglsentryfmt}, or if you +want to redefine \cs{glsentryfmt}, you may use the following +commands: + +\begin{definition}[\DescribeMacro{\glslabel}] +\cs{glslabel} +\end{definition} +This is the label of the entry being referenced. As from version +4.08, you can also access the glossary entry type using: +\begin{definition}[\DescribeMacro{\glstype}] +\cs{glstype} +\end{definition} +This is defined using \ics{edef} so the replacement text is the +actual glossary type rather than \verb|\glsentrytype{\glslabel}|. + +\begin{definition}[\DescribeMacro{\glscustomtext}] +\cs{glscustomtext} +\end{definition} +This is the custom text supplied in \cs{glsdisp}. It's always empty +for \ics{gls}, \ics{glspl} and their upper case variants. (You can +use \sty{etoolbox}'s \cs{ifdefempty} to determine if +\cs{glscustomtext} is empty.) + +\begin{definition}[\DescribeMacro{\glsinsert}] +\cs{glsinsert} +\end{definition} +The custom text supplied in the final optional argument to \cs{gls}, +\cs{glspl} and their upper case variants. + +\begin{definition}[\DescribeMacro{\glsifplural}] +\cs{glsifplural}\marg{true text}\marg{false text} +\end{definition} +If \cs{glspl}, \cs{Glspl} or \cs{GLSpl} was used, this command does +\meta{true text} otherwise it does \meta{false text}. + +\begin{definition}[\DescribeMacro{\glscapscase}] +\cs{glscapscase}\marg{no case}\marg{first uc}\marg{all caps} +\end{definition} +If \cs{gls}, \cs{glspl} or \cs{glsdisp} were used, this does \meta{no +case}. If \cs{Gls} or \cs{Glspl} were used, this does \meta{first +uc}. If \cs{GLS} or \cs{GLSpl} were used, this does \meta{all caps}. + +\begin{definition}[\DescribeMacro\glsifhyperon] +\cs{glsifhyperon}\marg{hyper true}\marg{hyper false} +\end{definition} +This will do \meta{hyper true} if the hyperlinks are on for the +current reference, otherwise it will do \meta{hyper false}. The +hyperlink may be off even if it wasn't explicitly switched off with +the \gloskey[glslink]{hyper} key or the use of a starred command. +It may be off because the \sty{hyperref} package hasn't been loaded +or because \ics{glsdisablehyper} has been used or because the entry +is in a glossary type that's had the hyperlinks switched off (using +\pkgopt{nohypertypes}) or because it's the \firstuse\ and the +hyperlinks have been suppressed on first use. + +Note that \ics{glsifhyper} is now deprecated. +If you want to know if the command used to reference +this entry was used with the star or plus variant, you can use: +\begin{definition}[\DescribeMacro\glslinkvar] +\cs{glslinkvar}\marg{unmodified}\marg{star}\marg{plus} +\end{definition} +This will do \meta{unmodified} if the unmodified version was used, +or will do \meta{star} if the starred version was used, or +will do \meta{plus} if the plus version was used. +Note that this doesn't take into account if the +\gloskey[glslink]{hyper} key was used to override the default +setting, so this command shouldn't be used to guess whether or not +the hyperlink is on for this reference. + +Note that you can also use commands such as \ics{ifglsused} within +the definition of \cs{glsentryfmt} (see \sectionref{sec:glsunset}). + +The commands \ics{glslabel}, \ics{glstype}, \ics{glsifplural}, +\ics{glscapscase}, \ics{glscustomtext} and \ics{glsinsert} are +typically updated at the start of the \glslike\ and \glstextlike\ +commands so they can usually be accessed in the hook user commands, +such as \ics{glspostlinkhook} and \ics{glslinkpostsetkeys}. + +\begin{important} +This means that using commands like \ics{gls} within the fields +that are accessed using the \glslike\ or \glstextlike\ commands +(such as the \gloskey{first}, \gloskey{text}, \gloskey{long} +or \gloskey{short} keys) will cause a problem. The entry formatting +performed by \cs{glsentryfmt} and related commands isn't scoped +(otherwise if would cause problems for \cs{glspostlinkhook} which +may need to look ahead as well as look behind). +This means that any nested commands will, at the very least, change +the label stored in \cs{glslabel}. +\end{important} + +If you only want to make minor modifications to \cs{glsentryfmt}, +you can use +\begin{definition}[\DescribeMacro{\glsgenentryfmt}] +\cs{glsgenentryfmt} +\end{definition} +This uses the above commands to display just the \gloskey{first}, +\gloskey{text}, \gloskey{plural} or \gloskey{firstplural} keys +(or the custom text) with the insert text appended. + +Alternatively, if want to change the entry format for abbreviations +(defined via \ics{newacronym}) you can use: +\begin{definition}[\DescribeMacro{\glsgenacfmt}] +\cs{glsgenacfmt} +\end{definition} +This uses the values from the \gloskey{long}, \gloskey{short}, +\gloskey{longplural} and \gloskey{shortplural} keys, rather than +using the \gloskey{text}, \gloskey{plural}, \gloskey{first} +and \gloskey{firstplural} keys. The first use singular text is obtained via: +\begin{definition}[\DescribeMacro{\genacrfullformat}] +\cs{genacrfullformat}\marg{label}\marg{insert} +\end{definition} +instead of from the \gloskey{first} key, and the first use plural +text is obtained via: +\begin{definition}[\DescribeMacro{\genplacrfullformat}] +\cs{genplacrfullformat}\marg{label}\marg{insert} +\end{definition} +instead of from the \gloskey{firstplural} key. +In both cases, \meta{label} is the entry's label and \meta{insert} +is the insert text provided in the final optional argument of +commands like \ics{gls}. The default behaviour is to do the long +form (or plural long form) followed by \meta{insert} and a~space and the short form (or plural +short form) in parentheses, where the short form is in the argument +of \ics{firstacronymfont}. There are also first letter upper case +versions: +\begin{definition}[\DescribeMacro{\Genacrfullformat}] +\cs{Genacrfullformat}\marg{label}\marg{insert} +\end{definition} +and +\begin{definition}[\DescribeMacro{\Genplacrfullformat}] +\cs{Genplacrfullformat}\marg{label}\marg{insert} +\end{definition} +By default these perform a protected expansion on their no-case-change +equivalents and then use \ics{makefirstuc} to convert the first +character to upper case. If there are issues caused by this +expansion, you will need to redefine those commands to explicitly +use commands like \ics{Glsentrylong} (which is what the predefined +acronym styles, such as \acrstyle{long-short}, do). Otherwise, you +only need to redefine \ics{genacrfullformat} and +\ics{genplacrfullformat} to change the behaviour of +\ics{glsgenacfmt}. See \sectionref{sec:acronyms} for further details +on changing the style of acronyms. + +\begin{important} +Note that \cs{glsentryfmt} (or the formatting given by \cs{defglsentryfmt}) +is not used by the \glstextlike\ commands. +\end{important} + +As from version 4.16, both the \glslike\ and \glstextlike\ commands +use +\begin{definition}[\DescribeMacro\glslinkpostsetkeys] +\cs{glslinkpostsetkeys} +\end{definition} +after the \meta{options} are set. This macro does nothing by default +but can be redefined. (For example, to switch off the hyperlink +under certain conditions.) This version also introduces +\begin{definition}[\DescribeMacro\glspostlinkhook] +\cs{glspostlinkhook} +\end{definition} +which is done after the link text has been displayed and also +\emph{after} the \firstuseflag\ has been unset (see +example~\ref{ex:dotabbr}). + +\begin{example}{Custom Entry Display in Text}{ex:customfmt} +Suppose you want a glossary of measurements and +units, you can use the \gloskey{symbol} key to store the unit: +\begin{verbatim} +\newglossaryentry{distance}{name=distance, +description={The length between two points}, +symbol={km}} +\end{verbatim} +and now suppose you want \verb|\gls{distance}| to produce +\qt{distance (km)} on \firstuse, then you can redefine +\ics{glsentryfmt} as follows: +\begin{verbatim} +\renewcommand*{\glsentryfmt}{% + \glsgenentryfmt + \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}% +} +\end{verbatim} + +(Note that I've used \ics{glsentrysymbol} rather than \ics{glssymbol} +to avoid nested hyperlinks.) + +Note also that all of the \gls{linktext} will be formatted according +to \ics{glstextformat} (described earlier). So if you do, say: +\begin{verbatim} +\renewcommand{\glstextformat}[1]{\textbf{#1}} +\renewcommand*{\glsentryfmt}{% + \glsgenentryfmt + \ifglsused{\glslabel}{}{\space(\glsentrysymbol{\glslabel})}% +} +\end{verbatim} +then \verb|\gls{distance}| will produce \qt{\textbf{distance (km)}}. + +For a complete document, see the sample file \samplefile{-entryfmt}. +\end{example} + +\begin{example}{Custom Format for Particular Glossary}{ex:defglsentryfmt} +Suppose you have created a new glossary called +\texttt{notation} and you want to change the way the entry is +displayed on \firstuse\ so that it includes the symbol, you can do: +\begin{verbatim} +\defglsentryfmt[notation]{\glsgenentryfmt + \ifglsused{\glslabel}{}{\space + (denoted \glsentrysymbol{\glslabel})}} +\end{verbatim} +Now suppose you have defined an entry as follows: +\begin{verbatim} +\newglossaryentry{set}{type=notation, + name=set, + description={A collection of objects}, + symbol={$S$} +} +\end{verbatim} +The \glslink{firstuse}{first time} you reference this entry it will be displayed as: +\qt{set (denoted $S$)} (assuming \ics{gls} was used). + +Alternatively, if you expect all the symbols to be set in math mode, +you can do: +\begin{verbatim} +\defglsentryfmt[notation]{\glsgenentryfmt + \ifglsused{\glslabel}{}{\space + (denoted $\glsentrysymbol{\glslabel}$)}} +\end{verbatim} +and define entries like this: +\begin{verbatim} +\newglossaryentry{set}{type=notation, + name=set, + description={A collection of objects}, + symbol={S} +} +\end{verbatim} +\end{example} + +Remember that if you use the \gloskey{symbol} key, you need to use a +glossary style that displays the symbol, as many of the styles +ignore it. + +\section{Enabling and disabling hyperlinks to glossary entries} +\label{sec:disablehyperlinks} + +If you load the \sty{hyperref} or \sty{html} packages prior to +loading the \styfmt{glossaries} package, the \glslike\ and +\glstextlike\ commands will automatically have hyperlinks +to the relevant glossary entry, unless the \gloskey[glslink]{hyper} +option has been switched off (either explicitly or through +implicit means, such as via the \pkgopt{nohypertypes} package option). + +You can disable or enable links using: +\begin{definition}[\DescribeMacro{\glsdisablehyper}] +\cs{glsdisablehyper} +\end{definition} +and +\begin{definition}[\DescribeMacro{\glsenablehyper}] +\cs{glsenablehyper} +\end{definition} +respectively. The effect can be localised by placing the commands +within a group. Note that you should only use \cs{glsenablehyper} +if the commands \ics{hyperlink} and \ics{hypertarget} have been +defined (for example, by the \sty{hyperref} package). + +You can disable just the \gls{firstuse} links using the package +option \pkgopt[false]{hyperfirst}. Note that this option only +affects the \glslike\ commands that recognise the \firstuseflag. + +\begin{example}{First Use With Hyperlinked Footnote Description}{ex:hyperdesc} +Suppose I want the \gls*{firstuse} to have a hyperlink to the +description in a footnote instead of hyperlinking to the relevant +place in the glossary. First I need to disable the hyperlinks on +first use via the package option \pkgopt[false]{hyperfirst}: +\begin{verbatim} +\usepackage[hyperfirst=false]{glossaries} +\end{verbatim} +Now I need to redefine \ics{glsentryfmt} (see +\sectionref{sec:glsdisplay}): +\begin{verbatim} +\renewcommand*{\glsentryfmt}{% + \glsgenentryfmt + \ifglsused{\glslabel}{}{\footnote{\glsentrydesc{\glslabel}}}% +} +\end{verbatim} + +Now the first use won't have hyperlinked text, but will be followed +by a footnote. +See the sample file \samplefile{-FnDesc} for a complete document. +\end{example} + +Note that the \pkgopt{hyperfirst} option applies to all defined glossaries. It +may be that you only want to disable the hyperlinks on +\gls{firstuse} for glossaries that have a different form on +\gls*{firstuse}. This can be achieved by noting that since the +entries that require hyperlinking for all instances have identical +first and subsequent text, they can be unset via \ics{glsunsetall} +(see \sectionref{sec:glsunset}) so that the \pkgopt{hyperfirst} +option doesn't get applied. + +\begin{example}{Suppressing Hyperlinks on First Use Just For +Acronyms}{ex:hyperfirst} +Suppose I want to suppress the hyperlink on \gls{firstuse} for +acronyms but not for entries in the main glossary. I~can load +the \styfmt{glossaries} package using: +\begin{verbatim} +\usepackage[hyperfirst=false,acronym]{glossaries} +\end{verbatim} +Once all glossary entries have been defined I~then do: +\begin{verbatim} +\glsunsetall[main] +\end{verbatim} + +\end{example} + +For more complex requirements, you might find it easier to switch +off all hyperlinks via \ics{glsdisablehyper} and put the hyperlinks +(where required) within the definition of \ics{glsentryfmt} (see +\sectionref{sec:glsdisplay}) via \ics{glshyperlink} (see +\sectionref{sec:glsnolink}). + +\begin{example}{Only Hyperlink in Text Mode Not Math +Mode}{ex:nomathhyper} +This is a bit of a contrived example, but suppose, for some reason, +I only want the \glslike\ commands to have +hyperlinks when used in text mode, but not in math mode. I~can do +this by adding the glossary to the list of nohypertypes and redefining +\ics{glsentryfmt}: +\begin{verbatim} +\GlsDeclareNoHyperList{main} + +\renewcommand*{\glsentryfmt}{% + \ifmmode + \glsgenentryfmt + \else + \glsifhyperon + {\glsgenentryfmt}% hyperlink already on + {\glshyperlink[\glsgenentryfmt]{\glslabel}}% + \fi +} +\end{verbatim} +Note that this doesn't affect the \glstextlike\ commands, which will +have the hyperlinks off unless they're forced on using the plus +variant. + +See the sample file \samplefile{-nomathhyper} for a complete +document. +\end{example} + +\begin{example}{One Hyper Link Per Entry Per Chapter}{ex:chap-hyperfirst} +Here's a more complicated example that will only have the hyperlink +on the first time an entry is used per chapter. This doesn't involve +resetting the \firstuseflag. Instead it adds a~new key using +\ics{glsaddstoragekey} (see \sectionref{sec:glsaddstoragekey}) that +keeps track of the chapter number that the entry was last used in: +\begin{verbatim} +\glsaddstoragekey{chapter}{0}{\glschapnum} +\end{verbatim} +This creates a new user command called \cs{glschapnum} that's +analogous to \cs{glsentrytext}. The default value for this key is~0. +I~then define my glossary entries as usual. + +Next I redefine the hook \ics{glslinkpostsetkeys} +(see \sectionref{sec:glsdisplay}) so that it determines the current +chapter number (which is stored in \cs{currentchap} using +\cs{edef}). This value is then compared with the value of the +entry's \texttt{chapter} key that I defined earlier. If they're the +same, this entry has already been used in this chapter so the +hyperlink is switched off using \sty{xkeyval}'s \cs{setkeys} +command. If the chapter number isn't the same, then this entry +hasn't been used in the current chapter. The \texttt{chapter} field +is updated using \ics{glsfieldxdef} (\sectionref{sec:fetchset}) +provided the user hasn't switched off the hyperlink. +(This test is performed using \cs{glsifhyperon}. +\begin{verbatim} +\renewcommand*{\glslinkpostsetkeys}{% + \edef\currentchap{\arabic{chapter}}% + \ifnum\currentchap=\glschapnum{\glslabel}\relax + \setkeys{glslink}{hyper=false}% + \else + \glsifhyperon{\glsfieldxdef{\glslabel}{chapter}{\currentchap}}{}% + \fi +} +\end{verbatim} +Note that this will be confused if you use \cs{gls} etc when the +chapter counter is~0. (That is, before the first \cs{chapter}.) + +See the sample file \samplefile{-chap-hyperfirst} for a complete +document. +\end{example} + +\chapter{Adding an Entry to the Glossary Without Generating Text} +\label{sec:glsadd} + +It is possible to add a line to the glossary file without +generating any text at that point in the document using: +\begin{definition}[\DescribeMacro{\glsadd}] +\cs{glsadd}\oarg{options}\marg{label} +\end{definition} +This is similar to the \glstextlike\ commands, only it doesn't produce +any text (so therefore, there is no \gloskey[glslink]{hyper} key +available in \meta{options} but all the other options that can +be used with \glstextlike\ commands can be passed to \cs{glsadd}). +For example, to add a page range to the glossary number list for the +entry whose label is given by \texttt{set}: +\begin{verbatim} +\glsadd[format=(]{set} +Lots of text about sets spanning many pages. +\glsadd[format=)]{set} +\end{verbatim} + +To add all entries that have been defined, use: +\begin{definition}[\DescribeMacro{\glsaddall}] +\cs{glsaddall}\oarg{options} +\end{definition} +The optional argument is the same as for \cs{glsadd}, except +there is also a key \gloskey[glsaddall]{types} which can be +used to specify which glossaries to use. This should be a +comma separated list. For example, if you only want to add +all the entries belonging to the list of acronyms (specified by +the glossary type \ics{acronymtype}) and a list of +notation (specified by the glossary type \texttt{notation}) then you can +do: +\begin{verbatim} +\glsaddall[types={\acronymtype,notation}] +\end{verbatim} + +\begin{important} +Note that \cs{glsadd} and \cs{glsaddall} add the current location to +the \gls{numberlist}. In the case of \cs{glsaddall}, all entries in the +glossary will have the same location in the number list. If you want +to use \cs{glsaddall}, it's best to suppress the number list with +the \pkgopt{nonumberlist} package option. (See +sections~\ref{sec:pkgopts-printglos} and~\ref{sec:numberlists}.) +\end{important} + +There is now a variation of \cs{glsaddall} that skips any entries +that have already been used: +\begin{definition}[\DescribeMacro\glsaddallunused] +\cs{glsaddallunused}\oarg{list} +\end{definition} +This command uses \cs{glsadd}\texttt{[format=@gobble]} which will +ignore this location in the number list. The optional argument +\meta{list} is a comma-separated list of glossary types. If omitted, +it defaults to the list of all defined glossaries. + +If you want to use \cs{glsaddallunused}, it's best to place the +command at the end of the document to ensure that all the commands +you intend to use have already been used. Otherwise you could end up +with a spurious comma or dash in the location list. + +\begin{example}{Dual Entries}{ex:dual} +The example file \samplefile{-dual} makes use of \cs{glsadd} to +allow for an entry that should appear both in the main glossary and +in the list of acronyms. This example sets up the list of acronyms +using the \pkgopt{acronym} package option: +\begin{verbatim} +\usepackage[acronym]{glossaries} +\end{verbatim} +A new command is then defined to make it easier to define dual +entries: +\begin{verbatim} +\newcommand*{\newdualentry}[5][]{% + \newglossaryentry{main-#2}{name={#4},% + text={#3\glsadd{#2}},% + description={#5},% + #1 + }% + \newacronym{#2}{#3\glsadd{main-#2}}{#4}% +} +\end{verbatim} +This has the following syntax: +\begin{alltt} +\ics{newdualentry}\oarg{options}\marg{label}\marg{abbrv}\marg{long}\marg{description} +\end{alltt} +You can then define a new dual entry: +\begin{verbatim} +\newdualentry{svm}% label + {SVM}% abbreviation + {support vector machine}% long form + {Statistical pattern recognition technique}% description +\end{verbatim} +Now you can reference the acronym with \verb|\gls{svm}| or you can +reference the entry in the main glossary with \verb|\gls{main-svm}|. +\end{example} + +\chapter{Cross-Referencing Entries} +\label{sec:crossref} + +\begin{important} +You must use \ics{makeglossaries} (\optsor23) or +\ics{makenoidxglossaries} (\opt1) \emph{before} defining any +terms that cross-reference entries. If any of the terms that you have +cross-referenced don't appear in the glossary, check that you have +put \cs{makeglossaries}\slash\cs{makenoidxglossaries} before all +entry definitions. The \gls{glossaries-extra} package provides +better cross-reference handling. +\end{important} + +There are several ways of cross-referencing entries in the +glossary: + +\begin{enumerate} +\item You can use commands such as \ics{gls} in the +entries description. For example: +\begin{verbatim} +\newglossaryentry{apple}{name=apple, +description={firm, round fruit. See also \gls{pear}}} +\end{verbatim} +Note that with this method, if you don't use the cross-referenced term +in the main part of the document, you will need two runs of +\gls{makeglossaries}: +\begin{verbatim} +latex filename +makeglossaries filename +latex filename +makeglossaries filename +latex filename +\end{verbatim} + +\item As described in \sectionref{sec:newglosentry}, you can use the +\gloskey{see} key when you define the entry. For example: +\begin{verbatim} +\newglossaryentry{MaclaurinSeries}{name={Maclaurin +series}, +description={Series expansion}, +see={TaylorsTheorem}} +\end{verbatim} +Note that in this case, the entry with the \gloskey{see} key will +automatically be added to the glossary, but the cross-referenced +entry won't. You therefore need to ensure that you use the +cross-referenced term with the commands described in +\sectionref{sec:glslink} or \sectionref{sec:glsadd}. + +The \qt{see} tag is produce using \ics{seename}, but can be +overridden in specific instances using square brackets +at the start of the \gloskey{see} value. For example: +\begin{verbatim} +\newglossaryentry{MaclaurinSeries}{name={Maclaurin +series}, +description={Series expansion}, +see=[see also]{TaylorsTheorem}} +\end{verbatim} +Take care if you want to use the optional argument of commands such +as \ics{newacronym} or \ics{newterm} as the value will need to be +grouped. For example: +\begin{verbatim} +\newterm{seal} +\newterm[see={[see also]seal}]{sea lion} +\end{verbatim} +Similarly if the value contains a list. For example: +\begin{verbatim} +\glossaryentry{lemon}{ + name={lemon}, + description={Yellow citrus fruit} +} +\glossaryentry{lime} +{ + name={lime}, + description={Green citrus fruit} +} +\glossaryentry{citrus} +{ + name={citrus}, + description={Plant in the Rutaceae family}, + see={lemon,lime} +} +\end{verbatim} + +\item After you have defined the entry, use +\begin{definition}[\DescribeMacro{\glssee}] +\cs{glssee}\oarg{tag}\marg{label}\marg{xr label list} +\end{definition} +where \meta{xr label list} is a comma-separated list of entry +labels to be cross-referenced, \meta{label} is the label of the +entry doing the cross-referencing and \meta{tag} is the \qt{see} tag. +(The default value of \meta{tag} is \ics{seename}.) +For example: +\begin{verbatim} +\glssee[see also]{series}{FourierSeries,TaylorsTheorem} +\end{verbatim} +Note that this automatically adds the entry given by \meta{label} to +the glossary but doesn't add the cross-referenced entries (specified +by \meta{xr label list}) to the glossary. +\end{enumerate} + +In both cases~2 and 3 above, the cross-referenced information +appears in the \gls{numberlist}, whereas in case~1, the +cross-referenced information appears in the description. (See the +\samplefile{-crossref} example file that comes with this package.) +This means that in cases~2 and~3, the cross-referencing information +won't appear if you have suppressed the \gls*{numberlist}. In this +case, you will need to activate the \gls*{numberlist} for the given +entries using \gloskey{nonumberlist=false}. Alternatively, if you +just use the \gloskey{see} key instead of \ics{glssee}, you can +automatically activate the \gls*{numberlist} using the +\pkgopt{seeautonumberlist} package option. + +\section{Customising Cross-reference Text} +\label{sec:customxr} + +When you use either the \gloskey{see} key or the command +\cs{glssee}, the cross-referencing information will be typeset in the +glossary according to: +\begin{definition}[\DescribeMacro{\glsseeformat}] +\cs{glsseeformat}\oarg{tag}\marg{label-list}\marg{location} +\end{definition} +The default definition of \cs{glsseeformat} is: +\begin{display} +\cs{emph}\marg{tag} \cs{glsseelist}\marg{label-list} +\end{display} +Note that the location is always ignored.\footnote{\gls{makeindex} +will always assign a location number, even if it's not needed, so it +needs to be discarded.} For example, if you want the tag to appear +in bold, you can do:\footnote{If you redefine \cs{glsseeformat}, +keep the default value of the optional argument as \ics{seename} as +both \gloskey{see} and \cs{glssee} explicitly write +\texttt[\cs{seename}\texttt] in the output file if no optional +argument is given.} +\begin{verbatim} +\renewcommand*{\glsseeformat}[3][\seename]{\textbf{#1} + \glsseelist{#2}} +\end{verbatim} + + +The list of labels is dealt with by \cs{glsseelist}, which iterates +through the list and typesets each entry in the label. The entries +are separated by +\begin{definition}[\DescribeMacro{\glsseesep}] +\cs{glsseesep} +\end{definition} +or (for the last pair) +\begin{definition}[\DescribeMacro{\glsseelastsep}] +\cs{glsseelastsep} +\end{definition} +These default to ``",\space"'' and +\qt{\cs{space}\ics{andname}\cs{space}} respectively. The list entry text +is displayed using: +\begin{definition}[\DescribeMacro{\glsseeitemformat}] +\cs{glsseeitemformat}\marg{label} +\end{definition} +This defaults to \ics{glsentrytext}\marg{label}.\footnote{In +versions before 3.0, \cs{glsentryname} was used, but this could cause +problems when the \gloskey{name} key was \glsd{sanitize}.} For example, to +make the cross-referenced list use small caps: +\begin{verbatim} +\renewcommand{\glsseeitemformat}[1]{% + \textsc{\glsentrytext{#1}}} +\end{verbatim} + +\begin{important} +You can use \ics{glsseeformat} and \ics{glsseelist} in the main body +of the text, but they won't automatically add the cross-referenced +entries to the glossary. If you want them added with that location, +you can do: +\begin{verbatim} +Some information (see also +\glsseelist{FourierSeries,TaylorsTheorem}% +\glsadd{FourierSeries}\glsadd{TaylorsTheorem}). +\end{verbatim} +\end{important} + +\chapter{Using Glossary Terms Without Links} +\label{sec:glsnolink} + +The commands described in this section display entry details without +adding any information to the glossary. They don't use +\ics{glstextformat}, they don't have any optional arguments, they +don't affect the \firstuseflag\ and, apart from \ics{glshyperlink}, +they don't produce hyperlinks. + +\begin{important} +Commands that aren't expandable will be ignored by PDF bookmarks, so +you will need to provide an alternative via \sty{hyperref}'s +\cs{texorpdfstring} if you want to use them in sectioning commands. +(This isn't specific to the \styfmt{glossaries} package.) See the +\sty{hyperref} documentation for further details. All the commands +that convert the first letter to upper case aren't expandable. +The other commands depend on whether their corresponding keys were +assigned non-expandable values. +\end{important} + +If you want to title case a field, you can use: +\begin{definition}[\DescribeMacro\glsentrytitlecase] +\cs{glsentrytitlecase}\marg{label}\marg{field} +\end{definition} +where \meta{label} is the label identifying the glossary entry, +\meta{field} is the field label (see \tableref{tab:fieldmap}). +For example: +\begin{verbatim} +\glsentrytitlecase{sample}{desc} +\end{verbatim} +(If you want title-casing in your glossary style, you might want to +investigate the \sty{glossaries-extra} package.) + +Note that this command has the same limitations as \cs{makefirstuc} which is +used by commands like \cs{Gls} and \cs{Glsentryname} to upper-case +the first letter (see the notes about \cs{Gls} in \sectionref{sec:gls-like}). + +\begin{definition}[\DescribeMacro{\glsentryname}] +\cs{glsentryname}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryname}] +\cs{Glsentryname}\marg{label} +\end{definition} +These commands display the name of the glossary entry given by +\meta{label}, as specified by the \gloskey{name} key. +\cs{Glsentryname} makes the first letter upper case. +Neither of these commands check for the existence of \meta{label}. +The first form \cs{glsentryname} is expandable (unless the name +contains unexpandable commands). Note that this may be different from the values of +the \gloskey{text} or \gloskey{first} keys. In general it's better +to use \cs{glsentrytext} or \cs{glsentryfirst} instead of +\cs{glsentryname}. + +\begin{important} +In general it's best to avoid \cs{Glsentryname} with abbreviations. Instead, +consider using \cs{Glsentrylong}, \cs{Glsentryshort} or \cs{Glsentryfull}. +\end{important} + +\begin{definition}[\DescribeMacro{\glossentryname}] +\cs{glossentryname}\marg{label} +\end{definition} +This is like \cs{glsnamefont}\{\cs{glsentryname\marg{label}}\} +but also checks for the existence of \meta{label}. This command is +not expandable. It's used in the predefined glossary styles, so if +you want to change the way the name is formatted in the glossary, +you can redefine \cs{glsnamefont} to use the required fonts. For +example: +\begin{verbatim} +\renewcommand*{\glsnamefont}[1]{\textmd{\sffamily #1}} +\end{verbatim} +\begin{definition}[\DescribeMacro{\Glossentryname}] +\cs{Glossentryname}\marg{label} +\end{definition} +This is like \cs{glossentryname} but makes the first letter of the +name upper case. + +\begin{definition}[\DescribeMacro{\glsentrytext}] +\cs{glsentrytext}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentrytext}] +\cs{Glsentrytext}\marg{label} +\end{definition} +These commands display the subsequent use text for the glossary +entry given by \meta{label}, as specified by the \gloskey{text} key. +\cs{Glsentrytext} makes the first letter upper case. +The first form is expandable (unless the text contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\glsentryplural}] +\cs{glsentryplural}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryplural}] +\cs{Glsentryplural}\marg{label} +\end{definition} +These commands display the subsequent use plural text for the +glossary entry given by \meta{label}, as specified by the +\gloskey{plural} key. \cs{Glsentryplural} makes the first letter +upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\glsentryfirst}] +\cs{glsentryfirst}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryfirst}] +\cs{Glsentryfirst}\marg{label} +\end{definition} +These commands display the \firstusetext\ for the glossary entry +given by \meta{label}, as specified by the \gloskey{first} key. +\cs{Glsentryfirst} makes the first letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\glsentryfirstplural}] +\cs{glsentryfirstplural}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryfirstplural}] +\cs{Glsentryfirstplural}\marg{label} +\end{definition} +These commands display the plural form of the \firstusetext\ for the +glossary entry given by \meta{label}, as specified by the +\gloskey{firstplural} key. \cs{Glsentryfirstplural} makes the first +letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\glsentrydesc}] +\cs{glsentrydesc}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentrydesc}] +\cs{Glsentrydesc}\marg{label} +\end{definition} +These commands display the description for the glossary entry given +by \meta{label}. \cs{Glsentrydesc} makes the first letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\glossentrydesc}] +\cs{glossentrydesc}\marg{label} +\end{definition} +This is like \cs{glsentrydesc}\marg{label} +but also checks for the existence of \meta{label}. This command is +not expandable. It's used in the predefined glossary styles to +display the description. +\begin{definition}[\DescribeMacro{\Glossentrydesc}] +\cs{Glossentrydesc}\marg{label} +\end{definition} +This is like \cs{glossentrydesc} but converts the first letter to +upper case. This command is not expandable. + +\begin{definition}[\DescribeMacro{\glsentrydescplural}] +\cs{glsentrydescplural}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentrydescplural}] +\cs{Glsentrydescplural}\marg{label} +\end{definition} +These commands display the plural description for the glossary entry +given by \meta{label}. \cs{Glsentrydescplural} makes the first +letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + + +\begin{definition}[\DescribeMacro{\glsentrysymbol}] +\cs{glsentrysymbol}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentrysymbol}] +\cs{Glsentrysymbol}\marg{label} +\end{definition} +These commands display the symbol for the glossary entry given by +\meta{label}. \cs{Glsentrysymbol} makes the first letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + + +\begin{definition}[\DescribeMacro\glsletentryfield] +\cs{glsletentryfield}\marg{cs}\marg{label}\marg{field} +\end{definition} +This command doesn't display anything. It merely fetches the +value associated with the given field (where the available field names +are listed in \tableref{tab:fieldmap}) and stores the result +in the control sequence \meta{cs}. For example, to store +the description for the entry whose label is \qt{apple} in the +control sequence \verb|\tmp|: +\begin{verbatim} +\glsletentryfield{\tmp}{apple}{desc} +\end{verbatim} + +\begin{definition}[\DescribeMacro{\glossentrysymbol}] +\cs{glossentrysymbol}\marg{label} +\end{definition} +This is like \cs{glsentrysymbol}\marg{label} +but also checks for the existence of \meta{label}. This command is +not expandable. It's used in some of the predefined glossary styles to +display the symbol. +\begin{definition}[\DescribeMacro{\Glossentrysymbol}] +\cs{Glossentrysymbol}\marg{label} +\end{definition} +This is like \cs{glossentrysymbol} but converts the first letter to +upper case. This command is not expandable. + +\begin{definition}[\DescribeMacro{\glsentrysymbolplural}] +\cs{glsentrysymbolplural}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentrysymbolplural}] +\cs{Glsentrysymbolplural}\marg{label} +\end{definition} +These commands display the plural symbol for the glossary entry +given by \meta{label}. \cs{Glsentrysymbolplural} makes the first +letter upper case. +The first form is expandable (unless the value of that key contains unexpandable +commands). The second form is not expandable. Neither checks for the +existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\glsentryuseri}] +\cs{glsentryuseri}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryuseri}] +\cs{Glsentryuseri}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glsentryuserii}] +\cs{glsentryuserii}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryuserii}] +\cs{Glsentryuserii}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glsentryuseriii}] +\cs{glsentryuseriii}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryuseriii}] +\cs{Glsentryuseriii}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glsentryuseriv}] +\cs{glsentryuseriv}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryuseriv}] +\cs{Glsentryuseriv}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glsentryuserv}] +\cs{glsentryuserv}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryuserv}] +\cs{Glsentryuserv}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glsentryuservi}] +\cs{glsentryuservi}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryuservi}] +\cs{Glsentryuservi}\marg{label} +\end{definition} +These commands display the value of the user keys for the glossary +entry given by \meta{label}. +The lower case forms are expandable (unless the value of the key +contains unexpandable commands). The commands beginning with an +upper case letter convert the first letter of the required value to +upper case and are not expandable. None of these commands check for +the existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\glshyperlink}] +\cs{glshyperlink}\oarg{link text}\marg{label} +\end{definition} +This command provides a hyperlink to the glossary entry given by +\meta{label} \textbf{but does not add any information to the +glossary file}. The link text is given by +\ics{glsentrytext}\marg{label} by default\footnote{versions before +3.0 used \ics{glsentryname} as the default, but this could cause +problems when \gloskey{name} had been \glsd{sanitize}.}, but can be +overridden using the optional argument. Note that the hyperlink will +be suppressed if you have used \ics{glsdisablehyper} or if you +haven't loaded the \sty{hyperref} package. + +\begin{important} +If you use \cs{glshyperlink}, you need to ensure that the relevant +entry has been added to the glossary using any of the commands +described in \sectionref{sec:glslink} or \sectionref{sec:glsadd} +otherwise you will end up with an undefined link. +\end{important} + +The next two commands are only available with \opt1 or with the +\pkgopt{savenumberlist} package option: +\begin{definition}[\DescribeMacro{\glsentrynumberlist}] +\cs{glsentrynumberlist}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glsdisplaynumberlist}] +\cs{glsdisplaynumberlist}\marg{label} +\end{definition} +Both display the \gls{numberlist} for the entry given by +\meta{label}. When used with \opt1 a~rerun is required to ensure +this list is up-to-date, when used with \optsor23 +a run of \gls{makeglossaries} (or \gls{makeindex}\slash\gls{xindy}) +followed by one or two runs of \LaTeX\ is required. + +The first command, \cs{glsentrynumberlist}, simply displays +the number list as is. The second command, +\cs{glsdisplaynumberlist}, formats the list using: +\begin{definition}[\DescribeMacro{\glsnumlistsep}] +\cs{glsnumlistsep} +\end{definition} +as the separator between all but the last two elements and +\begin{definition}[\DescribeMacro{\glsnumlistlastsep}] +\cs{glsnumlistlastsep} +\end{definition} +between the final two elements. The defaults are +\verb*|, | and \verb*| \& |, respectively. + +\begin{important} +\cs{glsdisplaynumberlist} is fairly experimental. It works with +\opt1, but for \optsor23 it only works when the default counter +format is used (that is, when the \gloskey[glslink]{format} key is +set to \texttt{glsnumberformat}). This command will only work with +\sty{hyperref} if you choose \opt1. If you try using this command +with \optsor23 and \sty{hyperref}, \cs{glsentrynumberlist} will be +used instead. +\end{important} + +For further information see \ifpdf section~\ref*{sec:code:glsnolink} +\fi \qt{Displaying entry details without adding information to the +glossary} in the documented code (\texttt{glossaries-code.pdf}). + +\chapter{Displaying a glossary} +\label{sec:printglossary} + +All defined glossaries may be displayed using: +\begin{description} +\itempar{\opt1:} +\begin{definition}[\DescribeMacro{\printnoidxglossaries}] +\cs{printnoidxglossaries} +\end{definition} +(Must be used with \ics{makenoidxglossaries} in the preamble.) + +\itempar{\optsand23:} +\begin{definition}[\DescribeMacro{\printglossaries}] +\cs{printglossaries} +\end{definition} +(Must be used with \ics{makeglossaries} in the preamble.) +\end{description} + +These commands will display all the glossaries in the order in which +they were defined. Note that, in the case of \optsand23, no +glossaries will appear until you have either used the Perl script +\gls{makeglossaries} or Lua script \gls{makeglossaries-lite.lua} or +have directly used \gls{makeindex} or \gls{xindy} (as described in +\sectionref{sec:makeglossaries}). (While the external files are +missing, these commands will just do \cs{null} for each missing +glossary to assist dictionary style documents that just use +\cs{glsaddall} without inserting any text. If you use +\gls{glossaries-extra}, it will insert a heading and boilerplate text when the +external files are missing. The extension package also provides +\cs{printunsrtglossaries} as an alternative. See the +\gls{glossaries-extra} manual for further details.) + +If the glossary still does not appear after you re-\LaTeX\ your +document, check the \gls*{makeindex}\slash\gls*{xindy} log files to +see if there is a problem. With \opt1, you just need two \LaTeX\ +runs to make the glossaries appear, but you may need further runs to +make the \glspl{numberlist} up-to-date. + +An individual glossary can be displayed using: +\begin{description} +\itempar{\opt1:} +\begin{definition}[\DescribeMacro{\printnoidxglossary}] +\cs{printnoidxglossary}\oarg{options} +\end{definition} +(Must be used with \ics{makenoidxglossaries} in the preamble.) + +\itempar{\optsand23:} +\begin{definition}[\DescribeMacro{\printglossary}] +\cs{printglossary}\oarg{options} +\end{definition} +(Must be used with \ics{makeglossaries} in the preamble.) +\end{description} +where \meta{options} is a \meta{key}=\meta{value} list of options. +(Again, when the associated external file is missing, \cs{null} is +inserted into the document.) + +The following keys are available: +\begin{description} +\item[{\gloskey[printglossary]{type}}] The value of this key +specifies which glossary to print. If omitted, the default +glossary is assumed. For example, to print the list of acronyms: +\begin{verbatim} +\printglossary[type=\acronymtype] +\end{verbatim} +Note that you can't display an ignored glossary, so don't try +setting \gloskey[printglossary]{type} to the name of a glossary that +was defined using \ics{newignoredglossary}, described in +\sectionref{sec:newglossary}. (You can display an ignored glossary +with \cs{printunsrtglossary} provided by \gls{glossaries-extra}.) + +\item[{\gloskey[printglossary]{title}}] This is the glossary's +title (overriding the title specified when the glossary was +defined). + +\item[{\gloskey[printglossary]{toctitle}}] This is the title +to use for the table of contents (if the \pkgopt{toc} package +option has been used). It may also be used for the page header, +depending on the page style. If omitted, the value of +\gloskey[printglossary]{title} is used. + +\item[{\gloskey[printglossary]{style}}] This specifies which +glossary style to use for this glossary, overriding the effect +of the \pkgopt{style} package option or \ics{glossarystyle}. + +\item[{\gloskey[printglossary]{numberedsection}}] This specifies +whether to use a numbered section for this glossary, overriding +the effect of the \pkgopt{numberedsection} package option. This +key has the same syntax as the \pkgopt{numberedsection} package +option, described in \sectionref{sec:pkgopts-sec}. + +\item[{\gloskey[printglossary]{nonumberlist}}] This is a boolean +key. If true (\verb|nonumberlist=true|) the numberlist is suppressed +for this glossary. If false (\verb|nonumberlist=false|) the +numberlist is displayed for this glossary. + +\item[{\gloskey[printglossary]{nogroupskip}}] This is a boolean +key. If true the vertical gap between groups +is suppressed for this glossary. + +\item[{\gloskey[printglossary]{nopostdot}}] This is a boolean +key. If true the full stop after the description +is suppressed for this glossary. + +\item[{\gloskey[printglossary]{entrycounter}}] This is a boolean +key. Behaves similar to the package option of the same name. +The corresponding package option must be used to make \ics{glsrefentry} +work correctly. + +\item[{\gloskey[printglossary]{subentrycounter}}] This is a boolean +key. Behaves similar to the package option of the same name. If you +want to set both \gloskey{entrycounter} and +\gloskey{subentrycounter}, make sure you specify +\gloskey{entrycounter} first. The corresponding package option must +be used to make \ics{glsrefentry} work correctly. + +\item[{\gloskey[printnoidxglossary]{sort}}] This key is only +available for \opt1. Possible values are: \texttt{word} (word +order), \texttt{letter} (letter order), \texttt{standard} (word or +letter ordering taken from the \pkgopt{order} package option), +\texttt{use} (order of use), \texttt{def} (order of definition) +\texttt{nocase} (case-insensitive) or \texttt{case} (case-sensitive). +Note that the word and letter comparisons (that is, everything other +than \texttt{sort=use} and \texttt{sort=def}) just use a simple +character code comparison. For a locale-sensitive sort, you must use +either \gls{xindy} (\opt3) or \gls{bib2gls} (\opt4). Note that \gls{bib2gls} +provides many other sort options. + +\begin{important} +If you use the \texttt{use} or \texttt{def} values make sure +that you select a glossary style that doesn't have a visual +indicator between groups, as the grouping no longer makes sense. +Consider using the \pkgopt{nogroupskip} option. +\end{important} + +{\raggedright +The word and letter order sort methods use +\sty{datatool}'s +\ics{dtlwordindexcompare} and \ics{dtlletterindexcompare} handlers. +The case-insensitive sort method uses \sty{datatool}'s +\ics{dtlicompare} handler. The case-sensitive sort method uses +\sty{datatool}'s \ics{dtlcompare} handler. See the \sty{datatool} +documentation for further details. +\par} + +If you don't get an error with \texttt{sort=use} and +\texttt{sort=def} but you do get an error with one of the other sort +options, then you probably need to use the +\pkgopt[true]{sanitizesort} package option or make sure none of the +entries have fragile commands in their \gloskey{sort} field. +\end{description} + +By default, the glossary is started either by \ics{chapter*} or by +\ics{section*}, depending on whether or not \ics{chapter} is defined. +This can be overridden by the \pkgopt{section} package option or the +\ics{setglossarysection} command. Numbered sectional units can be +obtained using the \pkgopt{numberedsection} package option. Each +glossary sets the page header via the command +\begin{definition}[\DescribeMacro\glsglossarymark] +\ics{glsglossarymark}\marg{title} +\end{definition} +If this mechanism is unsuitable for your chosen class file or page +style package, you will need to redefine \ics{glsglossarymark}. Further +information about these options and commands is given in +\sectionref{sec:pkgopts-sec}. + +Information can be added to the start of the glossary (after the +title and before the main body of the glossary) by redefining +\begin{definition}[\DescribeMacro{\glossarypreamble}] +\cs{glossarypreamble} +\end{definition} +For example: +\begin{verbatim} +\renewcommand{\glossarypreamble}{Numbers in italic +indicate primary definitions.} +\end{verbatim} +This needs to be done before the glossary is displayed. + +If you want a different preamble per glossary you can use +\begin{definition}[\DescribeMacro{\setglossarypreamble}] +\cs{setglossarypreamble}\oarg{type}\marg{preamble text} +\end{definition} +If \meta{type} is omitted, \cs{glsdefaulttype} is used. + +For example: +\begin{verbatim} +\setglossarypreamble{Numbers in italic +indicate primary definitions.} +\end{verbatim} +This will print the given preamble text for the main glossary, +but not have any preamble text for any other glossaries. + +There is an analogous command to \cs{glossarypreamble} called +\begin{definition}[\DescribeMacro{\glossarypostamble}] +\cs{glossarypostamble} +\end{definition} +which is placed at the end of each glossary. + +\begin{example}{Switch to Two Column Mode for Glossary}{ex:twocolumn} +Suppose you are using the \glostyle{superheaderborder} +style\footnote{you can't use the \glostyle{longheaderborder} style +for this example as you can't use the \env{longtable} environment in +two column mode.}, and you want the glossary to be in two columns, +but after the glossary you want to switch back to one column mode, +you could do: +\begin{verbatim} +\renewcommand*{\glossarysection}[2][]{% + \twocolumn[{\chapter*{#2}}]% + \setlength\glsdescwidth{0.6\linewidth}% + \glsglossarymark{\glossarytoctitle}% +} + +\renewcommand*{\glossarypostamble}{\onecolumn} +\end{verbatim} + +\end{example} + +Within each glossary, each entry name is formatted according to +\begin{definition}[\DescribeMacro{\glsnamefont}] +\cs{glsnamefont}\marg{name} +\end{definition} +which takes one argument: the entry name. This command is always +used regardless of the glossary style. By default, \cs{glsnamefont} +simply displays its argument in whatever the surrounding font +happens to be. This means that in the list-like glossary styles +(defined in the \sty{glossary-list} style file) the name will appear +in bold, since the name is placed in the optional argument of +\cs{item}, whereas in the tabular styles (defined in the +\sty{glossary-long} and \sty{glossary-super} style files) the name +will appear in the normal font. The hierarchical glossary styles +(defined in the \sty{glossary-tree} style file) also set the name in +bold. + +If you want to change the font for the description, or if you +only want to change the name font for some types of entries +but not others, you might want to consider using the +\sty{glossaries-extra} package. + +\begin{example}{Changing the Font Used to Display Entry Names in the +Glossary}{ex:glsnamefont} +Suppose you want all the entry names to appear in +medium weight small caps in your glossaries, then you can do: +\begin{verbatim} +\renewcommand{\glsnamefont}[1]{\textsc{\mdseries #1}} +\end{verbatim} +\end{example} + +\chapter[Xindy (Option 3)]{Xindy (\ifpdf\opt3\else Option 3\fi)} +\label{sec:xindy} + +If you want to use \gls{xindy} to sort the glossary, you +must use the package option \pkgopt{xindy}: +\begin{verbatim} +\usepackage[xindy]{glossaries} +\end{verbatim} +This ensures that the glossary information is written in +\gls*{xindy} syntax. + +\sectionref{sec:makeglossaries} covers how to use the external +\gls{indexingapp}, and \sectionref{sec:locationsyntax} covers the +issues involved in the location syntax. This section covers the +commands provided by the \styfmt{glossaries} package that allow you +to adjust the \gls{xindy} style file (\filetype{.xdy}) and +parameters. + +To assist writing information to the \gls{xindy} style +file, the \styfmt{glossaries} package provides the following +commands: +\begin{definition}[\DescribeMacro{\glsopenbrace}] +\cs{glsopenbrace} +\end{definition} +\begin{definition}[\DescribeMacro{\glsclosebrace}] +\cs{glsclosebrace} +\end{definition} +which produce an open and closing brace. (This is needed because +\verb|\{| and \verb|\}| don't expand to a simple brace character +when written to a file.) Similarly, you can write a percent +character using: +\begin{definition}[\DescribeMacro{\glspercentchar}] +\cs{glspercentchar} +\end{definition} +and a tilde character using: +\begin{definition}[\DescribeMacro{\glstildechar}] +\cs{glstildechar} +\end{definition} +For example, a newline character is specified in a \gls{xindy} style +file using \verb|~n| so you can use \texttt{\cs{glstildechar} n} +to write this correctly (or you can do \verb|\string~n|). +A backslash can be written to a file using +\begin{definition}[\DescribeMacro{\glsbackslash}] +\cs{glsbackslash} +\end{definition} + +In addition, if you are using a package that makes the double +quote character active (e.g. \sty{ngerman}) you can use: +\begin{definition}[\DescribeMacro{\glsquote}] +\cs{glsquote}\marg{text} +\end{definition} +which will produce \verb|"|\meta{text}\verb|"|. Alternatively, +you can use \verb|\string"| to write the double-quote character. +This document assumes that the double quote character has not been +made active, so the examples just use \verb|"| for clarity. + +If you want greater control over the \gls{xindy} style file than is +available through the \LaTeX\ commands provided by the +\styfmt{glossaries} package, you will need to edit the \gls*{xindy} +style file. In which case, you must use \ics{noist} to prevent the +style file from being overwritten by the \styfmt{glossaries} +package. For additional information about \gls*{xindy}, read the +\gls*{xindy} documentation. I'm sorry I can't provide any assistance +with writing \gls*{xindy} style files. If you need help, I recommend +you ask on the \gls*{xindy} mailing list +(\url{http://xindy.sourceforge.net/mailing-list.html}). + +\section{Language and Encodings} +\label{sec:langenc} + +When you use \gls{xindy}, you need to specify the language +and encoding used (unless you have written your own custom +\gls*{xindy} style file that defines the relevant alphabet +and sort rules). If you use \gls{makeglossaries}, +this information is obtained from the document's auxiliary +(\filetype{.aux}) file. The \gls{makeglossaries} script attempts to +find the root language given your document settings, but in the +event that it gets it wrong or if \gls*{xindy} doesn't support +that language, then you can specify the required language using: +\begin{definition}[\DescribeMacro{\GlsSetXdyLanguage}] +\cs{GlsSetXdyLanguage}\oarg{glossary type}\marg{language} +\end{definition} +where \meta{language} is the name of the language. The +optional argument can be used if you have multiple glossaries +in different languages. If \meta{glossary type} is omitted, it +will be applied to all glossaries, otherwise the language +setting will only be applied to the glossary given by +\meta{glossary type}. + +If the \sty{inputenc} package is used, the encoding will be +obtained from the value of \ics{inputencodingname}. +Alternatively, you can specify the encoding using: +\begin{definition}[\DescribeMacro{\GlsSetXdyCodePage}] +\cs{GlsSetXdyCodePage}\marg{code} +\end{definition} +where \meta{code} is the name of the encoding. For example: +\begin{verbatim} +\GlsSetXdyCodePage{utf8} +\end{verbatim} + +Note that you can also specify the language and encoding using +the package option +\verb|xindy={language=|\meta{lang}\verb|,codepage=|\meta{code}\verb|}|. +For example: +\begin{verbatim} +\usepackage[xindy={language=english,codepage=utf8}]{glossaries} +\end{verbatim} + +If you write your own custom \gls{xindy} style file that +includes the language settings, you need to set the language +to nothing: +\begin{verbatim} +\GlsSetXdyLanguage{} +\end{verbatim} +(and remember to use \ics{noist} to prevent the style file from +being overwritten). + +\begin{important} +The commands \cs{GlsSetXdyLanguage} and \cs{GlsSetXdyCodePage} +have no effect if you don't use \gls{makeglossaries}. If +you call \gls{xindy} without \gls*{makeglossaries} you +need to remember to set the language and encoding using the +\xdyopt{L} and \xdyopt{C} switches. +\end{important} + +\section{Locations and Number lists} +\label{sec:xindyloc} + +If you use \pkgopt{xindy}, the \styfmt{glossaries} package needs to +know which counters you will be using in the \gls{numberlist} in order to correctly format the \gls{xindy} style +file. Counters specified using the \pkgopt{counter} package option +or the \meta{counter} option of \ics{newglossary} are +automatically taken care of, but if you plan to use a different +counter in the \gloskey[glslink]{counter} key for commands like +\ics{glslink}, then you need to identify these counters \emph{before} +\ics{makeglossaries} using: +\begin{definition}[\DescribeMacro{\GlsAddXdyCounters}] +\cs{GlsAddXdyCounters}\marg{counter list} +\end{definition} +where \meta{counter list} is a comma-separated list of counter names. + +The most likely attributes used in the \gloskey[glslink]{format} +key (\locfmt{textrm}, \locfmt{hyperrm} etc) are automatically added +to the \gls{xindy} style file, but if you want to use another +attribute, you need to add it using: +\begin{definition}[\DescribeMacro{\GlsAddXdyAttribute}] +\cs{GlsAddXdyAttribute}\marg{name} +\end{definition} +where \meta{name} is the name of the attribute, as used in +the \gloskey[glslink]{format} key. + +Take care if you have multiple instances of the same location with +different formats. The duplicate locations will be discarded +according to the order in which the attributes are listed. Consider +defining semantic commands to use for primary references. For +example: +\begin{verbatim} +\newcommand*{\primary}[1]{\textbf{#1}} +\GlsAddXdyAttribute{primary} +\end{verbatim} +Then in the document: +\begin{verbatim} +A \gls[format=primary]{duck} is an aquatic bird. +There are lots of different types of \gls{duck}. +\end{verbatim} +This will give the \verb|format=primary| instance preference over +the next use that doesn't use the \gloskey[glslink]{format} key. + +\begin{example}{Custom Font for Displaying a Location}{ex:hyperbfit} +Suppose I want a bold, italic, hyperlinked location. I first need to define a +command that will do this: +\begin{verbatim} +\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}} +\end{verbatim} +but with \gls{xindy}, I also need to add this as an allowed +attribute: +\begin{verbatim} +\GlsAddXdyAttribute{hyperbfit} +\end{verbatim} +Now I can use it in the optional argument of commands like +\ics{gls}: +\begin{verbatim} +Here is a \gls[format=hyperbfit]{sample} entry. +\end{verbatim} +(where \texttt{sample} is the label of the required entry). +\end{example} + +\begin{important} +Note that \cs{GlsAddXdyAttribute} has no effect if \ics{noist} is +used or if \ics{makeglossaries} is omitted. +\cs{GlsAddXdyAttribute} must be used before \ics{makeglossaries}. +Additionally, \cs{GlsAddXdyCounters} must come before +\cs{GlsAddXdyAttribute}. +\end{important} + +If the location numbers include formatting commands, then +you need to add a location style in the appropriate format using +\begin{definition}[\DescribeMacro{\GlsAddXdyLocation}] +\cs{GlsAddXdyLocation}\oarg{prefix-location}\marg{name}\marg{definition} +\end{definition} +where \meta{name} is the name of the format and \meta{definition} is +the \gls{xindy} definition. The optional argument \meta{prefix-location} +is needed if \cs{theH}\meta{counter} either isn't defined or is +different from \cs{the}\meta{counter}. +Be sure to also read \sectionref{sec:locationsyntax} for some issues +that you may encounter. + +\begin{important} +Note that \cs{GlsAddXdyLocation} has no effect if \ics{noist} is +used or if \ics{makeglossaries} is omitted. +\cs{GlsAddXdyLocation} must be used before \ics{makeglossaries}. +\end{important} + +\begin{example}{Custom Numbering System for Locations}{ex:customloc} +Suppose I decide to use a somewhat eccentric numbering +system for sections where I redefine \cs{thesection} as follows: +\begin{verbatim} +\renewcommand*{\thesection}{[\thechapter]\arabic{section}} +\end{verbatim} +If I haven't done "counter=section" in the package +option, I need to specify that the counter will be used as a +location number: +\begin{verbatim} +\GlsAddXdyCounters{section} +\end{verbatim} +Next I need to add the location style (\cs{thechapter} is assumed to +be the standard \verb"\arabic{chapter}"): +\begin{verbatim} +\GlsAddXdyLocation{section}{:sep "[" "arabic-numbers" :sep "]" + "arabic-numbers" +} +\end{verbatim} +Note that if I have further decided to use the \sty{hyperref} +package and want to redefine \cs{theHsection} as: +\begin{verbatim} +\renewcommand*{\theHsection}{\thepart.\thesection} +\renewcommand*{\thepart}{\Roman{part}} +\end{verbatim} +then I need to modify the \cs{GlsAddXdyLocation} code above to: +\begin{verbatim} +\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "[" + "arabic-numbers" :sep "]" "arabic-numbers" +} +\end{verbatim} +Since \ics{Roman} will result in an empty string if the counter is +zero, it's a good idea to add an extra location to catch this: +\begin{verbatim} +\GlsAddXdyLocation{zero.section}{:sep "[" + "arabic-numbers" :sep "]" "arabic-numbers" +} +\end{verbatim} +This example is illustrated in the sample file +\samplefile{xdy2}. +\end{example} + +\begin{example}{Locations as Dice}{ex:dice} +Suppose I want a rather eccentric page numbering system that's +represented by the number of dots on dice. The \sty{stix} package +provides \cs{dicei}, \ldots, \cs{dicevi} that represent the six +sides of a die. I can define a command that takes a number as its +argument. If the number is less than seven, the appropriate +\cs{dice}\meta{n} command is used otherwise it does \cs{dicevi} the +required number of times with the leftover in a final +\cs{dice}\meta{n}. For example, the number 16 is represented by +\verb|\dicevi\dicevi\diceiv| ($6+6+4=16$). I've called this command +\cs{tallynum} to match the example given earlier in +\sectionref{sec:locationsyntax}: +\begin{verbatim} +\newrobustcmd{\tallynum}[1]{% + \ifnum\number#1<7 + $\csname dice\romannumeral#1\endcsname$% + \else + $\dicevi$% + \expandafter\tallynum\expandafter{\numexpr#1-6}% + \fi +} +\end{verbatim} +Here's the counter command: +\begin{verbatim} +newcommand{\tally}[1]{\tallynum{\arabic{#1}}} +\end{verbatim} +The \ctr{page} counter representation (\cs{thepage}) needs to be +changed to use this command: +\begin{verbatim} +\renewcommand*{\thepage}{\tally{page}} +\end{verbatim} +The \cs{tally} command expands to \cs{tallynum} \marg{number} so +this needs a location class that matches this format: +\begin{verbatim} +\GlsAddXdyLocation{tally}{% + :sep "\string\tallynum\space\glsopenbrace" + "arabic-numbers" + :sep "\glsclosebrace" +} +\end{verbatim} +The space between \cs{tallynum} and \marg{number} is +significant to \gls{xindy} so \cs{space} is required. + +Note that \cs{GlsAddXdyLocation}\marg{name}\marg{definition} will define +commands in the form: +\begin{definition} +\cs{glsX}\meta{counter}"X"\meta{name}\marg{Hprefix}\marg{location} +\end{definition} +for each counter that has been identified either by the +\pkgopt{counter} package option, the \meta{counter} option for +\ics{newglossary} or in the argument of \ics{GlsAddXdyCounters}. +The first argument \meta{Hprefix} is only relevant when used with +the \sty{hyperref} package and indicates that \cs{theH}\meta{counter} +is given by \cs{Hprefix}"."\cs{the}\meta{counter}. + +The sample file \samplefile{xdy}, which comes with the \styfmt{glossaries} +package, uses the default \ctr{page} counter for locations, and it +uses the default \ics{glsnumberformat} and a custom \cs{hyperbfit} +format. A new \gls{xindy} location called \texttt{tallynum}, as +illustrated above, is defined to make the page numbers appear as +dice. In order for the location numbers to +hyperlink to the relevant pages, I~need to redefine the necessary +\cs{glsX}\meta{counter}"X"\meta{format} commands: +\begin{verbatim} +\renewcommand{\glsXpageXglsnumberformat}[2]{% + \linkpagenumber#2% +} + +\renewcommand{\glsXpageXhyperbfit}[2]{% + \textbf{\em\linkpagenumber#2}% +} + +\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} +\end{verbatim} +Note that the second argument of \cs{glsXpageXglsnumberformat} is +in the format \cs{tallynum}\marg{n} so the line +\begin{verbatim} + \linkpagenumber#2% +\end{verbatim} +does +\begin{alltt} + \cs{linkpagenumber}\cs{tallynum}\marg{number} +\end{alltt} +so \cs{tallynum} is the first argument of \cs{linkpagenumber} +and \meta{number} is the second argument. +\end{example} + +\begin{important} +This method is very sensitive to the internal definition of the +location command. +\end{important} + +\begin{example}{Locations as Words not Digits}{ex:fmtcount} +Suppose I want the page numbers written as words +rather than digits and I~use the \sty{fmtcount} package to +do this. I~can redefine \ics{thepage} as follows: +\begin{verbatim} +\renewcommand*{\thepage}{\Numberstring{page}} +\end{verbatim} +This \emph{used} to get expanded to \verb|\protect \Numberstringnum |\marg{n} +where \meta{n} is the Arabic page number. This means that I~needed to +define a new location with the form: +\begin{verbatim} +\GlsAddXdyLocation{Numberstring}{:sep "\string\protect\space + \string\Numberstringnum\space\glsopenbrace" + "arabic-numbers" :sep "\glsclosebrace"} +\end{verbatim} +and if I'd used the \cs{linkpagenumber} command from the previous +example, it would need \emph{three} arguments (the first being +\cs{protect}): +\begin{verbatim} +\newcommand{\linkpagenumber}[3]{\hyperlink{page.#3}{#1#2{#3}}} +\end{verbatim} + +The internal definition of \cs{Numberstring} has since changed +so that it now expands to \verb|\Numberstringnum |\marg{n} +(no \cs{protect}). This means that the location class definition +must be changed to: +\begin{verbatim} +\GlsAddXdyLocation{Numberstring}{% no \protect now! + :sep "\string\Numberstringnum\space\glsopenbrace" + "arabic-numbers" :sep "\glsclosebrace"} +\end{verbatim} +and \cs{linkpagenumber} goes back to only two arguments: +\begin{verbatim} +\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} +\end{verbatim} +The other change is that \cs{Numberstring} uses +\begin{alltt} +\cs{the}\cs{value}\marg{counter} +\end{alltt} +instead of +\begin{alltt} +\cs{expandafter}\cs{the}\cs{csname} c@\meta{counter}\cs{endcsname} +\end{alltt} +so it hides \cs{c@page} from the location escaping mechanism +(see \sectionref{sec:locationsyntax}). This means that the page +number may be incorrect if the indexing occurs during the output +routine. + +A more recent change to \sty{fmtcount} (v3.03) now puts three +instances of \cs{expandafter} before \verb|\the\value| which +no longer hides \cs{c@page} from the location escaping mechanism, so +the page numbers should once more be correct. Further changes +to the \sty{fmtcount} package may cause a problem again. + +\begin{important} +When dealing with custom formats where the internal definitions +are outside of your control and liable to change, it's best +to provide a wrapper command. +\end{important} + +Instead of directly using \cs{Numberstring} in the definition of +\cs{thepage}, I can provide a custom command in the same form +as the earlier \cs{tally} command: +\begin{verbatim} +\newcommand{\customfmt}[1]{\customfmtnum{\arabic{#1}}} +\newrobustcmd{\customfmtnum}[1]{\Numberstringnum{#1}} +\end{verbatim} +This ensures that the location will always be written to +the indexing file in the form: +\begin{alltt} +:locref "\glsopenbrace\glsclosebrace\glsopenbrace\string\\customfmtnum \marg{n}\glsclosebrace" +\end{alltt} +So the location class can be defined as: +\begin{verbatim} +\GlsAddXdyLocation{customfmt}{ + :sep "\string\customfmtnum\space\glsopenbrace" + "arabic-numbers" + :sep "\glsclosebrace"} +\end{verbatim} + +The sample file +\samplefile{xdy3} illustrates this. +\end{example} + +In the \gls{numberlist}, the locations are sorted according to the list +of provided location classes. The default ordering is: +\texttt{roman-page-numbers} (i, ii, \ldots), \texttt{arabic-page-numbers} +(1, 2, \ldots), \texttt{arabic-section-numbers} (for example, 1.1 if the +compositor is a full stop or 1-1 if the compositor is a +hyphen\footnote{see \ics{glsSetCompositor} described in +\sectionref{sec:setup}}), \texttt{alpha-page-numbers} (a, b, \ldots), +\texttt{Roman-page-numbers} (I, II, \ldots), \texttt{Alpha-page-numbers} +(A, B, \ldots), \texttt{Appendix-page-numbers} (for example, A.1 if the Alpha +compositor is a full stop or A-1 if the Alpha compositor is a +hyphen\footnote{see \ics{glsSetAlphaCompositor} described in +\sectionref{sec:setup}}), user defined location names (as specified +by \ics{GlsAddXdyLocation} in the order in which they were defined), +and finally \texttt{see} (cross-referenced entries).\footnote{With +\gls{glossaries-extra} \texttt{seealso} is appended to the end of +the list.} This ordering can be changed using: + +\begin{definition}[\DescribeMacro\GlsSetXdyLocationClassOrder] +\cs{GlsSetXdyLocationClassOrder}\marg{location names} +\end{definition} +where each location name is delimited by double quote marks and +separated by white space. For example: +\begin{verbatim} +\GlsSetXdyLocationClassOrder{ + "arabic-page-numbers" + "arabic-section-numbers" + "roman-page-numbers" + "Roman-page-numbers" + "alpha-page-numbers" + "Alpha-page-numbers" + "Appendix-page-numbers" + "see" +} +\end{verbatim} +(Remember to add \verb|"seealso"| if you're using +\gls{glossaries-extra}.) + +\begin{important} +Note that \cs{GlsSetXdyLocationClassOrder} has no effect if +\ics{noist} is used or if \ics{makeglossaries} is omitted. +\cs{GlsSetXdyLocationClassOrder} must be used before +\ics{makeglossaries}. +\end{important} + +If a \gls{numberlist} consists of a sequence of consecutive +numbers, the range will be concatenated. The +number of consecutive locations that causes a range formation +defaults to 2, but can be changed using: + +\begin{definition}[\DescribeMacro\GlsSetXdyMinRangeLength] +\cs{GlsSetXdyMinRangeLength}\marg{n} +\end{definition} +For example: +\begin{verbatim} +\GlsSetXdyMinRangeLength{3} +\end{verbatim} +The argument may also be the keyword \texttt{none}, to indicate that +there should be no range formations. See the \gls{xindy} +manual for further details on range formations. + +\begin{important} +Note that \cs{GlsSetXdyMinRangeLength} has no effect if \ics{noist} +is used or if \ics{makeglossaries} is omitted. +\cs{GlsSetXdyMinRangeLength} must be used before +\ics{makeglossaries}. +\end{important} +See also \sectionref{sec:ranges}. + +\section{Glossary Groups} +\label{sec:groups} + +The glossary is divided into groups according to the first +letter of the sort key. The \styfmt{glossaries} package also adds +a number group by default, unless you suppress it in the +\pkgopt{xindy} package option. For example: +\begin{verbatim} +\usepackage[xindy={glsnumbers=false}]{glossaries} +\end{verbatim} +Any entry that doesn't go in one of the letter groups or the +number group is placed in the default group. If you want \gls{xindy} +to sort the number group numerically (rather than by a string sort) +then you need to use \gls{xindy}['s] \texttt{numeric-sort} module: +\begin{verbatim} +\GlsAddXdyStyle{numeric-sort} +\end{verbatim} + +If you don't use \texttt{glsnumbers=false}, the default behaviour is to locate +the number group before the \qt{A} letter group. If you are not using a +Roman alphabet, you need to change this using: + + +\begin{definition}[\DescribeMacro\GlsSetXdyFirstLetterAfterDigits] +\cs{GlsSetXdyFirstLetterAfterDigits}\marg{letter} +\end{definition} +where \meta{letter} is the first letter of your alphabet. Take care +if you're using \sty{inputenc} as non-ASCII characters are actually +active characters that expand. (This isn't a problem with the native +UTF-8 engines and \sty{fontspec}.) The starred form will sanitize +the argument to prevent expansion. +Alternatively you can use: + + +\begin{definition}[\DescribeMacro\GlsSetXdyNumberGroupOrder] +\cs{GlsSetXdyNumberGroupOrder}\marg{relative location} +\end{definition} +to change the default +\begin{alltt} +:before \cs{string}"\meta{letter}\cs{string}" +\end{alltt} +to \meta{relative location}. For example: +\begin{verbatim} +\GlsSetXdyNumberGroupOrder{:after \string"Z\string"} +\end{verbatim} +will put the number group after the \qt{Z} letter group. +Again take care of active characters. There's a starred version +that sanitizes the argument (so don't use \cs{string} in it). +\begin{alltt} +\cs{GlsSetXdyNumberGroupOrder}*\{:after "\"O"\} +\end{alltt} + +\begin{important} +Note that these commands have no effect if +\ics{noist} is used or if \ics{makeglossaries} is omitted. +\cs{GlsSetXdyFirstLetterAfterDigits} must be used before +\ics{makeglossaries}.\par +\end{important} + + +\chapter{Defining New Glossaries} +\label{sec:newglossary} + +A new glossary can be defined using: +\begin{definition}[\DescribeMacro{\newglossary}] +\cs{newglossary}\oarg{log-ext}\marg{name}\marg{in-ext}\marg{out-ext}\linebreak\marg{title}\oarg{counter} +\end{definition} +where \meta{name} is the label to assign to this glossary. +The arguments \meta{in-ext} and \meta{out-ext} specify the extensions to +give to the input and output files for that glossary, \meta{title} +is the default title for this new glossary and the final optional +argument \meta{counter} specifies which counter to use for the +associated \glspl{numberlist} (see also +\sectionref{sec:numberlists}). The first optional argument specifies +the extension for the \gls{makeindex} (\opt2) or \gls{xindy} (\opt3) +transcript file (this information is only used by +\gls{makeglossaries} which picks up the information from the +auxiliary file). If you use \opt1, the \meta{log-ext}, +\meta{in-ext} and \meta{out-ext} arguments are ignored. + +\begin{important} +The glossary label \meta{name} must not contain any active +characters. It's generally best to stick with just characters that +have category code~11 (typically the non-extended \glspl{latinchar} +for standard \LaTeX). +\end{important} + +There is also a starred version (new to v4.08): +\begin{definition}[\DescribeMacro{\newglossary*}] +\cs{newglossary*}\marg{name}\marg{title}\oarg{counter} +\end{definition} +which is equivalent to +\begin{alltt} +\cs{newglossary}[\meta{name}-glg]\marg{name}\{\meta{name}-gls\}\{\meta{name}-glo\}\ifpdf\linebreak\fi\marg{title}\oarg{counter} +\end{alltt} +or you can also use: +\begin{definition}[\DescribeMacro{\altnewglossary}] +\cs{altnewglossary}\marg{name}\marg{tag}\marg{title}\oarg{counter} +\end{definition} +which is equivalent to +\begin{alltt} +\cs{newglossary}[\meta{tag}-glg]\marg{name}\{\meta{tag}-gls\}\{\meta{tag}-glo\}\marg{title}\oarg{counter} +\end{alltt} + +It may be that you have some terms that are so common +that they don't need to be listed. In this case, you can define +a~special type of glossary that doesn't create any associated files. +This is referred to as an \qt{ignored glossary} and it's ignored by +commands that iterate over all the glossaries, such as +\ics{printglossaries}. To define an ignored glossary, use +\begin{definition}[\DescribeMacro\newignoredglossary] +\cs{newignoredglossary}\marg{name} +\end{definition} +where \meta{name} is the name of the glossary (as above). This +glossary type will automatically be added to the +\pkgopt{nohypertypes} list, since there are no hypertargets for +the entries in an ignored glossary. +(The sample file \samplefile{-entryfmt} defines an ignored glossary.) + +You can test if a glossary is an ignored one using: +\begin{definition}[\DescribeMacro\ifignoredglossary] +\cs{ifignoredglossary}\marg{name}\marg{true}\marg{false} +\end{definition} +This does \meta{true} if \meta{name} was defined as an ignored +glossary, otherwise it does \meta{false}. + +Note that the main (default) glossary is automatically created as: +\begin{verbatim} +\newglossary{main}{gls}{glo}{\glossaryname} +\end{verbatim} +so it can be identified by the label \texttt{main} (unless the +\pkgopt{nomain} package option is used). Using the +\pkgopt{acronym} package option is equivalent to: +\begin{verbatim} +\newglossary[alg]{acronym}{acr}{acn}{\acronymname} +\end{verbatim} +so it can be identified by the label \texttt{acronym}. If you are +not sure whether the \pkgopt{acronym} option has been used, you +can identify the list of acronyms by the command +\DescribeMacro{\acronymtype}\cs{acronymtype} which is set to +\texttt{acronym}, if the \pkgopt{acronym} option has been used, +otherwise it is set to \texttt{main}. Note that if you are using +the main glossary as your list of acronyms, you need to declare +it as a list of acronyms using the package option +\pkgopt{acronymlists}. + +The \pkgopt{symbols} package option creates a new glossary with the +label \texttt{symbols} using: +\begin{verbatim} +\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname} +\end{verbatim} +The \pkgopt{numbers} package option creates a new glossary with +the label \texttt{numbers} using: +\begin{verbatim} +\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname} +\end{verbatim} +The \pkgopt{index} package option creates a new glossary with +the label \texttt{index} using: +\begin{verbatim} +\newglossary[ilg]{index}{ind}{idx}{\indexname} +\end{verbatim} + +\begin{important} +\optsand23: all glossaries must be defined before \ics{makeglossaries} to +ensure that the relevant output files are opened. + +See \sectionref{sec:fixednames} if you want to redefine \cs{glossaryname}, +especially if you are using \sty{babel} or \sty{translator}. +(Similarly for \cs{glssymbolsgroupname} and +\cs{glsnumbersgroupname}.) If you want to redefine \ics{indexname}, +just follow the advice in +\href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=fixnam}{How to +change LaTeX’s \qt{fixed names}}. +\end{important} + +\chapter{Acronyms and Other Abbreviations} +\label{sec:acronyms} + +The \sty{glossaries-extra} package provides superior +abbreviation handling. You may want to consider using that +package instead of the commands described here. + +\begin{important} +Note that although this chapter uses the term \qt{acronym}, you can also +use the commands described here for initialisms or contractions +(as in the case of some of the examples given below). +If the glossary title is no longer applicable (for example, it +should be \qt{Abbreviations} rather than \qt{Acronyms}) then +you can change the title either by redefining \ics{acronymname} (see +\sectionref{sec:languages}) or by using the \gloskey[printglossary]{title} +in the optional argument of \ics{printglossary} (or +\ics{printacronym}). Alternatively consider using the +\sty{glossaries-extra} package's \pkgoptfmt{abbreviations} +option instead. +\end{important} + +You may have noticed in \sectionref{sec:newglosentry} that when you +specify a new entry, you can specify alternate text to use when the +term is \glsd{firstuse} in the document. This provides a +useful means to define abbreviations. For convenience, the +\styfmt{glossaries} package defines the command: +\begin{definition}[\DescribeMacro{\newacronym}] +\cs{newacronym}\oarg{key-val list}\marg{label}\marg{abbrv}\marg{long} +\end{definition} + +This uses \ics{newglossaryentry} to create an entry with the given +label in the glossary given by \ics{acronymtype}. You can specify a +different glossary using the \gloskey{type} key within the optional +argument. The \cs{newacronym} command also uses the \gloskey{long}, +\gloskey{longplural}, \gloskey{short} and \gloskey{shortplural} keys +in \cs{newglossaryentry} to store the long and abbreviated forms and +their plurals. + +Note that the same restrictions on the entry \meta{label} +in \ics{newglossaryentry} also apply to \cs{newacronym} +(see \sectionref{sec:newglosentry}). + +\begin{important} +If you haven't identified the specified glossary type as a list of +acronyms (via the package option +\pkgopt{acronymlists} or the command \ics{DeclareAcronymList}, +see \sectionref{sec:pkgopts-acronym}) \cs{newacronym} will add it to +the list and \emph{reset the display style} for that glossary via +\ics{defglsentryfmt}. If you have a mixture of acronyms and regular +entries within the same glossary, care is needed if you want to +change the display style: you must first identify that glossary as a +list of acronyms and then use \ics{defglsentryfmt} (not redefine +\ics{glsentryfmt}) before defining your entries. +\end{important} + +The optional argument \marg{key-val list} allows you to specify +additional information. Any key that can be used in the second +argument of \ics{newglossaryentry} can also be used here in \meta{key-val +list}. +For example, \gloskey{description} (when used with one of the styles that +require a description, described in +\sectionref{sec:setacronymstyle}) or you can +override plural forms of \meta{abbrv} or \meta{long} using the +\gloskey{shortplural} or \gloskey{longplural} keys. +For example: +\begin{verbatim} +\newacronym[longplural={diagonal matrices}]% + {dm}{DM}{diagonal matrix} +\end{verbatim} +If the \firstuse\ uses the plural form, \verb|\glspl{dm}| will +display: diagonal matrices (DMs). If you want to use +the \gloskey{longplural} or \gloskey{shortplural} keys, I recommend +you use \ics{setacronymstyle} to set the display style rather than +using one of the pre-version 4.02 acronym styles. + +As with \gloskey{plural} and \gloskey{firstplural}, if +\gloskey{longplural} is missing, it's obtained by appended +\ics{glspluralsuffix} to the singular form. The short plural +\gloskey{shortplural} is obtained (is not explicitly set) by appending +\ics{glsacrpluralsuffix} to the short form. These commands may be +changed by the associated language files, but they can't be added to +the usual caption hooks as there's no guarantee when they'll be +expanded (as \hyperref[pluralsuffix]{discussed earlier}). +A different approach is used by \styfmt{glossaries-extra}, which has +category attributes to determine whether or not to append a suffix +when forming the default value of \gloskey{shortplural}. + +Since \ics{newacronym} uses \ics{newglossaryentry}, you can use +commands like \ics{gls} and \ics{glsreset} as with any other +glossary entry. + +\begin{important} +Since \cs{newacronym} sets \verb|type=\acronymtype|, +if you want to load a file containing acronym definitions using +\ics{loadglsentries}\oarg{type}\marg{filename}, the optional argument +\meta{type} will not have an effect unless you explicitly set the +type as \verb|type=\glsdefaulttype| in the optional argument to +\ics{newacronym}. See \sectionref{sec:loadglsentries}. +\end{important} + +\begin{example}{Defining an Abbreviation}{ex:newacronym} +The following defines the abbreviation IDN: +\begin{verbatim} +\newacronym{idn}{IDN}{identification number} +\end{verbatim} +\verb|\gls{idn}| will produce \qt{identification number (IDN)} on +\firstuse\ and \qt{IDN} on subsequent uses. If you want to use one +of the smallcaps acronym styles, described in +\sectionref{sec:setacronymstyle}, you need to use lower case +characters for the shortened form: +\begin{verbatim} +\newacronym{idn}{idn}{identification number} +\end{verbatim} +Now \verb|\gls{idn}| will produce \qt{identification number +(\textsc{idn})} on \firstuse\ and \qt{\textsc{idn}} on subsequent +uses. +\end{example} + +\begin{important} +Avoid nested definitions. +\end{important} + +Recall from the warning in +\sectionref{sec:newglosentry} that you should avoid using +the \glslike\ and \glstextlike\ commands within the value of +keys like \gloskey{text} and \gloskey{first} due to complications +arising from nested links. The same applies to abbreviations +defined using \cs{newacronym}. + +For example, suppose you have defined: +\begin{verbatim} +\newacronym{ssi}{SSI}{server side includes} +\newacronym{html}{HTML}{hypertext markup language} +\end{verbatim} +you may be tempted to do: +\begin{verbatim} +\newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}} +\end{verbatim} +\textbf{Don't!} This will break the case-changing commands, such +as \ics{Gls}, it will cause inconsistencies on \firstuse, and, +if hyperlinks are enabled, will cause nested hyperlinks. It will +also confuse the commands used by the entry formatting (such as +\ics{glslabel}). + +Instead, consider doing: +\begin{verbatim} +\newacronym + [description={\gls{ssi} enabled \gls{html}}] + {shtml}{SHTML}{SSI enabled HTML} +\end{verbatim} +or +\begin{verbatim} +\newacronym + [description={\gls{ssi} enabled \gls{html}}] + {shtml}{SHTML} + {server side includes enabled hypertext markup language} +\end{verbatim} +Similarly for the \glstextlike\ commands. + +Other approaches are available with \sty{glossaries-extra}. +See the section \qt{Nested Links} in the \styfmt{glossaries-extra} +user manual. + +\begin{important} +The commands described below are similar to the \glstextlike\ +commands in that they don't modify the \firstuseflag. +However, their display is governed by \ics{defentryfmt} with +\ics{glscustomtext} set as appropriate. All caveats that apply to +the \glstextlike\ commands also apply to the following commands. +(Including the warning immediately above this box.) +\end{important} + +The optional arguments are the same as those for the \glstextlike\ +commands, and there are similar star and plus variants that switch +off or on the hyperlinks. As with the \glstextlike\ commands, the +\gls{linktext} is placed in the argument of \ics{glstextformat}. + +\begin{definition}[\DescribeMacro{\acrshort}] +\cs{acrshort}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This sets the \gls{linktext} to the short form (within the argument +of \ics{acronymfont}) for the entry given by \meta{label}. The short +form is as supplied by the \gloskey{short} key, which +\ics{newacronym} implicitly sets. + +There are also analogous upper case variants: +\begin{definition}[\DescribeMacro{\Acrshort}] +\cs{Acrshort}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\ACRshort}] +\cs{ACRshort}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +There are also plural versions: +\begin{definition}[\DescribeMacro\acrshortpl] +\cs{acrshortpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\Acrshortpl] +\cs{Acrshortpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\ACRshortpl] +\cs{ACRshortpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +The short plural form is as supplied +by the \gloskey{shortplural} key, which \ics{newacronym} implicitly sets. + +\begin{definition}[\DescribeMacro{\acrlong}] +\cs{acrlong}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This sets the \gls{linktext} to the long form for the entry given by +\meta{label}. The long form is as supplied +by the \gloskey{long} key, which \ics{newacronym} implicitly sets. + +There are also analogous upper case variants: +\begin{definition}[\DescribeMacro{\Acrlong}] +\cs{Acrlong}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\ACRlong}] +\cs{ACRlong}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +Again there are also plural versions: +\begin{definition}[\DescribeMacro{\acrlongpl}] +\cs{acrlongpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\Acrlongpl}] +\cs{Acrlongpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\ACRlongpl}] +\cs{ACRlongpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +The long plural form is as supplied by the \gloskey{longplural} key, +which \ics{newacronym} implicitly sets. + +The commands below display the full form of the acronym, but note +that this isn't necessarily the same as the form used on \firstuse. +These full-form commands are shortcuts that use the above commands, +rather than creating the \gls{linktext} from the complete full form. +These full-form commands have star and plus variants and optional +arguments that are passed to the above commands. + +\begin{definition}[\DescribeMacro{\acrfull}] +\cs{acrfull}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This is a shortcut for +\begin{definition}[\DescribeMacro{\acrfullfmt}] +\cs{acrfullfmt}\marg{options}\marg{label}\marg{insert} +\end{definition} +which by default does +\begin{alltt} +\cs{acrfullformat} + \{\cs{acrlong}\oarg{options}\marg{label}\marg{insert}\} + \{\cs{acrshort}\oarg{options}\marg{label}\} +\end{alltt} +where +\begin{definition}[\DescribeMacro\acrfullformat] +\cs{acrfullformat}\marg{long}\marg{short} +\end{definition} +by default does \meta{long} (\meta{short}). This command is now +deprecated for new acronym styles but is used by the default for +backward compatibility if \cs{setacronymstyle} +(\sectionref{sec:setacronymstyle}) hasn't been used. (For further +details of these format commands see \ifpdf +section~\ref*{sec:code:acronym} in \fi the documented code, +\texttt{glossaries-code.pdf}.) + +There are also analogous upper case variants: +\begin{definition}[\DescribeMacro{\Acrfull}] +\cs{Acrfull}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro{\ACRfull}] +\cs{ACRfull}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +and plural versions: +\begin{definition}[\DescribeMacro\acrfullpl] +\cs{acrfullpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\Acrfullpl] +\cs{Acrfullpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +\begin{definition}[\DescribeMacro\ACRfullpl] +\cs{ACRfullpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} + +If you find the above commands too cumbersome to write, you can use +the \pkgopt{shortcuts} package option to activate the shorter +command names listed in \tableref{tab:shortcuts}. + +\begin{table}[htbp] +\caption{Synonyms provided by the package option \pkgoptfmt{shortcuts}} +\label{tab:shortcuts} +\vskip\baselineskip +\centering +\begin{tabular}{ll} +\bfseries Shortcut Command & \bfseries Equivalent Command\\ +\ics{acs} & \ics{acrshort}\\ +\ics{Acs} & \ics{Acrshort}\\ +\ics{acsp} & \ics{acrshortpl}\\ +\ics{Acsp} & \ics{Acrshortpl}\\ +\ics{acl} & \ics{acrlong}\\ +\ics{Acl} & \ics{Acrlong}\\ +\ics{aclp} & \ics{acrlongpl}\\ +\ics{Aclp} & \ics{Acrlongpl}\\ +\ics{acf} & \ics{acrfull}\\ +\ics{Acf} & \ics{Acrfull}\\ +\ics{acfp} & \ics{acrfullpl}\\ +\ics{Acfp} & \ics{Acrfullpl}\\ +\ics{ac} & \ics{gls}\\ +\ics{Ac} & \ics{Gls}\\ +\ics{acp} & \ics{glspl}\\ +\ics{Acp} & \ics{Glspl} +\end{tabular} +\end{table} + +It is also possible to access the long and short forms without +adding information to the glossary using commands analogous to +\ics{glsentrytext} (described in \sectionref{sec:glsnolink}). + +\begin{important} +The commands that convert the first letter to upper case come with +the same caveats as those for analogous commands like +\ics{Glsentrytext} (non-expandable, can't be used in PDF bookmarks, +care needs to be taken if the first letter is an accented character +etc). See \sectionref{sec:glsnolink}. +\end{important} + +The long form can be accessed using: +\begin{definition}[\DescribeMacro{\glsentrylong}] +\cs{glsentrylong}\marg{label} +\end{definition} +or, with the first letter converted to upper case: +\begin{definition}[\DescribeMacro{\Glsentrylong}] +\cs{Glsentrylong}\marg{label} +\end{definition} +Plural forms: +\begin{definition}[\DescribeMacro{\glsentrylongpl}] +\cs{glsentrylongpl}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentrylongpl}] +\cs{Glsentrylongpl}\marg{label} +\end{definition} + +Similarly, to access the short form: +\begin{definition}[\DescribeMacro{\glsentryshort}] +\cs{glsentryshort}\marg{label} +\end{definition} +or, with the first letter converted to upper case: +\begin{definition}[\DescribeMacro{\Glsentryshort}] +\cs{Glsentryshort}\marg{label} +\end{definition} +Plural forms: +\begin{definition}[\DescribeMacro{\glsentryshortpl}] +\cs{glsentryshortpl}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryshortpl}] +\cs{Glsentryshortpl}\marg{label} +\end{definition} + +And the full form can be obtained using: +\begin{definition}[\DescribeMacro{\glsentryfull}] +\cs{glsentryfull}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryfull}] +\cs{Glsentryfull}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glsentryfullpl}] +\cs{glsentryfullpl}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\Glsentryfullpl}] +\cs{Glsentryfullpl}\marg{label} +\end{definition} +These again use \ics{acrfullformat} by default, but +the new styles described in the section below use different +formatting commands. + +\section{Changing the Abbreviation Style} +\label{sec:setacronymstyle} + +It may be that the default style doesn't suit your requirements in +which case you can switch to another style using +\begin{definition}[\DescribeMacro{\setacronymstyle}] +\cs{setacronymstyle}\marg{style name} +\end{definition} +where \meta{style name} is the name of the required style. + +\begin{important} +You must use \cs{setacronymstyle} \emph{before} you define the +acronyms with \cs{newacronym}. +\end{important} + +For example: +\begin{verbatim} +\usepackage[acronym]{glossaries} + +\makeglossaries + +\setacronymstyle{long-sc-short} + +\newacronym{html}{html}{hypertext markup language} +\newacronym{xml}{xml}{extensible markup language} +\end{verbatim} +Unpredictable results can occur if you try to use multiple styles. + +\begin{important} +If you need multiple abbreviation styles, then try +using the \gls{glossaries-extra} package, which has better +abbreviation management. +\end{important} + +Note that unlike the default behaviour of \cs{newacronym}, the +styles used via \cs{setacronymstyle} don't use the \gloskey{first} +or \gloskey{text} keys, but instead they use \ics{defglsentryfmt} to +set a~custom format that uses the \gloskey{long} and \gloskey{short} +keys (or their plural equivalents). This means that these styles +cope better with plurals that aren't formed by simply appending the +singular form with the letter \qt{s}. In fact, most of the predefined +styles use \ics{glsgenacfmt} and modify the definitions of commands +like \ics{genacrfullformat}. + +Note that when you use \cs{setacronymstyle} the \gloskey{name} key +is set to +\begin{definition}[\DescribeMacro{\acronymentry}] +\cs{acronymentry}\marg{label} +\end{definition} +and the \gloskey{sort} key is set to +\begin{definition}[\DescribeMacro{\acronymsort}] +\cs{acronymsort}\marg{short}\marg{long} +\end{definition} +These commands are redefined by the acronym styles. However, you can +redefine them again after the style has been set but before you use +\cs{newacronym}. Protected expansion is performed on \cs{acronymsort} +when the entry is defined. + +\subsection{Predefined Acronym Styles} +\label{sec:predefinedacrstyles} + +The \styfmt{glossaries} package provides a~number of predefined +styles. These styles apply +\begin{definition}[\DescribeMacro{\firstacronymfont}] +\cs{firstacronymfont}\marg{text} +\end{definition} +to the short form on first use and +\begin{definition}[\DescribeMacro{\acronymfont}] +\cs{acronymfont}\marg{text} +\end{definition} +on subsequent use. The styles modify the definition of +\cs{acronymfont} as required, but \ics{firstacronymfont} is only set +once by the package when it's loaded. By default +\ics{firstacronymfont}\marg{text} is the same as +\ics{acronymfont}\marg{text}. +If you want the short form displayed differently on first use, you +can redefine \ics{firstacronymfont} independently of the acronym +style. + +The predefined styles that contain \texttt{sc} in their name (for +example \acrstyle{long-sc-short}) redefine \cs{acronymfont} to use +\ics{textsc}, which means that the short form needs to be specified +in lower case. \ifpdf Remember that \verb|\textsc{abc}| produces +\textsc{abc} but \verb|\textsc{ABC}| produces \textsc{ABC}.\fi + +\hypertarget{boldsc}{}% +\begin{important}% +Some fonts don't support bold smallcaps, so you may need to redefine +\ics{glsnamefont} (see \sectionref{sec:printglossary}) to switch to +medium weight if you are using a glossary style that displays entry +names in bold and you have chosen an acronym style that uses +\ics{textsc}. +\end{important} + +The predefined styles that contain \texttt{sm} in their name +(for example \acrstyle{long-sm-short}) redefine \cs{acronymfont} to +use \ics{textsmaller}. + +\hypertarget{smaller}{}% +\begin{important} +Note that the \styfmt{glossaries} package doesn't define or load any package that +defines \ics{textsmaller}. If you use one of the acronym styles that +set \ics{acronymfont} to \cs{textsmaller} you must +explicitly load the \sty{relsize} package or otherwise define +\cs{textsmaller}. +\end{important} + +The remaining predefined styles redefine \cs{acronymfont}\marg{text} +to simply do its argument \meta{text}. + +\begin{important} +In most cases, the predefined styles adjust \ics{acrfull} and +\ics{glsentryfull} (and their plural and upper case variants) to +reflect the style. The only exceptions to this are the +\acrstyle{dua} and \acrstyle{footnote} styles (and their variants). +\end{important} + +The following styles are supplied by the \styfmt{glossaries} +package: +\begin{itemize} +\item \acrstyle{long-short}, \acrstyle{long-sc-short}, +\acrstyle{long-sm-short}, \acrstyle{long-sp-short}: + +With these three styles, acronyms are displayed in the form +\begin{definition} +\meta{long} (\ics{firstacronymfont}\marg{short}) +\end{definition} +on first use and +\begin{definition} +\ics{acronymfont}\marg{short} +\end{definition} +on subsequent use. +They also set \cs{acronymsort}\marg{short}\marg{long} to just +\meta{short}. This means that the acronyms are sorted according to +their short form. In addition, \cs{acronymentry}\marg{label} is set +to just the short form (enclosed in \cs{acronymfont}) and the +\gloskey{description} key is set to the long form. + +The \acrstyle{long-sp-short} style was introduced in version~4.16 +and uses +\begin{definition}[\DescribeMacro\glsacspace] +\cs{glsacspace}\marg{label} +\end{definition} +for the space between the long and short forms. This defaults to +a~non-breakable space (\verb|~|) if +(\cs{acronymfont}\marg{short}) is less than 3em, otherwise it uses +a~normal space. This may be redefined as required. For example, to +always use a~non-breakable space: +\begin{verbatim} +\renewcommand*{\glsacspace}[1]{~} +\end{verbatim} + +\item \acrstyle{short-long}, \acrstyle{sc-short-long}, +\acrstyle{sm-short-long}: + +These three styles are analogous to the above three styles, except +the display order is swapped to +\begin{definition} +\ics{firstacronymfont}\marg{short} (\meta{long}) +\end{definition} +on first use. + +Note, however, that \ics{acronymsort} and \ics{acronymentry} are the +same as for the \meta{long} (\meta{short}) styles above, so the +acronyms are still sorted according to the short form. + +\item \acrstyle{long-short-desc}, \acrstyle{long-sc-short-desc}, +\acrstyle{long-sm-short-desc}, \acrstyle{long-sp-short-desc}: + +These are like the \acrstyle{long-short}, \acrstyle{long-sc-short}, +\acrstyle{long-sm-short} and \acrstyle{long-sp-short} styles described above, except that the +\gloskey{description} key must be supplied in the optional argument +of \ics{newacronym}. They also redefine \ics{acronymentry} to +\marg{long} (\cs{acronymfont}\marg{short}) and redefine +\ics{acronymsort}\marg{short}\marg{long} to just \meta{long}. +This means that the acronyms are sorted according to the long form, +and in the list of acronyms the name field has the long form +followed by the short form in parentheses. I~recommend you use +a~glossary style such as \glostyle{altlist} with these acronym +styles to allow for the long name field. + +\item \acrstyle{short-long-desc}, \acrstyle{sc-short-long-desc}, +\acrstyle{sm-short-long-desc}: + +These styles are analogous to the above three styles, but the first +use display style is: +\begin{definition} +\cs{firstacronymfont}\marg{short} (\meta{long}) +\end{definition} +The definitions of \cs{acronymsort} and \cs{acronymentry} are the +same as those for \acrstyle{long-short-desc} etc. + +\item \acrstyle{dua}, \acrstyle{dua-desc}: + +With these styles, the \glslike\ commands always display the long form +regardless of whether the entry has been used or not. However, \ics{acrfull} +and \ics{glsentryfull} will display \meta{long} (\cs{acronymfont}\marg{short}). In the case +of \acrstyle{dua}, the \gloskey{name} and \gloskey{sort} keys are set to +the short form and the description is set to the long form. In the +case of \acrstyle{dua-desc}, the \gloskey{name} and \gloskey{sort} +keys are set to the long form and the description is supplied in the +optional argument of \ics{newacronym}. + +\item \acrstyle{footnote}, \acrstyle{footnote-sc}, +\acrstyle{footnote-sm}: + +With these three styles, on first use the \glslike\ commands display: +\begin{definition} +\cs{firstacronymfont}\marg{short}\ics{footnote}\marg{long} +\end{definition} +However, \ics{acrfull} and \ics{glsentryfull} are set to +\cs{acronymfont}\marg{short} (\meta{long}). On subsequent use the display is: +\begin{definition} +\cs{acronymfont}\marg{short} +\end{definition} +The \gloskey{sort} and \gloskey{name} keys are set to +the short form, and the \gloskey{description} is set to the long +form. + +\begin{important} +In order to avoid nested hyperlinks on \firstuse\ the footnote +styles automatically implement \pkgopt[false]{hyperfirst} for the +acronym lists. +\end{important} + +\item \acrstyle{footnote-desc}, \acrstyle{footnote-sc-desc}, +\acrstyle{footnote-sm-desc}: + +These three styles are similar to the previous three styles, but the +description has to be supplied in the optional argument of +\ics{newacronym}. The \gloskey{name} key is set to the long form +followed by the short form in parentheses and the \gloskey{sort} key +is set to the long form. This means that the acronyms will be sorted +according to the long form. In addition, since the \gloskey{name} +will typically be quite wide it's best to choose a glossary style +that can accommodate this, such as \glostyle{altlist}. + +\end{itemize} + +\begin{example}{Adapting a Predefined Acronym Style}{ex:acrstyle} +Suppose I~want to use the \acrstyle{footnote-sc-desc} style, but +I~want the \gloskey{name} key set to the short form followed by the +long form in parentheses and the \gloskey{sort} key set to the short +form. Then I need to specify the \acrstyle{footnote-sc-desc} style: +\begin{verbatim} +\setacronymstyle{footnote-sc-desc} +\end{verbatim} +and then redefine \ics{acronymsort} and \ics{acronymentry}: +\begin{verbatim} +\renewcommand*{\acronymsort}[2]{#1}% sort by short form +\renewcommand*{\acronymentry}[1]{% + \acronymfont{\glsentryshort{#1}}\space (\glsentrylong{#1})}% +\end{verbatim} +(I've used \cs{space} for extra clarity, but you can just use an +actual space instead.) + +Since the default Computer Modern fonts don't support bold +smallcaps, I'm also going to redefine \ics{acronymfont} so that it +always switches to medium weight to ensure the smallcaps setting is +used: +\begin{verbatim} +\renewcommand*{\acronymfont}[1]{\textmd{\scshape #1}} +\end{verbatim} +This isn't necessary if you use a font that supports bold smallcaps. + +The sample file \samplefile{FnAcrDesc} illustrates this +example. +\end{example} + +\subsection{Defining A Custom Acronym Style} +\label{sec:customacronym} + +You may find that the predefined acronyms styles that come with the +\styfmt{glossaries} package don't suit your requirements. In this +case you can define your own style using: +\begin{definition}[\DescribeMacro{\newacronymstyle}] +\cs{newacronymstyle}\marg{style name}\marg{display}\marg{definitions} +\end{definition} +where \meta{style name} is the name of the new style (avoid active +characters). The second argument, \meta{display}, is equivalent to +the mandatory argument of \ics{defglsentryfmt}. You can simply use +\ics{glsgenacfmt} or you can customize the display using commands +like \ics{ifglsused}, \ics{glsifplural} and \ics{glscapscase}. +(See \sectionref{sec:glsdisplay} for further details.) +If the style is likely to be used with a mixed glossary (that is entries in +that glossary are defined both with \ics{newacronym} and +\ics{newglossaryentry}) then you can test if the entry is an acronym +and use \ics{glsgenacfmt} if it is or \ics{glsgenentryfmt} if it +isn't. For example, the \acrstyle{long-short} style sets +\meta{display} as +\begin{verbatim} +\ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +\end{verbatim} +(You can use \ics{ifglshasshort} instead of \ics{ifglshaslong} to +test if the entry is an acronym if you prefer.) + +The third argument, \meta{definitions}, can be used to redefine the +commands that affect the display style, such as \ics{acronymfont} +or, if \meta{display} uses \cs{glsgenacfmt}, \ics{genacrfullformat} +and its variants. + +Note that \ics{setacronymstyle} redefines \ics{glsentryfull} and +\ics{acrfullfmt} to use \ics{genacrfullformat} (and similarly for +the plural and upper case variants). If this isn't appropriate for the +style (as in the case of styles like \acrstyle{footnote} and +\acrstyle{dua}) \cs{newacronymstyle} should redefine these commands +within \meta{definitions}. + + +Within \cs{newacronymstyle}'s \meta{definitions} argument you +can also redefine +\begin{definition}[\DescribeMacro{\GenericAcronymFields}] +\cs{GenericAcronymFields} +\end{definition} +This is a list of additional fields to be set in \ics{newacronym}. +You can use the following token registers to access the entry label, +long form and short form: \DescribeMacro{\glslabeltok}\cs{glslabeltok}, +\DescribeMacro{\glslongtok}\cs{glslongtok} and +\DescribeMacro{\glsshorttok}\cs{glsshorttok}. As with all \TeX\ +registers, you can access their values by preceding the register +with \ics{the}. For example, the \acrstyle{long-short} style does: +\begin{verbatim} +\renewcommand*{\GenericAcronymFields}{% + description={\the\glslongtok}}% +\end{verbatim} +which sets the \gloskey{description} field to the long form of the +acronym whereas the \acrstyle{long-short-desc} style does: +\begin{verbatim} +\renewcommand*{\GenericAcronymFields}{}% +\end{verbatim} +since the description needs to be specified by the user. + +It may be that you want to define a new acronym style that's based +on an existing style. Within \meta{display} you can use +\begin{definition}[\DescribeMacro\GlsUseAcrEntryDispStyle] +\cs{GlsUseAcrEntryDispStyle}\marg{style name} +\end{definition} +to use the \meta{display} definition from the style given by +\meta{style name}. Within \meta{definitions} you can use +\begin{definition}[\DescribeMacro{\GlsUseAcrStyleDefs}] +\cs{GlsUseAcrStyleDefs}\marg{style name} +\end{definition} +to use the \meta{definitions} from the style given by \meta{style +name}. For example, the \acrstyle{long-sc-short} acronym style is +based on the \acrstyle{long-short} style with minor +modifications (remember to use \verb|##| instead of \verb|#| within +\meta{definitions}): +\begin{verbatim} +\newacronymstyle{long-sc-short}% +{% use the same display as "long-short" + \GlsUseAcrEntryDispStyle{long-short}% +}% +{% use the same definitions as "long-short" + \GlsUseAcrStyleDefs{long-short}% + % Minor modifications: + \renewcommand{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% +} +\end{verbatim} +(\DescribeMacro{\glstextup}\cs{glstextup} is used to cancel the effect +of \ics{textsc}. This defaults to \ics{textulc}, if defined, +otherwise \ics{textup}. For example, the plural of \textsc{svm} +should be rendered as \textsc{svm}s rather than \textsc{svms}.) + +\begin{example}{Defining a Custom Acronym Style}{ex:customacrstyle} +Suppose I want my acronym on \firstuse\ to have the +short form in the text and the long form with the description in a +footnote. Suppose also that I want the short form to be put in small +caps in the main body of the document, but I want it in normal +capitals in the list of acronyms. In my list of acronyms, I want the +long form as the name with the short form in brackets followed by +the description. That is, in the text I want \ics{gls} on \gls{firstuse} +to display: +\begin{display} +\ics{textsc}\marg{abbrv}\cs{footnote}"{"\meta{long}: \meta{description}"}" +\end{display} +on subsequent use: +\begin{display} +\ics{textsc}\marg{abbrv} +\end{display} +and in the list of acronyms, each entry will be displayed in the +form: +\begin{display} +\meta{long} (\meta{short}) \meta{description} +\end{display} + +Let's suppose it's possible that I may have a mixed glossary. I can +check this in the second argument of \ics{newacronymstyle} using: +\begin{verbatim} +\ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +\end{verbatim} +This will use \ics{glsgenentryfmt} if the entry isn't an acronym, +otherwise it will use \ics{glsgenacfmt}. The third argument +(\meta{definitions}) of +\ics{newacronymstyle} needs to redefine \ics{genacrfullformat} etc +so that the \firstuse\ displays the short form in the text with the +long form in a footnote followed by the description. This is done as +follows (remember to use \verb|##| instead of \verb|#|): +\begin{verbatim} + % No case change, singular first use: + \renewcommand*{\genacrfullformat}[2]{% + \firstacronymfont{\glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + % First letter upper case, singular first use: + \renewcommand*{\Genacrfullformat}[2]{% + \firstacronymfont{\Glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + % No case change, plural first use: + \renewcommand*{\genplacrfullformat}[2]{% + \firstacronymfont{\glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + % First letter upper case, plural first use: + \renewcommand*{\Genplacrfullformat}[2]{% + \firstacronymfont{\Glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% +\end{verbatim} +If you think it inappropriate for the short form to be capitalised +at the start of a sentence you can change the above to: +\begin{verbatim} + % No case change, singular first use: + \renewcommand*{\genacrfullformat}[2]{% + \firstacronymfont{\glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + % No case change, plural first use: + \renewcommand*{\genplacrfullformat}[2]{% + \firstacronymfont{\glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + \let\Genacrfullformat\genacrfullformat + \let\Genplacrfullformat\genplacrfullformat +\end{verbatim} +Another variation is to use \ics{Glsentrylong} and +\ics{Glsentrylongpl} in the footnote instead of \ics{glsentrylong} and +\ics{glsentrylongpl}. + +Now let's suppose that commands such as \ics{glsentryfull} and +\ics{acrfull} shouldn't +use a~footnote, but instead use the format: \meta{long} +(\meta{short}). +This means that the style needs to redefine \cs{glsentryfull}, +\ics{acrfullfmt} and their plural and upper case variants. + +First, the non-linking commands: +\begin{verbatim} + \renewcommand*{\glsentryfull}[1]{% + \glsentrylong{##1}\space + (\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Glsentryfull}[1]{% + \Glsentrylong{##1}\space + (\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\glsentryfullpl}[1]{% + \glsentrylongpl{##1}\space + (\acronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Glsentryfullpl}[1]{% + \Glsentrylongpl{##1}\space + (\acronymfont{\glsentryshortpl{##1}})% + }% +\end{verbatim} +Now for the linking commands: +\begin{verbatim} + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + }% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + }% +\end{verbatim} +(This may cause problems with long hyperlinks, in which case adjust +the definitions so that, for example, only the short form is inside +the argument of \ics{glslink}.) + +The style also needs to redefine \ics{acronymsort} so that the +acronyms are sorted according to the long form: +\begin{verbatim} + \renewcommand*{\acronymsort}[2]{##2}% +\end{verbatim} +If you prefer them to be sorted according to the short form you can +change the above to: +\begin{verbatim} + \renewcommand*{\acronymsort}[2]{##1}% +\end{verbatim} +The acronym font needs to be set to \ics{textsc} and the plural +suffix adjusted so that the \qt{s} suffix in the plural short form +doesn't get converted to smallcaps: +\begin{verbatim} + \renewcommand*{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% +\end{verbatim} +There are a number of ways of dealing with the format in the list of +acronyms. The simplest way is to redefine \ics{acronymentry} to the +long form followed by the upper case short form in parentheses: +\begin{verbatim} + \renewcommand*{\acronymentry}[1]{% + \Glsentrylong{##1}\space + (\MakeTextUppercase{\glsentryshort{##1}})}% +\end{verbatim} +(I've used \ics{Glsentrylong} instead of \ics{glsentrylong} to +capitalise the name in the glossary.) + +An alternative approach is to set \ics{acronymentry} to just the +long form and redefine \ics{GenericAcronymFields} to set the +\gloskey{symbol} key to the short form and use a glossary style that +displays the symbol in parentheses after the \gloskey{name} (such as +the \glostyle{tree} style) like this: +\begin{verbatim} + \renewcommand*{\acronymentry}[1]{\Glsentrylong{##1}}% + \renewcommand*{\GenericAcronymFields}{% + symbol={\protect\MakeTextUppercase{\the\glsshorttok}}}% +\end{verbatim} +I'm going to use the first approach and set +\ics{GenericAcronymFields} to do nothing: +\begin{verbatim} + \renewcommand*{\GenericAcronymFields}{}% +\end{verbatim} + +Finally, this style needs to switch off hyperlinks on first use to +avoid nested links: +\begin{verbatim} + \glshyperfirstfalse +\end{verbatim} +Putting this all together: +\begin{verbatim} +\newacronymstyle{custom-fn}% new style name +{% + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{}% + \glshyperfirstfalse + \renewcommand*{\genacrfullformat}[2]{% + \firstacronymfont{\glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \firstacronymfont{\Glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \firstacronymfont{\glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \firstacronymfont{\Glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\glsentryfull}[1]{% + \glsentrylong{##1}\space + (\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Glsentryfull}[1]{% + \Glsentrylong{##1}\space + (\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\glsentryfullpl}[1]{% + \glsentrylongpl{##1}\space + (\acronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Glsentryfullpl}[1]{% + \Glsentrylongpl{##1}\space + (\acronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + }% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + }% + \renewcommand*{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \Glsentrylong{##1}\space + (\MakeTextUppercase{\glsentryshort{##1}})}% +} +\end{verbatim} + +Now I need to specify that I want to use this new style: +\begin{verbatim} +\setacronymstyle{custom-fn} +\end{verbatim} +I also need to use a glossary style that suits this acronym style, +for example \glostyle{altlist}: +\begin{verbatim} +\setglossarystyle{altlist} +\end{verbatim} + +Once the acronym style has been set, I can define my acronyms: +\begin{verbatim} +\newacronym[description={set of tags for use in +developing hypertext documents}]{html}{html}{Hyper +Text Markup Language} + +\newacronym[description={language used to describe the +layout of a document written in a markup language}]{css} +{css}{Cascading Style Sheet} +\end{verbatim} + +The sample file \samplefile{-custom-acronym} illustrates this +example. +\end{example} + +\begin{example}{Italic and Upright Abbreviations}{ex:font-abbr} +Suppose I~want to have some abbreviations in italic and some that +just use the surrounding font. Hard-coding this into the +\meta{short} argument of \cs{newacronym} can cause complications. + +This example uses \ics{glsaddstoragekey} to add an extra field that +can be used to store the formatting declaration (such as \cs{em}). +\begin{verbatim} +\glsaddstoragekey{font}{}{\entryfont} +\end{verbatim} +This defines a~new field/key called \texttt{font}, which defaults to +nothing if it's not explicitly set. This also defines a command +called \cs{entryfont} that's analogous to \cs{glsentrytext}. A~new +style is then created to format abbreviations that access this field. + +There are two ways to do this. The first is to create a style that +doesn't use \ics{glsgenacfmt} but instead provides a~modified +version that doesn't use \cs{acronymfont}\marg{short} +but instead uses +\verb|{|\cs{entryfont}\verb|{\glslabel}|\meta{short}\verb|}|. +The full format given by commands such as \cs{genacrfullformat} +need to be similarly adjusted. For example: +\begin{verbatim} + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% +\end{verbatim} +This will deal with commands like \ics{gls} but not commands like +\ics{acrshort} which still use \ics{acronymfont}. Another approach +is to redefine \cs{acronymfont} to look up the required font +declaration. Since \cs{acronymfont} doesn't take the entry label as +an argument, the following will only work if \cs{acronymfont} is +used in a~context where the label is provided by \ics{glslabel}. +This is true in \cs{gls}, \cs{acrshort} and \cs{acrfull}. The +redefinition is now: +\begin{verbatim} +\renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}#1}}% +\end{verbatim} +So the new style can be defined as: +\begin{verbatim} +\newacronymstyle{long-font-short} +{% + \GlsUseAcrEntryDispStyle{long-short}% +} +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}% + \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}% +} +\end{verbatim} +Remember the style needs to be set before defining the entries: +\begin{verbatim} +\setacronymstyle{long-font-short} +\end{verbatim} + +The complete document is contained in the sample file +\samplefile{-font-abbr}. +\end{example} + +Some writers and publishing houses have started to drop full stops +(periods) from upper case initials but may still retain them for +lower case abbreviations, while others may still use them for both +upper and lower case. This can cause complications. Chapter~12 of +\emph{The \TeX{}book} discusses the spacing between words but, +briefly, the default behaviour of \TeX\ is to assume that an upper +case character followed by a~full stop and space is an abbreviation, +so the space is the default inter-word space whereas a~lower case +character followed by a~full stop and space is a word occurring at +the end of a~sentence. In the event that this isn't true, you need +to make a~manual adjustment using \verb*| | (back slash space) in +place of just a~space character for an inter-word mid-sentence space +and use \verb|\@| before the full stop to indicate the end of the +sentence. + +For example: +\begin{verbatim} +I was awarded a B.Sc. and a Ph.D. (From the same place.) +\end{verbatim} +is typeset as +\begin{display} +I was awarded a B.Sc. and a Ph.D. (From the same place.) +\end{display} +The spacing is more noticeable with the typewriter font: +\begin{verbatim} +\ttfamily +I was awarded a B.Sc. and a Ph.D. (From the same place.) +\end{verbatim} +is typeset as +\begin{display}\ttfamily +I was awarded a B.Sc. and a Ph.D. (From the same place.) +\end{display} +The lower case letter at the end of ``B.Sc.''\ is confusing \TeX\ +into thinking that the full stop after it marks the end of the +sentence. Whereas the upper case letter at the end of ``Ph.D.'' has +confused \TeX\ into thinking that the following full stop is just +part of the abbreviation. These can be corrected: +\begin{verbatim} +I was awarded a B.Sc.\ and a Ph.D\@. (From the same place.) +\end{verbatim} + +This situation is a bit problematic for \styfmt{glossaries}. The +full stops can form part of the \meta{short} argument of +\cs{newacronym} and the \verb*|B.Sc.\ | part can be dealt with by +remembering to add \verb*|\ | (for example, \verb*|\gls{bsc}\ |) +but the end of sentence case is more troublesome as you need to omit +the sentence terminating full stop (to avoid two dots) which can +make the source code look a little strange but you also need to +adjust the space factor, which is usually done by inserting \cs{@} +before the full stop. + +The next example shows one way of achieving this. +(Note that the supplemental \gls{glossaries-extra} package provides a much +simpler way of doing this, which you may prefer to use. See the +\href{http://www.dickimaw-books.com/gallery/sample-initialisms.shtml}{initialisms +example}.) + +\begin{example}{Abbreviations with Full Stops (Periods)}{ex:dotabbr} +As from version 4.16, there's now a hook (\ics{glspostlinkhook}) +that's called at the very end of the \glslike\ and \glstextlike\ +commands. This can be redefined to check if the following character +is a full stop. The \sty{amsgen} package (which is automatically +loaded by \styfmt{glossaries}) provides an internal command +called \cs{new@ifnextchar} that can be used to determine if the +given character appears next. (For more information see the +\sty{amsgen} documentation.) + +It's possible that I~may also want acronyms or contractions in my +document, so I~need some way to differentiate between them. +Here I'm going to use the same method as in +example~\ref{ex:addstoragekey} where a~new field is defined +to indicate the type of abbreviation: +\begin{verbatim} +\glsaddstoragekey{abbrtype}{word}{\abbrtype} + +\newcommand*{\newabbr}[1][]{\newacronym[abbrtype=initials,#1]} +\end{verbatim} +Now I just use \ics{newacronym} for the acronyms, for example, +\begin{verbatim} +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} +\end{verbatim} +and my new command \cs{newabbr} for initials, for example, +\begin{verbatim} +\newabbr{eg}{e.g.}{exempli gratia} +\newabbr{ie}{i.e.}{id est} +\newabbr{bsc}{B.Sc.}{Bachelor of Science} +\newabbr{ba}{B.A.}{Bachelor of Arts} +\newabbr{agm}{A.G.M.}{annual general meeting} +\end{verbatim} +Within \cs{glspostlinkhook} the entry's label can be accessed using +\ics{glslabel} and \ics{ifglsfieldeq} can be used to determine if +the current entry has the new \texttt{abbrtype} field set to +\qt{initials}. If it doesn't, then nothing needs to happen, but if +it does, a~check is performed to see if the next character is a~full +stop. If it is, this signals the end of a~sentence otherwise it's +mid-sentence. + +Remember that internal commands within the document file (rather +than in a~class or package) need to be placed between +\ics{makeatletter} and \ics{makeatother}: +\begin{verbatim} +\makeatletter +\renewcommand{\glspostlinkhook}{% + \ifglsfieldeq{\glslabel}{abbrtype}{initials}% + {\new@ifnextchar.\doendsentence\doendword} + {}% +} +\makeatother +\end{verbatim} +In the event that a full stop is found \cs{doendsentence} is +performed but it will be followed by the full stop, which needs to +be discarded. Otherwise \cs{doendword} will be done but it won't be +followed by a full stop so there's nothing to discard. The +definitions for these commands are: +\begin{verbatim} +\newcommand{\doendsentence}[1]{\spacefactor=10000{}} +\newcommand{\doendword}{\spacefactor=1000{}} +\end{verbatim} +Now, I can just do \verb|\gls{bsc}| mid-sentence and +\verb|\gls{phd}.| at the end of the sentence. The terminating full +stop will be discarded in the latter case, but it won't be discarded +in, say, \verb|\gls{laser}.| as that doesn't have the +\texttt{abbrtype} field set to \qt{initials}. + +This also works on first use when the style is set to one of the +\meta{long} (\meta{short}) styles but it will fail with the +\meta{short} (\meta{long}) styles as in this case the terminating +full stop shouldn't be discarded. Since \ics{glspostlinkhook} is +used after the \firstuseflag\ has been unset for the entry, this +can't be fixed by simply checking with \ics{ifglsused}. One possible +solution to this is to redefine \ics{glslinkpostsetkeys} to check +for the \firstuseflag\ and define a macro that can then be used in +\ics{glspostlinkhook}. + +The other thing to consider is what to do with plurals. One +possibility is to check for plural use within \cs{doendsentence} +(using \ics{glsifplural}) and put the full stop back if the plural +has been used. + +The complete document is contained in the sample file +\samplefile{-dot-abbr}. +\end{example} + +\section{Displaying the List of Acronyms} +\label{sec:disploa} + +The list of acronyms is just like any other type of glossary and can +be displayed on its own using: +\begin{description} +\itempar{\opt1:} +\begin{alltt} +\ics{printnoidxglossary}[type=\ics{acronymtype}] +\end{alltt} + +\itempar{\optsand23:} +\begin{alltt} +\ics{printglossary}[type=\ics{acronymtype}] +\end{alltt} + +(If you use the +\pkgopt{acronym} package option you can also use +\begin{alltt} +\ics{printacronyms}\oarg{options} +\end{alltt} +as a synonym for +\begin{alltt} +\ics{printglossary}[type=\ics{acronymtype},\meta{options}] +\end{alltt} +See \sectionref{sec:pkgopts-acronym}.) + +\end{description} +Alternatively the list of acronyms can be displayed with all the other +glossaries using: +\begin{description} +\item[\opt1:] \ics{printnoidxglossaries} + +\item[\optsand23:] \ics{printglossaries} +\end{description} + +However, care must be taken to choose a glossary style that's +appropriate to your acronym style. +Alternatively, you can define your own custom style (see +\sectionref{sec:newglossarystyle} for further details). + +\section{Upgrading From the glossary Package} +\label{sec:oldacronym} + +Users of the obsolete \sty{glossary} package may recall that +the syntax used to define new acronyms has changed with the +replacement \styfmt{glossaries} package. In addition, the old +\sty{glossary} package created the command +\cs{}\meta{acr-name} when defining the acronym \meta{acr-name}. + +In order to facilitate migrating from the old package to the new +one, the \styfmt{glossaries} package\footnote{as from version 1.18} +provides the command: +\begin{definition}[\DescribeMacro{\oldacronym}] +\cs{oldacronym}\oarg{label}\marg{abbrv}\marg{long}\marg{key-val list} +\end{definition} +This uses the same syntax as the \sty{glossary} package's +method of defining acronyms. It is equivalent to: +\begin{display} +\ics{newacronym}\oarg{key-val list}\marg{label}\marg{abbrv}\marg{long} +\end{display} +In addition, \ics{oldacronym} also defines the commands +\cs{}\meta{label}, which is equivalent to \ics{gls}\marg{label}, +and \cs{}\meta{label}\texttt{*}, which is equivalent to +\ics{Gls}\marg{label}. If \meta{label} is omitted, \meta{abbrv} +is used. Since commands names must consist only of alphabetical +characters, \meta{label} must also only consist of alphabetical +characters. Note that \cs{}\meta{label} doesn't allow you to use +the first optional argument of \ics{gls} or \ics{Gls} --- you will +need to explicitly use \ics{gls} or \ics{Gls} to change the +settings. + +\begin{important} +Recall that, in general, \LaTeX\ ignores spaces following command +names consisting of alphabetical characters. This is also true for +\cs{}\meta{label} unless you additionally load the +\sty{xspace} package, but be aware that there are some issues with +using \sty{xspace}.\footnotemark +\end{important} +\footnotetext{See David Carlisle's explanation in +\url{http://tex.stackexchange.com/questions/86565/drawbacks-of-xspace}} + +The \styfmt{glossaries} package doesn't load the \sty{xspace} package +since there are both advantages and disadvantages to using +\ics{xspace} in \cs{}\meta{label}. If you don't use the +\sty{xspace} package you need to explicitly force a space using +\verb*|\ | (backslash space) however you can follow \cs{}\meta{label} +with additional text in square brackets (the final optional +argument to \ics{gls}). If you use the \sty{xspace} package +you don't need to escape the spaces but you can't use +the optional argument to insert text (you will have to explicitly +use \ics{gls}). + +To illustrate this, suppose I define the acronym \qt{abc} as +follows: +\begin{verbatim} +\oldacronym{abc}{example acronym}{} +\end{verbatim} +This will create the command \cs{abc} and its starred version +\cs{abc*}. \Tableref{tab:xspace} illustrates the effect of +\cs{abc} (on subsequent use) according to whether or not the +\sty{xspace} package has been loaded. As can be seen from the +final row in the table, the \sty{xspace} package prevents the +optional argument from being recognised. + +\begin{table}[htbp] +\caption[The effect of using xspace]{The effect of using +\styfmt{xspace} with \cs{oldacronym}} +\label{tab:xspace} +\vskip\baselineskip +\centering +\begin{tabular}{lll} +\bfseries Code & \bfseries With \styfmt{xspace} & +\bfseries Without \styfmt{xspace}\\ +\verb|\abc.| & abc. & abc.\\ +\verb|\abc xyz| & abc xyz & abcxyz\\ +\verb|\abc\ xyz| & abc xyz & abc xyz\\ +\verb|\abc* xyz| & Abc xyz & Abc xyz\\ +\verb|\abc['s] xyz| & abc ['s] xyz & abc's xyz +\end{tabular} +\par +\end{table} + +\chapter{Unsetting and Resetting Entry Flags} +\label{sec:glsunset} + +When using the \glslike\ commands it is +possible that you may want to use the value given by the +\gloskey{first} key, even though you have already \glslink{firstuse}{used} the glossary +entry. Conversely, you may want to use the value given by the +\gloskey{text} key, even though you haven't used the glossary entry. +The former can be achieved by one of the following commands: +\begin{definition}[\DescribeMacro{\glsreset}] +\cs{glsreset}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glslocalreset}] +\cs{glslocalreset}\marg{label} +\end{definition} +while the latter can be achieved by one of the following commands: +\begin{definition}[\DescribeMacro{\glsunset}] +\cs{glsunset}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro{\glslocalunset}] +\cs{glslocalunset}\marg{label} +\end{definition} +You can also reset or unset all entries for a given glossary or list of +glossaries using: +\begin{definition}[\DescribeMacro{\glsresetall}] +\cs{glsresetall}\oarg{glossary list} +\end{definition} +\begin{definition}[\DescribeMacro{\glslocalresetall}] +\cs{glslocalresetall}\oarg{glossary list} +\end{definition} +\begin{definition}[\DescribeMacro{\glsunsetall}] +\cs{glsunsetall}\oarg{glossary list} +\end{definition} +\begin{definition}[\DescribeMacro{\glslocalunsetall}] +\cs{glslocalunsetall}\oarg{glossary list} +\end{definition} +where \meta{glossary list} is a comma-separated list of +glossary labels. If omitted, all defined glossaries are assumed +(except for the ignored ones). +For example, to reset all entries in the main glossary and the +list of acronyms: +\begin{verbatim} +\glsresetall[main,acronym] +\end{verbatim} + +You can determine whether an entry's \gls{firstuseflag} is set using: +\begin{definition}[\DescribeMacro{\ifglsused}] +\cs{ifglsused}\marg{label}\marg{true part}\marg{false part} +\end{definition} +where \meta{label} is the label of the required entry. If the +entry has been used, \meta{true part} will be done, otherwise +\meta{false part} will be done. + +\begin{important} +Be careful when using \glslike\ commands within an +environment or command argument that gets processed multiple times +as it can cause unwanted side-effects when the first use displayed +text is different from subsequent use. +\end{important} + +For example, the \env{frame} environment in \cls{beamer} processes +its argument for each overlay. This means that the \firstuseflag\ +will be unset on the first overlay and subsequent overlays will use +the non-first use form. + +Consider the following example: +\begin{verbatim} +\documentclass{beamer} + +\usepackage{glossaries} + +\newacronym{svm}{SVM}{support vector machine} + +\begin{document} + +\begin{frame} + \frametitle{Frame 1} + + \begin{itemize} + \item<+-> \gls{svm} + \item<+-> Stuff. + \end{itemize} +\end{frame} + +\end{document} +\end{verbatim} + +On the first overlay, \verb|\gls{svm}| produces \qt{support vector +machine (SVM)} and then unsets the \firstuseflag. When the second +overlay is processed, \verb|\gls{svm}| now produces \qt{SVM}, which +is unlikely to be the desired effect. I~don't know anyway around +this and I can only offer two suggestions. + +Firstly, unset all acronyms at the start of the document and +explicitly use \ics{acrfull} when you want the full version to be +displayed: +\begin{verbatim} +\documentclass{beamer} + +\usepackage{glossaries} + +\newacronym{svm}{SVM}{support vector machine} + +\glsunsetall + +\begin{document} +\begin{frame} + \frametitle{Frame 1} + + \begin{itemize} + \item<+-> \acrfull{svm} + \item<+-> Stuff. + \end{itemize} +\end{frame} +\end{document} +\end{verbatim} + +Secondly, explicitly reset each acronym on first use: +\begin{verbatim} +\begin{frame} + \frametitle{Frame 1} + + \begin{itemize} + \item<+-> \glsreset{svm}\gls{svm} + \item<+-> Stuff. + \end{itemize} +\end{frame} +\end{verbatim} +These are non-optimal, but the \cls{beamer} class is too complex for +me to provide a programmatic solution. Other potentially problematic +environments are some \env{tabular}-like environments (but not +\env{tabular} itself) that process the contents in order to work out +the column widths and then reprocess the contents to do the actual +typesetting. + +The \sty{amsmath} environments, such as \env{align}, also process +their contents multiple times, but the \styfmt{glossaries} package now +checks for this. For \sty{tabularx}, you need to explicitly patch it +by placing \cs{glspatchtabularx} in the preamble (or anywhere +before the problematic use of \envfmt{tabularx}). + +\section{Counting the Number of Times an Entry has been Used (First Use +Flag Unset)} +\label{sec:enableentrycount} + +As from version 4.14, it's now possible to keep track of how many +times an entry is used. That is, how many times the \firstuseflag\ +is unset. Note that the supplemental \gls{glossaries-extra} package improves +this function and also provides per-unit counting, which isn't +available with the \styfmt{glossaries} package. + +\begin{important} +This function is disabled by default as it adds extra +overhead to the document build time and also switches +\ics{newglossaryentry} (and therefore \ics{newacronym}) into +a~preamble-only command. +\end{important} + +To enable this function, use +\begin{definition}[\DescribeMacro\glsenableentrycount] +\cs{glsenableentrycount} +\end{definition} +before defining your entries. This adds two extra (internal) fields +to entries: \texttt{currcount} and \texttt{prevcount}. + +The \texttt{currcount} field keeps track of how many times +\cs{glsunset} is used within the document. A~local unset (using +\cs{glslocalunset}) performs a~local rather than global increment to +\texttt{currcount}. Remember that not all commands use +\cs{glsunset}. Only the \glslike\ commands do this. The reset +commands \cs{glsreset} and \cs{glslocalreset} reset this field back +to zero (where \cs{glslocalreset} performs a~local change). + +The \texttt{prevcount} field stores the final value of the +\texttt{currcount} field \emph{from the previous run}. This value is +read from the \texttt{.aux} file at the beginning of the +\env{document} environment. + +You can access these fields using +\begin{definition}[\DescribeMacro\glsentrycurrcount] +\cs{glsentrycurrcount}\marg{label} +\end{definition} +for the \texttt{currcount} field, and +\begin{definition}[\DescribeMacro\glsentryprevcount] +\cs{glsentryprevcount}\marg{label} +\end{definition} +for the \texttt{prevcount} field. \textbf{These commands are +only defined if you have used \cs{glsenableentrycount}.} + +For example: +\begin{verbatim} +\documentclass{article} +\usepackage{glossaries} +\makeglossaries + +\glsenableentrycount + +\newglossaryentry{apple}{name=apple,description={a fruit}} + +\begin{document} +Total usage on previous run: \glsentryprevcount{apple}. + +\gls{apple}. \gls{apple}. \glsadd{apple}\glsentrytext{apple}. +\glslink{apple}{apple}. \glsdisp{apple}{apple}. \Gls{apple}. + +Number of times apple has been used: \glsentrycurrcount{apple}. +\end{document} +\end{verbatim} +On the first \LaTeX\ run, \verb|\glsentryprevcount{apple}| +produces~0. At the end of the document, +\verb|\glsentrycurrcount{apple}| produces~4. This is because +the only commands that have incremented the entry count are those +that use \cs{glsunset}. That is: \cs{gls}, \cs{glsdisp} and +\cs{Gls}. The other commands used in the above example, \cs{glsadd}, +\cs{glsentrytext} and \cs{glslink}, don't use \cs{glsunset} so they +don't increment the entry count. On the \emph{next} \LaTeX\ run, +\verb|\glsentryprevcount{apple}| now produces~4 as that was the +value of the \texttt{currcount} field for the \texttt{apple} entry +at the end of the document on the previous run. + +When you enable the entry count using \cs{glsenableentrycount}, you +also enable the following commands: +\begin{definition}[\DescribeMacro\cgls] +\cs{cgls}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +(no case-change, singular) +\begin{definition}[\DescribeMacro\cglspl] +\cs{cglspl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +(no case-change, plural) +\begin{definition}[\DescribeMacro\cGls] +\cs{cGls}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +(first letter uppercase, singular), and +\begin{definition}[\DescribeMacro\cGlspl] +\cs{cGlspl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +(first letter uppercase, plural). +These all have plus and starred variants like the analogous +\cs{gls}, \cs{glspl}, \cs{Gls} and \cs{Glspl} commands. + +If you don't use \cs{glsenableentrycount}, these commands behave +like \cs{gls}, \cs{glspl}, \cs{Gls} and \cs{Glspl}, +respectively, only there will be a warning that you haven't enabled +entry counting. If you have enabled entry counting with +\cs{glsenableentrycount} then these commands test if +\cs{glsentryprevcount}\marg{label} equals~1. If it doesn't then the +analogous \cs{gls} etc will be used. If it does, then the first optional +argument will be ignored and +\begin{alltt} +\meta{cs format}\marg{label}\marg{insert}\cs{glsunset}\marg{label} +\end{alltt} +will be performed, where \meta{cs format} is a command that takes +two arguments. The command used depends whether you have used +\cs{cgls}, \cs{cglspl}, \cs{cGls} or \cs{cGlspl}. + +\begin{definition}[\DescribeMacro\cglsformat] +\cs{cglsformat}\marg{label}\marg{insert} +\end{definition} +This command is used by \cs{cgls} and defaults to +\begin{alltt} +\cs{glsentrylong}\marg{label}\meta{insert} +\end{alltt} +if the entry given by +\meta{label} has a~long form or +\begin{alltt} +\cs{glsentryfirst}\marg{label}\meta{insert} +\end{alltt} +otherwise. + +\begin{definition}[\DescribeMacro\cglsplformat] +\cs{cglsplformat}\marg{label}\marg{insert} +\end{definition} +This command is used by \cs{cglspl} and defaults to +\begin{alltt} +\cs{glsentrylongpl}\marg{label}\meta{insert} +\end{alltt} +if the entry given by +\meta{label} has a~long form or +\begin{alltt} +\cs{glsentryfirstplural}\marg{label}\meta{insert} +\end{alltt} +otherwise. + +\begin{definition}[\DescribeMacro\cGlsformat] +\cs{cGlsformat}\marg{label}\marg{insert} +\end{definition} +This command is used by \cs{cGls} and defaults to +\begin{alltt} +\cs{Glsentrylong}\marg{label}\meta{insert} +\end{alltt} +if the entry given by \meta{label} has a~long form or +\begin{alltt} +\cs{Glsentryfirst}\marg{label}\meta{insert} +\end{alltt} +otherwise. + +\begin{definition}[\DescribeMacro\cGlsplformat] +\cs{cGlsplformat}\marg{label}\marg{insert} +\end{definition} +This command is used by \cs{cGlspl} and defaults to +\begin{alltt} +\cs{Glsentrylongpl}\marg{label}\meta{insert} +\end{alltt} +if the entry given by \meta{label} has a~long form or +\begin{alltt} +\cs{Glsentryfirstplural}\marg{label}\meta{insert} +\end{alltt} +otherwise. + +This means that if the previous count for the given entry was~1, the +entry won't be hyperlinked with the \cs{cgls}-like commands and they +won't add a~line to the external glossary file. If you haven't used +any of the other commands that add information to glossary file +(such as \cs{glsadd} or the \glstextlike\ commands) then the entry +won't appear in the glossary. + +Remember that since these commands use \cs{glsentryprevcount} you +need to run \LaTeX\ twice to ensure they work correctly. The +document build order is now (at least): \texttt{(pdf)latex}, +\texttt{(pdf)latex}, \texttt{makeglossaries}, \texttt{(pdf)latex}. + +\begin{example}{Don't index entries that are only used once}{sec:entrycount} +In this example, the abbreviations that have only been used once (on the previous run) +only have their long form shown with \cs{cgls}. +\begin{verbatim} +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[acronym]{glossaries} +\makeglossaries + +\glsenableentrycount + +\setacronymstyle{long-short} + +\newacronym{html}{HTML}{hypertext markup language} +\newacronym{css}{CSS}{cascading style sheets} +\newacronym{xml}{XML}{extensible markup language} +\newacronym{sql}{SQL}{structured query language} +\newacronym{rdbms}{RDBMS}{relational database management system} +\newacronym{rdsms}{RDSMS}{relational data stream management system} + +\begin{document} +These entries are only used once: \cgls{sql}, \cgls{rdbms}, +\cgls{xml}. These entries are used multiple times: +\cgls{html}, \cgls{html}, \cgls{css}, \cgls{css}, \cgls{css}, +\cgls{rdsms}, \cgls{rdsms}. + +\printglossaries +\end{document} +\end{verbatim} +After a complete document build (\texttt{latex}, \texttt{latex}, +\texttt{makeglossaries}, \texttt{latex}) the list of abbrevaitions only +includes the entries HTML, CSS and RDSMS. The entries SQL, RDBMS and +XML +only have their long forms displayed and don't have a~hyperlink. +\end{example} + +Remember that if you don't like typing \cs{cgls} you can create a +synonym. For example +\begin{verbatim} +\let\ac\cgls +\end{verbatim} + +\chapter{Glossary Styles} +\label{sec:styles} + +Glossaries vary from lists that simply contain a symbol with a terse +description to lists of terms or phrases with lengthy descriptions. +Some glossaries may have terms with associated symbols. Some may +have hierarchical entries. There is therefore no single style that +fits every type of glossary. The \styfmt{glossaries} package comes +with a number of pre-defined glossary styles, described in +\sectionref{sec:predefinedstyles}. You can choose one of these that +best suits your type of glossary or, if none of them suit your +document, you can defined your own style (see +\sectionref{sec:newglossarystyle}). There are some examples +of glossary styles available at +\url{http://www.dickimaw-books.com/gallery/#glossaries}. + +The glossary style can be set using the \gloskey[printglossary]{style} key in the optional +argument to \ics{printnoidxglossary} (\opt1) or \ics{printglossary} +(\optsand23) or using the command: +\begin{definition}[\DescribeMacro{\setglossarystyle}] +\cs{setglossarystyle}\marg{style-name} +\end{definition} +(before the glossary is displayed). + +Some of the predefined glossary styles may also be set using the \pkgopt{style} +package option, it depends if the package in which they are defined +is automatically loaded by the \styfmt{glossaries} package. + +You can use the lorum ipsum dummy entries provided in the +accompanying +\texttt{example-glossaries-*.tex} files (described in +\sectionref{sec:lipsum}) to test the different styles. + +\section{Predefined Styles} +\label{sec:predefinedstyles} + +The predefined styles can +accommodate numbered level~0 (main) and level~1 entries. See the +package options \pkgopt{entrycounter}, \pkgopt{counterwithin} and +\pkgopt{subentrycounter} described in +\sectionref{sec:pkgopts-printglos}. There is a summary +of available styles in \tableref{tab:styles}. +You can view samples of all the predefined styles at +\url{http://www.dickimaw-books.com/gallery/glossaries-styles/}. +Note that \gls{glossaries-extra} provides additional styles +in the supplementary packages \sty{glossary-bookindex} and +\sty{glossary-longnoloc}. See the \gls{glossaries-extra} manual for +further details. + +\begin{important} +Note that the group styles (such as \glostyle{listgroup}) will +have unexpected results if used with the \pkgopt[def]{sort} +or \pkgopt[use]{sort} options. If you don't sort your entries +alphabetically, it's best to set the \pkgopt{nogroupskip} +package option to prevent odd vertical gaps appearing. +\end{important} + +The group title is obtained using \cs{glsgetgrouptitle}\marg{label}, +which is described in \sectionref{sec:newglossarystyle}. + +\begin{table}[htbp] +\caption[Glossary Styles]{Glossary Styles. An asterisk in the style +name indicates anything that matches that doesn't match any +previously listed style (e.g.\ \texttt{long3col*} +matches \glostyle{long3col}, \glostyle{long3colheader}, +\glostyle{long3colborder} and \glostyle{long3colheaderborder}). +A maximum level of 0 indicates a flat glossary (sub-entries +are displayed in the same way as main entries). Where the maximum +level is given as --- there is no limit, but note that +\gls{makeindex} (\opt2) imposes a limit of 2 sub-levels. If the +homograph column is checked, then the name is not displayed for +sub-entries. If the symbol column is checked, then the symbol will +be displayed.} +\label{tab:styles} +\vskip\baselineskip +\centering +\begin{tabular}{lccc} +\bfseries Style & \bfseries Maximum Level & +\bfseries Homograph & \bfseries Symbol\\ +\ttfamily listdotted & 0 & & \\ +\ttfamily sublistdotted & 1 & & \\ +\ttfamily list* & 1 & \tick & \\ +\ttfamily altlist* & 1 & \tick & \\ +\ttfamily long*3col* & 1 & \tick & \\ +\ttfamily long4col* & 1 & \tick & \tick \\ +\ttfamily altlong*4col* & 1 & \tick & \tick \\ +\ttfamily long* & 1 & \tick & \\ +\ttfamily super*3col* & 1 & \tick & \\ +\ttfamily super4col* & 1 & \tick & \tick \\ +\ttfamily altsuper*4col* & 1 & \tick & \tick \\ +\ttfamily super* & 1 & \tick & \\ +\ttfamily *index* & 2 & & \tick\\ +\ttfamily treenoname* & --- & \tick & \tick\\ +\ttfamily *alttree* & --- & & \tick\\ +\ttfamily *tree* & --- & & \tick\\ +\ttfamily inline & 1 & \tick & +\end{tabular} +\par +\end{table} + +The tabular-like styles that allow multi-line descriptions and page +lists use the length \DescribeMacro{\glsdescwidth}\cs{glsdescwidth} +to set the width of the description column and the length +\DescribeMacro{\glspagelistwidth}\cs{glspagelistwidth} to set the +width of the page list column.\footnote{These lengths will not be +available if you use both the \pkgopt{nolong} and \pkgopt{nosuper} +package options or if you use the \pkgopt{nostyles} package option +unless you explicitly load the relevant package.} +These will need to be changed using \cs{setlength} if the glossary +is too wide. Note that the \glostyle{long4col} and +\glostyle{super4col} styles (and their header and border variations) +don't use these lengths as they are designed for single line +entries. Instead you should use the analogous \glostyle{altlong4col} +and \glostyle{altsuper4col} styles. If you want to +explicitly create a line-break within a multi-line description in +a tabular-like style it's better to use \ics{newline} instead of +\verb|\\|. + +\begin{important} +Remember that a cell within a tabular-like environment can't +be broken across a page, so even if a tabular-like style, such as +\glostyle{long}, allows multilined descriptions, you'll probably encounter +page-breaking problems if you have entries with long descriptions. +You may want to consider using the \glostyle{alttree} style instead. +\end{important} + +Note that if you use the \gloskey[printglossary]{style} key in the +optional argument to \ics{printnoidxglossary} (\opt1) or +\ics{printglossary} (\optsand23), it will override any +previous style settings for the given glossary, so if, for example, +you do +\begin{verbatim} +\renewcommand*{\glsgroupskip}{} +\printglossary[style=long] +\end{verbatim} +then the new definition of \ics{glsgroupskip} will not have an affect +for this glossary, as \cs{glsgroupskip} is redefined by +\verb|style=long|. Likewise, \ics{setglossarystyle} will also +override any previous style definitions, so, again +\begin{verbatim} +\renewcommand*{\glsgroupskip}{} +\setglossarystyle{long} +\end{verbatim} +will reset \cs{glsgroupskip} back to its default definition for the +named glossary style (\glostyle{long} in this case). If you want to +modify the styles, either use \ics{newglossarystyle} (described +in the next section) or make the modifications after +\ics{setglossarystyle}, e.g.: +\begin{verbatim} +\setglossarystyle{long} +\renewcommand*{\glsgroupskip}{} +\end{verbatim} +As from version 3.03, you can now use the package option +\pkgopt{nogroupskip} to suppress the gap between groups for the +default styles instead of redefining \cs{glsgroupskip}. + +All the styles except for the three- and four-column styles and the +\glostyle{listdotted} style use the command +\begin{definition}[\DescribeMacro{\glspostdescription}] +\cs{glspostdescription} +\end{definition} +after the description. This simply displays a full stop by default. +To eliminate this full stop (or replace it with something else, say, +a comma) you will need to redefine \cs{glspostdescription} before +the glossary is displayed. Alternatively, you can suppress it for a +given entry by placing \ics{nopostdesc} in the entry's description. +Note that \ics{longnewglossaryentry} puts \cs{nopostdesc} at the end +of the description. The \sty{glossaries-extra} package provides a +starred version that doesn't. + +As from version 3.03 you can now use the package option +\pkgopt{nopostdot} to suppress this full stop. This is the better +option if you want to use the \sty{glossaries-extra} package. +The \sty{glossaries-extra-stylemods} package provides some +adjustments some of to the predefined styles listed here, allowing +for greater flexibility. See the \sty{glossaries-extra} +documentation for further details. + +\subsection{List Styles} +\label{sec:liststyles} + +The styles described in this section are all defined in the package +\sty{glossary-list}. Since they all use the \env{description} +environment, they are governed by the same parameters as that +environment. These styles all ignore the entry's symbol. Note that +these styles will automatically be available unless you use the +\pkgopt{nolist} or \pkgopt{nostyles} package options. + +\begin{important} +Note that, except for the \glostyle{listdotted} style, these +list styles are incompatible with \sty{classicthesis}. They +may also be incompatible with other classes or packages that +modify the \env{description} environment. +\end{important} + +\begin{description} +\item[list] The \glostyle{list} style uses the \env{description} +environment. The entry name is placed in the optional argument of +the \ics{item} command (so it will usually appear in bold by default). The +description follows, and then the associated \gls{numberlist} for +that entry. The symbol is ignored. If the entry has child entries, +the description and number list follows (but not the name) for each +child entry. Groups are separated using \ics{indexspace}. + +The closest matching non-list style is the \glostyle{index} style. + +\item[listgroup] The \glostyle{listgroup} style is like +\glostyle{list} but the glossary groups have headings +obtained using \cs{glsgetgrouptitle}\marg{label}, +which is described in \sectionref{sec:newglossarystyle}. + +\item[listhypergroup] The \glostyle{listhypergroup} style is like +\glostyle{listgroup} but has a navigation line at the start of the +glossary with links to each group that is present in the glossary. +This requires an additional run through \LaTeX\ to ensure the group +information is up to date. In the navigation line, each group is +separated by +\begin{definition}[\DescribeMacro{\glshypernavsep}] +\cs{glshypernavsep} +\end{definition} +which defaults to a vertical bar with a space on either side. For +example, to simply have a space separating each group, do: +\begin{verbatim} +\renewcommand*{\glshypernavsep}{\space} +\end{verbatim} + +Note that the hyper-navigation line is now (as from version 1.14) +set inside the optional argument to \ics{item} instead of after it +to prevent a spurious space at the start. This can cause a problem +if the navigation line is too long. +As from v4.22, if you need to adjust this, you can redefine +\begin{definition}[\DescribeMacro\glslistnavigationitem] +\cs{glslistnavigationitem}\marg{navigation line} +\end{definition} +The default definition is \cs{item}\oarg{navigation line} but may +be redefined independently of setting the style. For example: +\begin{verbatim} +\renewcommand*{\glslistnavigationitem}[1]{\item \textbf{#1}} +\end{verbatim} + +You may prefer to use the tree-like styles, such as +\glostyle{treehypergroup} instead. + +\item[altlist] The \glostyle{altlist} style is like \glostyle{list} +but the description starts on the line following the name. (As +with the \glostyle{list} style, the symbol is ignored.) Each child +entry starts a new line, but as with the \glostyle{list} style, +the name associated with each child entry is ignored. + +The closest matching non-list style is the \glostyle{index} +style with the following adjustment: +\begin{verbatim} +\renewcommand{\glstreepredesc}{% + \glstreeitem\parindent\hangindent} +\end{verbatim} + + +\item[altlistgroup] The \glostyle{altlistgroup} style is like +\glostyle{altlist} but the glossary groups have headings. + +\item[altlisthypergroup] The \glostyle{altlisthypergroup} style is like +\glostyle{altlistgroup} but has a set of links to the glossary +groups. The navigation line is the same as that for +\glostyle{listhypergroup}, described above. + +\item[listdotted] This style uses the \env{description} +environment.\footnote{This style was supplied by Axel~Menzel.} Each +entry starts with \verb|\item[]|, followed by the name followed by a +dotted line, followed by the description. Note that this style +ignores both the \gls{numberlist} and the symbol. The length +\begin{definition}[\DescribeMacro{\glslistdottedwidth}] +\cs{glslistdottedwidth} +\end{definition} +governs where the description should start. This is a flat style, so +child entries are formatted in the same way as the parent entries. + +A non-list alternative is to use the \glostyle{index} style +with +\begin{verbatim} +\renewcommand{\glstreepredesc}{\dotfill} +\renewcommand{\glstreechildpredesc}{\dotfill} +\end{verbatim} +Note that this doesn't use \cs{glslistdottedwidth} and causes +the description to be flush-right and will display the +symbol, if provided. (It also doesn't suppress +the \gls*{numberlist}, but that can be achieved with the +\pkgopt{nonumberlist} option.) + +\item[sublistdotted] This is a variation on the \glostyle{listdotted} +style designed for hierarchical glossaries. The main entries +have just the name displayed. The sub entries are displayed in +the same manner as \glostyle{listdotted}. Unlike the +\glostyle{listdotted} style, this style is incompatible with +\sty{classicthesis}. +\end{description} + + +\subsection{Longtable Styles} +\label{sec:longstyles} + +The styles described in this section are all defined in the package +\sty{glossary-long}. Since they all use the \env{longtable} +environment, they are governed by the same parameters as that +environment. Note that these styles will automatically be available +unless you use the \pkgopt{nolong} or \pkgopt{nostyles} package +options. These styles fully justify the description and page list +columns. If you want ragged right formatting instead, use the +analogous styles described in \sectionref{sec:longraggedstyles}. +If you want to incorporate rules from the \sty{booktabs} package, +try the styles described in \sectionref{sec:longbooktabsstyles}. + +\begin{description} +\item[long] The \glostyle{long} style uses the \env{longtable} +environment (defined by the \sty{longtable} package). It has two +columns: the first column contains the entry's name and the second +column contains the description followed by the \gls{numberlist}. +The entry's symbol is ignored. +Sub groups are separated with a blank row. The width of the +first column is governed by the widest entry in that column. The +width of the second column is governed by the length +\ics{glsdescwidth}. Child entries have a similar format to the +parent entries except that their name is suppressed. + +\item[longborder] The \glostyle{longborder} style is like +\glostyle{long} but has horizontal and vertical lines around it. + +\item[longheader] The \glostyle{longheader} style is like +\glostyle{long} but has a header row. + +\item[longheaderborder] The \glostyle{longheaderborder} style is +like \glostyle{longheader} but has horizontal and vertical lines +around it. + +\item[long3col] The \glostyle{long3col} style is like +\glostyle{long} but has three columns. The first column contains +the entry's name, the second column contains the description +and the third column contains the \gls{numberlist}. +The entry's symbol is ignored. The width of the +first column is governed by the widest entry in that column, the +width of the second column is governed by the length +\ics{glsdescwidth}, and the width of the third column is governed by the +length \ics{glspagelistwidth}. + +\item[long3colborder] The \glostyle{long3colborder} style is like +the \glostyle{long3col} style but has horizontal and vertical +lines around it. + +\item[long3colheader] The \glostyle{long3colheader} style is like +\glostyle{long3col} but has a header row. + +\item[long3colheaderborder] The \glostyle{long3colheaderborder} style is +like \glostyle{long3colheader} but has horizontal and vertical lines +around it. + +\item[long4col] The \glostyle{long4col} style is like +\glostyle{long3col} but has an additional column in which the +entry's associated symbol appears. This style is used for brief +single line descriptions. The column widths are governed by the +widest entry in the given column. Use \glostyle{altlong4col} for +multi-line descriptions. + +\item[long4colborder] The \glostyle{long4colborder} style is like +the \glostyle{long4col} style but has horizontal and vertical +lines around it. + +\item[long4colheader] The \glostyle{long4colheader} style is like +\glostyle{long4col} but has a header row. + +\item[long4colheaderborder] The \glostyle{long4colheaderborder} style is +like \glostyle{long4colheader} but has horizontal and vertical lines +around it. + +\item[altlong4col] The \glostyle{altlong4col} style is like +\glostyle{long4col} but allows multi-line descriptions and page +lists. The width of the description column is governed by the +length \ics{glsdescwidth} and the width of the page list column is +governed by the length \ics{glspagelistwidth}. The widths of the +name and symbol columns are governed by the widest entry in the +given column. + +\item[altlong4colborder] The \glostyle{altlong4colborder} style is like +the \glostyle{long4colborder} but allows multi-line descriptions and +page lists. + +\item[altlong4colheader] The \glostyle{altlong4colheader} style is like +\glostyle{long4colheader} but allows multi-line descriptions and +page lists. + +\item[altlong4colheaderborder] The \glostyle{altlong4colheaderborder} +style is like \glostyle{long4colheaderborder} but allows multi-line +descriptions and page lists. +\end{description} + + +\subsection{Longtable Styles (Ragged Right)} +\label{sec:longraggedstyles} + +The styles described in this section are all defined in the package +\sty{glossary-longragged}. These styles are analogous to those +defined in \sty{glossary-long} but the multiline columns are left +justified instead of fully justified. Since these styles all use the +\env{longtable} environment, they are governed by the same +parameters as that environment. The \sty{glossary-longragged} +package additionally requires the \sty{array} package. Note that +these styles will only be available if you explicitly load +\sty{glossary-longragged}: +\begin{verbatim} +\usepackage{glossaries} +\usepackage{glossary-longragged} +\end{verbatim} +Note that you can't set these styles using the \pkgopt{style} +package option since the styles aren't defined until after +the \styfmt{glossaries} package has been loaded. +If you want to incorporate rules from the \sty{booktabs} package, +try the styles described in \sectionref{sec:longbooktabsstyles}. + +\begin{description} +\item[longragged] The \glostyle{longragged} style has two +columns: the first column contains the entry's name and the second +column contains the (left-justified) description followed by the +\gls{numberlist}. The entry's symbol is ignored. +Sub groups are separated with a blank row. The width of the +first column is governed by the widest entry in that column. The +width of the second column is governed by the length +\ics{glsdescwidth}. Child entries have a similar format to the +parent entries except that their name is suppressed. + +\item[longraggedborder] The \glostyle{longraggedborder} style is like +\glostyle{longragged} but has horizontal and vertical lines around it. + +\item[longraggedheader] The \glostyle{longraggedheader} style is like +\glostyle{longragged} but has a header row. + +\item[longraggedheaderborder] The \glostyle{longraggedheaderborder} +style is like \glostyle{longraggedheader} but has horizontal and +vertical lines around it. + +\item[longragged3col] The \glostyle{longragged3col} style is like +\glostyle{longragged} but has three columns. The first column +contains the entry's name, the second column contains the (left +justified) description and the third column contains the (left +justified) \gls{numberlist}. The entry's symbol is ignored. The +width of the first column is governed by the widest entry in that +column, the width of the second column is governed by the length +\ics{glsdescwidth}, and the width of the third column is governed by +the length \ics{glspagelistwidth}. + +\item[longragged3colborder] The \glostyle{longragged3colborder} +style is like the \glostyle{longragged3col} style but has horizontal +and vertical lines around it. + +\item[longragged3colheader] The \glostyle{longragged3colheader} style is like +\glostyle{longragged3col} but has a header row. + +\item[longragged3colheaderborder] The \glostyle{longragged3colheaderborder} style is +like \glostyle{longragged3colheader} but has horizontal and vertical lines +around it. + +\item[altlongragged4col] The \glostyle{altlongragged4col} style is +like \glostyle{longragged3col} but has an additional column in which +the entry's associated symbol appears. The width of the description +column is governed by the length \ics{glsdescwidth} and the width of +the page list column is governed by the length +\ics{glspagelistwidth}. The widths of the name and symbol columns +are governed by the widest entry in the given column. + +\item[altlongragged4colborder] The +\glostyle{altlongragged4colborder} style is like the +\glostyle{altlongragged4col} but has horizontal and vertical lines +around it. + +\item[altlongragged4colheader] The +\glostyle{altlongragged4colheader} style is like +\glostyle{altlongragged4col} but has a header row. + +\item[altlongragged4colheaderborder] The +\glostyle{altlongragged4colheaderborder} style is like +\glostyle{altlongragged4colheader} but has horizontal and vertical +lines around it. + +\end{description} + +\subsection{Longtable Styles (\styfmt{booktabs})} +\label{sec:longbooktabsstyles} + +The styles described in this section are all defined in the package +\sty{glossary-longbooktabs}. + +Since these styles all use the +\env{longtable} environment, they are governed by the same +parameters as that environment. The \sty{glossary-longbooktabs} +package automatically loads the \sty{glossary-long} +(\sectionref{sec:longstyles}) +and \sty{glossary-longragged} (\sectionref{sec:longraggedstyles}) packages. Note that +these styles will only be available if you explicitly load +\sty{glossary-longbooktabs}: +\begin{verbatim} +\usepackage{glossaries} +\usepackage{glossary-longbooktabs} +\end{verbatim} +Note that you can't set these styles using the \pkgopt{style} +package option since the styles aren't defined until after +the \styfmt{glossaries} package has been loaded. + +These styles are similar to the +\qt{header} styles in the \sty{glossary-long} and +\sty{glossary-ragged} packages, but they add the rules +provided by the \sty{booktabs} package, \ics{toprule}, \ics{midrule} and +\ics{bottomrule}. Additionally these styles patch the +\env{longtable} environment to check for instances of the group +skip occurring at a page break. If you don't want this patch to +affect any other use of \env{longtable} in your document, you can +scope the effect by only setting the style through the +\gloskey[printglossary]{style} key in the optional argument of +\cs{printglossary}. (The \pkgopt{nogroupskip} package option +is checked by these styles.) + +Alternatively, you can restore the original \env{longtable} +behaviour with: +\begin{definition}[\DescribeMacro\glsrestoreLToutput] +\cs{glsrestoreLToutput} +\end{definition} +For more information about the patch, see the documented code +(\texttt{glossaries-code.pdf}). + +\begin{description} +\item[\glostyle{long-booktabs}] This style is similar to +the \glostyle{longheader} style but adds rules above and below the +header (\cs{toprule} and \cs{midrule}) and inserts a rule at the +bottom of the table (\cs{bottomrule}). + +\item[\glostyle{long3col-booktabs}] This style is similar to +the \glostyle{long3colheader} style but adds rules as per +\glostyle{long-booktabs}. + +\item[\glostyle{long4col-booktabs}] This style is similar to +the \glostyle{long4colheader} style but adds rules as above. + +\item[\glostyle{altlong4col-booktabs}] This style is similar to +the \glostyle{altlong4colheader} style but adds rules as above. + +\item[\glostyle{longragged-booktabs}] This style is similar to +the \glostyle{longraggedheader} style but adds rules as above. + +\item[\glostyle{longragged3col-booktabs}] This style is similar to +the \glostyle{longragged3colheader} style but adds rules as above. + +\item[\glostyle{altlongragged4col-booktabs}] This style is similar to +the \glostyle{altlongragged4colheader} style but adds rules as above. + +\end{description} + +\subsection{Supertabular Styles} +\label{sec:superstyles} + +The styles described in this section are all defined in the package +\sty{glossary-super}. Since they all use the \env{supertabular} +environment, they are governed by the same parameters as that +environment. Note that these styles will automatically be available +unless you use the \pkgopt{nosuper} or \pkgopt{nostyles} package +options. In general, the \env{longtable} environment is better, +but there are some circumstances where it is better to use +\env{supertabular}.\footnote{e.g.\ with the \sty{flowfram} +package.} These styles fully justify the description and page list +columns. If you want ragged right formatting instead, use the +analogous styles described in \sectionref{sec:superraggedstyles}. + +\begin{description} +\item[super] The \glostyle{super} style uses the \env{supertabular} +environment (defined by the \sty{supertabular} package). It has two +columns: the first column contains the entry's name and the second +column contains the description followed by the \gls{numberlist}. +The entry's symbol is ignored. +Sub groups are separated with a blank row. The width of the +first column is governed by the widest entry in that column. The +width of the second column is governed by the length +\ics{glsdescwidth}. Child entries have a similar format to the +parent entries except that their name is suppressed. + +\item[superborder] The \glostyle{superborder} style is like +\glostyle{super} but has horizontal and vertical lines around it. + +\item[superheader] The \glostyle{superheader} style is like +\glostyle{super} but has a header row. + +\item[superheaderborder] The \glostyle{superheaderborder} style is +like \glostyle{superheader} but has horizontal and vertical lines +around it. + +\item[super3col] The \glostyle{super3col} style is like +\glostyle{super} but has three columns. The first column contains +the entry's name, the second column contains the description +and the third column contains the \gls{numberlist}. The +entry's symbol is ignored. The width of the +first column is governed by the widest entry in that column. The +width of the second column is governed by the length +\ics{glsdescwidth}. The width of the third column is governed by the +length \ics{glspagelistwidth}. + +\item[super3colborder] The \glostyle{super3colborder} style is like +the \glostyle{super3col} style but has horizontal and vertical +lines around it. + +\item[super3colheader] The \glostyle{super3colheader} style is like +\glostyle{super3col} but has a header row. + +\item[super3colheaderborder] The \glostyle{super3colheaderborder} style +is like the \glostyle{super3colheader} style but has horizontal and vertical +lines around it. + +\item[super4col] The \glostyle{super4col} style is like +\glostyle{super3col} but has an additional column in which the +entry's associated symbol appears. This style is designed for +entries with brief single line descriptions. The column widths are governed by the +widest entry in the given column. Use \glostyle{altsuper4col} +for multi-line descriptions. + +\item[super4colborder] The \glostyle{super4colborder} style is like +the \glostyle{super4col} style but has horizontal and vertical +lines around it. + +\item[super4colheader] The \glostyle{super4colheader} style is like +\glostyle{super4col} but has a header row. + +\item[super4colheaderborder] The \glostyle{super4colheaderborder} style +is like the \glostyle{super4colheader} style but has horizontal and vertical +lines around it. + +\item[altsuper4col] The \glostyle{altsuper4col} style is like +\glostyle{super4col} but allows multi-line descriptions and page +lists. +The width of the description column is governed by the length +\ics{glsdescwidth} and the width of the page list column is +governed by the length \ics{glspagelistwidth}. The width of the name +and symbol columns is governed by the widest entry in the +given column. + +\item[altsuper4colborder] The \glostyle{altsuper4colborder} style is like +the \glostyle{super4colborder} style but allows multi-line descriptions +and page lists. + +\item[altsuper4colheader] The \glostyle{altsuper4colheader} style is like +\glostyle{super4colheader} but allows multi-line descriptions and +page lists. + +\item[altsuper4colheaderborder] The \glostyle{altsuper4colheaderborder} +style is like \glostyle{super4colheaderborder} but allows multi-line +descriptions and page lists. +\end{description} + + +\subsection{Supertabular Styles (Ragged Right)} +\label{sec:superraggedstyles} + +The styles described in this section are all defined in the package +\sty{glossary-superragged}. These styles are analogous to those +defined in \sty{glossary-super} but the multiline columns are left +justified instead of fully justified. Since these styles all use the +\env{supertabular} environment, they are governed by the same +parameters as that environment. The \sty{glossary-superragged} +package additionally requires the \sty{array} package. Note that +these styles will only be available if you explicitly load +\sty{glossary-superragged}: +\begin{verbatim} +\usepackage{glossaries} +\usepackage{glossary-superragged} +\end{verbatim} +Note that you can't set these styles using the \pkgopt{style} +package option since the styles aren't defined until after +the \styfmt{glossaries} package has been loaded. + +\begin{description} +\item[superragged] The \glostyle{superragged} style uses the +\env{supertabular} environment (defined by the +\sty{supertabular} package). It has two columns: the first column +contains the entry's name and the second column contains the (left +justified) description followed by the \gls{numberlist}. The +entry's symbol is ignored. Sub groups are separated with a blank +row. The width of the first column is governed by the widest entry +in that column. The width of the second column is governed by the +length \ics{glsdescwidth}. Child entries have a similar format to +the parent entries except that their name is suppressed. + +\item[superraggedborder] The \glostyle{superraggedborder} style is +like \glostyle{superragged} but has horizontal and vertical lines +around it. + +\item[superraggedheader] The \glostyle{superraggedheader} style is +like \glostyle{superragged} but has a header row. + +\item[superraggedheaderborder] The +\glostyle{superraggedheaderborder} style is like +\glostyle{superraggedheader} but has horizontal and vertical lines +around it. + +\item[superragged3col] The \glostyle{superragged3col} style is like +\glostyle{superragged} but has three columns. The first column +contains the entry's name, the second column contains the (left +justified) description and the third column contains the (left +justified) \gls{numberlist}. The entry's symbol is ignored. The +width of the first column is governed by the widest entry in that +column. The width of the second column is governed by the length +\ics{glsdescwidth}. The width of the third column is governed by the +length \ics{glspagelistwidth}. + +\item[superragged3colborder] The \glostyle{superragged3colborder} +style is like the \glostyle{superragged3col} style but has +horizontal and vertical lines around it. + +\item[superragged3colheader] The \glostyle{superragged3colheader} +style is like \glostyle{superragged3col} but has a header row. + +\item[superragged3colheaderborder] The +\glostyle{superragged3colheaderborder} style is like +\glostyle{superragged3colheader} but has horizontal and vertical +lines around it. + +\item[altsuperragged4col] The \glostyle{altsuperragged4col} style is +like \glostyle{superragged3col} but has an additional column in +which the entry's associated symbol appears. The column widths for +the name and symbol column are governed by the widest entry in the +given column. + +\item[altsuperragged4colborder] The +\glostyle{altsuperragged4colborder} style is like the +\glostyle{altsuperragged4col} style but has horizontal and vertical +lines around it. + +\item[altsuperragged4colheader] The +\glostyle{altsuperragged4colheader} style is like +\glostyle{altsuperragged4col} but has a header row. + +\item[altsuperragged4colheaderborder] The +\glostyle{altsuperragged4colheaderborder} style is like +\glostyle{altsuperragged4colheader} but has horizontal and vertical +lines around it. + +\end{description} + +\subsection{Tree-Like Styles} +\label{sec:treestyles} + +The styles described in this section are all defined in the package +\sty{glossary-tree}. These styles are designed for hierarchical +glossaries but can also be used with glossaries that don't have +sub-entries. These styles will display the entry's symbol if it +exists. Note that these styles will automatically be available +unless you use the \pkgopt{notree} or \pkgopt{nostyles} package +options. + +These styles all format the entry name using: +\begin{definition}[\DescribeMacro\glstreenamefmt] +\cs{glstreenamefmt}\marg{name} +\end{definition} +This defaults to \cs{textbf}\marg{name}, but note that \meta{name} +includes \ics{glsnamefont} so the bold setting in \cs{glstreenamefont} +may be counteracted by another font change in \cs{glsnamefont} (or +in \cs{acronymfont}). The tree-like styles that also display the +header use +\begin{definition}[\DescribeMacro\glstreegroupheaderfmt] +\cs{glstreegroupheaderfmt}\marg{text} +\end{definition} +to format the heading. This defaults to +\cs{glstreenamefmt}\marg{text}. The tree-like styles that display +navigation links to the groups (such as \glostyle{indexhypergroup}), format +the navigation line using +\begin{definition}[\DescribeMacro\glstreenavigationfmt] +\cs{glstreenavigationfmt}\marg{text} +\end{definition} +which defaults to \cs{glstreenamefmt}\marg{text}. Note that this is +different from \cs{glslistnavigationitem}, provided with the styles +such as \glostyle{listhypergroup}, as that also includes \cs{item}. + +With the exception of the \glostyle{alttree} style (and those +derived from it), the space before the description for top-level +entries is produced with +\begin{definition}[\DescribeMacro\glstreepredesc] +\cs{glstreepredesc} +\end{definition} +This defaults to \cs{space}. + +With the exception of the \glostyle{treenoname} and +\glostyle{alttree} styles (and those derived from them), the +space before the description for child +entries is produced with +\begin{definition}[\DescribeMacro\glstreechildpredesc] +\cs{glstreechildpredesc} +\end{definition} +This defaults to \cs{space}. + +\begin{important} +Most of these styles are not designed for multi-paragraph +descriptions. (The \glostyle{tree} style isn't too bad for +multi-paragraph top-level entry descriptions, or you can use the +\glostyle{index} style with the adjustment shown below.) +\end{important} + +\begin{description} +\item[index] The \glostyle{index} style is similar to the way +indices are usually formatted in that it has a hierarchical +structure up to three levels (the main level plus two sub-levels). +The name is typeset in bold, and if the symbol is present it is set +in parentheses after the name and before the description. +Sub-entries are indented and also include the name, the symbol +in brackets (if present) and the description. Groups are separated +using \ics{indexspace}. + +Each main level item is started with +\begin{definition}[\DescribeMacro\glstreeitem] +\cs{glstreeitem} +\end{definition} +The level~1 entries are started with +\begin{definition}[\DescribeMacro\glstreesubitem] +\cs{glstreesubitem} +\end{definition} + +The level~2 entries are started with +\begin{definition}[\DescribeMacro\glstreesubsubitem] +\cs{glstreesubsubitem} +\end{definition} + +Note that the \glostyle{index} style automatically sets +\begin{verbatim} +\let\item\glstreeitem +\let\subitem\glstreesubitem +\let\subsubitem\glstreesubsubitem +\end{verbatim} +at the start of the glossary for backward compatibility. + +The \glostyle{index} style isn't suitable for multi-paragraph +descriptions, but this limitation can be overcome by redefining +the above commands. For example: +\begin{verbatim} +\renewcommand{\glstreeitem}{% + \parindent0pt\par\hangindent40pt + \everypar{\parindent50pt\hangindent40pt}} +\end{verbatim} + +\item[indexgroup] The \glostyle{indexgroup} style is similar to +the \glostyle{index} style except that each group has a heading +obtained using \cs{glsgetgrouptitle}\marg{label}, +which is described in \sectionref{sec:newglossarystyle}. + +\item[indexhypergroup] The \glostyle{indexhypergroup} style is like +\glostyle{indexgroup} but has a set of links to the glossary +groups. The navigation line is the same as that for +\glostyle{listhypergroup}, described above, but is formatted using +\cs{glstreenavigationfmt}. + +\item[tree] The \glostyle{tree} style is similar to the +\glostyle{index} style except that it can have arbitrary levels. +(Note that \gls{makeindex} is limited to three levels, so +you will need to use \gls{xindy} if you want more than +three levels.) Each sub-level is indented by +\DescribeMacro{\glstreeindent}\cs{glstreeindent}. Note that the +name, symbol (if present) and description are placed in the +same paragraph block. If you want the name to be apart from the +description, use the \glostyle{alttree} style instead. (See below.) + +\item[treegroup] The \glostyle{treegroup} style is similar to +the \glostyle{tree} style except that each group has a heading. + +\item[treehypergroup] The \glostyle{treehypergroup} style is like +\glostyle{treegroup} but has a set of links to the glossary +groups. The navigation line is the same as that for +\glostyle{listhypergroup}, described above, but is formatted using +\cs{glstreenavigationfmt}. + +\item[treenoname] The \glostyle{treenoname} style is like +the \glostyle{tree} style except that the name for each sub-entry +is ignored. + +\item[treenonamegroup] The \glostyle{treenonamegroup} style is +similar to the \glostyle{treenoname} style except that each group +has a heading. + +\item[treenonamehypergroup] The \glostyle{treenonamehypergroup} +style is like \glostyle{treenonamegroup} but has a set of links to +the glossary groups. The navigation line is the same as that for +\glostyle{listhypergroup}, described above, but is formatted using +\cs{glstreenavigationfmt}. + +\item[alttree] The \glostyle{alttree} style is similar to the +\glostyle{tree} style except that the indentation for each level +is determined by the width of the text specified by +\begin{definition}[\DescribeMacro{\glssetwidest}] +\cs{glssetwidest}\oarg{level}\marg{text} +\end{definition} +The optional argument \meta{level} indicates the level, where +0 indicates the top-most level, 1 indicates the first level +sub-entries, etc. If \cs{glssetwidest} hasn't been used for a +given sub-level, the level~0 widest text is used instead. If +\meta{level} is omitted, 0 is assumed. + +As from v4.22, the \sty{glossary-tree} package also provides +\begin{definition}[\DescribeMacro\glsfindwidesttoplevelname] +\cs{glsfindwidesttoplevelname}\oarg{glossary list} +\end{definition} +This iterates over all parentless entries in the given glossary +lists and determines the widest entry. If the optional argument is +omitted, all glossaries are assumed (as per \cs{forallglossaries}). + +For example, to have the same name width for all glossaries: +\begin{verbatim} +\glsfindwidesttoplevelname +\setglossarystyle{alttree} +\printglossaries +\end{verbatim} +Alternatively, to compute the widest entry for each glossary +before it's displayed: +\begin{verbatim} +\renewcommand{\glossarypreamble}{% + \glsfindwidesttoplevelname[\currentglossary]} +\setglossarystyle{alttree} +\printglossaries +\end{verbatim} + +\begin{important} +These commands only affects the \glostyle{alttree} styles, including those +listed below and the ones in the \sty{glossary-mcols} package. +If you forget to set the widest entry name, the description will +overwrite the name. +\end{important} + +For each level, the name is placed to the left of the paragraph +block containing the symbol (optional) and the description. If the +symbol is present, it is placed in parentheses before the +description. + +The name is placed inside a left-aligned \cs{makebox}. As from +v4.19, this can now be adjusted by redefining +\begin{definition}[\DescribeMacro\glstreenamebox] +\cs{glstreenamebox}\marg{width}\marg{text} +\end{definition} +where \meta{width} is the width of the box and \meta{text} is the +contents of the box. For example, to make the name right-aligned: +\begin{verbatim} +\renewcommand*{\glstreenamebox}[2]{% + \makebox[#1][r]{#2}% +} +\end{verbatim} + +\item[alttreegroup] The \glostyle{alttreegroup} is like the +\glostyle{alttree} style except that each group has a heading. + +\item[alttreehypergroup] The \glostyle{alttreehypergroup} style is +like \glostyle{alttreegroup} but has a set of links to the glossary +groups. The navigation line is the same as that for +\glostyle{listhypergroup}, described above. + +\end{description} + +\subsection{Multicols Style} +\label{sec:mcolstyles} + +The \sty{glossary-mcols} package provides tree-like styles that are +in the \env{multicols} environment (defined by the \sty{multicol} +package). The style names are as their analogous tree styles (as +defined in \sectionref{sec:treestyles}) but are prefixed with +\qt{mcol}. +For example, the \glostyle{mcolindex} style is essentially the +\glostyle{index} style but put in a \env{multicols} environment. +For the complete list, see \tableref{tab:mcols}. The +\sty{glossary-tree} package is automatically loaded by +\sty{glossary-mcols} (even if the \pkgopt{notree} package option is +used when loading \styfmt{glossaries}). The formatting commands +\cs{glstreenamefmt}, \cs{glstreegroupheaderfmt} and +\cs{glstreenavigationfmt} are all used by the corresponding +\sty{glossary-mcols} styles. + +\begin{important} +Note that \sty{glossary-mcols} is not loaded by \styfmt{glossaries}. If +you want to use any of the multicol styles in that package you need +to load it explicitly with \cs{usepackage} and set the required glossary +style using \ics{setglossarystyle}. +\end{important} + +The default number of columns is 2, but can be changed by redefining +\begin{definition}[\DescribeMacro{\glsmcols}] +\cs{glsmcols} +\end{definition} +to the required number. For example, for a three column glossary: +\begin{verbatim} +\usepackage{glossary-mcols} +\renewcommand*{\glsmcols}{3} +\setglossarystyle{mcolindex} +\end{verbatim} + +\begin{table}[htbp] +\caption{Multicolumn Styles} +\label{tab:mcols} +\centering +\begin{tabular}{ll} +\bfseries +\sty{glossary-mcols} Style & +\bfseries +Analogous Tree Style\\ +\glostyle{mcolindex} & \glostyle{index}\\ +\glostyle{mcolindexgroup} & \glostyle{indexgroup}\\ +\glostyle{mcolindexhypergroup} or \glostyle{mcolindexspannav} & \glostyle{indexhypergroup}\\ +\glostyle{mcoltree} & \glostyle{tree}\\ +\glostyle{mcoltreegroup} & \glostyle{treegroup}\\ +\glostyle{mcoltreehypergroup} or \glostyle{mcoltreespannav} & \glostyle{treehypergroup}\\ +\glostyle{mcoltreenoname} & \glostyle{treenoname}\\ +\glostyle{mcoltreenonamegroup} & \glostyle{treenonamegroup}\\ +\glostyle{mcoltreenonamehypergroup} or +\glostyle{mcoltreenonamespannav} & \glostyle{treenonamehypergroup}\\ +\glostyle{mcolalttree} & \glostyle{alttree}\\ +\glostyle{mcolalttreegroup} & \glostyle{alttreegroup}\\ +\glostyle{mcolalttreehypergroup} or \glostyle{mcolalttreespannav} & \glostyle{alttreehypergroup} +\end{tabular} +\end{table} + +The styles with a navigation line, such as +\glostyle{mcoltreehypergroup}, now have a variant (as from v4.22) +with \qt{hypergroup} replaced with \qt{spannav} in the style name. +The original \qt{hypergroup} styles place the navigation line at the +start of the first column. The newer \qt{spannav} styles put the +navigation line in the optional argument of the \env{multicols} +environment so that it spans across all the columns. + +\subsection{In-Line Style} +\label{sec:inline} + +This section covers the \sty{glossary-inline} package that supplies +the \glostyle{inline} style. This is a style that is designed for +in-line use (as opposed to block styles, such as lists or tables). +This style doesn't display the \gls{numberlist}. + +You will most likely need to redefine \ics{glossarysection} with +this style. For example, suppose you are required to have your +glossaries and list of acronyms in a footnote, you can do: +\begin{verbatim} + \usepackage{glossary-inline} + + \renewcommand*{\glossarysection}[2][]{\textbf{#1}: } + \setglossarystyle{inline} +\end{verbatim} + +\begin{important} +Note that you need to include \sty{glossary-inline} with +\cs{usepackage} as it's not automatically included by the +\styfmt{glossaries} package and then set the style using +\ics{setglossarystyle}. +\end{important} + +Where you need to include your glossaries as a footnote you can do: +\begin{verbatim} +\footnote{\printglossaries} +\end{verbatim} + +The \glostyle{inline} style is governed by the following: +\begin{definition}[\DescribeMacro{\glsinlineseparator}] +\ics{glsinlineseparator} +\end{definition} +This defaults to \qt{\texttt{\glsinlineseparator}} and is used between +main (i.e.\ level~0) entries. +\begin{definition}[\DescribeMacro{\glsinlinesubseparator}] +\ics{glsinlinesubseparator} +\end{definition} +This defaults to \qt{\texttt{\glsinlinesubseparator}} and is used between +sub-entries. +\begin{definition}[\DescribeMacro{\glsinlineparentchildseparator}] +\ics{glsinlineparentchildseparator} +\end{definition} +This defaults to \qt{\texttt{\glsinlineparentchildseparator}} and is used between +a parent main entry and its first sub-entry. +\begin{definition}[\DescribeMacro{\glspostinline}] +\ics{glspostinline} +\end{definition} +This defaults to \qt{\texttt{\glsinlineseparator}} and is used at the end +of the glossary. +\begin{definition}[\DescribeMacro\glsinlinenameformat] +\cs{glsinlinenameformat}\marg{label}\marg{name} +\end{definition} +This is used to format the entry name and defaults to +\cs{glstarget}\marg{label}\marg{name}, where \meta{name} is provided +in the form \cs{glossentryname}\marg{label} and \meta{label} is the +entry's label. For example, if you want the name to appear in +smallcaps: +\begin{verbatim} +\renewcommand*{\glsinlinenameformat}[2]{\glstarget{#1}{\textsc{#2}}} +\end{verbatim} +Sub-entry names are formatted according to +\begin{definition}[\DescribeMacro\glsinlinesubnameformat] +\cs{glsinlinesubnameformat}\marg{label}\marg{name} +\end{definition} +This defaults to \cs{glstarget}\marg{label}\verb|{}| so the +sub-entry name is ignored. + +If the description has been suppressed (according to +\cs{ifglsdescsuppressed}) then +\begin{definition}[\DescribeMacro\glsinlineemptydescformat] +\cs{glsinlineemptydescformat}\marg{symbol}\marg{number list} +\end{definition} +(which defaults to nothing) is used, +otherwise the description is formatted according to +\begin{definition}[\DescribeMacro\glsinlinedescformat] +\cs{glsinlinedescformat}\marg{description}\marg{symbol}\marg{number +list} +\end{definition} +This defaults to just \cs{space}\meta{description} so the symbol and +location list are ignored. If the description is missing (according +to \cs{ifglshasdesc}), then \cs{glsinlineemptydescformat} is used +instead. + +For example, if you want a colon between the name and the +description: +\begin{verbatim} +\renewcommand*{\glsinlinedescformat}[3]{: #1} +\end{verbatim} + +The sub-entry description is formatted according to: +\begin{definition}[\DescribeMacro\glsinlinesubdescformat] +\cs{glsinlinesubdescformat}\marg{description}\marg{symbol}\marg{number +list} +\end{definition} +This defaults to just \meta{description}. + +\section{Defining your own glossary style} +\label{sec:newglossarystyle} + +If the predefined styles don't fit your requirements, you can +define your own style using: +\begin{definition}[\DescribeMacro{\newglossarystyle}] +\cs{newglossarystyle}\marg{name}\marg{definitions} +\end{definition} +where \meta{name} is the name of the new glossary style (to be +used in \cs{setglossarystyle}). The second argument \meta{definitions} +needs to redefine all of the following: + +\begin{definition}[\DescribeEnv{theglossary}] +\env{theglossary} +\end{definition} +This environment defines how the main body of the glossary should +be typeset. Note that this does not include the section heading, +the glossary preamble (defined by \ics{glossarypreamble}) or the +glossary postamble (defined by \ics{glossarypostamble}). For example, +the \glostyle{list} style uses the \env{description} environment, +so the \env{theglossary} environment is simply redefined to begin +and end the \env{description} environment. + +\begin{definition}[\DescribeMacro{\glossaryheader}] +\cs{glossaryheader} +\end{definition} +This macro indicates what to do at the start of the main body +of the glossary. Note that this is not the same as +\ics{glossarypreamble}, which should not be affected by changes in +the glossary style. The \glostyle{list} glossary style redefines +\ics{glossaryheader} to do nothing, whereas the \glostyle{longheader} +glossary style redefines \cs{glossaryheader} to do a header row. + +\begin{definition}[\DescribeMacro{\glsgroupheading}] +\cs{glsgroupheading}\marg{label} +\end{definition} +This macro indicates +what to do at the start of each logical block within the main body +of the glossary. If you use \gls{makeindex} the glossary is +sub-divided into a maximum of twenty-eight logical blocks that are +determined by the first character of the \gloskey{sort} key (or +\gloskey{name} key if the \gloskey{sort} key is omitted). The +sub-divisions are in the following order: symbols, numbers, A, +\ldots, Z\@. If you use \gls{xindy}, the sub-divisions depend on +the language settings. + +Note that the argument to \cs{glsgroupheading} +is a label \emph{not} the group title. The group title can be obtained +via +\begin{definition}[\DescribeMacro{\glsgetgrouptitle}] +\cs{glsgetgrouptitle}\marg{label} +\end{definition} +This obtains the title as follows: if \meta{label} consists of a +single non-active character or \meta{label} is equal to +\texttt{glssymbols} or \texttt{glsnumbers} and +\cs{}\meta{label}\texttt{groupname} exists, this is taken to be the +title, otherwise the title is just \meta{label}. (The \qt{symbols} +group has the label \texttt{glssymbols}, so the command +\ics{glssymbolsgroupname} is used, and the \qt{numbers} group has the +label \texttt{glsnumbers}, so the command \ics{glsnumbersgrouptitle} +is used.) If you are using \gls{xindy}, \meta{label} may be an +active character (for example \o), in which case the title will be +set to just \meta{label}. You can redefine \cs{glsgetgrouptitle} if +this is unsuitable for your document. + +A navigation hypertarget can be created using +\begin{definition}[\DescribeMacro{\glsnavhypertarget}] +\cs{glsnavhypertarget}\marg{label}\marg{text} +\end{definition} +This typically requires \cs{glossaryheader} to be redefined to use +\begin{definition}[\DescribeMacro\glsnavigation] +\cs{glsnavigation} +\end{definition} +which displays the navigation line. + +For further details about \cs{glsnavhypertarget}, see +\ifpdf section~\ref*{sec:code:hypernav} in \fi the documented code +(\texttt{glossaries-code.pdf}). + +Most of the predefined glossary styles redefine \cs{glsgroupheading} +to simply ignore its argument. The \glostyle{listhypergroup} style +redefines \cs{glsgroupheading} as follows: +\begin{verbatim} +\renewcommand*{\glsgroupheading}[1]{% +\item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]} +\end{verbatim} +See also \cs{glsgroupskip} below. (Note that command definitions within +\ics{newglossarystyle} must use \verb|##1| instead of \verb|#1| etc.) + +\begin{definition}[\DescribeMacro{\glsgroupskip}] +\cs{glsgroupskip} +\end{definition} +This macro determines what to do after one logical group but before +the header for the next logical group. The \glostyle{list} glossary +style simply redefines \cs{glsgroupskip} to be \ics{indexspace}, +whereas the tabular-like styles redefine \cs{glsgroupskip} to +produce a blank row. + +As from version 3.03, the package option \pkgopt{nogroupskip} can be +used to suppress this default gap for the predefined styles. + +\begin{definition}[\DescribeMacro{\glossentry}] +\cs{glossentry}\marg{label}\marg{number list} +\end{definition} +This macro indicates what to do for each top-level (level~0) glossary entry. +The entry label is given by \meta{label} and the associated +\gls{numberlist} is given by \meta{number list}. You can redefine +\ics{glossentry} to use commands like \ics{glossentryname}\marg{label}, +\ics{glossentrydesc}\marg{label} and \ics{glossentrysymbol}\marg{label} +to display the name, description and symbol fields, or to access +other fields, use commands like \ics{glsentryuseri}\marg{label}. +(See \sectionref{sec:glsnolink} for further details.) You can also +use the following commands: + +\begin{definition}[\DescribeMacro{\glsentryitem}] +\cs{glsentryitem}\marg{label} +\end{definition} +This macro will increment and display the associated counter for the +main (level~0) entries if the \pkgopt{entrycounter} or +\pkgopt{counterwithin} package options have been used. This macro +is typically called by \cs{glossentry} before \cs{glstarget}. +The format of the counter is controlled by the macro +\begin{definition}[\DescribeMacro{\glsentrycounterlabel}] +\cs{glsentrycounterlabel} +\end{definition} + +Each time you use a glossary entry it creates a hyperlink (if +hyperlinks are enabled) to the relevant line in the glossary. +Your new glossary style must therefore redefine +\cs{glossentry} to set the appropriate target. This +is done using +\begin{definition}[\DescribeMacro{\glstarget}] +\cs{glstarget}\marg{label}\marg{text} +\end{definition} +where \meta{label} is the entry's label. Note that you +don't need to worry about whether the \sty{hyperref} package has +been loaded, as \cs{glstarget} won't create a target if +\cs{hypertarget} hasn't been defined. + +For example, the \glostyle{list} style defines \cs{glossentry} as follows: +\begin{verbatim} + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription\space ##2} +\end{verbatim} + +Note also that \meta{number list} will always be of the form +\begin{definition} +\ics{glossaryentrynumbers}\{\cs{relax}\\ +\ics{setentrycounter}\oarg{Hprefix}\marg{counter name}\meta{format cmd}\marg{number(s)}\} +\end{definition} +where \meta{number(s)} +may contain \ics{delimN} (to delimit individual numbers) and/or +\ics{delimR} (to indicate a range of numbers). There may be +multiple occurrences of +\ics{setentrycounter}\oarg{Hprefix}\marg{counter name}\meta{format cmd}\marg{number(s)}, but note +that the entire number list is enclosed within the argument +of \ics{glossaryentrynumbers}. The user can redefine this to change +the way the entire number list is formatted, regardless of +the glossary style. However the most common use of +\ics{glossaryentrynumbers} is to provide a means of suppressing the +number list altogether. (In fact, the \pkgopt{nonumberlist} option +redefines \ics{glossaryentrynumbers} to ignore its argument.) +Therefore, when you define a new glossary style, you don't need +to worry about whether the user has specified the +\pkgopt{nonumberlist} package option. + +\begin{definition}[\DescribeMacro{\subglossentry}] +\cs{subglossentry}\marg{level}\marg{label}\marg{number list} +\end{definition} +This is used to display sub-entries. +The first argument, \meta{level}, indicates the sub-entry level. +This must be an integer from 1 (first sub-level) onwards. The +remaining arguments are analogous to those for +\ics{glossentry} described above. + +\begin{definition}[\DescribeMacro{\glssubentryitem}] +\cs{glssubentryitem}\marg{label} +\end{definition} +This macro will increment and display the associated counter for the +level~1 entries if the \pkgopt{subentrycounter} package option has +been used. This macro is typically called by \cs{subglossentry} +before \ics{glstarget}. The format of the counter is controlled by +the macro +\begin{definition}[\DescribeMacro{\glssubentrycounterlabel}] +\cs{glssubentrycounterlabel} +\end{definition} + +Note that \ics{printglossary} (which \ics{printglossaries} calls) +sets +\begin{definition}[\DescribeMacro{\currentglossary}] +\cs{currentglossary} +\end{definition} +to the current glossary label, so it's possible to create a glossary +style that varies according to the glossary type. + +For further details of these commands, see \ifpdf +section~\ref*{sec:code:printglos} \fi \qt{Displaying the glossary} +in the documented code (\texttt{glossaries-code.pdf}). + +\begin{example}{Creating a completely new style}{sec:exnewstyle} + +If you want a completely new style, you will need to redefine all +of the commands and the environment listed above. + +For example, suppose you want each entry to start with a bullet point. +This means that the glossary should be placed in the \env{itemize} +environment, so \env{theglossary} should start and end that +environment. Let's also suppose that you don't want anything between +the glossary groups (so \ics{glsgroupheading} and \ics{glsgroupskip} +should do nothing) and suppose you don't want anything to appear +immediately after \verb|\begin{theglossary}| (so \ics{glossaryheader} +should do nothing). In addition, let's suppose the symbol should +appear in brackets after the name, followed by the description and +last of all the \gls{numberlist} should appear within square brackets +at the end. Then you can create this new glossary style, called, say, +\texttt{mylist}, as follows: +\begin{verbatim} + \newglossarystyle{mylist}{% + % put the glossary in the itemize environment: + \renewenvironment{theglossary}% + {\begin{itemize}}{\end{itemize}}% + % have nothing after \begin{theglossary}: + \renewcommand*{\glossaryheader}{}% + % have nothing between glossary groups: + \renewcommand*{\glsgroupheading}[1]{}% + \renewcommand*{\glsgroupskip}{}% + % set how each entry should appear: + \renewcommand*{\glossentry}[2]{% + \item % bullet point + \glstarget{##1}{\glossentryname{##1}}% the entry name + \space (\glossentrysymbol{##1})% the symbol in brackets + \space \glossentrydesc{##1}% the description + \space [##2]% the number list in square brackets + }% + % set how sub-entries appear: + \renewcommand*{\subglossentry}[3]{% + \glossentry{##2}{##3}}% + } +\end{verbatim} +Note that this style creates a flat glossary, where sub-entries +are displayed in exactly the same way as the top level entries. +It also hasn't used \ics{glsentryitem} or \ics{glssubentryitem} so +it won't be affected by the \pkgopt{entrycounter}, +\pkgopt{counterwithin} or \pkgopt{subentrycounter} package options. + +Variations: +\begin{itemize} +\item You might want the entry name to be capitalised, in +which case use \ics{Glossentryname} instead of \ics{glossentryname}. + +\item You might want to check if the symbol hasn't been set and omit +the parentheses if the symbol is absent. In this case you can use +\ics{ifglshassymbol} (see \sectionref{sec:utilities}): +\begin{verbatim} + \renewcommand*{\glossentry}[2]{% + \item % bullet point + \glstarget{##1}{\glossentryname{##1}}% the entry name + \ifglshassymbol{##1}% check if symbol exists + {% + \space (\glossentrysymbol{##1})% the symbol in brackets + }% + {}% no symbol so do nothing + \space \glossentrydesc{##1}% the description + \space [##2]% the number list in square brackets + }% +\end{verbatim} +\end{itemize} +\end{example} + +\begin{example}{Creating a new glossary style based on an +existing style}{sec:exadaptstyle} + +If you want to define a new style that is a slightly modified +version of an existing style, you can use \ics{setglossarystyle} +within the second argument of \ics{newglossarystyle} followed by +whatever alterations you require. For example, suppose you want +a style like the \glostyle{list} style but you don't want the extra +vertical space created by \ics{indexspace} between groups, then you +can create a new glossary style called, say, \texttt{mylist} as +follows: +\begin{verbatim} +\newglossarystyle{mylist}{% +\setglossarystyle{list}% base this style on the list style +\renewcommand{\glsgroupskip}{}% make nothing happen + % between groups +} +\end{verbatim} +(In this case, you can actually achieve the same effect using the +\glostyle{list} style in combination with the package option +\pkgopt{nogroupskip}.) +\end{example} + +\begin{example}{Example: creating a glossary style that uses the +\texorpdfstring{\gloskey{user1}}{user1}, \ldots, +\texorpdfstring{\gloskey{user6}}{user6} keys}{sec:exuserstyle} + +Suppose each entry not only has an associated symbol, +but also units (stored in \gloskey{user1}) and dimension +(stored in \gloskey{user2}). Then you can define a glossary style +that displays each entry in a \env{longtable} as follows: +\begin{verbatim} +\newglossarystyle{long6col}{% + % put the glossary in a longtable environment: + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}cccp{\glspagelistwidth}}}% + {\end{longtable}}% + % Set the table's header: + \renewcommand*{\glossaryheader}{% + \bfseries Term & \bfseries Description & \bfseries Symbol & + \bfseries Units & \bfseries Dimensions & \bfseries Page List + \\\endhead}% + % No heading between groups: + \renewcommand*{\glsgroupheading}[1]{}% + % Main (level 0) entries displayed in a row optionally numbered: + \renewcommand*{\glossentry}[2]{% + \glsentryitem{##1}% Entry number if required + \glstarget{##1}{\glossentryname{##1}}% Name + & \glossentrydesc{##1}% Description + & \glossentrysymbol{##1}% Symbol + & \glsentryuseri{##1}% Units + & \glsentryuserii{##1}% Dimensions + & ##2% Page list + \tabularnewline % end of row + }% + % Similarly for sub-entries (no sub-entry numbers): + \renewcommand*{\subglossentry}[3]{% + % ignoring first argument (sub-level) + \glstarget{##2}{\glossentryname{##2}}% Name + & \glossentrydesc{##2}% Description + & \glossentrysymbol{##2}% Symbol + & \glsentryuseri{##2}% Units + & \glsentryuserii{##2}% Dimensions + & ##3% Page list + \tabularnewline % end of row + }% + % Nothing between groups: + \renewcommand*{\glsgroupskip}{}% +} +\end{verbatim} +\end{example} + +\chapter{Utilities} +\label{sec:utilities} + +This section describes some utility commands. Additional commands +can be found in the documented code (glossaries-code.pdf). + +\section{Loops} +\label{sec:loops} + +\begin{important} +Some of the commands described here take a comma-separated list as +an argument. As with \LaTeX's \cs{@for} command, make sure your list +doesn't have any unwanted spaces in it as they don't get stripped. +(Discussed in more detail in +\href{http://www.dickimaw-books.com/latex/admin/html/docsvlist.shtml#spacesinlists}{\S2.7.2 of \qt{\LaTeX\ for Administrative +Work}}.) +\end{important} + +\begin{definition}[\DescribeMacro{\forallglossaries}] +\cs{forallglossaries}\oarg{glossary list}\marg{cs}\marg{body} +\end{definition} +This iterates through \meta{glossary list}, a comma-separated list +of glossary labels (as supplied when the glossary was defined). +At each iteration \meta{cs} (which must be a control sequence) is +set to the glossary label for the current iteration and \meta{body} +is performed. If \meta{glossary list} is omitted, the default is to +iterate over all glossaries (except the ignored ones). + +\begin{definition}[\DescribeMacro{\forallacronyms}] +\cs{forallacronyms}\marg{cs}\marg{body} +\end{definition} +This is like \cs{forallglossaries} but only iterates over the +lists of acronyms (that have previously been declared using +\ics{DeclareAcronymList} or the \pkgopt{acronymlists} package +option). This command doesn't have an optional argument. If you want +to explicitly say which lists to iterate over, just use the optional +argument of \cs{forallglossaries}. + +\begin{definition}[\DescribeMacro{\forglsentries}] +\cs{forglsentries}\oarg{glossary label}\marg{cs}\marg{body} +\end{definition} +This iterates through all entries in the glossary given by +\meta{glossary label}. At each iteration \meta{cs} (which must be a +control sequence) is set to the entry label for the current +iteration and \meta{body} is performed. If \meta{glossary label} is +omitted, \ics{glsdefaulttype} (usually the main glossary) is used. + +\begin{definition}[\DescribeMacro{\forallglsentries}] +\cs{forallglsentries}\oarg{glossary list}\marg{cs}\marg{body} +\end{definition} +This is like \cs{forglsentries} but for each glossary in +\meta{glossary list} (a comma-separated list of glossary labels). If +\meta{glossary list} is omitted, the default is the list of all +defined glossaries (except the ignored ones). At each iteration +\meta{cs} is set to the entry label and \meta{body} is performed. +(The current glossary label can be obtained using +\cs{glsentrytype}\marg{cs} within \meta{body}.) + +\section{Conditionals} +\label{sec:conditionals} + +\begin{definition}[\DescribeMacro{\ifglossaryexists}] +\cs{ifglossaryexists}{\meta{label}}{\meta{true part}}{\meta{false +part}} +\end{definition} +This checks if the glossary given by \meta{label} exists. If it +does \meta{true part} is performed, otherwise \meta{false part}. + +\begin{definition}[\DescribeMacro{\ifglsentryexists}] +\cs{ifglsentryexists}{\meta{label}}{\meta{true part}}{\meta{false +part}} +\end{definition} +This checks if the glossary entry given by \meta{label} exists. If it +does \meta{true part} is performed, otherwise \meta{false part}. +(Note that \cs{ifglsentryexists} will always be true after the +containing glossary has been displayed via \ics{printglossary} +or \ics{printglossaries} even if the entry is explicitly defined +later in the document. This is because the entry has to be defined +before it can be displayed in the glossary, see \sectionref{sec:techissues} for +further details.) + +\begin{definition}[\DescribeMacro{\glsdoifexists}] +\cs{glsdoifexists}\marg{label}\marg{code} +\end{definition} +Does \meta{code} if the entry given by \meta{label} exists. If it +doesn't exist, an error is generated. (This command uses +\cs{ifglsentryexists}.) + +\begin{definition}[\DescribeMacro{\glsdoifnoexists}] +\cs{glsdoifnoexists}\marg{label}\marg{code} +\end{definition} +Does the reverse of \cs{glsdoifexists}. (This command uses +\cs{ifglsentryexists}.) + +\begin{definition}[\DescribeMacro{\glsdoifexistsorwarn}] +\cs{glsdoifexistsorwarn}\marg{label}\marg{code} +\end{definition} +As \cs{glsdoifexists} but issues a warning rather than an error if +the entry doesn't exist. + +\begin{definition}[\DescribeMacro{\glsdoifexistsordo}] +\cs{glsdoifexistsordo}\marg{label}\marg{code}\marg{else code} +\end{definition} +Does \meta{code} if the entry given by \meta{label} exists otherwise +generate an error and do \meta{else code}. + +\begin{definition}[\DescribeMacro{\glsdoifnoexistsordo}] +\cs{glsdoifnoexistsordo}\marg{label}\marg{code}\marg{else code} +\end{definition} +Does \meta{code} if the entry given by \meta{label} doesn't exist otherwise +generate an error and do \meta{else code}. + +\begin{definition}[\DescribeMacro{\ifglsused}] +\cs{ifglsused}{\meta{label}}{\meta{true part}}{\meta{false +part}} +\end{definition} +See \sectionref{sec:glsunset}. + +\begin{definition}[\DescribeMacro{\ifglshaschildren}] +\cs{ifglshaschildren}{\meta{label}}{\meta{true part}}{\meta{false +part}} +\end{definition} +This checks if the glossary entry given by \meta{label} has any +sub-entries. If it does, \meta{true part} is performed, otherwise +\meta{false part}. + +\begin{definition}[\DescribeMacro{\ifglshasparent}] +\cs{ifglshasparent}{\meta{label}}{\meta{true part}}{\meta{false +part}} +\end{definition} +This checks if the glossary entry given by \meta{label} has a parent +entry. If it does, \meta{true part} is performed, otherwise +\meta{false part}. + +\begin{definition}[\DescribeMacro{\ifglshassymbol}] +\cs{ifglshassymbol}\marg{label}\marg{true part}\marg{false part} +\end{definition} +This checks if the glossary entry given by \meta{label} has had the +\gloskey{symbol} field set. If it has, \meta{true part} is performed, +otherwise \meta{false part}. + +\begin{definition}[\DescribeMacro{\ifglshaslong}] +\cs{ifglshaslong}\marg{label}\marg{true part}\marg{false part} +\end{definition} +This checks if the glossary entry given by \meta{label} has had the +\gloskey{long} field set. If it has, \meta{true part} is performed, +otherwise \meta{false part}. This should be true for any entry that +has been defined via \ics{newacronym}. +There is no check for the existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\ifglshasshort}] +\cs{ifglshasshort}\marg{label}\marg{true part}\marg{false part} +\end{definition} +This checks if the glossary entry given by \meta{label} has had the +\gloskey{short} field set. If it has, \meta{true part} is performed, +otherwise \meta{false part}. This should be true for any entry that +has been defined via \ics{newacronym}. +There is no check for the existence of \meta{label}. + +\begin{definition}[\DescribeMacro{\ifglshasdesc}] +\cs{ifglshasdesc}\marg{label}\marg{true part}\marg{false part} +\end{definition} +This checks if the \gloskey{description} field is non-empty for +the entry given by \meta{label}. If it has, \meta{true part} is +performed, otherwise \meta{false part}. Compare with: +\begin{definition}[\DescribeMacro{\ifglsdescsuppressed}] +\cs{ifglsdescsuppressed}\marg{label}\marg{true part}\marg{false part} +\end{definition} +This checks if the \gloskey{description} field has been set to just +\ics{nopostdesc} for the entry given by \meta{label}. If it has, +\meta{true part} is performed, otherwise \meta{false part}. +There is no check for the existence of \meta{label}. + +For all other fields you can use: +\begin{definition}[\DescribeMacro\ifglshasfield] +\cs{ifglshasfield}\marg{field}\marg{label}\marg{true part}\marg{false +part} +\end{definition} +This tests the value of the field given by \meta{field} for the entry +identified by \meta{label}. If the value is empty \emph{or the default +value}, then \meta{false part} is performed, otherwise \meta{true +part} is performed. If the field supplied is unrecognised \meta{false part} +is performed and a warning is issued. Unlike the above commands, +such as \cs{ifglshasshort}, an error occurs if the entry is +undefined. + +As from version 4.23, within \meta{true part} you can use +\begin{definition}[\DescribeMacro\glscurrentfieldvalue] +\cs{glscurrentfieldvalue} +\end{definition} +to access the field value. This command is +initially defined to nothing but has +no relevance outside \meta{true part}. This saves re-accessing the +field if the test is true. For example: +\begin{verbatim} +\ifglshasfield{useri}{sample}{, \glscurrentfieldvalue}{} +\end{verbatim} +will insert a comma, space and the field value if the +\gloskey{user1} key has been set for +the entry whose label is \texttt{sample}. + +You can test if the value of the field is equal to a given string +using: +\begin{definition}[\DescribeMacro\ifglsfieldeq] +\cs{ifglsfieldeq}\marg{label}\marg{field}\marg{string}\marg{true}\marg{false} +\end{definition} +In this case the \meta{field} must be the field name not the key +(see \tableref{tab:fieldmap}). If the field isn't recognised, an +error will occur. This command internally uses +\sty{etoolbox}'s \cs{ifcsstring} to perform the comparison. \emph{The +string is not expanded during the test.} + +The result may vary depending on whether or not expansion is on for +the given field (when the entry was defined). For example: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} + +\newcommand*{\foo}{FOO} + +\newglossaryentry{sample1}{name={sample1},description={an example}, +user1={FOO}} +\newglossaryentry{sample2}{name={sample2},description={an example}, +user1={\foo}} + +\begin{document} +\ifglsfieldeq{sample1}{useri}{FOO}{TRUE}{FALSE}. + +\ifglsfieldeq{sample2}{useri}{FOO}{TRUE}{FALSE}. +\end{document} +\end{verbatim} +This will produce \qt{TRUE} in both cases since expansion is on, so +\cs{foo} was expanded to \qt{FOO} when \texttt{sample2} was defined. +If the tests are changed to: +\begin{verbatim} +\ifglsfieldeq{sample1}{useri}{\foo}{TRUE}{FALSE}. + +\ifglsfieldeq{sample2}{useri}{\foo}{TRUE}{FALSE}. +\end{verbatim} +then this will produce \qt{FALSE} in both cases. Now suppose +expansion is switched off for the \gloskey{user1} key: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} + +\newcommand*{\foo}{FOO} + +\glssetnoexpandfield{useri} + +\newglossaryentry{sample1}{name={sample1},description={an example}, +user1={FOO}} +\newglossaryentry{sample2}{name={sample2},description={an example}, +user1={\foo}} + +\begin{document} +\ifglsfieldeq{sample1}{useri}{FOO}{TRUE}{FALSE}. + +\ifglsfieldeq{sample2}{useri}{FOO}{TRUE}{FALSE}. +\end{document} +\end{verbatim} +This now produces \qt{TRUE} for the first case (comparing \qt{FOO} +with \qt{FOO}) and \qt{FALSE} for the second case (comparing +\qt{\cs{foo}} with \qt{FOO}). + +The reverse happens in the following: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} + +\newcommand*{\foo}{FOO} + +\glssetnoexpandfield{useri} + +\newglossaryentry{sample1}{name={sample1},description={an example}, +user1={FOO}} +\newglossaryentry{sample2}{name={sample2},description={an example}, +user1={\foo}} + +\begin{document} +\ifglsfieldeq{sample1}{useri}{\foo}{TRUE}{FALSE}. + +\ifglsfieldeq{sample2}{useri}{\foo}{TRUE}{FALSE}. +\end{document} +\end{verbatim} +This now produces \qt{FALSE} for the first case (comparing \qt{FOO} +with \qt{\cs{foo}}) and \qt{TRUE} for the second case (comparing +\qt{\cs{foo}} with \qt{\cs{foo}}). + +You can test if the value of a field is equal to the replacement +text of a command using: +\begin{definition}[\DescribeMacro\ifglsfielddefeq] +\cs{ifglsfielddefeq}\marg{label}\marg{field}\marg{command}\marg{true}\marg{false} +\end{definition} +This internally uses \sty{etoolbox}'s \cs{ifdefstrequal} command to +perform the comparison. The argument \meta{command} must be a macro. + +For example: +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} + +\newcommand*{\foo}{FOO} + +\glssetnoexpandfield{useri} + +\newglossaryentry{sample1}{name={sample1},description={an example}, +user1={FOO}} +\newglossaryentry{sample2}{name={sample2},description={an example}, +user1={\foo}} + +\begin{document} +\ifglsfielddefeq{sample1}{useri}{\foo}{TRUE}{FALSE}. + +\ifglsfielddefeq{sample2}{useri}{\foo}{TRUE}{FALSE}. +\end{document} +\end{verbatim} +Here, the first case produces \qt{TRUE} since the value of the +\texttt{useri} field (\qt{FOO}) is the same as the replacement text +(definition) of \cs{foo} (\qt{FOO}). We have the result +\qt{\texttt{FOO}} is equal to \qt{\texttt{FOO}}. + +The second case produces \qt{FALSE} since the value of the +\texttt{useri} field (\qt{\cs{foo}}) is not the same as the replacement +text (definition) of \cs{foo} (\qt{FOO}). No expansion has been +performed on the value of the \texttt{useri} field. We have the +result \qt{\cs{foo}} is not equal to \qt{\texttt{FOO}}. + +If we add: +\begin{verbatim} +\newcommand{\FOO}{\foo} +\ifglsfielddefeq{sample2}{useri}{\FOO}{TRUE}{FALSE}. +\end{verbatim} +we now get \qt{TRUE} since the value of the +\texttt{useri} field (\qt{\cs{foo}}) is the same as the replacement +text (definition) of \cs{FOO} (\qt{\cs{foo}}). We have the result \qt{\cs{foo}} +is equal to \qt{\cs{foo}}. + +There is a similar command that requires the control sequence name +(without the leading backslash) instead of the actual control sequence: +\begin{definition}[\DescribeMacro\ifglsfieldcseq] +\cs{ifglsfieldcseq}\marg{label}\marg{field}\marg{csname}\marg{true}\marg{false} +\end{definition} +This internally uses \sty{etoolbox}'s \cs{ifcsstrequal} command +instead of \cs{ifdefstrequal}. + +\section{Fetching and Updating the Value of a Field} +\label{sec:fetchset} + +You can fetch the value of a given field and store it in a control +sequence using: +\begin{definition}[\DescribeMacro\glsfieldfetch] +\cs{glsfieldfetch}\marg{label}\marg{field}\marg{cs} +\end{definition} +where \meta{label} is the label identifying the glossary entry, +\meta{field} is the field label (see \tableref{tab:fieldmap}) +and \meta{cs} is the control sequence in which to store the value. +Remember that \meta{field} is the internal label and is not +necessarily the same as the key used to set that field in the +argument of \cs{newglossaryentry} (or the optional argument of +\cs{newacronym}). + +You can change the value of a given field using one of the following +commands. Note that these commands only change the value of the +given field. They have no affect on any related field. For example, +if you change the value of the \gloskey{text} field, it won't modify the +value given by the \gloskey{name}, \gloskey{plural}, \gloskey{first} or any other related key. + +In all the four related commands below, \meta{label} and +\meta{field} are as above and \meta{definition} is the new value +of the field. + +\begin{definition}[\DescribeMacro\glsfielddef] +\cs{glsfielddef}\marg{label}\marg{field}\marg{definition} +\end{definition} +This uses \cs{def} to change the value of the field (so it will be +localised by any grouping). + +\begin{definition}[\DescribeMacro\glsfieldedef] +\cs{glsfieldedef}\marg{label}\marg{field}\marg{definition} +\end{definition} +This uses \cs{edef} to change the value of the field (so it will be +localised by any grouping). Any fragile commands contained in the +\meta{definition} must be protected. + +\begin{definition}[\DescribeMacro\glsfieldgdef] +\cs{glsfieldgdef}\marg{label}\marg{field}\marg{definition} +\end{definition} +This uses \cs{gdef} to change the value of the field. + +\begin{definition}[\DescribeMacro\glsfieldxdef] +\cs{glsfieldxdef}\marg{label}\marg{field}\marg{definition} +\end{definition} +This uses \cs{xdef} to change the value of the field. Any fragile +commands contained in the \meta{definition} must be protected. + + +\chapter{Prefixes or Determiners}\label{sec:prefix} + +The \sty{glossaries-prefix} package that comes with the +\styfmt{glossaries} package provides +additional keys that can be used as prefixes. For example, if you +want to specify determiners (such +as \qt{a}, \qt{an} or \qt{the}). The \styfmt{glossaries-prefix} +package automatically loads the \styfmt{glossaries} package and has +the same package options. + +The extra keys for \ics{newglossaryentry} are as follows: +\begin{description} +\item[\gloskey{prefix}] The prefix associated with the +\gloskey{text} key. This defaults to nothing. + +\item[\gloskey{prefixplural}] The prefix associated with the +\gloskey{plural} key. This defaults to nothing. + +\item[\gloskey{prefixfirst}] The prefix associated with the +\gloskey{first} key. If omitted, this defaults to the value of the +\gloskey{prefix} key. + +\item[\gloskey{prefixfirstplural}] The prefix associated with the +\gloskey{firstplural} key. If omitted, this defaults to the value of +the \gloskey{prefixplural} key. +\end{description} + +\begin{example}{Defining Determiners}{ex:determiners} +Here's the start of my example document: +\begin{verbatim} +documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[toc,acronym]{glossaries-prefix} +\end{verbatim} +Note that I've simply replaced \styfmt{glossaries} from previous +sample documents with \styfmt{glossaries-prefix}. Now for a sample +definition\footnote{Single letter words, such as \qt{a} and \qt{I} +should typically not appear at the end of a line, hence the +non-breakable space after \qt{a} in the \gloskey{prefix} field.}: +\begin{verbatim} +\newglossaryentry{sample}{name={sample},% + description={an example},% + prefix={a~},% + prefixplural={the\space}% +} +\end{verbatim} +Note that I've had to explicitly insert a~space after the prefix. +This allows for the possibility of prefixes that shouldn't have a~space, +such as: +\begin{verbatim} +\newglossaryentry{oeil}{name={oeil}, + plural={yeux}, + description={eye}, + prefix={l'}, + prefixplural={les\space}} +\end{verbatim} +Where a space is required at the end of the prefix, you must use +a~spacing command, such as \cs{space}, \verb*|\ | (backslash space) or +\verb|~| due to the automatic spacing trimming performed in +\meta{key}=\meta{value} options. + +The prefixes can also be used with acronyms. For example: +\begin{verbatim} +\newacronym + [% + prefix={an\space},prefixfirst={a~}% + ]{svm}{SVM}{support vector machine} +\end{verbatim} +\end{example} + +The \sty{glossaries-prefix} package provides convenient commands to +use these prefixes with commands such as \ics{gls}. Note that the +prefix is not considered part of the \gls{linktext}, so it's not +included in the hyperlink (where hyperlinks are enabled). The +options and any star or plus modifier are passed on to the \glslike\ +command. (See \sectionref{sec:glslink} for further details.) + +\begin{definition}[\DescribeMacro\pgls] +\cs{pgls}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This is inserts the value of the \gloskey{prefix} key (or +\gloskey{prefixfirst} key, on \gls{firstuse}) in front of +\cs{gls}\oarg{options}\marg{label}\oarg{insert}. + +\begin{definition}[\DescribeMacro\Pgls] +\cs{Pgls}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +If the \gloskey{prefix} key (or \gloskey{prefixfirst}, on +\gls*{firstuse}) has been set, this displays the value of that key +with the first letter converted to upper case followed by +\cs{gls}\oarg{options}\marg{label}\oarg{insert}. If that key hasn't +been set, this is equivalent to +\ics{Gls}\oarg{options}\marg{label}\oarg{insert}. + +\begin{definition}[\DescribeMacro\PGLS] +\cs{PGLS}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +As \cs{pgls} but converts the prefix to upper case and uses +\ics{GLS} instead of \cs{gls}. + +\begin{definition}[\DescribeMacro\pglspl] +\cs{pglspl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +This is inserts the value of the \gloskey{prefixplural} key (or +\gloskey{prefixfirstplural} key, on \gls{firstuse}) in front of +\cs{glspl}\oarg{options}\marg{label}\oarg{insert}. + +\begin{definition}[\DescribeMacro\Pglspl] +\cs{Pglspl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +If the \gloskey{prefixplural} key (or \gloskey{prefixfirstplural}, on +\gls*{firstuse}) has been set, this displays the value of that key +with the first letter converted to upper case followed by +\cs{glspl}\oarg{options}\marg{label}\oarg{insert}. If that key hasn't +been set, this is equivalent to +\ics{Glspl}\oarg{options}\marg{label}\oarg{insert}. + +\begin{definition}[\DescribeMacro\PGLSpl] +\cs{PGLSpl}\oarg{options}\marg{label}\oarg{insert} +\end{definition} +As \cs{pglspl} but converts the prefix to upper case and uses +\ics{GLSpl} instead of \cs{glspl}. + +\begin{example}{Using Prefixes}{ex:prefixes} +Continuing from Example~\ref{ex:determiners}, now that I've defined +my entries, I~can use them in the text via the above commands: +\begin{verbatim} +First use: \pgls{svm}. Next use: \pgls{svm}. +Singular: \pgls{sample}, \pgls{oeil}. +Plural: \pglspl{sample}, \pglspl{oeil}. +\end{verbatim} +which produces: +\begin{quote} +First use: a~support vector machine (SVM). Next +use: an SVM. +Singular: a~sample, l'oeil. Plural: the samples, les yeux. +\end{quote} +For a complete document, see \samplefile{-prefix}. +\end{example} + +This package also provides the commands described below, none of +which perform any check to determine the entry's existence. + +\begin{definition}[\DescribeMacro\ifglshasprefix] +\cs{ifglshasprefix}\marg{label}\marg{true part}\marg{false part} +\end{definition} +Does \meta{true part} if the entry identified by \meta{label} has a +non-empty value for the \gloskey{prefix} key. + +This package also provides the following commands: +\begin{definition}[\DescribeMacro\ifglshasprefixplural] +\cs{ifglshasprefixplural}\marg{label}\marg{true part}\marg{false part} +\end{definition} +Does \meta{true part} if the entry identified by \meta{label} has a +non-empty value for the \gloskey{prefixplural} key. + +\begin{definition}[\DescribeMacro\ifglshasprefixfirst] +\cs{ifglshasprefixfirst}\marg{label}\marg{true part}\marg{false part} +\end{definition} +Does \meta{true part} if the entry identified by \meta{label} has a +non-empty value for the \gloskey{prefixfirst} key. + +\begin{definition}[\DescribeMacro\ifglshasprefixfirstplural] +\cs{ifglshasprefixfirstplural}\marg{label}\marg{true part}\marg{false part} +\end{definition} +Does \meta{true part} if the entry identified by \meta{label} has a +non-empty value for the \gloskey{prefixfirstplural} key. + +\begin{definition}[\DescribeMacro\glsentryprefix] +\cs{glsentryprefix}\marg{label} +\end{definition} +Displays the value of the \gloskey{prefix} key for the entry given +by \meta{label}. + +\begin{definition}[\DescribeMacro\glsentryprefixfirst] +\cs{glsentryprefixfirst}\marg{label} +\end{definition} +Displays the value of the \gloskey{prefixfirst} key for the entry given +by \meta{label}. + +\begin{definition}[\DescribeMacro\glsentryprefixplural] +\cs{glsentryprefixplural}\marg{label} +\end{definition} +Displays the value of the \gloskey{prefixplural} key for the entry given +by \meta{label}. (No check is performed to determine if the entry +exists.) + +\begin{definition}[\DescribeMacro\glsentryprefixfirstplural] +\cs{glsentryprefixfirstplural}\marg{label} +\end{definition} +Displays the value of the \gloskey{prefixfirstplural} key for the entry given +by \meta{label}. (No check is performed to determine if the entry +exists.) + +There are also variants that convert the first letter to upper +case\footnote{The earlier caveats about initial non-Latin characters +apply.}: +\begin{definition}[\DescribeMacro\Glsentryprefix] +\cs{Glsentryprefix}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro\Glsentryprefixfirst] +\cs{Glsentryprefixfirst}\marg{label} +\end{definition} +\begin{definition}[\DescribeMacro\Glsentryprefixplural] +\cs{Glsentryprefixplural}\marg{label} +\end{definition} + +\begin{definition}[\DescribeMacro\Glsentryprefixfirstplural] +\cs{Glsentryprefixfirstplural}\marg{label} +\end{definition} + +\begin{important} +As with analogous commands such as \ics{Glsentrytext}, these +commands aren't expandable so can't be used in PDF bookmarks. +\end{important} + +\begin{example}{Adding Determiner to Glossary Style}{ex:plist} +You can use the above commands to define a new glossary style that +uses the determiner. For example, the following style is a slight +modification of the \glostyle{list} style that inserts the prefix +before the name: +\begin{verbatim} +\newglossarystyle{plist}{% + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \Glsentryprefix{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription\space ##2}% +} +\end{verbatim} +\end{example} + +\chapter{Accessibility Support}\label{sec:accsupp} + +Limited accessibility support is provided by the accompanying +\sty{glossaries-accsupp} package, but note that this package is +experimental and it requires the \sty{accsupp} package +which is also listed as experimental. This package defines +additional keys that may be used when defining glossary entries. +The keys are as follows: +\begin{description} +\item[{\gloskey{access}}] The replacement text corresponding to +the \gloskey{name} key. + +\item[{\gloskey{textaccess}}] The replacement text corresponding +to the \gloskey{text} key. + +\item[{\gloskey{firstaccess}}] The replacement text corresponding +to the \gloskey{first} key. + +\item[{\gloskey{pluralaccess}}] The replacement text corresponding +to the \gloskey{plural} key. + +\item[{\gloskey{firstpluralaccess}}] The replacement text corresponding +to the \gloskey{firstplural} key. + +\item[{\gloskey{symbolaccess}}] The replacement text corresponding +to the \gloskey{symbol} key. + +\item[{\gloskey{symbolpluralaccess}}] The replacement text corresponding +to the \gloskey{symbolplural} key. + +\item[{\gloskey{descriptionaccess}}] The replacement text corresponding +to the \gloskey{description} key. + +\item[{\gloskey{descriptionpluralaccess}}] The replacement text corresponding +to the \gloskey{descriptionplural} key. + +\item[{\gloskey{longaccess}}] The replacement text corresponding to +the \gloskey{long} key (used by \ics{newacronym}). + +\item[{\gloskey{shortaccess}}] The replacement text corresponding to +the \gloskey{short} key (used by \ics{newacronym}). + +\item[{\gloskey{longpluralaccess}}] The replacement text corresponding to +the \gloskey{longplural} key (used by \ics{newacronym}). + +\item[{\gloskey{shortpluralaccess}}] The replacement text corresponding to +the \gloskey{shortplural} key (used by \ics{newacronym}). + +\end{description} +For example: +\begin{verbatim} +\newglossaryentry{tex}{name={\TeX},description={Document +preparation language},access={TeX}} +\end{verbatim} +Now \verb|\gls{tex}| will be equivalent to +\begin{verbatim} +\BeginAccSupp{ActualText=TeX}\TeX\EndAccSupp{} +\end{verbatim} +The sample file \samplefile{accsupp} illustrates the +\sty{glossaries-accsupp} package. + +See \ifpdf section~\ref*{sec:code:accsupp} in \fi the documented code +(\texttt{glossaries-code.pdf}) for further details. I~recommend +that you also read the \sty{accsupp} documentation. + +\chapter{Troubleshooting} +\label{sec:trouble} + +In addition to the sample files listed in \sectionref{sec:samples}, +the \styfmt{glossaries} package comes with some minimal example +files, \texttt{minimalgls.tex}, \texttt{mwe-gls.tex}, +\texttt{mwe-acr.tex} and \texttt{mwe-acr-desc.tex}, which can be +used for testing. These should be located in the \texttt{samples} +subdirectory (folder) of the \styfmt{glossaries} documentation +directory. The location varies according to your operating system +and \TeX\ installation. For example, on my Linux partition it can +be found in \texttt{/usr\slash local\slash texlive\slash +2014\slash texmf-dist\slash doc\slash latex\slash glossaries/}. +The \gls{makeglossariesgui} application can also be used to test for +various problems. +Further information on debugging \LaTeX\ code is available at +\url{http://www.dickimaw-books.com/latex/minexample/}. + +If you have any problems, please first consult the +\urlfootref{http://www.dickimaw-books.com/faqs/glossariesfaq.html}{\styfmt{glossaries} FAQ}. If that +doesn't help, try posting your query to somewhere like the +\texttt{comp.text.tex} newsgroup, the +\urlfootref{http://www.latex-community.org/}{\LaTeX\ Community Forum} or +\urlfootref{http://tex.stackexchange.com/}{\TeX\ on StackExchange}. +Bug reports can be submitted via +\urlfootref{http://www.dickimaw-books.com/bug-report.html}{my package bug report form}. + +\PrintIndex + +\end{document} diff --git a/macros/latex/contrib/glossaries/glossaries.dtx b/macros/latex/contrib/glossaries/glossaries.dtx new file mode 100644 index 0000000000..6da667da8b --- /dev/null +++ b/macros/latex/contrib/glossaries/glossaries.dtx @@ -0,0 +1,39747 @@ +%\iffalse +% glossaries.dtx generated using makedtx version 1.2 (c) Nicola Talbot +% Command line args: +% -setambles ".*\.perl=>\nopreamble\nopostamble" +% -setambles ".*\.tex=>\nopreamble\nopostamble" +% -setambles ".*\.xdy=>\nopreamble\nopostamble" +% -src "glossaries\.sty\Z=>glossaries.sty" +% -src "glossaries-prefix.sty\Z=>glossaries-prefix.sty" +% -src "(glossary-.+)\.(sty)\Z=>\1.\2" +% -src "(glossaries-compatible-207)\.(sty)\Z=>\1.\2" +% -src "(glossaries-compatible-307)\.(sty)\Z=>\1.\2" +% -src "(glossaries-accsupp)\.(sty)\Z=>\1.\2" +% -src "(glossaries-babel)\.(sty)\Z=>\1.\2" +% -src "(glossaries-polyglossia)\.(sty)\Z=>\1.\2" +% -src "(minimalgls\.tex)\Z=>\1" +% -src "(glossary-lipsum-examples\.tex)\Z=>\1" +% -src "(example-glossaries-.*\.tex)\Z=>\1" +% -src "(sample.*\.tex)\Z=>\1" +% -src "(mwe.*\.tex)\Z=>\1" +% -src "(samplexdy-mc.*\.xdy)\Z=>\1" +% -src "(database.*\.tex)\Z=>\1" +% -src "(.*\.perl)\Z=>\1" +% -codetitle "Main Package Code" +% -author "Nicola Talbot" +% -macrocode ".*\.perl" +% -macrocode ".*\.tex" +% -macrocode ".*\.xdy" +% -section "chapter" +% -doc "glossaries-manual.tex" +% -comment ".*\.perl" +% -comment ".*\.tex" +% -comment ".*\.xdy" +% glossaries +% Created on 2019/1/6 19:06 +%\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]{nlctdoc} + +\DeleteShortVerb{|} + +\iffalse +glossaries-manual.tex is a stub file used by makedtx to create +glossaries.dtx +\fi + +\usepackage{alltt} +\usepackage{pifont} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[colorlinks, + bookmarks, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, + pdftitle={glossaries.sty: LaTeX2e Package to Assist Generating Glossaries}, + pdfkeywords={LaTeX,package,glossary,acronyms}]{hyperref} +\usepackage[toc]{glossaries} + +\RecordChanges +\setlength\IndexMin{100pt} + +\makeglossaries + +\renewcommand*{\main}[1]{\underline{\hyperpage{#1}}} +\renewcommand*{\usage}[1]{\textit{\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}, +} + +\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}. + \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{GlsKey}{key}{glossary keys} +\doxitem{Style}{style}{glossary styles} +\doxitem{Counter}{counter}{glossary counters} +\doxitem{AcrStyle}{acrstyle}{acronym styles} + +\setcounter{IndexColumns}{2} + +\CheckSum{19625} + +\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*{\glostyle}[1]{\textsf{#1}\index{glossary styles:>#1={\protect\ttfamily#1}|main}} + + +\begin{document} +\DocInput{glossaries.dtx} +\end{document} +% +%\fi +%\MakeShortVerb{"} +% +% \title{Documented Code For glossaries v4.42} +% \author{Nicola L.C. Talbot\\[10pt] +%Dickimaw Books\\ +%\url{http://www.dickimaw-books.com/}} +% +% \date{2019-01-06} +% \maketitle +% +%This is the documented code for the \styfmt{glossaries} package. +%This bundle comes with the following documentation: +%\begin{description} +%\item[\url{glossariesbegin.pdf}] +%If you are a complete beginner, start with \qt{The glossaries +%package: a guide for beginners}. +% +%\item[\url{glossary2glossaries.pdf}] +%If you are moving over from the obsolete \sty{glossary} package, +%read \qt{Upgrading from the glossary package to the +%glossaries package}. +% +%\item[\url{glossaries-user.pdf}] +%For the main user guide, read \qt{glossaries.sty v4.42: +%\LaTeX2e\ Package to Assist Generating Glossaries}. +% +%\item[\url{mfirstuc-manual.pdf}] +%The commands provided by the \sty{mfirstuc} package are briefly +%described in \qt{mfirstuc.sty: uppercasing first letter}. +% +%\item[glossaries-code.pdf] +%This document is for advanced users wishing to know more about the +%inner workings of the \styfmt{glossaries} package. +% +%\item[INSTALL] Installation instructions. +% +%\item[CHANGES] Change log. +% +%\item[README] Package summary. +% +%\end{description} +% +%The user level commands described in the user manual +%(glossaries-user.pdf) may be considered ``future-proof''. Even if +%they become deprecated, they should still work for +%old documents (although they may not work in a document that also +%contains new commands introduced since the old commands were +%deprecated, and you may need to specify a compatibility mode). +% +%The internal commands in \emph{this} document that aren't documented in the +%\emph{user manual} should not be considered future-proof and are liable to +%change. If you want a new user level command, you can post a feature +%request at \url{http://www.dickimaw-books.com/feature-request.html}. +%If you are a package writer wanting to integrate your package with +%\styfmt{glossaries}, it's better to request a new user level command +%than to hack these internals. +% +%\tableofcontents +% +%\StopEventually{% +% \printglossaries +% \PrintChanges +% \PrintIndex +%} +% +% +% +%\chapter{Main Package Code} +%\iffalse +% \begin{macrocode} +%<*glossaries.sty> +% \end{macrocode} +%\fi +%\label{sec:code} +% \section{Package Definition} +% This package requires \LaTeXe. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +%\changes{4.18}{2015-09-09}{split mfirstuc into separate bundle} +% Required packages: +% \begin{macrocode} +\RequirePackage{ifthen} +\RequirePackage{xkeyval}[2006/11/18] +\RequirePackage{mfirstuc} +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{Now requires textcase} +% The \sty{textcase} package has much better case changing handling, +% so use \cs{MakeTextUppercase} instead of \cs{MakeUppercase} +% \begin{macrocode} +\RequirePackage{textcase} +\renewcommand*{\mfirstucMakeUppercase}{\MakeTextUppercase}% +% \end{macrocode} +% \begin{macrocode} +\RequirePackage{xfor} +% \end{macrocode} +%\changes{3.04}{2012-11-18}{added datatool-base as a required +%package} +% \begin{macrocode} +\RequirePackage{datatool-base} +% \end{macrocode} +%\changes{1.1}{2008-02-22}{amsgen now loaded (\cs{new@ifnextchar} needed)} +% Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in +% commands that have a final optional argument (such as \ics{gls}) +% so require \isty{amsgen}. +% Thanks to Morten~H\o gholm for suggesting this. (This has +% replaced using the \sty{xspace} package.) +% \begin{macrocode} +\RequirePackage{amsgen} +% \end{macrocode} +%\changes{3.0}{2011-04-02}{etoolbox now loaded} +% As from v3.0, now loading \sty{etoolbox}: +% \begin{macrocode} +\RequirePackage{etoolbox} +% \end{macrocode} +%\changes{3.04}{2012-11-18}{Added check for doc package} +% Check if \sty{doc} has been loaded. +%\begin{macro}{\if@gls@docloaded} +% \begin{macrocode} +\newif\if@gls@docloaded +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +\@ifpackageloaded{doc}% +{% + \@gls@docloadedtrue +}% +{% + \@ifclassloaded{nlctdoc}{\@gls@docloadedtrue}{\@gls@docloadedfalse}% +} +\if@gls@docloaded +% \end{macrocode} +% \cs{doc} has been loaded, so some modifications need to be made to +% ensure both packages can work together. The amount of conflict has +% been reduced as from v4.11 and no longer involves patching +% internal commands. +% +%\cs{PrintChanges} needs to use \sty{doc}'s version of +%\env{theglossary}, so save that. +%\begin{macro}{\glsorg@theglossary} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} + \let\glsorg@theglossary\theglossary +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsorg@endtheglossary} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} + \let\glsorg@endtheglossary\endtheglossary +% \end{macrocode} +%\end{macro} +%\begin{macro}{\PrintChanges} +% Now redefine \cs{PrintChanges} so that it uses the original +% \env{theglossary} environment. +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} + \let\glsorg@PrintChanges\PrintChanges + \renewcommand{\PrintChanges}{% + \begingroup + \let\theglossary\glsorg@theglossary + \let\endtheglossary\glsorg@endtheglossary + \glsorg@PrintChanges + \endgroup + } +% \end{macrocode} +%\end{macro} +% End of doc stuff. +% \begin{macrocode} +\fi +% \end{macrocode} +% +% \section{Package Options}\label{sec:pkgopt} +%\begin{option}{debug} +%\changes{4.24}{2016-05-27}{new} +% Switch on debug mode. This will also cancel the \pkgopt{nowarn} +% option. This is now a choice key. +%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to +%\cs{gls@debug@val} and \cs{gls@debug@nr}} +% \begin{macrocode} +\newif\if@gls@debug +\define@choicekey{glossaries.sty}{debug}[\gls@debug@val\gls@debug@nr]% + {true,false,showtargets}[true]{% + \ifcase\gls@debug@nr\relax + \@gls@debugtrue + \renewcommand*{\GlossariesWarning}[1]{% + \PackageWarning{glossaries}{##1}% + }% + \renewcommand*{\GlossariesWarningNoLine}[1]{% + \PackageWarningNoLine{glossaries}{##1}% + }% + \let\@glsshowtarget\@gobble + \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}% + \or + \@gls@debugfalse + \let\@glsshowtarget\@gobble + \PackageInfo{glossaries}{debug mode OFF}% + \or + \@gls@debugtrue + \renewcommand*{\GlossariesWarning}[1]{% + \PackageWarning{glossaries}{##1}% + }% + \renewcommand*{\GlossariesWarningNoLine}[1]{% + \PackageWarningNoLine{glossaries}{##1}% + }% + \PackageInfo{glossaries}{debug mode ON (nowarn option disabled)}% + \renewcommand{\@glsshowtarget}{\glsshowtarget}% + \fi +} +% \end{macrocode} +%\end{option} +%\begin{macro}{\glsshowtarget} +%\changes{4.32}{2017-08-24}{new} +%\changes{4.34}{2017-11-03}{modified to check for math mode and inner} +%If \pkgopt[showtargets]{debug}, show the hyperlink target name in the +%margin. +% \begin{macrocode} +\newcommand*{\glsshowtarget}[1]{% + \ifmmode + \nfss@text{\ttfamily\small [#1]}% + \else + \ifinner + \texttt{\small [#1]}% + \else + \marginpar{\texttt{\small #1}}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsshowtarget} +%\changes{4.32}{2017-08-24}{new} +%\pkgopt[showtargets]{debug} will redefine this. +% \begin{macrocode} +\newcommand*{\@glsshowtarget}[1]{} +% \end{macrocode} +%\end{macro} +% +%Determine what to do if the \gloskey{see} key is used before +%\cs{makeglossaries}. The default is to produce an error. +%\begin{macro}{\@gls@see@noindex} +%\changes{4.24}{2016-05-27}{new} +% \begin{macrocode} +\newcommand*{\@gls@see@noindex}{% + \PackageError{glossaries}% + {`\gls@xr@key' key may only be used after \string\makeglossaries\space + or \string\makenoidxglossaries\space (or move + \string\newglossaryentry\space + definitions into the preamble)}% + {You must use \string\makeglossaries\space + or \string\makenoidxglossaries\space before defining + any entries that have a `\gls@xr@key' key. It may + be that the `see' key has been written to the .glsdefs + file from the previous run, in which case you need to + move your definitions + to the preamble if you don't want to use + \string\makeglossaries\space + or \string\makenoidxglossaries}% +} +% \end{macrocode} +%\end{macro} +%\begin{option}{seenoindex} +%\changes{4.24}{2016-05-27}{new} +%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to +%\cs{gls@seenoindex@val} and \cs{gls@seenoindex@nr}} +% \begin{macrocode} +\define@choicekey{glossaries.sty}{seenoindex}% + [\gls@seenoindex@val\gls@seenoindex@nr]{error,warn,ignore}{% + \ifcase\gls@seenoindex@nr + \renewcommand*{\@gls@see@noindex}{% + \PackageError{glossaries}% + {`\gls@xr@key' key may only be used after \string\makeglossaries\space + or \string\makenoidxglossaries}% + {You must use \string\makeglossaries\space + or \string\makenoidxglossaries\space before defining + any entries that have a `\gls@xr@key' key}% + }% + \or + \renewcommand*{\@gls@see@noindex}{% + \GlossariesWarning{`\gls@xr@key' key ignored}% + }% + \or + \renewcommand*{\@gls@see@noindex}{}% + \fi +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{toc} +% The \pkgopt{toc} package option will add the glossaries +% to the table of contents. This is a boolean key, if the +% value is omitted it is taken to be true. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{toc}[true]{} +% \end{macrocode} +%\end{option} +%\begin{option}{numberline} +%\changes{1.1}{2008-02-22}{numberline option added} +% The \pkgopt{numberline} package option adds \cs{numberline} to +% \cs{addcontentsline}. Note that this option only has an effect +% if used in with \pkgopt[true]{toc}. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{numberline}[true]{} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@@glossarysec} +% The sectional unit used to start the glossary is stored in +% \cs{@@glossarysec}. If chapters are defined, this +% is initialised to \texttt{chapter}, otherwise it is +% initialised to \texttt{section}. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifcsundef{chapter}% + {\newcommand*{\@@glossarysec}{section}}% + {\newcommand*{\@@glossarysec}{chapter}} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{section} +% The \pkgopt{section} key can be used to set the sectional unit. +% If no unit is specified, use \texttt{section} as the default. +% The starred form of the named sectional unit will be used. +% If you want some other way to start the glossary section (e.g.\ +% a numbered section) you will have to redefined +% \ics{glossarysection}. +% \begin{macrocode} +\define@choicekey{glossaries.sty}{section}{part,chapter,section,% +subsection,subsubsection,paragraph,subparagraph}[section]{% + \renewcommand*{\@@glossarysec}{#1}} +% \end{macrocode} +%\end{option} +% +% Determine whether or not to use numbered sections. +%\begin{macro}{\@@glossarysecstar} +% \begin{macrocode} +\newcommand*{\@@glossarysecstar}{*} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@@glossaryseclabel} +% \begin{macrocode} +\newcommand*{\@@glossaryseclabel}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsautoprefix} +% Prefix to add before label if automatically generated: +%\changes{1.14}{2008-06-17}{new} +% \begin{macrocode} +\newcommand*{\glsautoprefix}{} +% \end{macrocode} +%\end{macro} +%\begin{option}{numberedsection} +%\changes{1.1}{2008-02-22}{numberedsection package option added} +%\changes{4.02}{2013-12-05}{added nameref option} +%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to +%\cs{gls@numberedsection@val} and \cs{gls@numberedsection@nr}} +% \begin{macrocode} +\define@choicekey{glossaries.sty}{numberedsection}% + [\gls@numberedsection@val\gls@numberedsection@nr]{% +false,nolabel,autolabel,nameref}[nolabel]{% + \ifcase\gls@numberedsection@nr\relax + \renewcommand*{\@@glossarysecstar}{*}% + \renewcommand*{\@@glossaryseclabel}{}% + \or + \renewcommand*{\@@glossarysecstar}{}% + \renewcommand*{\@@glossaryseclabel}{}% + \or + \renewcommand*{\@@glossarysecstar}{}% + \renewcommand*{\@@glossaryseclabel}{% + \label{\glsautoprefix\@glo@type}}% + \or + \renewcommand*{\@@glossarysecstar}{*}% + \renewcommand*{\@@glossaryseclabel}{% + \protected@edef\@currentlabelname{\glossarytoctitle}% + \label{\glsautoprefix\@glo@type}}% + \fi +} +% \end{macrocode} +%\end{option} +% +% The default glossary style is stored in +% \cs{@glossary@default@style}. This is initialised to +% \texttt{list}. (The \glostyle{list} style is +% defined in the accompanying \isty{glossary-list} package +% described in \autoref{sec:code:styles}.) Note that the +% \glostyle{list} style is incompatible with \sty{classicthesis} +% so change the default to \glostyle{index} if that package has been +% loaded. +%\begin{macro}{\@glossary@default@style} +%\changes{4.26}{2016-10-12}{added check for classicthesis} +% \begin{macrocode} +\@ifpackageloaded{classicthesis} +{\newcommand*{\@glossary@default@style}{index}} +{\newcommand*{\@glossary@default@style}{list}} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{style} +% The default glossary style can be changed using the \pkgopt{style} +% package option. The value can be the name of any +% defined glossary style. The glossary style is set at the beginning +% of the document, so you can still use the \pkgopt{style} key to +% set a style that is defined in another package. This package comes +% with some predefined styles that are defined in +% \autoref{sec:code:styles}. +%\changes{4.31}{2017-09-10}{changed \cs{renewcommand} to \cs{def}} +%This now uses \cs{def} instead of \cs{renewcommand} as +% \cs{@glossary@default@style} may have been set to \cs{relax}. +% \begin{macrocode} +\define@key{glossaries.sty}{style}{% + \def\@glossary@default@style{#1}% +} +% \end{macrocode} +%\end{option} +% +% Each \cs{DeclareOptionX} needs a corresponding \cs{DeclareOption} +% so that it can be passed as a document class option, so define a +% command that will implement both. +%\changes{4.01}{2013-11-16}{fixed non-value options so that they can be passed to +%document class} +%\begin{macro}{\@gls@declareoption} +% \begin{macrocode} +\newcommand*{\@gls@declareoption}[2]{% + \DeclareOptionX{#1}{#2}% + \DeclareOption{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +% Each entry within a given glossary will have an associated +% number list. By default, this refers to the page numbers on +% which that entry has been used, but it can also refer to any counter +% used in the document (such as the section or equation counters). +% The default number list format displays the number list ``as is'': +%\begin{macro}{\glossaryentrynumbers} +% \begin{macrocode} +\newcommand*{\glossaryentrynumbers}[1]{#1\gls@save@numberlist{#1}} +% \end{macrocode} +%\end{macro} +%\begin{option}{nonumberlist} +% Note that the entire number list for a given entry will be +% passed to \cs{glossaryentrynumbers} so any font changes +% will also be applied to the delimiters. +% The \pkgopt{nonumberlist} package option suppresses the +% number lists (this simply redefines +% \cs{glossaryentrynumbers} to ignores its argument). +% \begin{macrocode} +\@gls@declareoption{nonumberlist}{% + \renewcommand*{\glossaryentrynumbers}[1]{\gls@save@numberlist{#1}}% +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{savenumberlist} +%\changes{3.02}{2012-05-21}{new} +% Provide means to store the number list for entries. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{savenumberlist}[true]{} +\glssavenumberlistfalse +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@glo@seeautonumberlist} +% \begin{macrocode} +\newcommand*\@glo@seeautonumberlist{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{seeautonumberlist} +% Automatically activates number list for entries containing the +% \gloskey{see} key. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\@gls@declareoption{seeautonumberlist}{% + \renewcommand*{\@glo@seeautonumberlist}{% + \def\@glo@prefix{\glsnextpages}% + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{esclocations} +% When using \gls{makeindex} or \gls{xindy}, the locations may need +% to be adjusted to ensure they're in a format that's allowed by the +% indexing application. This involves a bit of hackery and isn't +% needed if the locations are all guaranteed to be in the correct +% form (or if the user is prepared to post-process the glossary file before +% calling the relevant indexing application) so \pkgopt[false]{esclocations} +% will switch off this mechanism allowing for a faster and more +% stable approach. +%\changes{4.33}{2017-09-20}{new} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{esclocations}[true]{} +\glsesclocationstrue +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@loadlong} +%\changes{1.18}{2009-01-14}{new} +% \begin{macrocode} +\newcommand*{\@gls@loadlong}{\RequirePackage{glossary-long}} +% \end{macrocode} +%\end{macro} +%\begin{option}{nolong} +%\changes{1.18}{2009-01-14}{new} +% This option prevents \isty{glossary-long} from being loaded. +% This means that the glossary styles that use the +% \env{longtable} environment will not be available. This option +% is provided to reduce overhead caused by loading unrequired +% packages. +% \begin{macrocode} +\@gls@declareoption{nolong}{\renewcommand*{\@gls@loadlong}{}} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@loadsuper} +%\changes{1.18}{2009-01-14}{new} +% The \isty{glossary-super} package isn't loaded if +% \isty{supertabular} isn't installed. +% \begin{macrocode} +\IfFileExists{supertabular.sty}{% + \newcommand*{\@gls@loadsuper}{\RequirePackage{glossary-super}}}{% + \newcommand*{\@gls@loadsuper}{}} +% \end{macrocode} +%\end{macro} +%\begin{option}{nosuper} +%\changes{1.18}{2009-01-14}{new} +% This option prevents \isty{glossary-super} from being loaded. +% This means that the glossary styles that use the +% \env{supertabular} environment will not be available. This option +% is provided to reduce overhead caused by loading unrequired +% packages. +% \begin{macrocode} +\@gls@declareoption{nosuper}{\renewcommand*{\@gls@loadsuper}{}} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@loadlist} +%\changes{1.18}{2009-01-14}{new} +% \begin{macrocode} +\newcommand*{\@gls@loadlist}{\RequirePackage{glossary-list}} +% \end{macrocode} +%\end{macro} +%\begin{option}{nolist} +%\changes{1.18}{2009-01-14}{new} +% This option prevents \isty{glossary-list} from being loaded +% (to reduce overheads if required). Naturally, the styles defined +% in \isty{glossary-list} will not be available if this option +% is used. If the style is still set to \glostyle{list}, the default +% must be set to \cs{relax}. +%\changes{4.31}{2017-08-10}{added check for \qt{list} style} +% \begin{macrocode} +\@gls@declareoption{nolist}{% + \renewcommand*{\@gls@loadlist}{% + \ifdefstring{\@glossary@default@style}{list}% + {\let\@glossary@default@style\relax}% + {}% + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@loadtree} +%\changes{1.18}{2009-01-14}{new} +% \begin{macrocode} +\newcommand*{\@gls@loadtree}{\RequirePackage{glossary-tree}} +% \end{macrocode} +%\end{macro} +%\begin{option}{notree} +%\changes{1.18}{2009-01-14}{new} +% This option prevents \isty{glossary-tree} from being loaded +% (to reduce overheads if required). Naturally, the styles defined +% in \isty{glossary-tree} will not be available if this option +% is used. +% \begin{macrocode} +\@gls@declareoption{notree}{\renewcommand*{\@gls@loadtree}{}} +% \end{macrocode} +%\end{option} +% +%\begin{option}{nostyles} +%\changes{1.18}{2009-01-14}{new} +% Provide an option to suppress all the predefined styles (in the +% event that the user has custom styles that are not dependent +% on the predefined styles). +% \begin{macrocode} +\@gls@declareoption{nostyles}{% + \renewcommand*{\@gls@loadlong}{}% + \renewcommand*{\@gls@loadsuper}{}% + \renewcommand*{\@gls@loadlist}{}% + \renewcommand*{\@gls@loadtree}{}% + \let\@glossary@default@style\relax +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glspostdescription} +% The description terminator is given by \cs{glspostdescription} +% (except for the 3 and 4 column styles). This is a full stop +% by default. +%\changes{3.07}{2013-07-05}{Added spacefactor code} +% The spacefactor is adjusted in case the description ends with an +% upper case letter. (Patch provided by Michael Pock.) +% \begin{macrocode} +\newcommand*{\glspostdescription}{% + \ifglsnopostdot\else.\spacefactor\sfcode`\. \fi +} +% \end{macrocode} +%\end{macro} +%\begin{option}{nopostdot} +% Boolean option to suppress post description dot +%\changes{3.03}{2012/09/21}{new} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{nopostdot}[true]{} +\glsnopostdotfalse +% \end{macrocode} +%\end{option} +%\begin{option}{nogroupskip} +% Boolean option to suppress vertical space between groups in the +% pre-defined styles. +%\changes{3.03}{2012/09/21}{new} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{nogroupskip}[true]{} +\glsnogroupskipfalse +% \end{macrocode} +%\end{option} +% +%\begin{option}{ucmark} +% Boolean option to determine whether or not to use +% use upper case in definition of \ics{glsglossarymark} +%\changes{3.02}{2012-05-21}{new} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{ucmark}[true]{} +% \end{macrocode} +%\changes{3.13a}{2013-11-05}{added check for memoir} +% \begin{macrocode} +\@ifclassloaded{memoir} +{% + \glsucmarktrue +}% +{% + \glsucmarkfalse +} +% \end{macrocode} +%\end{option} +% +%\begin{counter}{glossaryentry} +%\changes{3.0}{2011-04-02}{new} +% If the \pkgopt{entrycounter} package option has been used, define +% a counter to number each level~0 entry. +% This is now defined by an internal command for consistency. +%\end{counter} +% +%\begin{macro}{\@gls@define@glossaryentrycounter} +%\changes{4.38}{2018-05-10}{new} +% \begin{macrocode} +\newcommand*{\@gls@define@glossaryentrycounter}{% + \ifglsentrycounter +% \end{macrocode} +%\changes{4.38}{2018-05-10}{added check for existence of glossaryentry counter} +%Define the \ctr{glossaryentry} counter if it doesn't already exist. +% \begin{macrocode} + \ifundef\c@glossaryentry + {% + \ifx\@gls@counterwithin\@empty + \newcounter{glossaryentry}% + \else + \newcounter{glossaryentry}[\@gls@counterwithin]% + \fi + \def\theHglossaryentry{\currentglossary.\theglossaryentry}% + }% + {}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{entrycounter} +% Defines a counter that can be used in the standard glossary styles +% to number each (main) entry. If true, this will define a counter called +% \ctr{glossaryentry}. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{entrycounter}[true]{} +\glsentrycounterfalse +% \end{macrocode} +%\end{option} +% +%\begin{option}{counterwithin} +% This option can be used to set a parent counter for +% \ctr{glossaryentry}. This option automatically sets +% \pkgopt[true]{entrycounter}. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\define@key{glossaries.sty}{counterwithin}{% + \renewcommand*{\@gls@counterwithin}{#1}% + \glsentrycountertrue + \@gls@define@glossaryentrycounter +} +% \end{macrocode} +%\end{option} +%\begin{macro}{\@gls@counterwithin} +%\changes{3.0}{2011-04-02}{new} +% The default value is no parent counter: +% \begin{macrocode} +\newcommand*{\@gls@counterwithin}{} +% \end{macrocode} +%\end{macro} +% +%\begin{counter}{glossarysubentry} +%\changes{3.0}{2011-04-02}{new} +% If the \pkgopt{subentrycounter} package option has been used, define +% a counter to number each level~1 entry. This is now defined by an +% internal command for consistency. +%\end{counter} +%\begin{macro}{\@gls@define@glossarysubentrycounter} +%\changes{4.38}{2018-05-10}{new} +% \begin{macrocode} +\newcommand{\@gls@define@glossarysubentrycounter}{% +% \end{macrocode} +%Check if counter already defined. +% \begin{macrocode} + \ifundef\c@glossarysubentry + {% + \ifglssubentrycounter + \ifglsentrycounter + \newcounter{glossarysubentry}[glossaryentry]% + \else + \newcounter{glossarysubentry}% + \fi +% \end{macrocode} +%\changes{4.38}{2018-05-10}{prepended \cs{currentglossary}\texttt{.} to +%\cs{theHglossarysubentry} and removed spurious eol space} +%As with \cs{theHglossaryentry}, this starts with +%\cs{currentglossary}\texttt{.} to help avoid duplicate hyper targets. +% \begin{macrocode} + \def\theHglossarysubentry{\currentglossary.\currentglssubentry.\theglossarysubentry}% + \fi + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{subentrycounter} +% Define a counter that can be used in the standard glossary styles +% to number each level~1 entry. If true, this will define a counter called +% \ctr{glossarysubentry}. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{subentrycounter}[true]{} +\glssubentrycounterfalse +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@glo@default@sorttype} +% Initialise default sort for \cs{printnoidxglossary} +% \begin{macrocode} +\newcommand*{\@glo@default@sorttype}{standard} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{sort} +%\changes{3.0}{2011-04-02}{new} +% Define the sort method: \pkgopt[standard]{sort} (default), +% \pkgopt[def]{sort} (order of definition) or +% \pkgopt[use]{sort} (order of use). If no indexing required, use +% \pkgopt[none]{sort}. +% \begin{macrocode} +\define@choicekey{glossaries.sty}{sort}{standard,def,use,none}{% + \renewcommand*{\@glo@default@sorttype}{#1}% + \csname @gls@setupsort@#1\endcsname +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glsprestandardsort} +%\changes{3.13a}{2013-11-05}{new} +%\begin{definition} +%\cs{glsprestandardsort}\marg{sort cs}\marg{type}\marg{label} +%\end{definition} +% Allow user to hook into sort mechanism. The first argument +% \meta{sort cs} is the temporary control sequence containing the +% sort value before it has been sanitized and had +% \gls{makeindex}\slash\gls{xindy} special characters escaped. +% \begin{macrocode} +\newcommand*{\glsprestandardsort}[3]{% + \glsdosanitizesort +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@check@sortallowed} +%\changes{4.30}{2017-06-11}{new} +% \begin{macrocode} +\newcommand*{\@glo@check@sortallowed}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setupsort@standard} +%\changes{3.0}{2011-04-02}{new} +% Set up the macros for default sorting. +% \begin{macrocode} +\newcommand*{\@gls@setupsort@standard}{% +% \end{macrocode} +% Store entry information when it's defined. +% \begin{macrocode} + \def\do@glo@storeentry{\@glo@storeentry}% +% \end{macrocode} +% No count register required for standard sort. +% \begin{macrocode} + \def\@gls@defsortcount##1{}% +% \end{macrocode} +% Sort according to sort key (\cs{@glo@sort}) if provided otherwise +% sort according to the entry's name (\cs{@glo@name}). +% (First argument glossary type, second argument entry label.) +% \begin{macrocode} + \def\@gls@defsort##1##2{% + \ifx\@glo@sort\@glsdefaultsort + \let\@glo@sort\@glo@name + \fi +% \end{macrocode} +%\changes{3.03}{2012/09/21}{used \cs{@gls@sanitizesort}} +%\changes{3.13a}{2013-11-05}{moved \cs{@gls@santizesort} to +%\cs{glsprestandardsort}} +% \begin{macrocode} + \let\glsdosanitizesort\@gls@sanitizesort + \glsprestandardsort{\@glo@sort}{##1}{##2}% + \expandafter\protected@xdef\csname glo@##2@sort\endcsname{\@glo@sort}% + }% +% \end{macrocode} +% Don't need to do anything when the entry is used. +% \begin{macrocode} + \def\@gls@setsort##1{}% +% \end{macrocode} +% This sort option is allowed with \cs{makeglossaries} and +% \cs{makenoidxglossaries}. +% \begin{macrocode} + \let\@glo@check@sortallowed\@gobble +} +% \end{macrocode} +% Set standard sort as the default: +% \begin{macrocode} +\@gls@setupsort@standard +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssortnumberfmt} +%\changes{3.0}{2011-04-02}{new} +% Format the number used as the sort key by \pkgopt[def]{sort} and +% \pkgopt[use]{sort}. Defaults to six digit numbering. +% \begin{macrocode} +\newcommand*\glssortnumberfmt[1]{% + \ifnum#1<100000 0\fi + \ifnum#1<10000 0\fi + \ifnum#1<1000 0\fi + \ifnum#1<100 0\fi + \ifnum#1<10 0\fi + \number#1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setupsort@def} +%\changes{3.0}{2011-04-02}{new} +% Set up the macros for order of definition sorting. +% \begin{macrocode} +\newcommand*{\@gls@setupsort@def}{% +% \end{macrocode} +% Store entry information when it's defined. +% \begin{macrocode} + \def\do@glo@storeentry{\@glo@storeentry}% +% \end{macrocode} +% Defined count register associated with the glossary. +% \begin{macrocode} + \def\@gls@defsortcount##1{% + \expandafter\global + \expandafter\newcount\csname glossary@##1@sortcount\endcsname + }% +% \end{macrocode} +% Increment count register associated with the glossary and use as +% the sort key. +% \begin{macrocode} + \def\@gls@defsort##1##2{% +% \end{macrocode} +% It may be that the sort order was changed after the glossary was +% defined, so check if the count register has been defined. +%\changes{4.30}{2017-06-11}{added check for register} +% \begin{macrocode} + \ifcsundef{glossary@##1@sortcount}% + {\@gls@defsortcount{##1}}% + {}% + \expandafter\global\expandafter + \advance\csname glossary@##1@sortcount\endcsname by 1\relax + \expandafter\protected@xdef\csname glo@##2@sort\endcsname{% + \expandafter\glssortnumberfmt + {\csname glossary@##1@sortcount\endcsname}}% + }% +% \end{macrocode} +% Don't need to do anything when the entry is used. +% \begin{macrocode} + \def\@gls@setsort##1{}% +% \end{macrocode} +% This sort option is allowed with \cs{makeglossaries} and +% \cs{makenoidxglossaries}. +% \begin{macrocode} + \let\@glo@check@sortallowed\@gobble +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setupsort@use} +%\changes{3.0}{2011-04-02}{new} +% Set up the macros for order of use sorting. +% \begin{macrocode} +\newcommand*{\@gls@setupsort@use}{% +% \end{macrocode} +% Don't store entry information when it's defined. +% \begin{macrocode} + \let\do@glo@storeentry\@gobble +% \end{macrocode} +% Defined count register associated with the glossary. +% \begin{macrocode} + \def\@gls@defsortcount##1{% + \expandafter\global + \expandafter\newcount\csname glossary@##1@sortcount\endcsname + }% +% \end{macrocode} +% Initialise the sort key to empty. +% \begin{macrocode} + \def\@gls@defsort##1##2{% + \expandafter\gdef\csname glo@##2@sort\endcsname{}% + }% +% \end{macrocode} +% If the sort key hasn't been set, increment the counter associated +% with the glossary and set the sort key. +% \begin{macrocode} + \def\@gls@setsort##1{% +% \end{macrocode} +% Get the parent, if one exists +% \begin{macrocode} + \edef\@glo@parent{\csname glo@##1@parent\endcsname}% +% \end{macrocode} +% Set the information for the parent entry if not already done. +% \begin{macrocode} + \ifx\@glo@parent\@empty + \else + \expandafter\@gls@setsort\expandafter{\@glo@parent}% + \fi +% \end{macrocode} +% Set index information for this entry +% \begin{macrocode} + \edef\@glo@type{\csname glo@##1@type\endcsname}% + \edef\@gls@tmp{\csname glo@##1@sort\endcsname}% + \ifx\@gls@tmp\@empty + \expandafter\global\expandafter + \advance\csname glossary@\@glo@type @sortcount\endcsname by 1\relax + \expandafter\protected@xdef\csname glo@##1@sort\endcsname{% + \expandafter\glssortnumberfmt + {\csname glossary@\@glo@type @sortcount\endcsname}}% + \@glo@storeentry{##1}% + \fi + }% +% \end{macrocode} +% This sort option is allowed with \cs{makeglossaries} and +% \cs{makenoidxglossaries}. +% \begin{macrocode} + \let\@glo@check@sortallowed\@gobble +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setupsort@none} +%\changes{4.30}{2017-06-11}{new} +% Slightly improves efficiency in the event that no indexing is +% required. +% \begin{macrocode} +\newcommand*{\@gls@setupsort@none}{% +% \end{macrocode} +% Don't store entry index information. +% \begin{macrocode} + \def\do@glo@storeentry##1{}% +% \end{macrocode} +% No count register required for standard sort. +% \begin{macrocode} + \def\@gls@defsortcount##1{}% +% \end{macrocode} +% Don't modify sort value. +% \begin{macrocode} + \def\@gls@defsort##1##2{% + \expandafter\global\expandafter\let\csname glo@##2@sort\endcsname\@glo@sort + }% +% \end{macrocode} +% Don't need to do anything when the entry is used. +% \begin{macrocode} + \def\@gls@setsort##1{}% +% \end{macrocode} +% This sort option isn't allowed with \cs{makeglossaries} or +% \cs{makenoidxglossaries}. +% \begin{macrocode} + \renewcommand\@glo@check@sortallowed[1]{\PackageError{glossaries} + {Option sort=none not allowed with \string##1}% + {(Use sort=def instead)}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdefmain} +%\changes{2.01}{2009 May 30}{new} +%\changes{3.04}{2012-11-18}{added check for doc package} +% Define the main glossary. This will be the first glossary to +% be displayed when using \ics{printglossaries}. The default +% extensions conflict if used with \sty{doc}, so provide different +% extensions if \sty{doc} loaded. (If these extensions are +% inappropriate, use \pkgopt{nomain} and manually define the main +% glossary with the desired extensions.) +% \begin{macrocode} +\newcommand*{\glsdefmain}{% + \if@gls@docloaded + \newglossary[glg2]{main}{gls2}{glo2}{\glossaryname}% + \else + \newglossary{main}{gls}{glo}{\glossaryname}% + \fi +% \end{macrocode} +% Define hook to set the toc title when \sty{translator} is in use. +%\changes{4.06}{2014-03-12}{added hook to set toc title} +% \begin{macrocode} + \newcommand*{\gls@tr@set@main@toctitle}{% + \translatelet{\glossarytoctitle}{Glossary}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Keep track of the default glossary. This is initialised to +% the main glossary, but can be changed if for some reason +% you want to make a secondary glossary the main glossary. This +% affects any commands that can optionally take a glossary name +% as an argument (or as the value of the +% \gloskey{type}\igloskey[printglossary]{type} key in +%a key-value list). This was mainly done so that +% \ics{loadglsentries} can temporarily change +% \cs{glsdefaulttype} while it loads a file containing +% new glossary entries (see \autoref{sec:load}). +%\begin{macro}{\glsdefaulttype} +% \begin{macrocode} +\newcommand*{\glsdefaulttype}{main} +% \end{macrocode} +%\end{macro} +% Keep track of which glossary the acronyms are in. This is +% initialised to \cs{glsdefaulttype}, but is changed by +% the \pkgopt{acronym} package option. +%\begin{macro}{\acronymtype} +% \begin{macrocode} +\newcommand*{\acronymtype}{\glsdefaulttype} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{nomain} +%\changes{2.01}{2009 May 30}{added nomain package option} +% The \pkgopt{nomain} option suppress the creation of the main +% glossary. +% \begin{macrocode} +\@gls@declareoption{nomain}{% + \let\glsdefaulttype\relax + \renewcommand*{\glsdefmain}{}% +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{acronym} +% The \pkgopt{acronym} option sets an associated conditional +% which is used in \autoref{sec:code:acronym} to determine whether +% or not to define a separate glossary for acronyms. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{acronym}[true]{% + \ifglsacronym + \renewcommand{\@gls@do@acronymsdef}{% + \DeclareAcronymList{acronym}% + \newglossary[alg]{acronym}{acr}{acn}{\acronymname}% + \renewcommand*{\acronymtype}{acronym}% +% \end{macrocode} +% Define hook to set the toc title when \sty{translator} is in use. +%\changes{4.06}{2014-03-12}{added hook to set toc title} +% \begin{macrocode} + \newcommand*{\gls@tr@set@acronym@toctitle}{% + \translatelet{\glossarytoctitle}{Acronyms}% + }% + }% + \else + \let\@gls@do@acronymsdef\relax + \fi +} +% \end{macrocode} +%\end{option} +%\begin{macro}{\printacronyms} +% Define \cs{printacronyms} at the start of the document if +% \pkgopt{acronym} is set and compatibility mode isn't on and +% \cs{printacronyms} hasn't already been defined. +% \begin{macrocode} +\AtBeginDocument{% + \ifglsacronym + \ifbool{glscompatible-3.07}% + {}% + {% + \providecommand*{\printacronyms}[1][]{% + \printglossary[type=\acronymtype,#1]}% + }% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@do@acronymsdef} +% Set default value +% \begin{macrocode} +\newcommand*{\@gls@do@acronymsdef}{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{acronyms} +%\changes{3.14a}{2013-11-12}{new} +% Provide a synonym for \pkgopt[true]{acronym} that can be passed +% via the document class options. +% \begin{macrocode} +\@gls@declareoption{acronyms}{% + \glsacronymtrue + \renewcommand{\@gls@do@acronymsdef}{% + \DeclareAcronymList{acronym}% + \newglossary[alg]{acronym}{acr}{acn}{\acronymname}% + \renewcommand*{\acronymtype}{acronym}% +% \end{macrocode} +% Define hook to set the toc title when \sty{translator} is in use. +%\changes{4.06}{2014-03-12}{added hook to set toc title} +% \begin{macrocode} + \newcommand*{\gls@tr@set@acronym@toctitle}{% + \translatelet{\glossarytoctitle}{Acronyms}% + }% + }% +} +% \end{macrocode} +%\end{option} +%\begin{macro}{\@glsacronymlists} +%\changes{2.04}{2009-11-10}{new} +% Comma-separated list of glossary labels indicating which +% glossaries contain acronyms. Note that \ics{SetAcronymStyle} +% must be used after adding labels to this macro. +% \begin{macrocode} +\newcommand*{\@glsacronymlists}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@addtoacronynlists} +% \begin{macrocode} +\newcommand*{\@addtoacronymlists}[1]{% + \ifx\@glsacronymlists\@empty + \protected@xdef\@glsacronymlists{#1}% + \else + \protected@xdef\@glsacronymlists{\@glsacronymlists,#1}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DeclareAcronymList} +%\changes{2.04}{2009-11-10}{new}% +% Identifies the named glossary as a list of acronyms and adds +% to the list. (Doesn't check if the glossary exists, but checks +% if label already in list. Use \ics{SetAcronymStyle} after +% identifying all the acronym lists.) +% \begin{macrocode} +\newcommand*{\DeclareAcronymList}[1]{% + \glsIfListOfAcronyms{#1}{}{\@addtoacronymlists{#1}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsIfListOfAcronyms} +%\begin{definition} +%\cs{glsIfListOfAcronyms}\marg{label}\marg{true part}\marg{false part} +%\end{definition} +% Determines if the glossary with the given label has been identified +% as being a list of acronyms. +% \begin{macrocode} +\newcommand{\glsIfListOfAcronyms}[1]{% + \edef\@do@gls@islistofacronyms{% + \noexpand\@gls@islistofacronyms{#1}{\@glsacronymlists}}% + \@do@gls@islistofacronyms +} +% \end{macrocode} +% Internal command requires label and list to be expanded: +% \begin{macrocode} +\newcommand{\@gls@islistofacronyms}[4]{% + \def\gls@islistofacronyms##1,#1,##2\end@gls@islistofacronyms{% + \def\@before{##1}\def\@after{##2}}% + \gls@islistofacronyms,#2,#1,\@nil\end@gls@islistofacronyms + \ifx\@after\@nnil +% \end{macrocode} +% Not found +% \begin{macrocode} + #4% + \else +% \end{macrocode} +% Found +% \begin{macrocode} + #3% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\if@glsisacronymlist} +% Convenient boolean. +% \begin{macrocode} +\newif\if@glsisacronymlist +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@checkisacronymlist} +% Sets the above boolean if argument is a label representing +% a list of acronyms. +% \begin{macrocode} +\newcommand*{\gls@checkisacronymlist}[1]{% + \glsIfListOfAcronyms{#1}% + {\@glsisacronymlisttrue}{\@glsisacronymlistfalse}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetAcronymLists} +%\changes{2.04}{2009-11-10}{new}% +% Sets the ``list of acronyms'' list. Argument must be a +% comma-separated list of glossary labels. (Doesn't check at this +% point if the glossaries exists.) +% \begin{macrocode} +\newcommand*{\SetAcronymLists}[1]{% + \renewcommand*{\@glsacronymlists}{#1}% +} +% \end{macrocode} +%\end{macro} +%\begin{option}{acronymlists} +%\changes{2.04}{2009-11-10}{new}% +%\changes{3.11a}{2013-10-15}{replaced \cs{@addtoacronymlists} with +%\cs{DeclareAcronymList}} +% \begin{macrocode} +\define@key{glossaries.sty}{acronymlists}{% + \DeclareAcronymList{#1}% +} +% \end{macrocode} +%\end{option} +% +% The default counter associated with the numbers in the glossary +% is stored in \cs{glscounter}. This is initialised to the +% page counter. This is used as the default counter when a +% new glossary is defined, unless a different counter is specified +% in the optional argument to \ics{newglossary} (see +% \autoref{sec:newglos}). +%\begin{macro}{\glscounter} +% \begin{macrocode} +\newcommand{\glscounter}{page} +% \end{macrocode} +%\end{macro} +%\begin{option}{counter} +% The \pkgopt{counter} option changes the default counter. (This +% just redefines \cs{glscounter}.) +% \begin{macrocode} +\define@key{glossaries.sty}{counter}{% + \renewcommand*{\glscounter}{#1}% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@nohyperlist} +%\changes{3.05}{2013/04/21}{new} +% \begin{macrocode} +\newcommand*{\@gls@nohyperlist}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsDeclareNoHyperList} +%\changes{3.05}{2013/04/21}{new} +% \begin{macrocode} +\newcommand*{\GlsDeclareNoHyperList}[1]{% + \ifdefempty\@gls@nohyperlist + {% + \renewcommand*{\@gls@nohyperlist}{#1}% + }% + {% + \appto\@gls@nohyperlist{,#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{nohypertypes} +%\changes{3.05}{2013/04/21}{new} +% \begin{macrocode} +\define@key{glossaries.sty}{nohypertypes}{% + \GlsDeclareNoHyperList{#1}% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\GlossariesWarning} +% Prints a warning message. +% \begin{macrocode} +\newcommand*{\GlossariesWarning}[1]{% + \PackageWarning{glossaries}{#1}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlossariesWarningNoLine} +% Prints a warning message without the line number. +% \begin{macrocode} +\newcommand*{\GlossariesWarningNoLine}[1]{% + \PackageWarningNoLine{glossaries}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glosortentrieswarning} +%\changes{4.30}{2017-06-11}{new} +%Warn user that sorting may take a long time. This is actually an +%informational message rather than a warning so just use +%\cs{typeout}. +% \begin{macrocode} +\newcommand{\glosortentrieswarning}{% + \typeout{Using TeX to sort glossary entries---this may + take a while}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{nowarn} +% Define package option to suppress warnings +% \begin{macrocode} +\@gls@declareoption{nowarn}{% + \if@gls@debug + \GlossariesWarning{Warnings can't be suppressed in debug mode}% + \else + \renewcommand*{\GlossariesWarning}[1]{}% + \renewcommand*{\GlossariesWarningNoLine}[1]{}% + \renewcommand*{\glosortentrieswarning}{}% + \renewcommand*{\@gls@missinglang@warn}[2]{}% + \fi +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@missinglang@warn} +%\changes{4.33}{2017-09-20}{new} +%Missing language warning. +% \begin{macrocode} +\newcommand*{\@gls@missinglang@warn}[2]{% + \PackageWarningNoLine{glossaries}% + {No language module detected for `#1'.\MessageBreak + Language modules need to be installed separately.\MessageBreak + Please check on CTAN for a bundle called\MessageBreak + `glossaries-#2' or similar}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{nolangwarn} +% Suppress warning if language support not found. +% \begin{macrocode} +\@gls@declareoption{nolangwarn}{% + \renewcommand*{\@gls@missinglang@warn}[2]{}% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@warnonglossdefined} +%\changes{4.04}{2014-03-06}{new} +% Issue a warning if overriding \cs{printglossary} +% \begin{macrocode} +\newcommand*{\@gls@warnonglossdefined}{% + \GlossariesWarning{Overriding \string\printglossary}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@warnontheglossdefined} +%\changes{4.04}{2014-03-06}{new} +% Issue a warning if overriding \env{theglossary} +% \begin{macrocode} +\newcommand*{\@gls@warnontheglossdefined}{% + \GlossariesWarning{Overriding `theglossary' environment}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{noredefwarn} +% Suppress warning on redefinition of \cs{printglossary} +% \begin{macrocode} +\@gls@declareoption{noredefwarn}{% + \renewcommand*{\@gls@warnonglossdefined}{}% + \renewcommand*{\@gls@warnontheglossdefined}{}% +} +% \end{macrocode} +%\end{option} +% +% As from version 3.08a, the only information written to the external +% glossary files are the label and sort values. Therefore, now, the +% only sanitize option that makes sense is the one for the sort key. +% so the sanitize option is now deprecated and there is only a +% \pkgopt{sanitizesort} option. +% +%\begin{macro}{\@gls@sanitizedesc} +% \begin{macrocode} +\newcommand*{\@gls@sanitizedesc}{% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssetexpandfield} +%\changes{3.13a}{2013-11-05}{new} +%\begin{definition} +%\cs{glssetexpandfield}\marg{field} +%\end{definition} +% Sets field to always expand. +% \begin{macrocode} +\newcommand*{\glssetexpandfield}[1]{% + \csdef{gls@assign@#1@field}##1##2{% + \@@gls@expand@field{##1}{#1}{##2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssetnoexpandfield} +%\changes{3.13a}{2013-11-05}{new} +%\begin{definition} +%\cs{glssetnoexpandfield}\marg{field} +%\end{definition} +% Sets field to never expand. +% \begin{macrocode} +\newcommand*{\glssetnoexpandfield}[1]{% + \csdef{gls@assign@#1@field}##1##2{% + \@@gls@noexpand@field{##1}{#1}{##2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@assign@type@field} +%\changes{3.10a}{2013-09-28}{new} +%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetexpandfield}} +% The type must always be expandable. +% \begin{macrocode} +\glssetexpandfield{type} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@assign@desc@field} +%\changes{3.08a}{2013-09-28}{new} +%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}} +% The description is not expanded by default: +% \begin{macrocode} +\glssetnoexpandfield{desc} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@assign@descplural@field} +%\changes{3.08a}{2013-09-28}{new} +%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}} +% \begin{macrocode} +\glssetnoexpandfield{descplural} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@sanitizename} +% \begin{macrocode} +\newcommand*{\@gls@sanitizename}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@assign@name@field} +%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}} +% Don't expand name by default. +% \begin{macrocode} +\glssetnoexpandfield{name} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@sanitizesymbol} +% \begin{macrocode} +\newcommand*{\@gls@sanitizesymbol}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@assign@symbol@field} +%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}} +% Don't expand symbol by default. +% \begin{macrocode} +\glssetnoexpandfield{symbol} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@assign@symbolplural@field} +%\changes{3.13a}{2013-11-05}{changed to use \cs{glssetnoexpandfield}} +%\changes{3.09a}{2013-10-09}{new} +% \begin{macrocode} +\glssetnoexpandfield{symbolplural} +% \end{macrocode} +%\end{macro} +% +% Sanitizing stuff: +%\begin{macro}{\@gls@sanitizesort} +%\changes{3.03}{2012/09/21}{new} +% \begin{macrocode} +\newcommand*{\@gls@sanitizesort}{% + \ifglssanitizesort + \@@gls@sanitizesort + \else + \@@gls@nosanitizesort + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@gls@sanitizesort} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*\@@gls@sanitizesort{% + \@onelevel@sanitize\@glo@sort +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@gls@nosanitizesort} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\@@gls@nosanitizesort}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@gls@noidx@sanitizesort} +%\changes{4.04}{2014-03-06}{new} +% Remove braces around first character (if present) before +% sanitizing. +% \begin{macrocode} +\newcommand*\@gls@noidx@sanitizesort{% + \ifdefvoid\@glo@sort + {}% + {% + \expandafter\@@gls@noidx@sanitizesort\@glo@sort\gls@end@sanitizesort + }% +} +\def\@@gls@noidx@sanitizesort#1#2\gls@end@sanitizesort{% + \def\@glo@sort{#1#2}% + \@onelevel@sanitize\@glo@sort +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@gls@noidx@nosanitizesort} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\@@gls@noidx@nosanitizesort}{% + \ifdefvoid\@glo@sort + {}% + {% + \expandafter\@@gls@noidx@no@sanitizesort\@glo@sort\gls@end@sanitizesort + }% +} +\def\@@gls@noidx@no@sanitizesort#1#2\gls@end@sanitizesort{% + \bgroup + \glsnoidxstripaccents + \protected@xdef\@@glo@sort{#1#2}% + \egroup + \let\@glo@sort\@@glo@sort +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnoidxstripaccents} +%\changes{4.04}{2014-03-06}{new} +%This strips accents by redefining the standard accent commands to +%just do their argument. (This will be localised since +%\cs{glsnoidxstripaccents} is used within a group.) Anything outside +%this standard set really shouldn't be using +%\cs{makenoidxglossaries}. +% \begin{macrocode} +\newcommand*\glsnoidxstripaccents{% + \let\IeC\@firstofone + \let\'\@firstofone + \let\`\@firstofone + \let\^\@firstofone + \let\"\@firstofone + \let\u\@firstofone + \let\t\@firstofone + \let\d\@firstofone + \let\r\@firstofone + \let\=\@firstofone + \let\.\@firstofone + \let\~\@firstofone + \let\v\@firstofone + \let\H\@firstofone + \let\c\@firstofone + \let\b\@firstofone +% \end{macrocode} +%\changes{4.30}{2017-06-11}{added \cs{a}} +% \begin{macrocode} + \let\a\@secondoftwo + \def\AE{AE}% + \def\ae{ae}% + \def\OE{OE}% + \def\oe{oe}% + \def\AA{AA}% + \def\aa{aa}% + \def\L{L}% + \def\l{l}% + \def\O{O}% + \def\o{o}% + \def\SS{SS}% + \def\ss{ss}% + \def\th{th}% +% \end{macrocode} +%\changes{4.30}{2017-06-11}{added \cs{TH}, \cs{dh} and \cs{DH}} +% \begin{macrocode} + \def\TH{TH}% + \def\dh{dh}% + \def\DH{DH}% +} +% \end{macrocode} +%\end{macro} +% +% Before defining the \pkgopt{sanitize} package option, The +% key-value list for the \pkgopt{sanitize} value needs to be defined. +% These are all boolean keys. If they are not given a value, assume +% \texttt{true}. +% +% \begin{macrocode} +\define@boolkey[gls]{sanitize}{description}[true]{% + \GlossariesWarning{sanitize={description} package option deprecated}% + \ifgls@sanitize@description + \glssetnoexpandfield{desc}% + \glssetnoexpandfield{descplural}% + \else + \glssetexpandfield{desc}% + \glssetexpandfield{descplural}% + \fi +} +% \end{macrocode} +% \begin{macrocode} +\define@boolkey[gls]{sanitize}{name}[true]{% + \GlossariesWarning{sanitize={name} package option deprecated}% + \ifgls@sanitize@name + \glssetnoexpandfield{name}% + \else + \glssetexpandfield{name}% + \fi +} +% \end{macrocode} +% \begin{macrocode} +\define@boolkey[gls]{sanitize}{symbol}[true]{% + \GlossariesWarning{sanitize={symbol} package option deprecated}% + \ifgls@sanitize@symbol + \glssetnoexpandfield{symbol}% + \glssetnoexpandfield{symbolplural}% + \else + \glssetexpandfield{symbol}% + \glssetexpandfield{symbolplural}% + \fi +} +% \end{macrocode} +% +%\begin{option}{sanitizesort} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{sanitizesort}[true]{% + \ifglssanitizesort + \glssetnoexpandfield{sortvalue}% + \renewcommand*{\@gls@noidx@setsanitizesort}{% + \glssanitizesorttrue + \glssetnoexpandfield{sortvalue}% + }% + \else + \glssetexpandfield{sortvalue}% + \renewcommand*{\@gls@noidx@setsanitizesort}{% + \glssanitizesortfalse + \glssetexpandfield{sortvalue}% + }% + \fi +} +% \end{macrocode} +% Default setting: +% \begin{macrocode} +\glssanitizesorttrue +\glssetnoexpandfield{sortvalue}% +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@noidx@setsanitizesort} +% Default behaviour for \ics{makenoidxglossaries} is +% sanitizesort=false. +% \begin{macrocode} +\newcommand*{\@gls@noidx@setsanitizesort}{% + \glssanitizesortfalse + \glssetexpandfield{sortvalue}% +} +% \end{macrocode} +%\end{macro} +% +% \begin{macrocode} +\define@choicekey[gls]{sanitize}{sort}{true,false}[true]{% + \setbool{glssanitizesort}{#1}% + \ifglssanitizesort + \glssetnoexpandfield{sortvalue}% + \else + \glssetexpandfield{sortvalue}% + \fi + \GlossariesWarning{sanitize={sort} package option + deprecated. Use sanitizesort instead}% +} +% \end{macrocode} +% +%\begin{option}{sanitize} +% \changes{4.02}{2013-12-05}{fixed bug that caused an error here} +% \changes{4.11}{2014-09-01}{fixed backward compatibility support of +% deprecated sanitize=none option} +% \begin{macrocode} +\define@key{glossaries.sty}{sanitize}[description=true,symbol=true,name=true]{% + \ifthenelse{\equal{#1}{none}}% + {% + \GlossariesWarning{sanitize package option deprecated}% + \glssetexpandfield{name}% + \glssetexpandfield{symbol}% + \glssetexpandfield{symbolplural}% + \glssetexpandfield{desc}% + \glssetexpandfield{descplural}% + }% + {% + \setkeys[gls]{sanitize}{#1}% + }% +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\ifglstranslate} +% As from version 3.13a, the \pkgopt{translator} package option is a +% choice rather than boolean option so now need to define +% conditional: +% \begin{macrocode} +\newif\ifglstranslate +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@notranslatorhook} +%\changes{3.13a}{2013-11-05}{new} +%\changes{4.12}{2014-11-22}{removed} +%\cs{@gls@notranslatorhook} has been removed. +%\end{macro} +%\begin{macro}{\@gls@usetranslator} +%\changes{4.12}{2014-11-22}{new} +% \begin{macrocode} +\newcommand*\@gls@usetranslator{% +% \end{macrocode} +% \sty{polyglossia} tricks \cs{@ifpackageloaded} into thinking that +% \sty{babel} has been loaded, so check for \sty{polyglossia} as well. +% \begin{macrocode} + \@ifpackageloaded{polyglossia}% + {% + \let\glsifusetranslator\@secondoftwo + }% + {% + \@ifpackageloaded{babel}% + {% + \IfFileExists{translator.sty}% + {% + \RequirePackage{translator}% + \let\glsifusetranslator\@firstoftwo + }% + {}% + }% + {}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsifusedtranslatordict} +%\changes{4.12}{2014-11-22}{new} +% Checks if given \sty{translator} dictionary has been loaded. +% \begin{macrocode} +\newcommand{\glsifusedtranslatordict}[3]{% + \glsifusetranslator + {\ifcsdef{ver@glossaries-dictionary-#1.dict}{#2}{#3}}% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{notranslate} +%\changes{3.14a}{2013-11-12}{new} +% Provide a synonym for \pkgopt[false]{translate} that can be passed +% via the document class. +% \begin{macrocode} +\@gls@declareoption{notranslate}{% + \glstranslatefalse + \let\@gls@usetranslator\relax + \let\glsifusetranslator\@secondoftwo +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{translate} +%\changes{1.1}{2008-02-22}{translate option added} +% Define \pkgopt{translate} option. If false don't set up +% multi-lingual support. +%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to +%\cs{gls@translate@val} and \cs{gls@translate@nr}} +% \begin{macrocode} +\define@choicekey{glossaries.sty}{translate}% + [\gls@translate@val\gls@translate@nr]% + {true,false,babel}[true]% + {% + \ifcase\gls@translate@nr\relax + \glstranslatetrue + \renewcommand*\@gls@usetranslator{% + \@ifpackageloaded{polyglossia}% + {% + \let\glsifusetranslator\@secondoftwo + }% + {% + \@ifpackageloaded{babel}% + {% + \IfFileExists{translator.sty}% + {% + \RequirePackage{translator}% + \let\glsifusetranslator\@firstoftwo + }% + {}% + }% + {}% + }% + }% + \or + \glstranslatefalse + \let\@gls@usetranslator\relax + \let\glsifusetranslator\@secondoftwo + \or + \glstranslatetrue + \let\@gls@usetranslator\relax + \let\glsifusetranslator\@secondoftwo + \fi + } +% \end{macrocode} +%\end{option} +% Set the default value: +% \begin{macrocode} +\glstranslatefalse +\let\glsifusetranslator\@secondoftwo +\@ifpackageloaded{translator}% +{% + \glstranslatetrue + \let\glsifusetranslator\@firstoftwo +}% +{% + \@for\gls@thissty:=tracklang,babel,ngerman,polyglossia\do + { + \@ifpackageloaded{\gls@thissty}% + {% + \glstranslatetrue + \@endfortrue + }% + {}% + } +} +% \end{macrocode} +% +%\begin{option}{indexonlyfirst} +%\changes{3.02}{2012-05-21}{new} +% Set whether to only index on first use. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{indexonlyfirst}[true]{} +\glsindexonlyfirstfalse +% \end{macrocode} +%\end{option} +% +%\begin{option}{hyperfirst} +%\changes{2.03}{2009-09-23}{new} +% Set whether or not terms should have a hyperlink on first use. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{hyperfirst}[true]{} +\glshyperfirsttrue +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@setacrstyle} +% Keep track of whether an acronym style has been set (for the +% benefit of \cs{setupglossaries}): +% \begin{macrocode} +\newcommand*{\@gls@setacrstyle}{} +% \end{macrocode} +%\end{macro} +%\begin{option}{footnote} +% Set the long form of the acronym in footnote on first use. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[glsacr]{footnote}[true]{% + \ifbool{glsacrdescription}% + {}% + {% + \renewcommand*{\@gls@sanitizedesc}{}% + }% + \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}% +} +% \end{macrocode} +%\end{option} +%\begin{option}{description} +% Allow acronyms to have a description (needs to be set using +% the \gloskey{description} key in the optional argument of +% \ics{newacronym}). +% \begin{macrocode} +\define@boolkey{glossaries.sty}[glsacr]{description}[true]{% + \renewcommand*{\@gls@sanitizesymbol}{}% + \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}% +} +% \end{macrocode} +%\end{option} +%\begin{option}{smallcaps} +% Define \ics{newacronym} to set the short form in small capitals. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[glsacr]{smallcaps}[true]{% + \renewcommand*{\@gls@sanitizesymbol}{}% + \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}% +} +% \end{macrocode} +%\end{option} +%\begin{option}{smaller} +% Define \ics{newacronym} to set the short form using \cs{smaller} +% which obviously needs to be defined by loading the appropriate +% package. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[glsacr]{smaller}[true]{% + \renewcommand*{\@gls@sanitizesymbol}{}% + \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}% +} +% \end{macrocode} +%\end{option} +%\begin{option}{dua} +% Define \ics{newacronym} to always use the long forms +% (i.e.\ don't use acronyms) +% \begin{macrocode} +\define@boolkey{glossaries.sty}[glsacr]{dua}[true]{% + \renewcommand*{\@gls@sanitizesymbol}{}% + \renewcommand*{\@gls@setacrstyle}{\SetAcronymStyle}% +} +% \end{macrocode} +%\end{option} +%\begin{option}{shotcuts} +% Define acronym shortcuts. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[glsacr]{shortcuts}[true]{} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glsorder} +% Stores the glossary ordering. This may either be \qt{word} +% or \qt{letter}. This passes the relevant information to +% \app{makeglossaries}. The default is word ordering. +% \begin{macrocode} +\newcommand*{\glsorder}{word} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsorder} +% The ordering information is written to the auxiliary file +% for \app{makeglossaries}, so ignore the auxiliary +% information. +% \begin{macrocode} +\newcommand*{\@glsorder}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{order} +%\changes{1.17}{2008-12-26}{order package option added} +% \begin{macrocode} +\define@choicekey{glossaries.sty}{order}{word,letter}{% + \def\glsorder{#1}} +% \end{macrocode} +%\end{option} +% +%\changes{1.17}{2008-12-26}{added xindy support} +%\begin{macro}{\ifglsxindy} +%\changes{1.17}{2008-12-26}{new} +% Provide boolean to determine whether \gls{xindy} or +% \gls{makeindex} will be used to sort the glossaries. +% \begin{macrocode} +\newif\ifglsxindy +% \end{macrocode} +%\end{macro} +% The default is \app{makeindex}: +% \begin{macrocode} +\glsxindyfalse +% \end{macrocode} +% +%\begin{option}{makeindex} +% Define package option to specify that \app{makeindex} will +% be used to sort the glossaries: +% \begin{macrocode} +\@gls@declareoption{makeindex}{\glsxindyfalse} +% \end{macrocode} +%\end{option} +% +% The \pkgopt{xindy} package option may have a value which in +% turn can be a key=value list. First define the keys for this +% sub-list. The boolean "glsnumbers" determines whether to +% automatically add the \texttt{glsnumbers} letter group. +% \begin{macrocode} +\define@boolkey[gls]{xindy}{glsnumbers}[true]{} +\gls@xindy@glsnumberstrue +% \end{macrocode} +% +%\begin{macro}{\@xdy@main@language} +%\changes{3.06}{2013/06/17}{Changed back to using \cs{languagename}} +% Define what language to use for each glossary type (if a +% language is not defined for a particular glossary type +% the language specified for the main glossary is used.) +% \begin{macrocode} +\def\@xdy@main@language{\languagename}% +% \end{macrocode} +%\end{macro} +% Define key to set the language +% \begin{macrocode} +\define@key[gls]{xindy}{language}{\def\@xdy@main@language{#1}} +% \end{macrocode} +% +%\begin{macro}{\gls@codepage} +% Define the code page. If \ics{inputencodingname} is defined +% use that, otherwise have initialise with no codepage. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifcsundef{inputencodingname}{% + \def\gls@codepage{}}{% + \def\gls@codepage{\inputencodingname} +} +% \end{macrocode} +% Define a key to set the code page. +% \begin{macrocode} +\define@key[gls]{xindy}{codepage}{\def\gls@codepage{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{xindy} +% Define package option to specify that \app{xindy} will be +% used to sort the glossaries: +% \begin{macrocode} +\define@key{glossaries.sty}{xindy}[]{% + \glsxindytrue + \setkeys[gls]{xindy}{#1}% +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{xindygloss} +%\changes{3.14a}{2013-11-12}{new} +% Provide a synonym for \pkgopt[]{xindy} that can be passed via the +% document class options. +% \begin{macrocode} +\@gls@declareoption{xindygloss}{% + \glsxindytrue +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{xindynoglsnumbers} +%\changes{4.02}{2013-12-05}{new} +% Provide a synonym for \texttt{xindy={glsnumbers=false}} that can +% be passed via the document class options. +% \begin{macrocode} +\@gls@declareoption{xindynoglsnumbers}{% + \glsxindytrue + \gls@xindy@glsnumbersfalse +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\ifglsautomake} +%\changes{4.42}{2019-01-06}{now defined explicitly instead of through +%boolean key} +% \begin{macrocode} +\newif\ifglsautomake +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@automake@nr} +%\changes{4.42}{2019-01-06}{new} +% \begin{macrocode} +\newcommand{\gls@automake@nr}{1} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{automake} +%\changes{4.08}{2014-07-30}{new} +%\changes{4.42}{2019-01-06}{switch from boolean to choice} +% If this setting is on, automatically run +% \gls{makeindex}\slash\gls{xindy} at the end of the document. +% Must be used with \ics{makeglossaries}. +% Default is false. As from v4.42, this is now a choice rather than +% boolean key. +% \begin{macrocode} +\define@choicekey{glossaries.sty}{automake}% + [\gls@automake@val\gls@automake@nr]{true,false,immediate}[true]{% + \ifnum\gls@automake@nr=1\relax + \glsautomakefalse + \else + \glsautomaketrue + \fi + \ifglsautomake + \renewcommand*{\@gls@doautomake}{% + \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.% + }% + }% + \else + \renewcommand*{\@gls@doautomake}{}% + \fi +} +\glsautomakefalse +% \end{macrocode} +%\end{option} +%\begin{macro}{\@gls@doautomake} +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\@gls@doautomake}{} +\AtEndDocument{\@gls@doautomake} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{savewrites} +%\changes{3.0}{2011-04-02}{new} +% The \pkgopt{savewrites} package option is provided to save on +% the number of write registers. +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{savewrites}[true]{% + \ifglssavewrites + \renewcommand*{\glswritefiles}{\@glswritefiles}% + \else + \let\glswritefiles\@empty + \fi +} +% \end{macrocode} +%\end{option} +% Set default: +%\changes{4.03}{2014-01-17}{changed default to \cs{@empty} instead +%of \cs{relax}} +% \begin{macrocode} +\glssavewritesfalse +\let\glswritefiles\@empty +% \end{macrocode} +% +%\begin{option}{compatible-3.07} +%\changes{3.11a}{2013-10-15}{cnew} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{compatible-3.07}[true]{} +\boolfalse{glscompatible-3.07} +% \end{macrocode} +%\end{option} +% +%\begin{option}{compatible-2.07} +%\changes{3.0}{2011-04-02}{compatible-2.07 option added} +% \begin{macrocode} +\define@boolkey{glossaries.sty}[gls]{compatible-2.07}[true]{% +% \end{macrocode} +% Also set 3.07 compatibility if this option is set. +%\changes{3.14a}{2013-11-12}{added check for 2.07 before setting 3.07 +%compatibility} +% \begin{macrocode} + \ifbool{glscompatible-2.07}% + {% + \booltrue{glscompatible-3.07}% + }% + {}% +} +\boolfalse{glscompatible-2.07} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\gls@original@makeglossary} +%Store the original definition. +%\changes{4.41}{2018-07-23}{new} +% \begin{macrocode} +\let\gls@original@makeglossary\makeglossary +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@original@glossary} +%Store the original definition. +%\changes{4.41}{2018-07-23}{new} +% \begin{macrocode} +\let\gls@original@glossary\glossary +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\makeglossary} +% The \cs{makeglossary} command is redefined to be +% identical to \cs{makeglossaries}. (This is done partly to +% reinforce the message that you must either use +% \cs{@makeglossary} for all the glossaries or for none +% of them, but is also a legacy from the old \styfmt{glossary} package.) +%\changes{4.41}{2018-07-23}{added warning} +% \begin{macrocode} +\def\makeglossary{% + \GlossariesWarning{Use of \string\makeglossary\space with + glossaries.sty is \MessageBreak deprecated. Use \string\makeglossaries\space + instead. If you \MessageBreak need the original definition of + \string\makeglossary\space use \MessageBreak the package options + kernelglossredefs=false (to \MessageBreak restore the former definition of + \string\makeglossary) and \MessageBreak nomain (if the file extensions cause a + conflict)}% + \makeglossaries +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@override@glossary} +%\changes{4.41}{2018-07-23}{new} +% \begin{macrocode} +\newcommand*{\@gls@override@glossary}[1][main]{% + \GlossariesWarning{Use of \string\glossary\space with + glossaries.sty is deprecated. \MessageBreak Indexing should be performed + with the user level \MessageBreak commands, such as \string\gls\space or + \string\glsadd. If you need the \MessageBreak original definition of + \string\glossary\space use the package \MessageBreak options + kernelglossredefs=false (to restore the \MessageBreak former definition of + \string\glossary) and nomain (if the \MessageBreak file extensions cause a + conflict)}% + \gls@glossary{#1}% +} +% \end{macrocode} +%\end{macro} +% +% In v4.10, the redefinition of \cs{glossary} was removed since it +% was never intended as a user level command (and wasn't documented +% in the user manual), however it seems there are packages that have +% hacked the internal macros used by \styfmt{glossaries} and no longer +% work with this redefinition removed, so it's been restored in v4.11 +% but is not used at all by \styfmt{glossaries}. +% (This may be removed or moved to a compatibility mode in future.) +% As from v4.41, the use of \cs{glossary} now triggers a warning. +% The package option \pkgopt[nowarn]{kernelglossredefs} may be used to +% remove the warning, but it's better not to use \cs{glossary}. +%\begin{macro}{\glossary} +%\changes{4.41}{2018-07-23}{added warning} +% \begin{macrocode} +\if@gls@docloaded +\else + \def\glossary{\@gls@override@glossary} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{option}{kernelglossredefs} +%\changes{4.41}{2018-07-23}{new} +%The \sty{glossaries} package redefines the kernel commands +%\cs{makeglossary} and \cs{glossary} as a legacy action from the +%former \sty{glossary} package. In hindsight that wasn't a good idea +%as it's possible that the \sty{glossaries} package may need to be +%used with another class or package that needs these commands. +%Neither of these commands are documented in the main user manual +%and their use is not encouraged. The preferred commands are +%\cs{makeglossaries} (to open all associated glossary files) and +%\cs{gls}, \cs{glstext} etc or \cs{glsadd} for indexing. +% \begin{macrocode} +\define@choicekey{glossaries.sty}{kernelglossredefs}% + [\gls@debug@val\gls@debug@nr]{true,false,nowarn}[true]% +{% + \ifcase\gls@debug@nr\relax + \def\glossary{\@gls@override@glossary}% + \def\makeglossary{% + \GlossariesWarning{Use of \string\makeglossary\space with + glossaries.sty is deprecated. Use \string\makeglossaries\space + instead. If you need the original definition of + \string\makeglossary\space use the package options + kernelglossredefs=false (to prevent redefinition of + \string\makeglossary) and nomain (if the file extensions cause a + conflict)}% + \makeglossaries + }% + \or + \let\glossary\gls@original@glossary + \let\makeglossary\gls@original@makeglossary + \or + \def\makeglossary{\makeglossaries}% + \renewcommand*{\@gls@override@glossary}[1][main]{% + \gls@glossary{##1}% + }% + \fi +} +% \end{macrocode} +%\end{option} +% +%\begin{option}{symbols} +% Create a \qt{symbols} glossary type +%\changes{3.11a}{2013-10-15}{new} +% \begin{macrocode} +\@gls@declareoption{symbols}{% + \let\@gls@do@symbolsdef\@gls@symbolsdef +} +% \end{macrocode} +% Default is not to define the symbols glossary: +% \begin{macrocode} +\newcommand*{\@gls@do@symbolsdef}{} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@symbolsdef} +%\changes{4.02}{2013-12-05}{new} +% \begin{macrocode} +\newcommand*{\@gls@symbolsdef}{% + \newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}% + \newcommand*{\printsymbols}[1][]{\printglossary[type=symbols,##1]}% +% \end{macrocode} +% Define hook to set the toc title when \sty{translator} is in use. +%\changes{4.06}{2014-03-12}{added hook to set toc title} +% \begin{macrocode} + \newcommand*{\gls@tr@set@symbols@toctitle}{% + \translatelet{\glossarytoctitle}{Symbols (glossaries)}% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{option}{numbers} +% Create a \qt{symbols} glossary type +%\changes{3.11a}{2013-10-15}{new} +% \begin{macrocode} +\@gls@declareoption{numbers}{% + \let\@gls@do@numbersdef\@gls@numbersdef +} +% \end{macrocode} +% Default is not to define the numbers glossary: +% \begin{macrocode} +\newcommand*{\@gls@do@numbersdef}{} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\@gls@numbersdef} +%\changes{4.02}{2013-12-05}{new} +% \begin{macrocode} +\newcommand*{\@gls@numbersdef}{% + \newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}% + \newcommand*{\printnumbers}[1][]{\printglossary[type=numbers,##1]}% +% \end{macrocode} +% Define hook to set the toc title when \sty{translator} is in use. +%\changes{4.06}{2014-03-12}{added hook to set toc title} +% \begin{macrocode} + \newcommand*{\gls@tr@set@numbers@toctitle}{% + \translatelet{\glossarytoctitle}{Numbers (glossaries)}% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{option}{index} +% Create an \qt{index} glossary type +%\changes{4.02}{2013-12-05}{new} +% \begin{macrocode} +\@gls@declareoption{index}{% + \ifx\@gls@do@indexdef\@empty + \let\@gls@do@indexdef\@gls@indexdef + \fi +} +% \end{macrocode} +%\end{option} +%\begin{option}{noglossaryindex} +% Counteract \pkgopt{index} if it happens to be globally used in the document class. +%\changes{4.42}{2019-01-06}{new} +% \begin{macrocode} +\@gls@declareoption{noglossaryindex}{% + \let\@gls@do@indexdef\relax +} +% \end{macrocode} +%\end{option} +% Default is not to define index glossary: +% \begin{macrocode} +\newcommand*{\@gls@do@indexdef}{} +% \end{macrocode} +% +%\begin{macro}{\@gls@indexdef} +%\changes{4.02}{2013-12-05}{new} +%\cs{indexname} isn't set by \sty{glossaries}. +% \begin{macrocode} +\newcommand*{\@gls@indexdef}{% + \newglossary[ilg]{index}{ind}{idx}{\indexname}% + \newcommand*{\printindex}[1][]{\printglossary[type=index,##1]}% + \newcommand*{\newterm}[2][]{% + \newglossaryentry{##2}% + {type={index},name={##2},description={\nopostdesc},##1}} + \let\@gls@do@indexdef\relax +}% +% \end{macrocode} +%\end{macro} +% +% Process package options. First process any options that have been +% passed via the document class. +% \begin{macrocode} +\@for\CurrentOption :=\@declaredoptions\do{% + \ifx\CurrentOption\@empty + \else + \@expandtwoargs + \in@ {,\CurrentOption ,}{,\@classoptionslist,\@curroptions,}% + \ifin@ + \@use@ption + \expandafter \let\csname ds@\CurrentOption\endcsname\@empty + \fi + \fi +} +% \end{macrocode} +% Now process options passed to the package: +% \begin{macrocode} +\ProcessOptionsX +% \end{macrocode} +% Load backward compatibility stuff: +% \begin{macrocode} +\RequirePackage{glossaries-compatible-307} +% \end{macrocode} +% +%\begin{macro}{\setupglossaries} +%\changes{3.11a}{2013-10-15}{new} +% Provide way to set options after package has been loaded. However, +% some options must be set before \cs{ProcessOptionsX}, so they have +% to be disabled: +% \begin{macrocode} +\disable@keys{glossaries.sty}{compatible-2.07,% + xindy,xindygloss,xindynoglsnumbers,makeindex,% + acronym,translate,notranslate,nolong,nosuper,notree,nostyles,% + nomain,noglossaryindex} +% \end{macrocode} +%Now define \cs{setupglossaries}: +% \begin{macrocode} +\newcommand*{\setupglossaries}[1]{% + \renewcommand*{\@gls@setacrstyle}{}% + \ifglsacrshortcuts + \def\@gls@setupshortcuts{\glsacrshortcutstrue}% + \else + \def\@gls@setupshortcuts{% + \ifglsacrshortcuts + \DefineAcronymSynonyms + \fi + }% + \fi + \glsacrshortcutsfalse + \let\@gls@do@numbersdef\relax + \let\@gls@do@symbolssdef\relax + \let\@gls@do@indexdef\relax + \let\@gls@do@acronymsdef\relax + \ifglsentrycounter + \let\@gls@doentrycounterdef\relax + \else + \let\@gls@doentrycounterdef\@gls@define@glossaryentrycounter + \fi + \ifglssubentrycounter + \let\@gls@dosubentrycounterdef\relax + \else + \let\@gls@dosubentrycounterdef\@gls@define@glossarysubentrycounter + \fi + \setkeys{glossaries.sty}{#1}% + \@gls@setacrstyle + \@gls@setupshortcuts + \@gls@do@acronymsdef + \@gls@do@numbersdef + \@gls@do@symbolssdef + \@gls@do@indexdef + \@gls@doentrycounterdef + \@gls@dosubentrycounterdef +} +% \end{macrocode} +%\end{macro} +% +% If chapters are defined and the user has requested the +% section counter as a package option, \cs{@chapter} will +% be modified so +% that it adds a \texttt{section.}\meta{n}\texttt{.0} target, +% otherwise entries placed before the first section of a chapter +% will have undefined links. +% +% The same problem will also occur if a lower sectional unit is +% used, but this is less likely to happen. If it does, or if +% you change \cs{glscounter} to "section" later, you +% will have to specify a different counter for the entries +% that give rise to a \texttt{name}"{"\meta{section-level}"."\meta{n}".0}" +% non-existent warning (e.g. "\gls[counter=chapter]{label}"). +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifthenelse{\equal{\glscounter}{section}}% +{% + \ifcsundef{chapter}{}% + {% + \let\@gls@old@chapter\@chapter + \def\@chapter[#1]#2{\@gls@old@chapter[{#1}]{#2}% + \ifcsundef{hyperdef}{}{\hyperdef{section}{\thesection}{}}}% + }% +}% +{} +% \end{macrocode} +% +%\begin{macro}{\@gls@onlypremakeg} +% Some commands only have an effect when used before +% \ics{makeglossaries}. So define a list of commands that +% should be disabled after \ics{makeglossaries} +% \begin{macrocode} +\newcommand*{\@gls@onlypremakeg}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@onlypremakeg} +% Adds the specified control sequence to the list of commands that +% must be disabled after \ics{makeglossaries}. +% \begin{macrocode} +\newcommand*{\@onlypremakeg}[1]{% + \ifx\@gls@onlypremakeg\@empty + \def\@gls@onlypremakeg{#1}% + \else + \expandafter\toks@\expandafter{\@gls@onlypremakeg}% + \edef\@gls@onlypremakeg{\the\toks@,\noexpand#1}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@disable@onlypremakeg} +% Disable all commands listed in \cs{@gls@onlypremakeg} +% \begin{macrocode} +\newcommand*{\@disable@onlypremakeg}{% +\@for\@thiscs:=\@gls@onlypremakeg\do{% + \expandafter\@disable@premakecs\@thiscs% +}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@disable@premakecs} +% Disables the given command. +% \begin{macrocode} +\newcommand*{\@disable@premakecs}[1]{% + \def#1{\PackageError{glossaries}{\string#1\space may only be + used before \string\makeglossaries}{You can't use + \string#1\space after \string\makeglossaries}}% +} +% \end{macrocode} +%\end{macro} +% +%\section{Predefined Text}\label{sec:predefinednames} +% Set up default textual tags that are used by this +% package. Some of the names may already be defined (e.g.\ by +% \isty{babel}) so \cs{providecommand} is used. +% +% Main glossary title: +%\begin{macro}{\glossaryname} +% \begin{macrocode} +\providecommand*{\glossaryname}{Glossary} +% \end{macrocode} +%\end{macro} +% The title for the "acronym" glossary type (which is defined if +% \pkgopt{acronym} package option is used) is given by +% \cs{acronymname}. If the \pkgopt{acronym} +% package option is not used, \cs{acronymname} won't be used. +%\begin{macro}{\acronymname} +% \begin{macrocode} +\providecommand*{\acronymname}{Acronyms} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glssettoctitle} +% Sets the TOC title for the given glossary. +%\changes{1.15}{2008-08-15}{new} +% \begin{macrocode} +\newcommand*{\glssettoctitle}[1]{% + \def\glossarytoctitle{\csname @glotype@#1@title\endcsname}} +% \end{macrocode} +%\end{macro} +% +% The following commands provide text for the headers used by +% some of the tabular-like glossary +% styles. Whether or not they get used in the glossary depends on +% the glossary style. +%\begin{macro}{\entryname} +% \begin{macrocode} +\providecommand*{\entryname}{Notation} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\descriptionname} +% \begin{macrocode} +\providecommand*{\descriptionname}{Description} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\symbolname} +% \begin{macrocode} +\providecommand*{\symbolname}{Symbol} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\pagelistname} +% \begin{macrocode} +\providecommand*{\pagelistname}{Page List} +% \end{macrocode} +%\end{macro} +% Labels for \app{makeindex}'s symbol and number groups: +%\begin{macro}{\glssymbolsgroupname} +% \begin{macrocode} +\providecommand*{\glssymbolsgroupname}{Symbols} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsnumbersgroupname} +% \begin{macrocode} +\providecommand*{\glsnumbersgroupname}{Numbers} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glspluralsuffix} +% The default plural is formed by appending \cs{glspluralsuffix} to +% the singular form. +% \begin{macrocode} +\newcommand*{\glspluralsuffix}{s} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsacrpluralsuffix} +% Default plural suffix for acronyms +%\changes{4.12}{2014-11-22}{new} +% \begin{macrocode} +\newcommand*{\glsacrpluralsuffix}{\glspluralsuffix} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsupacrpluralsuffix} +%\changes{4.12}{2014-11-22}{new} +% \begin{macrocode} +\newcommand*{\glsupacrpluralsuffix}{\glstextup{\glsacrpluralsuffix}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\seename} +% \begin{macrocode} +\providecommand*{\seename}{see} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\andname} +% \begin{macrocode} +\providecommand*{\andname}{\&} +% \end{macrocode} +%\end{macro} +% Add multi-lingual support\changes{1.08}{2007-10-13}{Added +% babel support}. Thanks to everyone who contributed to the +% translations from both comp.text.tex and via email. +%\begin{macro}{\RequireGlossariesLang} +%\changes{4.12}{2014-11-22}{new} +% \begin{macrocode} +\newcommand*{\RequireGlossariesLang}[1]{% + \@ifundefined{ver@glossaries-#1.ldf}{\input{glossaries-#1.ldf}}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ProvidesGlossariesLang} +%\changes{4.12}{2014-11-22}{new} +% \begin{macrocode} +\newcommand*{\ProvidesGlossariesLang}[1]{% + \ProvidesFile{glossaries-#1.ldf}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\addglossarytocaptions} +% Does nothing if \sty{translator} hasn't been loaded. +% \begin{macrocode} +\newcommand*{\addglossarytocaptions}[1]{} +% \end{macrocode} +%\end{macro} +% +% As from v4.12, multlingual support has been split off into +% independently-maintained language modules. +% \begin{macrocode} +\ifglstranslate +% \end{macrocode} +% Load \sty{tracklang} +% \begin{macrocode} + \RequirePackage{tracklang} +% \end{macrocode} +% Load \sty{translator} if required. +% \begin{macrocode} + \@gls@usetranslator +% \end{macrocode} +% If using \isty{translator}, \ics{glossaryname} should be defined +% in terms of \ics{translate}, but if babel is also loaded, it will +% redefine \cs{glossaryname} whenever the language is set, so +% override it. (Don't use \ics{addto} as \isty{polyglossia} doesn't +% define it.) +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} + \@ifpackageloaded{translator} + {% +% \end{macrocode} +% If the language options have been specified through the +% document class, then \sty{translator} can pick them up. If not, +% \sty{translator} will default to English and any language +% option passed to \sty{babel} won't be detected, so if +% \cs{trans@languages} is just \texttt{English} and \cs{bbl@loaded} +% isn't simply \texttt{english}, then don't use the \sty{translator} +% dictionaries. +% \begin{macrocode} + \ifboolexpr + { + test {\ifdefstring{\trans@languages}{English}} + and not + test {\ifdefstring{bbl@loaded}{english}} + } + {% + \let\glsifusetranslator\@secondoftwo + }% + {% + \usedictionary{glossaries-dictionary}% + \renewcommand*{\addglossarytocaptions}[1]{% + \ifcsundef{captions#1}{}% + {% + \expandafter\let\expandafter\@gls@tmp\csname captions#1\endcsname + \expandafter\toks@\expandafter{\@gls@tmp + \renewcommand*{\glossaryname}{\translate{Glossary}}% + }% + \expandafter\edef\csname captions#1\endcsname{\the\toks@}% + }% + }% + }% + }% + {}% +% \end{macrocode} +% Check for tracked languages +% \begin{macrocode} + \AnyTrackedLanguages + {% + \ForEachTrackedDialect{\this@dialect}{% + \IfTrackedLanguageFileExists{\this@dialect}% + {glossaries-}% prefix + {.ldf}% + {% + \RequireGlossariesLang{\CurrentTrackedTag}% + }% + {% + \@gls@missinglang@warn\this@dialect\CurrentTrackedLanguage + }% + }% + }% + {}% +% \end{macrocode} +% if using \sty{translator} use translator interface. +% \begin{macrocode} + \glsifusetranslator + {% + \renewcommand*{\glssettoctitle}[1]{% + \ifcsdef{gls@tr@set@#1@toctitle}% + {% + \csuse{gls@tr@set@#1@toctitle}% + }% + {% + \def\glossarytoctitle{\csname @glotype@#1@title\endcsname}% + }% + }% + \renewcommand*{\glossaryname}{\translate{Glossary}}% + \renewcommand*{\acronymname}{\translate{Acronyms}}% + \renewcommand*{\entryname}{\translate{Notation (glossaries)}}% + \renewcommand*{\descriptionname}{% + \translate{Description (glossaries)}}% + \renewcommand*{\symbolname}{\translate{Symbol (glossaries)}}% + \renewcommand*{\pagelistname}{% + \translate{Page List (glossaries)}}% + \renewcommand*{\glssymbolsgroupname}{% + \translate{Symbols (glossaries)}}% + \renewcommand*{\glsnumbersgroupname}{% + \translate{Numbers (glossaries)}}% + }{}% +\fi +% \end{macrocode} +% +%\begin{macro}{\nopostdesc} +% Provide a means to suppress description terminator for a given +% entry. (Useful for entries with no description.) Has no +% effect outside the glossaries. +%\changes{1.17}{2008-12-26}{new} +%\changes{3.05}{2013-04-21}{made robust} +% \begin{macrocode} +\DeclareRobustCommand*{\nopostdesc}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@nopostdesc} +% Suppress next description terminator. +% \begin{macrocode} +\newcommand*{\@nopostdesc}{% + \let\org@glspostdescription\glspostdescription + \def\glspostdescription{% + \let\glspostdescription\org@glspostdescription}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@no@post@desc} +% Used for comparison purposes. +% \begin{macrocode} +\newcommand*{\@no@post@desc}{\nopostdesc} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspar} +% Provide means of having a paragraph break in glossary entries +% \begin{macrocode} +\newcommand{\glspar}{\par} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\setStyleFile} +% Sets the style file. The relevant extension is appended. +% \begin{macrocode} +\newcommand{\setStyleFile}[1]{% + \renewcommand*{\gls@istfilebase}{#1}% +% \end{macrocode} +% Just in case \cs{istfilename} has been modified. +% \begin{macrocode} + \ifglsxindy + \def\istfilename{\gls@istfilebase.xdy} + \else + \def\istfilename{\gls@istfilebase.ist} + \fi +} +% \end{macrocode} +% This command only has an effect prior to using +% \ics{makeglossaries}. +% \begin{macrocode} +\@onlypremakeg\setStyleFile +% \end{macrocode} +%\end{macro} +% +% The name of the \app{makeindex} or \app{xindy} style file +% is given by \cs{istfilename}. This file is +% created by \ics{writeist} (which is used by +% \ics{makeglossaries}) so +% redefining this command will only have an effect if it is +% done \emph{before} \cs{makeglossaries}. As from v1.17, use +% \ics{setStyleFile} instead of directly redefining \cs{istfilename}. +%\begin{macro}{\istfilename} +%\changes{1.17}{2008-12-26}{added xindy support} +% \begin{macrocode} +\ifglsxindy + \def\istfilename{\gls@istfilebase.xdy} +\else + \def\istfilename{\gls@istfilebase.ist} +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@istfilebase} +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\gls@istfilebase}{\jobname} +% \end{macrocode} +%\end{macro} +% The \app{makeglossaries} Perl script picks up this name +% from the auxiliary file. If the name ends with \filetype{.xdy} +% it calls \app{xindy} otherwise it calls \app{makeindex}. +% Since its not required by +% \LaTeX, \cs{@istfilename} ignores its argument. +%\begin{macro}{\@istfilename} +% \begin{macrocode} +\newcommand*{\@istfilename}[1]{} +% \end{macrocode} +%\end{macro} +% +% This command is the value of the \istkey{page\_compositor} +% \app{makeindex} key. Again, any redefinition of this command +% must take place \emph{before} \cs{writeist} otherwise it +% will have no effect. As from 1.17, use \ics{glsSetCompositor} +% instead of directly redefining \cs{glscompositor}. +%\begin{macro}{\glscompositor} +% \begin{macrocode} +\newcommand*{\glscompositor}{.} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsSetCompositor} +% Sets the compositor. +% \begin{macrocode} +\newcommand*{\glsSetCompositor}[1]{% + \renewcommand*{\glscompositor}{#1}} +% \end{macrocode} +% Only use before \ics{makeglossaries} +% \begin{macrocode} +\@onlypremakeg\glsSetCompositor +% \end{macrocode} +%\end{macro} +% +% (The page compositor is usually defined as a dash when using +% \app{makeindex}, but most of the standard counters used +% by \LaTeX\ use a full stop as the compositor, which is why I +% have used it as the default.) If \app{xindy} is used +% \cs{glscompositor} only affects the \texttt{arabic-page-numbers} +% location class. +%\begin{macro}{\@glsAlphacompositor} +% This is only used by \app{xindy}. It specifies the +% compositor to use when location numbers are in the form +% \meta{letter}\meta{compositor}\meta{number}. For example, +% if \cs{@glsAlphacompositor} is set to ``.'' then it allows +% locations such as A.1 whereas if \cs{@glsAlphacompositor} is +% set to ``-'' then it allows locations such as A-1. +% \begin{macrocode} +\newcommand*{\@glsAlphacompositor}{\glscompositor} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsSetAlphaCompositor} +% Sets the alpha compositor. +% \begin{macrocode} +\ifglsxindy + \newcommand*\glsSetAlphaCompositor[1]{% + \renewcommand*\@glsAlphacompositor{#1}} +\else + \newcommand*\glsSetAlphaCompositor[1]{% + \glsnoxindywarning\glsSetAlphaCompositor} +\fi +% \end{macrocode} +% Can only be used before \ics{makeglossaries} +% \begin{macrocode} +\@onlypremakeg\glsSetAlphaCompositor +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@suffixF} +%\changes{1.17}{2008-12-26}{new} +% Suffix to use for a two page list. This overrides the separator +% and the closing page number if set to something other than +% an empty macro. +% \begin{macrocode} +\newcommand*{\gls@suffixF}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsSetSuffixF} +%\changes{1.17}{2008-12-26}{new} +% Sets the suffix to use for a two page list. +% \begin{macrocode} +\newcommand*{\glsSetSuffixF}[1]{% + \renewcommand*{\gls@suffixF}{#1}} +% \end{macrocode} +% Only has an effect when used before \ics{makeglossaries} +% \begin{macrocode} +\@onlypremakeg\glsSetSuffixF +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@suffixFF} +%\changes{1.17}{2008-12-26}{new} +% Suffix to use for a three page list. This overrides the separator +% and the closing page number if set to something other than +% an empty macro. +% \begin{macrocode} +\newcommand*{\gls@suffixFF}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsSetSuffixFF} +%\changes{1.17}{2008-12-26}{new} +% Sets the suffix to use for a three page list. +% \begin{macrocode} +\newcommand*{\glsSetSuffixFF}[1]{% + \renewcommand*{\gls@suffixFF}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnumberformat} +% The command \cs{glsnumberformat} indicates the default +% format for the page numbers in the glossary. (Note that this +% is not the same as \ics{glossaryentrynumbers}, but applies +% to individual numbers or groups of numbers within an entry's +% associated number list.) If hyperlinks are defined, it will use +% \ics{glshypernumber}, otherwise it will simply display its +% argument ``as is''. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifcsundef{hyperlink}% +{% + \newcommand*{\glsnumberformat}[1]{#1}% +}% +{% + \newcommand*{\glsnumberformat}[1]{\glshypernumber{#1}}% +} +% \end{macrocode} +%\end{macro} +% +% Individual numbers in an entry's associated number list are +% delimited using \cs{delimN} (which corresponds to the +% \istkey{delim\_n} \app{makeindex} keyword). The default value +% is a comma followed by a space. +%\begin{macro}{\delimN} +% \begin{macrocode} +\newcommand{\delimN}{, } +% \end{macrocode} +%\end{macro} +% A range of numbers within an entry's associated number list is +% delimited using \cs{delimR} (which corresponds to the +% \istkey{delim\_r} \app{makeindex} keyword). The default is +% an en-dash. +%\begin{macro}{\delimR} +% \begin{macrocode} +\newcommand{\delimR}{--} +% \end{macrocode} +%\end{macro} +% +% The glossary preamble is given by \cs{glossarypreamble}. This +% will appear after the glossary sectioning command, and before the +% \env{theglossary} environment. It is designed to allow the +% user to add information pertaining to the glossary (e.g.\ ``page +% numbers in italic indicate the primary definition'') therefore +% \cs{glossarypremable} shouldn't be affected by the glossary +% style. (So if you define your own glossary style, don't have it +% change \cs{glossarypreamble}.) The preamble is empty by +% default. If you have multiple glossaries, and you want a +% different preamble for each glossary, you will need to use +% \ics{printglossary} for each glossary type, instead of +% \ics{printglossaries}, and redefine \cs{glossarypreamble} +% before each \ics{printglossary}. +%\begin{macro}{\glossarypreamble} +%\changes{3.07}{2013-07-05}{modified to work with +%\cs{setglossarypreamble}} +% \begin{macrocode} +\newcommand*{\glossarypreamble}{% + \csuse{@glossarypreamble@\currentglossary}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\setglossarypreamble} +%\begin{definition} +%\cs{setglossarypreamble}\oarg{type}\marg{text} +%\end{definition} +% Code provided by Michael Pock. +%\changes{3.07}{2013-07-05}{new} +% \begin{macrocode} +\newcommand{\setglossarypreamble}[2][\glsdefaulttype]{% + \ifglossaryexists{#1}{% + \csgdef{@glossarypreamble@#1}{#2}% + }{% + \GlossariesWarning{% + Glossary `#1' is not defined% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% +% The glossary postamble is given by \cs{glossarypostamble}. +% This is provided to allow the user to +% add something after the end of the \env{theglossary} +% environment (again, this shouldn't be affected by the +% glossary style). It is, of course, possible to simply add the +% text after \ics{printglossary}, but if you only want the +% postamble to appear after the first glossary, but not after +% subsequent glossaries, you can do something like: +%\begin{verbatim} +%\renewcommand{\glossarypostamble}{For a complete list of terms +%see \cite{blah}\gdef\glossarypreamble{}} +%\end{verbatim} +%\begin{macro}{\glossarypostamble} +% \begin{macrocode} +\newcommand*{\glossarypostamble}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossarysection} +% The sectioning command that starts a glossary is given by +% \cs{glossarysection}. (This does not form part of the +% glossary style, and so should not be changed by a glossary +% style.) If \ics{phantomsection} +% is defined, it uses \cs{\@p@glossarysection}, otherwise it +% uses \cs{@glossarysection}. +%\changes{1.05}{2007-08-10}{added \cs{@mkboth} to +%\cs{glossarysection}} +%\changes{2.02}{2009-07-13}{changed \cs{@mkboth} to +%\cs{glossarymark}} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\newcommand*{\glossarysection}[2][\@gls@title]{% + \def\@gls@title{#2}% + \ifcsundef{phantomsection}% + {% + \@glossarysection{#1}{#2}% + }% + {% + \@p@glossarysection{#1}{#2}% + }% +% \end{macrocode} +%\changes{3.13a}{2013-11-05}{changed \cs{glossarymark} to \cs{glsglossarymark}} +% \begin{macrocode} + \glsglossarymark{\glossarytoctitle}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsglossarymark} +%\changes{2.02}{2009-07-13}{New} +%\changes{2.03}{2009-09-23}{Added check to see if it's already +%defined} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +%\changes{3.11a}{2013-10-15}{replaced \cs{MakeUppercase} with +%\cs{mfirstucMakeUppercase}} +%\changes{3.13a}{2013-11-05}{renamed \cs{glossarymark} to +%\cs{glsglossarymark} to avoid conflict with memoir} +% Sets the header mark for the glossary. Takes the glossary short +% (TOC) title as the argument. +% \begin{macrocode} +\ifcsundef{glossarymark}% +{% + \newcommand{\glsglossarymark}[1]{\glossarymark{#1}} +}% +{% + \@ifclassloaded{memoir} + {% + \newcommand{\glsglossarymark}[1]{% + \ifglsucmark + \markboth{\memUChead{#1}}{\memUChead{#1}}% + \else + \markboth{#1}{#1}% + \fi + } + }% + {% + \newcommand{\glsglossarymark}[1]{% + \ifglsucmark + \@mkboth{\mfirstucMakeUppercase{#1}}{\mfirstucMakeUppercase{#1}}% + \else + \@mkboth{#1}{#1}% + \fi + } + } +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glossarymark} +% Provided for backward compatibility: +% \begin{macrocode} +\providecommand{\glossarymark}[1]{% + \ifglsucmark + \@mkboth{\mfirstucMakeUppercase{#1}}{\mfirstucMakeUppercase{#1}}% + \else + \@mkboth{#1}{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +% +% The required sectional unit is given by \cs{@@glossarysec} +% which was defined by the \pkgopt{section} package option. The +% starred form of the command is chosen. If you don't want any sectional +% command, you will need to redefine \cs{glossarysection}. +% The sectional unit can be changed, if different sectional units +% are required. +%\begin{macro}{\setglossarysection} +%\changes{1.1}{2008-02-22}{new} +% \begin{macrocode} +\newcommand*{\setglossarysection}[1]{% +\setkeys{glossaries.sty}{section=#1}} +% \end{macrocode} +%\end{macro} +% +%The command \cs{@glossarysection} indicates how to start +% the glossary section if \ics{phantomsection} is not defined. +%\begin{macro}{\@glossarysection} +%\changes{1.1}{2008-02-22}{numbered sections and auto label added} +%\changes{4.07}{2014-04-04}{added optional argument when using unstarred +%version} +% \begin{macrocode} +\newcommand*{\@glossarysection}[2]{% + \ifdefempty\@@glossarysecstar + {% + \csname\@@glossarysec\endcsname[#1]{#2}% + }% + {% + \csname\@@glossarysec\endcsname*{#2}% + \@gls@toc{#1}{\@@glossarysec}% + }% +% \end{macrocode} +% Do automatic labelling if required +% \begin{macrocode} + \@@glossaryseclabel +} +% \end{macrocode} +%\end{macro} +% +% As \cs{@glossarysection}, but put in +% \ics{phantomsection}, and swap where \cs{@gls@toc} goes. +% If using chapters do a \cs{clearpage}. This ensures that +% the hyper link from the table of contents leads to the line above +% the heading, rather than the line below it. +%\begin{macro}{\@p@glossarysection} +%\changes{1.1}{2008-02-22}{numbered sections and auto label added} +% \begin{macrocode} +\newcommand*{\@p@glossarysection}[2]{% + \glsclearpage + \phantomsection + \ifdefempty\@@glossarysecstar + {% + \csname\@@glossarysec\endcsname{#2}% + }% + {% + \@gls@toc{#1}{\@@glossarysec}% + \csname\@@glossarysec\endcsname*{#2}% + }% +% \end{macrocode} +% Do automatic labelling if required +% \begin{macrocode} + \@@glossaryseclabel +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@doclearpage} +%The \cs{gls@doclearpage} command is used to issue a +% \cs{clearpage} (or \cs{cleardoublepage}) depending +% on whether the glossary sectional unit is a chapter. If the +% sectional unit is something else, do nothing. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +%\changes{3.07}{2013-07-05}{added check for openright} +% \begin{macrocode} +\newcommand*{\gls@doclearpage}{% + \ifthenelse{\equal{\@@glossarysec}{chapter}}% + {% + \ifcsundef{cleardoublepage}% + {% + \clearpage + }% + {% + \ifcsdef{if@openright}% + {% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + }% + {% + \cleardoublepage + }% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsclearpage} +% This just calls \cs{gls@doclearpage}, but it makes it easier to +% have a user command so that the user can override it. +%\changes{1.19}{2009-03-02}{new} +% \begin{macrocode} +\newcommand*{\glsclearpage}{\gls@doclearpage} +% \end{macrocode} +%\end{macro} +% +% The glossary is added to the table of contents if glstoc flag set. +% If it is set, \cs{@gls@toc} will add a line to the +% \filetype{.toc} file, otherwise it will do nothing. +% (The first argument to \cs{@gls@toc} is the title for the +% table of contents, the second argument is the sectioning type.) +%\begin{macro}{\@gls@toc} +%\changes{1.1}{2008-02-22}{numberline added} +%\changes{4.12}{2014-11-22}{added \cs{protect} to \cs{numberline}} +% \begin{macrocode} +\newcommand*{\@gls@toc}[2]{% + \ifglstoc + \ifglsnumberline + \addcontentsline{toc}{#2}{\protect\numberline{}#1}% + \else + \addcontentsline{toc}{#2}{#1}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\section{Xindy} +% This section defines commands that only have an effect if +% \app{xindy} is used to sort the glossaries. +%\begin{macro}{\glsnoxindywarning} +% Issues a warning if \app{xindy} hasn't been specified. +% These warnings can be suppressed by redefining +% \cs{glsnoxindywarning} to ignore its argument +% \begin{macrocode} +\newcommand*{\glsnoxindywarning}[1]{% + \GlossariesWarning{Not in xindy mode --- ignoring \string#1}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsnomakeindexwarning} +%\changes{4.24}{2016-05-27}{new} +% Reverse for commands that may only be used with \app{makeindex}. +% \begin{macrocode} +\newcommand*{\glsnomakeindexwarning}[1]{% + \GlossariesWarning{Not in makeindex mode --- ignoring \string#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdyattributes} +% Define list of attributes (\cs{string} is used in case +% the double quote character has been made active) +% \begin{macrocode} +\ifglsxindy + \edef\@xdyattributes{\string"default\string"}% +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@xdyattributelist} +% Comma-separated list of attributes. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\ifglsxindy + \edef\@xdyattributelist{}% +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@xdylocref} +% Define list of markup location references. +% \begin{macrocode} +\ifglsxindy + \def\@xdylocref{} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@ifinlist} +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\newcommand*{\@gls@ifinlist}[4]{% + \def\@do@ifinlist##1,#1,##2\end@doifinlist{% + \def\@gls@listsuffix{##2}% + \ifx\@gls@listsuffix\@empty + #4% + \else + #3% + \fi + }% + \@do@ifinlist,#2,#1,\end@doifinlist +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsAddXdyCounters} +%\changes{3.0}{2011-04-02}{new} +% Need to know all the counters that will be used in location +% numbers for Xindy. Argument may be a single counter name or a +% comma-separated list of counter names. +% \begin{macrocode} +\ifglsxindy + \newcommand*{\@xdycounters}{\glscounter} + \newcommand*\GlsAddXdyCounters[1]{% + \@for\@gls@ctr:=#1\do{% +% \end{macrocode} +% Check if already in list before adding. +% \begin{macrocode} + \edef\@do@addcounter{% + \noexpand\@gls@ifinlist{\@gls@ctr}{\@xdycounters}{}% + {% + \noexpand\edef\noexpand\@xdycounters{\@xdycounters,% + \noexpand\@gls@ctr}% + }% + }% + \@do@addcounter + } + } +% \end{macrocode} +% Only has an effect before \ics{writeist}: +% \begin{macrocode} + \@onlypremakeg\GlsAddXdyCounters +\else + \newcommand*\GlsAddXdyCounters[1]{% + \glsnoxindywarning\GlsAddXdyAttribute + } +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@disabled@glsaddxdycounters} +% Counters must all be identified before adding attributes. +% \begin{macrocode} +\newcommand*\@disabled@glsaddxdycounters{% + \PackageError{glossaries}{\string\GlsAddXdyCounters\space + can't be used after \string\GlsAddXdyAttribute}{Move all + occurrences of \string\GlsAddXdyCounters\space before the first + instance of \string\GlsAddXdyAttribute}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsAddXdyAttribute} +% Adds an attribute. +% \begin{macrocode} +\ifglsxindy +% \end{macrocode} +% First define internal command that adds an attribute for a given +% counter (2nd argument is the counter): +% \begin{macrocode} + \newcommand*\@glsaddxdyattribute[2]{% +% \end{macrocode} +% Add to xindy attribute list +% \begin{macrocode} + \edef\@xdyattributes{\@xdyattributes ^^J \string"#1\string" ^^J + \string"#2#1\string"}% +% \end{macrocode} +% Add to xindy markup location. +% \begin{macrocode} + \expandafter\toks@\expandafter{\@xdylocref}% + \edef\@xdylocref{\the\toks@ ^^J% + (markup-locref + :open \string"\glstildechar n% + \expandafter\string\csname glsX#2X#1\endcsname + \string" ^^J + :close \string"\string" ^^J + :attr \string"#2#1\string")}% +% \end{macrocode} +% Define associated attribute command +% \cs{glsX}\meta{counter}"X"\meta{attribute}\marg{Hprefix}\marg{n} +% \begin{macrocode} + \expandafter\gdef\csname glsX#2X#1\endcsname##1##2{% + \setentrycounter[##1]{#2}\csname #1\endcsname{##2}% + }% + } +% \end{macrocode} +% High-level command: +% \begin{macrocode} + \newcommand*\GlsAddXdyAttribute[1]{% +% \end{macrocode} +% Add to comma-separated attribute list +% \begin{macrocode} + \ifx\@xdyattributelist\@empty + \edef\@xdyattributelist{#1}% + \else + \edef\@xdyattributelist{\@xdyattributelist,#1}% + \fi +% \end{macrocode} +% Iterate through all specified counters and add counter-dependent +% attributes: +% \begin{macrocode} + \@for\@this@counter:=\@xdycounters\do{% + \protected@edef\gls@do@addxdyattribute{% + \noexpand\@glsaddxdyattribute{#1}{\@this@counter}% + } + \gls@do@addxdyattribute + }% +% \end{macrocode} +% All occurrences of \cs{GlsAddXdyCounters} must be used before this +% command +% \begin{macrocode} + \let\GlsAddXdyCounters\@disabled@glsaddxdycounters + } +% \end{macrocode} +% Only has an effect before \ics{writeist}: +% \begin{macrocode} + \@onlypremakeg\GlsAddXdyAttribute +\else + \newcommand*\GlsAddXdyAttribute[1]{% + \glsnoxindywarning\GlsAddXdyAttribute} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@addpredefinedattributes} +% Add known attributes for all defined counters +% \begin{macrocode} +\ifglsxindy +\newcommand*{\@gls@addpredefinedattributes}{% + \GlsAddXdyAttribute{glsnumberformat} + \GlsAddXdyAttribute{textrm} + \GlsAddXdyAttribute{textsf} + \GlsAddXdyAttribute{texttt} + \GlsAddXdyAttribute{textbf} + \GlsAddXdyAttribute{textmd} + \GlsAddXdyAttribute{textit} + \GlsAddXdyAttribute{textup} + \GlsAddXdyAttribute{textsl} + \GlsAddXdyAttribute{textsc} + \GlsAddXdyAttribute{emph} + \GlsAddXdyAttribute{glshypernumber} + \GlsAddXdyAttribute{hyperrm} + \GlsAddXdyAttribute{hypersf} + \GlsAddXdyAttribute{hypertt} + \GlsAddXdyAttribute{hyperbf} + \GlsAddXdyAttribute{hypermd} + \GlsAddXdyAttribute{hyperit} + \GlsAddXdyAttribute{hyperup} + \GlsAddXdyAttribute{hypersl} + \GlsAddXdyAttribute{hypersc} + \GlsAddXdyAttribute{hyperemph} +% \end{macrocode} +%\changes{4.12}{2014-11-22}{Added glsignore attribute} +% \begin{macrocode} + \GlsAddXdyAttribute{glsignore} +} +\else + \let\@gls@addpredefinedattributes\relax +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdyuseralphabets} +% List of additional alphabets +% \begin{macrocode} +\def\@xdyuseralphabets{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsAddXdyAlphabet} +% \cs{GlsAddXdyAlphabet}\marg{name}\marg{definition} +% adds a new alphabet called \meta{name}. The definition +% must use \app{xindy} syntax. +% \begin{macrocode} +\ifglsxindy + \newcommand*{\GlsAddXdyAlphabet}[2]{% + \edef\@xdyuseralphabets{% + \@xdyuseralphabets ^^J + (define-alphabet "#1" (#2))}} +\else + \newcommand*{\GlsAddXdyAlphabet}[2]{% + \glsnoxindywarning\GlsAddXdyAlphabet} +\fi +% \end{macrocode} +%\end{macro} +% +% This code is only required for xindy: +% \begin{macrocode} +\ifglsxindy +% \end{macrocode} +% +%\begin{macro}{\@gls@xdy@locationlist} +%\changes{3.0}{2011-04-02}{new} +% List of predefined location names. +% \begin{macrocode} + \newcommand*{\@gls@xdy@locationlist}{% + roman-page-numbers,% + Roman-page-numbers,% + arabic-page-numbers,% + alpha-page-numbers,% + Alpha-page-numbers,% + Appendix-page-numbers,% + arabic-section-numbers% + } +% \end{macrocode} +%\end{macro} +% Each location class \meta{name} has the format stored in +% \cs{@gls@xdy@Lclass@}\meta{name}. Set up predefined +% formats. +% +%\begin{macro}{\@gls@xdy@Lclass@roman-page-numbers} +% Lower case Roman numerals (i, ii, \ldots). In the event that +% \ics{roman} has been redefined to produce a fancy form of +% roman numerals, attempt to work out how it will be written +% to the output file. +% \begin{macrocode} + \protected@edef\@gls@roman{\@roman{0\string" + \string"roman-numbers-lowercase\string" :sep \string"}}% + \@onelevel@sanitize\@gls@roman + \edef\@tmp{\string" \string"roman-numbers-lowercase\string" + :sep \string"}% + \@onelevel@sanitize\@tmp + \ifx\@tmp\@gls@roman + \expandafter + \edef\csname @gls@xdy@Lclass@roman-page-numbers\endcsname{% + \string"roman-numbers-lowercase\string"% + }% + \else + \expandafter + \edef\csname @gls@xdy@Lclass@roman-page-numbers\endcsname{ + :sep \string"\@gls@roman\string"% + }% + \fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdy@Lclass@Roman-page-numbers} +% Upper case Roman numerals (I, II, \ldots). +% \begin{macrocode} + \expandafter\def\csname @gls@xdy@Lclass@Roman-page-numbers\endcsname{% + \string"roman-numbers-uppercase\string"% + }% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdy@Lclass@arabic-page-numbers} +% Arabic numbers (1, 2, \ldots). +% \begin{macrocode} + \expandafter\def\csname @gls@xdy@Lclass@arabic-page-numbers\endcsname{% + \string"arabic-numbers\string"% + }% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdy@Lclass@alpha-page-numbers} +% Lower case alphabetical (a, b, \ldots). +% \begin{macrocode} + \expandafter\def\csname @gls@xdy@Lclass@alpha-page-numbers\endcsname{% + \string"alpha\string"% + }% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdy@Lclass@Alpha-page-numbers} +% Upper case alphabetical (A, B, \ldots). +% \begin{macrocode} + \expandafter\def\csname @gls@xdy@Lclass@Alpha-page-numbers\endcsname{% + \string"ALPHA\string"% + }% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdy@Lclass@Appendix-page-numbers} +% Appendix style locations (e.g.\ A-1, A-2, \ldots, B-1, B-2, +% \ldots). The separator is given by \ics{@glsAlphacompositor}. +% \begin{macrocode} + \expandafter\def\csname @gls@xdy@Lclass@Appendix-page-numbers\endcsname{% + \string"ALPHA\string" + :sep \string"\@glsAlphacompositor\string" + \string"arabic-numbers\string"% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdy@Lclass@arabic-section-numbers} +% Section number style locations (e.g.\ 1.1, 1.2, \ldots). The +% compositor is given by \ics{glscompositor}. +% \begin{macrocode} + \expandafter\def\csname @gls@xdy@Lclass@arabic-section-numbers\endcsname{% + \string"arabic-numbers\string" + :sep \string"\glscompositor\string" + \string"arabic-numbers\string"% + }% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdyuserlocationdefs} +% List of additional location definitions +% (separated by "^^J") +% \begin{macrocode} + \def\@xdyuserlocationdefs{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@xdyuserlocationnames} +% List of additional user location names +% \begin{macrocode} + \def\@xdyuserlocationnames{} +% \end{macrocode} +%\end{macro} +% +% End of xindy-only block: +% \begin{macrocode} +\fi +% \end{macrocode} +% +%\begin{macro}{\@xdycrossrefhook} +%\changes{4.30}{2017-06-11}{new} +%Hook used after writing cross-reference class information. +% \begin{macrocode} +\ifglsxindy + \newcommand\@xdycrossrefhook{} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsAddXdyLocation} +% \cs{GlsAddXdyLocation}\oarg{prefix-loc}\marg{name}\marg{definition} +% Define a new location called \meta{name}. The definition +% must use \app{xindy} syntax. (Note that this doesn't +% check to see if the location is already defined. That is left +% to \app{xindy} to complain about.) +% \begin{macrocode} +\ifglsxindy + \newcommand*{\GlsAddXdyLocation}[3][]{% + \def\@gls@tmp{#1}% + \ifx\@gls@tmp\@empty + \edef\@xdyuserlocationdefs{% + \@xdyuserlocationdefs ^^J% + (define-location-class \string"#2\string"^^J\space\space + \space(:sep \string"{}\glsopenbrace\string" #3 + :sep \string"\glsclosebrace\string")) + }% + \else + \edef\@xdyuserlocationdefs{% + \@xdyuserlocationdefs ^^J% + (define-location-class \string"#2\string"^^J\space\space + \space(:sep "\glsopenbrace" + #1 + :sep "\glsclosebrace\glsopenbrace" #3 + :sep "\glsclosebrace")) + }% + \fi +% \end{macrocode} +%\changes{4.30}{2017-06-11}{bug fix: changed \#1 to \#2} +% \begin{macrocode} + \edef\@xdyuserlocationnames{% + \@xdyuserlocationnames^^J\space\space\space + \string"#2\string"}% + } +% \end{macrocode} +% Only has an effect before \ics{writeist}: +% \begin{macrocode} + \@onlypremakeg\GlsAddXdyLocation +\else + \newcommand*{\GlsAddXdyLocation}[2]{% + \glsnoxindywarning\GlsAddXdyLocation} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdylocationclassorder} +% Define location class order +%\changes{4.30}{2017-06-11}{bug fix: changed \cs{edef} to \cs{def}} +% \begin{macrocode} +\ifglsxindy + \def\@xdylocationclassorder{^^J\space\space\space + \string"roman-page-numbers\string"^^J\space\space\space + \string"arabic-page-numbers\string"^^J\space\space\space + \string"arabic-section-numbers\string"^^J\space\space\space + \string"alpha-page-numbers\string"^^J\space\space\space + \string"Roman-page-numbers\string"^^J\space\space\space + \string"Alpha-page-numbers\string"^^J\space\space\space + \string"Appendix-page-numbers\string" + \@xdyuserlocationnames^^J\space\space\space + \string"see\string" + } +\fi +% \end{macrocode} +%\end{macro} +% Change the location order. +%\begin{macro}{\GlsSetXdyLocationClassOrder} +% \begin{macrocode} +\ifglsxindy + \newcommand*\GlsSetXdyLocationClassOrder[1]{% + \def\@xdylocationclassorder{#1}} +\else + \newcommand*\GlsSetXdyLocationClassOrder[1]{% + \glsnoxindywarning\GlsSetXdyLocationClassOrder} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdysortrules} +% Define sort rules +% \begin{macrocode} +\ifglsxindy + \def\@xdysortrules{} +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsAddSortRule} +% Add a sort rule +% \begin{macrocode} +\ifglsxindy + \newcommand*\GlsAddSortRule[2]{% + \expandafter\toks@\expandafter{\@xdysortrules}% + \protected@edef\@xdysortrules{\the\toks@ ^^J + (sort-rule \string"#1\string" \string"#2\string")}% + } +\else + \newcommand*\GlsAddSortRule[2]{% + \glsnoxindywarning\GlsAddSortRule} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdyrequiredstyles} +% Define list of required styles (this should be a comma-separated +% list of \app{xindy} styles) +% \begin{macrocode} +\ifglsxindy + \def\@xdyrequiredstyles{tex} +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsAddXdyStyle} +% Add a \app{xindy} style to the list of required styles +% \begin{macrocode} +\ifglsxindy + \newcommand*\GlsAddXdyStyle[1]{% + \edef\@xdyrequiredstyles{\@xdyrequiredstyles,#1}}% +\else + \newcommand*\GlsAddXdyStyle[1]{% + \glsnoxindywarning\GlsAddXdyStyle} +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsSetXdyStyles} +% Reset the list of required styles +% \begin{macrocode} +\ifglsxindy + \newcommand*\GlsSetXdyStyles[1]{% + \edef\@xdyrequiredstyles{#1}} +\else + \newcommand*\GlsSetXdyStyles[1]{% + \glsnoxindywarning\GlsSetXdyStyles} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\findrootlanguage} +%\changes{3.06}{2013/06/17}{Obsoleted} +% This used to determine the root language, using a~bit of trickery +% since \sty{babel} doesn't supply the information, but now that +% \sty{babel} is once again actively maintained, we can't do this +% any more, so \cs{findrootlanguage} is no longer available. Now +% provide a command that does nothing (in case it's been patched), +% but this may be removed completely in the future. +% \begin{macrocode} +\newcommand*{\findrootlanguage}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdylanguage} +% The \app{xindy} language setting is required by +% \app{makeglossaries}, so provide a command for +% \app{makeglossaries} to pick up the information +% from the auxiliary file. This command is not needed by the +% \sty{glossaries} package, so define it to ignore its arguments. +% \begin{macrocode} +\def\@xdylanguage#1#2{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsSetXdyLanguage} +% Define a command that allows the user to set the language +% for a given glossary type. The first argument indicates the +% glossary type. If omitted the main glossary is assumed. +% \begin{macrocode} +\ifglsxindy + \newcommand*\GlsSetXdyLanguage[2][\glsdefaulttype]{% + \ifglossaryexists{#1}{% + \expandafter\def\csname @xdy@#1@language\endcsname{#2}% + }{% + \PackageError{glossaries}{Can't set language type for + glossary type `#1' --- no such glossary}{% + You have specified a glossary type that doesn't exist}}} +\else + \newcommand*\GlsSetXdyLanguage[2][]{% + \glsnoxindywarning\GlsSetXdyLanguage} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@codepage} +% The \app{xindy} codepage setting is required by +% \app{makeglossaries}, so provide a command for +% \app{makeglossaries} to pick up the information +% from the auxiliary file. This command is not needed by the +% \sty{glossaries} package, so define it to ignore its arguments. +% \begin{macrocode} +\def\@gls@codepage#1#2{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsSetXdyCodePage} +% Define command to set the code page. +% \begin{macrocode} +\ifglsxindy + \newcommand*{\GlsSetXdyCodePage}[1]{% + \renewcommand*{\gls@codepage}{#1}% + } +% \end{macrocode} +%\changes{3.07}{2013-07-05}{Added check for fontspec} +% Suggested by egreg: +% \begin{macrocode} + \AtBeginDocument{% + \ifx\gls@codepage\@empty + \@ifpackageloaded{fontspec}{\def\gls@codepage{utf8}}{}% + \fi + } +\else + \newcommand*{\GlsSetXdyCodePage}[1]{% + \glsnoxindywarning\GlsSetXdyCodePage} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdylettergroups} +% Store letter group definitions. +% \begin{macrocode} +\ifglsxindy + \ifgls@xindy@glsnumbers + \def\@xdylettergroups{(define-letter-group + \string"glsnumbers\string"^^J\space\space\space + :prefixes (\string"0\string" \string"1\string" + \string"2\string" \string"3\string" \string"4\string" + \string"5\string" \string"6\string" \string"7\string" + \string"8\string" \string"9\string")^^J\space\space\space + \@xdynumbergrouporder)} + \else + \def\@xdylettergroups{} + \fi +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsAddLetterGroup} +% Add a new letter group. The first argument is the name +% of the letter group. The second argument is the \app{xindy} +% code specifying prefixes and ordering. +% \begin{macrocode} + \newcommand*\GlsAddLetterGroup[2]{% + \expandafter\toks@\expandafter{\@xdylettergroups}% + \protected@edef\@xdylettergroups{\the\toks@^^J% + (define-letter-group \string"#1\string"^^J\space\space\space#2)}% + }% +% \end{macrocode} +%\end{macro} +% +%\section{Loops and conditionals} +%\begin{macro}{\forallglossaries} +% To iterate through all glossaries (or comma-separated list of +% glossary names given in optional argument) use: +%\begin{definition} +% \cs{forallglossaries}\oarg{glossary list}\marg{cmd}\marg{code} +%\end{definition} +% where \meta{cmd} is +% a control sequence which will be set to the name of the +% glossary in the current iteration. +%\changes{2.01}{2009 May 30}{replaced \cs{ifthenelse} with \cs{ifx}} +% \begin{macrocode} +\newcommand*{\forallglossaries}[3][\@glo@types]{% + \@for#2:=#1\do{\ifx#2\@empty\else#3\fi}% +} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\forallacronyms} +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\forallacronyms}[2]{% + \@for#1:=\@glsacronymlists\do{\ifx#1\@empty\else#2\fi}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\forglsentries} +% To iterate through all entries in a given glossary use: +%\begin{definition} +%\cs{forglsentries}\oarg{type}\marg{cmd}\marg{code} +%\end{definition} +%where \meta{type} is the glossary label and \meta{cmd} is a +% control sequence which will be set to the entry label in the +% current iteration. +%\changes{2.01}{2009 May 30}{replaced \cs{ifthenelse} with \cs{ifx}} +%\changes{3.11a}{2013-10-15}{replaced \cs{ifx} with \cs{ifdefempty}} +% \begin{macrocode} +\newcommand*{\forglsentries}[3][\glsdefaulttype]{% + \edef\@@glo@list{\csname glolist@#1\endcsname}% + \@for#2:=\@@glo@list\do + {% + \ifdefempty{#2}{}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\forallglsentries} +% To iterate through all glossary entries over all glossaries listed +% in the optional argument (the default is all glossaries) use: +%\begin{definition} +% \cs{forallglsentries}\oarg{glossary list}\marg{cmd}\marg{code} +%\end{definition} +% Within \cs{forallglsentries}, the current glossary type +% is given by \cs{@@this@glo@}. +% \begin{macrocode} +\newcommand*{\forallglsentries}[3][\@glo@types]{% + \expandafter\forallglossaries\expandafter[#1]{\@@this@glo@}% + {% + \forglsentries[\@@this@glo@]{#2}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglossaryexists} +% To check to see if a glossary exists use: +%\begin{definition} +%\cs{ifglossaryexists}\marg{type}\marg{true-text}\marg{false-text} +%\end{definition} +%where \meta{type} is the glossary's label. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\newcommand{\ifglossaryexists}[3]{% + \ifcsundef{@glotype@#1@out}{#3}{#2}% +} +% \end{macrocode} +%\end{macro} +% +% Since the label is used to form the name of control sequences, by +% default UTF8 etc characters can't be used in the label. A possible +% workaround is to use \ics{scantokens}, but commands such as +% \ics{glsentrytext} will no longer be usable in sectioning, caption +% etc commands. If the user really wants to be able to construct a +% label with UTF8 characters, allow them the means to do so (but on +% their own head be it, if they then use entries in \ics{section} +% etc). This can be done via: +%\begin{verbatim} +%\renewcommand*{\glsdetoklabel}[1]{\scantokens{#1\noexpand}} +%\end{verbatim} +% (Note, don't use \ics{detokenize} or it will cause commands like +% \ics{glsaddall} to fail.) +% Since redefining \cs{glsdetoklabel} can cause things to go +% badly wrong, I'm not going to mention it in the main user guide. +% Only advanced users who know what they're doing ought to attempt +% it. +%\begin{macro}{\glsdetoklabel} +%\changes{4.03}{2014-01-20}{new} +% \begin{macrocode} +\newcommand*{\glsdetoklabel}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsentryexists} +% To check to see if a glossary entry has been defined use: +%\begin{definition} +% \cs{ifglsentryexists}\marg{label}\marg{true text}\marg{false text} +%\end{definition} +%where \meta{label} is the entry's label. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand{\ifglsentryexists}[3]{% + \ifcsundef{glo@\glsdetoklabel{#1}@name}{#3}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsused} +% To determine if given glossary entry has been +% used in the document text yet use: +%\begin{definition} +% \cs{ifglsused}\marg{label}\marg{true text}\marg{false text} +%\end{definition} +% where \meta{label} is the entry's label. +% If true it will do \meta{true text} +% otherwise it will do \meta{false text}. +%\changes{3.11a}{2013-10-15}{replaced \cs{ifthenelse} with +%\cs{ifbool}} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\ifglsused}[3]{% + \ifbool{glo@\glsdetoklabel{#1}@flag}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +%The following two commands will cause an error if the given +% condition fails: +% +%\begin{macro}{\glsdoifexists} +%\begin{definition} +%\cs{glsdoifexists}\marg{label}\marg{code} +%\end{definition} +% Generate an error if entry specified by \meta{label} doesn't +% exists, otherwise do \meta{code}. +% \begin{macrocode} +\newcommand{\glsdoifexists}[2]{% + \ifglsentryexists{#1}{#2}{% + \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}' + has not been defined}{You need to define a glossary entry before you + can use it.}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoifnoexists} +%\cs{glsdoifnoexists}\marg{label}\marg{code}\par +% The opposite: only do second argument if the entry doesn't +% exists. Generate an error message if it exists. +% \begin{macrocode} +\newcommand{\glsdoifnoexists}[2]{% + \ifglsentryexists{#1}{% + \PackageError{glossaries}{Glossary entry `\glsdetoklabel{#1}' has already + been defined}{}}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoifexistsorwarn} +%\begin{definition} +%\cs{glsdoifexistsorwarn}\marg{label}\marg{code} +%\end{definition} +% Generate a warning if entry specified by \meta{label} doesn't +% exists, otherwise do \meta{code}. +%\changes{4.03}{2014-01-20}{new} +% \begin{macrocode} +\newcommand{\glsdoifexistsorwarn}[2]{% + \ifglsentryexists{#1}{#2}{% + \GlossariesWarning{Glossary entry `\glsdetoklabel{#1}' + has not been defined}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoifexistsordo} +%\begin{definition} +%\cs{glsdoifexistsordo}\marg{label}\marg{code}\marg{undef code} +%\end{definition} +% Generate an error and do \meta{undef code} if entry specified by \meta{label} doesn't +% exists, otherwise do \meta{code}. +%\changes{4.19}{2015-11-22}{new} +% \begin{macrocode} +\newcommand{\glsdoifexistsordo}[3]{% + \ifglsentryexists{#1}{#2}{% + \PackageError{glossaries}{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} +%\begin{definition} +%\cs{doifglossarynoexistsordo}\marg{label}\marg{code}\marg{else code} +%\end{definition} +%\changes{4.19}{2015-11-22}{new} +%If glossary given by \meta{label} doesn't exist do \meta{code} +%otherwise generate an error and do \meta{else code}. +% \begin{macrocode} +\newcommand{\doifglossarynoexistsordo}[3]{% + \ifglossaryexists{#1}% + {% + \PackageError{glossaries}{Glossary type `#1' already exists}{}% + #3% + }% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglshaschildren} +% \cs{ifglshaschildren}\marg{label}\marg{true part}\marg{false part} +%\changes{3.02}{2012-05-21}{new} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand{\ifglshaschildren}[3]{% + \glsdoifexists{#1}% + {% + \def\do@glshaschildren{#3}% + \edef\@gls@thislabel{\glsdetoklabel{#1}}% + \expandafter\forglsentries\expandafter + [\csname glo@\@gls@thislabel @type\endcsname] + {\glo@label}% + {% + \letcs\glo@parent{glo@\glo@label @parent}% + \ifdefequal\@gls@thislabel\glo@parent + {% + \def\do@glshaschildren{#2}% + \@endfortrue + }% + {}% + }% + \do@glshaschildren + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglshasparent} +%\begin{definition} +% \cs{ifglshasparent}\marg{label}\marg{true part}\marg{false part} +%\end{definition} +%\changes{3.02}{2012-05-21}{new} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand{\ifglshasparent}[3]{% + \glsdoifexists{#1}% + {% + \ifcsempty{glo@\glsdetoklabel{#1}@parent}{#3}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglshasdesc} +%\cs{ifglshasdesc}\marg{label}\marg{true part}\marg{false part} +%\changes{3.08a}{2013-09-28}{new} +%\changes{3.11a}{2013-10-15}{replaced \cs{ifdefempty} with +%\cs{ifcsempty}} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\ifglshasdesc}[3]{% + \ifcsempty{glo@\glsdetoklabel{#1}@desc}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsdescsuppressed} +%\cs{ifglsdescsuppressed}\marg{label}\marg{true part}\marg{false part} +%\changes{3.08a}{2013-09-28}{new} +% Does \meta{true part} if the description is just \cs{nopostdesc} +% otherwise does \meta{false part}. +%\changes{4.03}{2014-01-20}{fixed typo} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\ifglsdescsuppressed}[3]{% + \ifcsequal{glo@\glsdetoklabel{#1}@desc}{@no@post@desc}% + {#2}% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglshassymbol} +%\cs{ifglshassymbol}\marg{label}\marg{true part}\marg{false part} +%\changes{3.08a}{2013-09-28}{new} +%\changes{3.09a}{2013-10-09}{changed test to check for +%\cs{@gls@default@symbol}} +%\changes{3.11a}{2013-10-15}{replaced \cs{ifdefempty} with +%\cs{ifcsempty}} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.03}{2014-01-20}{replaced \cs{ifcsempty} with +%\cs{ifdefempty} and replaced \cs{ifx} with \cs{ifdefequal}} +% \begin{macrocode} +\newcommand*{\ifglshassymbol}[3]{% + \letcs{\@glo@symbol}{glo@\glsdetoklabel{#1}@symbol}% + \ifdefempty\@glo@symbol + {#3}% + {% + \ifdefequal\@glo@symbol\@gls@default@value + {#3}% + {#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglshaslong} +%\cs{ifglshaslong}\marg{label}\marg{true part}\marg{false part} +%\changes{3.11a}{2013-10-15}{new} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\ifglshaslong}[3]{% + \letcs{\@glo@long}{glo@\glsdetoklabel{#1}@long}% + \ifdefempty\@glo@long + {#3}% + {% + \ifdefequal\@glo@long\@gls@default@value + {#3}% + {#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglshasshort} +%\cs{ifglshasshort}\marg{label}\marg{true part}\marg{false part} +%\changes{3.11a}{2013-10-15}{new} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\ifglshasshort}[3]{% + \letcs{\@glo@short}{glo@\glsdetoklabel{#1}@short}% + \ifdefempty\@glo@short + {#3}% + {% + \ifdefequal\@glo@short\@gls@default@value + {#3}% + {#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglshasfield} +%\changes{4.03}{2014-01-20}{new} +%\begin{definition} +%\cs{ifglshasfield}\marg{field}\marg{label}\marg{true part}\marg{false +%part} +%\end{definition} +% \begin{macrocode} +\newcommand*{\ifglshasfield}[4]{% + \glsdoifexists{#2}% + {% + \letcs{\@glo@thisvalue}{glo@\glsdetoklabel{#2}@#1}% +% \end{macrocode} +% First check supplied field label is defined. +% \begin{macrocode} + \ifdef\@glo@thisvalue + {% +% \end{macrocode} +% Is defined, so now check if empty. +% \begin{macrocode} + \ifdefempty\@glo@thisvalue + {% +% \end{macrocode} +% Is empty, so doesn't have field set. +% \begin{macrocode} + #4% + }% + {% +% \end{macrocode} +% Not empty, so check if set to \cs{@gls@default@value} +% \begin{macrocode} + \ifdefequal\@glo@thisvalue\@gls@default@value + {% +% \end{macrocode} +% Value is set to the default value. +% \begin{macrocode} + #4% + }% + {% +% \end{macrocode} +% Non-empty, non-default value. Allow user to access this value +% through \cs{glscurrentfieldvalue}. +%\changes{4.23}{2016-04-30}{added \cs{glscurrentfieldvalue}} +% \begin{macrocode} + \let\glscurrentfieldvalue\@glo@thisvalue + #3% + }% + }% + }% + {% +% \end{macrocode} +% Field given isn't defined, so check if mapping exists. +% \begin{macrocode} + \@gls@fetchfield{\@gls@thisfield}{#1}% +% \end{macrocode} +% If \cs{@gls@thisfield} is defined, we've found a map. If not, the +% field supplied doesn't exist. +% \begin{macrocode} + \ifdef\@gls@thisfield + {% +% \end{macrocode} +% Is defined, so now check if empty. +% \begin{macrocode} + \letcs{\@glo@thisvalue}{glo@\glsdetoklabel{#2}@\@gls@thisfield}% + \ifdefempty\@glo@thisvalue + {% +% \end{macrocode} +% Is empty so field hasn't been set. +% \begin{macrocode} + #4% + }% + {% +% \end{macrocode} +% Isn't empty so check if it's been set to \cs{@gls@default@value}. +% \begin{macrocode} + \ifdefequal\@glo@thisvalue\@gls@default@value + {% +% \end{macrocode} +% Value is set to the default value. +% \begin{macrocode} + #4% + }% + {% +% \end{macrocode} +% Non-empty, non-default value. Allow user to access this value +% through \cs{glscurrentfieldvalue}. +%\changes{4.23}{2016-04-30}{added \cs{glscurrentfieldvalue}} +% \begin{macrocode} + \let\glscurrentfieldvalue\@glo@thisvalue + #3% + }% + }% + }% + {% +% \end{macrocode} +% Not defined. +% \begin{macrocode} + \GlossariesWarning{Unknown entry field `#1'}% + #4% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glscurrentfieldvalue} +%\changes{4.23}{2016-04-30}{new} +% \begin{macrocode} +\newcommand*{\glscurrentfieldvalue}{} +% \end{macrocode} +%\end{macro} +% +%\section{Defining new glossaries}\label{sec:newglos} +% A comma-separated list of glossary names is stored +% in \cs{@glo@types}. When a new glossary type +% is created, its identifying name is added to this list. +% This is used by commands that iterate through all glossaries +% (such as \ics{makeglossaries} and \ics{printglossaries}). +%\begin{macro}{\@glo@types} +% \begin{macrocode} +\newcommand*{\@glo@types}{,} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@provide@newglossary} +%\changes{3.10a}{2013-10-13}{new} +% If the user removes the glossary package from their document, +% ensure the next run doesn't throw a load of undefined control +% sequence errors when the aux file is parsed. +% \begin{macrocode} +\newcommand*\@gls@provide@newglossary{% + \protected@write\@auxout{}{\string\providecommand\string\@newglossary[4]{}}% +% \end{macrocode} +% Only need to do this once. +% \begin{macrocode} + \let\@gls@provide@newglossary\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\defglsentryfmt} +%\changes{3.11a}{2013-10-15}{new} +% Allow different glossaries to have different display styles. +% \begin{macrocode} +\newcommand*{\defglsentryfmt}[2][\glsdefaulttype]{% + \csgdef{gls@#1@entryfmt}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@doentryfmt} +%\changes{3.11a}{2013-10-15}{new} +% \begin{macrocode} +\newcommand*{\gls@doentryfmt}[1]{\csuse{gls@#1@entryfmt}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@forbidtexext} +%\changes{4.08}{2014-07-30}{new} +% As a security precaution, don't allow the user to specify a `tex' +% extension for any of the glossary files. (Just in case a seriously +% confused novice user doesn't know what they're doing.) The +% argument must be a control sequence whose replacement text is the +% requested extension. +% \begin{macrocode} +\newcommand*{\@gls@forbidtexext}[1]{% + \ifboolexpr{test {\ifdefstring{#1}{tex}} + or test {\ifdefstring{#1}{TEX}}} + {% + \def#1{nottex}% + \PackageError{glossaries}% + {Forbidden `.tex' extension replaced with `.nottex'}% + {I'm sorry, I can't allow you to do something so reckless.\MessageBreak + Don't use `.tex' as an extension for a temporary file.}% + }% + {% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@gobbleopt} +% Discard optional argument. +%\changes{4.19}{2015-11-22}{new} +% \begin{macrocode} +\newcommand*{\gls@gobbleopt}{\new@ifnextchar[{\@gls@gobbleopt}{}} +\def\@gls@gobbleopt[#1]{} +% \end{macrocode} +%\end{macro} +% +% A new glossary type is defined using \cs{newglossary}. +% Syntax: +%\begin{definition} +%\cs{newglossary}\oarg{log-ext}\marg{name}\marg{in-ext}\marg{out-ext}% +%\marg{title}\oarg{counter} +%\end{definition} +% where \meta{log-ext} is the extension of the \app{makeindex} +% transcript file, \meta{in-ext} is the extension of the glossary +% input file (read in by \ics{printglossary} and created by +% \app{makeindex}), \meta{out-ext} is the extension of the +% glossary output file which is read in by \app{makeindex} +% (lines are written to this file by the \ics{glossary} command), +% \meta{title} is the title of the glossary that is used in +% \ics{glossarysection} and +% \meta{counter} is the default counter to be used by entries +% belonging to this glossary. The \app{makeglossaries} Perl +% script reads in the relevant extensions from the auxiliary file, +% and passes the appropriate file names and switches to +% \app{makeindex}. +%\begin{macro}{\newglossary} +%\changes{4.08}{2014-07-30}{added starred version} +% \begin{macrocode} +\newcommand*{\newglossary}{\@ifstar\s@newglossary\ns@newglossary} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\s@newglossary} +% The starred version will construct the extension based on the +% label. +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\s@newglossary}[2]{% + \ns@newglossary[#1-glg]{#1}{#1-gls}{#1-glo}{#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ns@newglossary} +%\changes{4.08}{2014-07-30}{new} +% Define the unstarred version. +% \begin{macrocode} +\newcommand*{\ns@newglossary}[5][glg]{% + \doifglossarynoexistsordo{#2}% + {% +% \end{macrocode} +% Check if default has been set +% \begin{macrocode} + \ifundef\glsdefaulttype + {% + \gdef\glsdefaulttype{#2}% + }{}% +% \end{macrocode} +% Add this to the list of glossary types: +% \begin{macrocode} + \toks@{#2}\edef\@glo@types{\@glo@types\the\toks@,}% +% \end{macrocode} +% Define a comma-separated list of labels for this glossary type, +% so that all the entries for this glossary can be reset with a +% single command. When a new entry is created, its label is added +% to this list. +% \begin{macrocode} + \expandafter\gdef\csname glolist@#2\endcsname{,}% +% \end{macrocode} +% Store the file extensions: +%\changes{4.08}{2014-07-30}{added \cs{@glotype@\meta{name}@log}} +% \begin{macrocode} + \expandafter\edef\csname @glotype@#2@log\endcsname{#1}% + \expandafter\edef\csname @glotype@#2@in\endcsname{#3}% + \expandafter\edef\csname @glotype@#2@out\endcsname{#4}% + \expandafter\@gls@forbidtexext\csname @glotype@#2@log\endcsname + \expandafter\@gls@forbidtexext\csname @glotype@#2@in\endcsname + \expandafter\@gls@forbidtexext\csname @glotype@#2@out\endcsname +% \end{macrocode} +% Store the title: +% \begin{macrocode} + \expandafter\def\csname @glotype@#2@title\endcsname{#5}% +% \end{macrocode} +%\changes{3.10a}{2013-10-13}{added \cs{@gls@provide@newglossary}} +% \begin{macrocode} + \@gls@provide@newglossary + \protected@write\@auxout{}{\string\@newglossary{#2}{#1}{#3}{#4}}% +% \end{macrocode} +% How to display this entry in the document text (uses +% \cs{glsentry} by +% default). This can be redefined by the user later if required +% (see \ics{defglsentry}). This +% may already have been defined if this has been specified as +% a list of acronyms. +%\changes{2.04}{2009-11-10}{added check to determine if +% \cs{gls@\meta{type}@display} and \cs{gls@\meta{type}@displayfirst} +% have been defined.} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +%\changes{3.11a}{2013-10-15}{replaced \cs{glsdisplay} and +%\cs{glsdisplayfirst} with \cs{glsentryfmt}} +% \begin{macrocode} + \ifcsundef{gls@#2@entryfmt}% + {% + \defglsentryfmt[#2]{\glsentryfmt}% + }% + {}% +% \end{macrocode} +% Define sort counter if required: +%\changes{3.0}{2011-04-02}{added \cs{@gls@defsortcount}} +% \begin{macrocode} + \@gls@defsortcount{#2}% +% \end{macrocode} +% Find out if the final optional argument has been specified, and +% use it to set the counter associated with this glossary. (Uses +% \ics{glscounter} if no optional argument is present.) +% \begin{macrocode} + \@ifnextchar[{\@gls@setcounter{#2}}% + {\@gls@setcounter{#2}[\glscounter]}% + }% + {% + \gls@gobbleopt + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\altnewglossary} +%\changes{2.06}{2010-06-14}{new} +% \begin{macrocode} +\newcommand*{\altnewglossary}[3]{% + \newglossary[#2-glg]{#1}{#2-gls}{#2-glo}{#3}% +} +% \end{macrocode} +%\end{macro} +% Only define new glossaries in the preamble: +% \begin{macrocode} +\@onlypreamble{\newglossary} +% \end{macrocode} +% Only define new glossaries before \ics{makeglossaries} +% \begin{macrocode} +\@onlypremakeg\newglossary +% \end{macrocode} +%\cs{@newglossary} is used to specify the file extensions +% for the \app{makeindex} input, output and transcript files. +% It is written to the auxiliary file by \ics{newglossary}. +% Since it is not used by \LaTeX, \cs{@newglossary} simply +% ignores its arguments. +%\begin{macro}{\@newglossary} +% \begin{macrocode} +\newcommand*{\@newglossary}[4]{} +% \end{macrocode} +%\end{macro} +% Store counter to be used for given glossary type (the first +% argument is the glossary label, the second argument is the name +% of the counter): +%\begin{macro}{\@gls@setcounter} +% \begin{macrocode} +\def\@gls@setcounter#1[#2]{% + \expandafter\def\csname @glotype@#1@counter\endcsname{#2}% +% \end{macrocode} +% Add counter to xindy list, if not already added: +% \begin{macrocode} + \ifglsxindy + \GlsAddXdyCounters{#2}% + \fi +} +% \end{macrocode} +%\end{macro} +% Get counter associated with given glossary (the argument is +% the glossary label): +%\begin{macro}{\@gls@getcounter} +% \begin{macrocode} +\newcommand*{\@gls@getcounter}[1]{% + \csname @glotype@#1@counter\endcsname +} +% \end{macrocode} +%\end{macro} +% +% Define the main glossary. This will be the first glossary to +% be displayed when using \ics{printglossaries}. +% \begin{macrocode} +\glsdefmain +% \end{macrocode} +% Define the \qt{acronym} glossaries if required. +% \begin{macrocode} +\@gls@do@acronymsdef +% \end{macrocode} +% Define the \qt{symbols}, \qt{numbers} and \qt{index} glossaries if required. +% \begin{macrocode} +\@gls@do@symbolsdef +\@gls@do@numbersdef +\@gls@do@indexdef +% \end{macrocode} +% +%\begin{macro}{\newignoredglossary} +% Creates a new glossary that doesn't have associated files. +% This glossary is ignored by and commands that iterate over +% glossaries, such as \ics{printglossaries}, and won't work with +% commands like \ics{printglossary}. It's intended for entries that +% are so commonly-known they don't require a glossary. +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\newignoredglossary}[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}{\@ignored@glossaries} +% List of ignored glossaries. +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\@ignored@glossaries}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifignoredglossary} +% Tests if the given glossary is an ignored glossary. +% Expansion is used in case the first argument is a control +% sequence. +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\ifignoredglossary}[3]{% + \edef\@gls@igtype{#1}% + \expandafter\DTLifinlist\expandafter + {\@gls@igtype}{\@ignored@glossaries}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\section{Defining new entries}\label{sec:newentry} +% New glossary entries are defined using \cs{newglossaryentry}. +% This command requires a label and a key-value list that defines +% the relevant information for that entry. The definition for these +% keys follows. Note that the \gloskey{name}, +% \gloskey{description} and \gloskey{symbol} keys will be +% sanitized later, depending on the value of the package option +% \pkgopt{sanitize} (this means that if some of the keys haven't +% been defined, they can be constructed from the \gloskey{name} +% and \gloskey{description} key before they are sanitized). +% +% +%\begin{key}{name} +%The \gloskey{name} key indicates the name +% of the term being defined. This is how the term will appear in +% the glossary. The \gloskey{name} key is required when defining +% a new glossary entry. +% \begin{macrocode} +\define@key{glossentry}{name}{% +\def\@glo@name{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{description} +% The \gloskey{description} key is usually only used in +% the glossary, but can be made to appear in the text by redefining +% \ics{glsentryfmt} or using \ics{defglsentryfmt}. The +% \gloskey{description} key is required when +% defining a new glossary entry. If a long description is required, +% use \ics{longnewglossaryentry} instead of \ics{newglossaryentry}. +% \begin{macrocode} +\define@key{glossentry}{description}{% +\def\@glo@desc{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{descriptionplural} +% \changes{1.12}{2008-03-08}{new} +% \begin{macrocode} +\define@key{glossentry}{descriptionplural}{% +\def\@glo@descplural{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{sort} +% The \gloskey{sort} key needs to be sanitized here +% (the sort key is provided for \app{makeindex}'s benefit, +% not for use in the document). The \gloskey{sort} key is optional +% when defining a new glossary entry. If omitted, the value +% is given by \meta{name} \meta{description}. +%\changes{1.18}{2009-01-14}{moved sanitization to +%\cs{newglossaryentry}} +% \begin{macrocode} +\define@key{glossentry}{sort}{% +\def\@glo@sort{#1}} +% \end{macrocode} +%\end{key} +% +%\begin{key}{text} +% The \gloskey{text} key determines how the term should appear when +% used in the document (i.e.\ outside of the glossary). If omitted, +% the value of the \gloskey{name} key is used instead. +% \begin{macrocode} +\define@key{glossentry}{text}{% +\def\@glo@text{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{plural} +% The \gloskey{plural} key determines how the plural form of the term +% should be displayed in the document. If omitted, the plural is +% constructed by appending \ics{glspluralsuffix} to the value of the +% \gloskey{text} key. +% \begin{macrocode} +\define@key{glossentry}{plural}{% +\def\@glo@plural{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{first} +% The \gloskey{first} key determines how the entry should be displayed +% in the document when it is first used. If omitted, it is taken +% to be the same as the value of the \gloskey{text} key. +% \begin{macrocode} +\define@key{glossentry}{first}{% +\def\@glo@first{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{firstplural} +% The \gloskey{firstplural} key is used to set the plural form for +% first use, in the event that the plural is required the first +% time the term is used. If omitted, it is constructed by +% appending \ics{glspluralsuffix} to the value of the \gloskey{first} key. +% \begin{macrocode} +\define@key{glossentry}{firstplural}{% +\def\@glo@firstplural{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{macro}{\@gls@default@value} +%\changes{3.09a}{2013-10-09}{new} +% \begin{macrocode} +\newcommand*{\@gls@default@value}{\relax} +% \end{macrocode} +%\end{macro} +% +%\begin{key}{symbol} +% The \gloskey{symbol} key is ignored by most of the predefined +% glossary styles, and defaults to \cs{relax} if omitted. +% It is provided for glossary styles that require an associated +% symbol, as well as a name and description. To make this value +% appear in the glossary, you need to redefine +% \ics{glossentry}. +% If you want this value to appear in the text when the term is used +% by commands like \ics{gls}, you will need to change +% \ics{glsentryfmt} (or use for \ics{defglsentryfmt} individual glossaries). +% \begin{macrocode} +\define@key{glossentry}{symbol}{% +\def\@glo@symbol{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{symbolplural} +% \changes{1.12}{2008-03-08}{new} +% \begin{macrocode} +\define@key{glossentry}{symbolplural}{% +\def\@glo@symbolplural{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{type} +% The \gloskey{type} key specifies to which glossary this +% entry belongs. If omitted, the default glossary is used. +% \begin{macrocode} +\define@key{glossentry}{type}{% +\def\@glo@type{#1}} +% \end{macrocode} +%\end{key} +% +%\begin{key}{counter} +% The \gloskey{counter} key specifies the name of the counter +% associated with this glossary entry: +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\define@key{glossentry}{counter}{% + \ifcsundef{c@#1}% + {% + \PackageError{glossaries}% + {There is no counter called `#1'}% + {% + The counter key should have the name of a valid counter + as its value% + }% + }% + {% + \def\@glo@counter{#1}% + }% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{see} +% The \gloskey{see} key specifies a list of cross-references +% \changes{1.17}{2008-12-26}{new} +% \changes{3.0}{2011-04-02}{added \cs{@glo@seeautonumberlist}} +%\changes{3.13a}{2013-11-05}{added \cs{gls@checkseeallowed}} +% \begin{macrocode} +\define@key{glossentry}{see}{% + \gls@set@xr@key{see}{\@glo@see}{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{macro}{\gls@set@xr@key} +%\changes{4.30}{2017-06-11}{new} +%\begin{definition} +%\cs{gls@set@xr@key}\marg{key name}\marg{cs}\marg{value} +%\end{definition} +%Assign a cross-reference key. +% \begin{macrocode} +\newcommand*{\gls@set@xr@key}[3]{% + \renewcommand*{\gls@xr@key}{#1}% + \gls@checkseeallowed + \def#2{#3}% + \@glo@seeautonumberlist +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@xr@key} +%\changes{4.30}{2017-06-11}{new} +% \begin{macrocode} +\newcommand*{\gls@xr@key}{see} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@checkseeallowed} +%\changes{3.13a}{2013-11-05}{new} +% \begin{macrocode} +\newcommand*{\gls@checkseeallowed}{% + \@gls@see@noindex +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@checkseeallowed@preambleonly} +%\changes{4.20}{2015-11-30}{new} +% \begin{macrocode} +\newcommand*{\gls@checkseeallowed@preambleonly}{% + \GlossariesWarning{glossaries}% + {`\gls@xr@key' key doesn't have any effect when used in the document + environment. Move the definition to the preamble + after \string\makeglossaries\space + or \string\makenoidxglossaries}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{key}{parent} +% The \gloskey{parent} key specifies the parent entry, if +% required. +% \changes{1.17}{2008-12-26}{new} +% \begin{macrocode} +\define@key{glossentry}{parent}{% +\def\@glo@parent{#1}} +% \end{macrocode} +%\end{key} +% +%\begin{key}{nonumberlist} +% The \gloskey{nonumberlist} key suppresses or activates the number list +% for the given entry. +%\changes{1.17}{2008-12-26}{new} +%\changes{3.0}{2011-04-02}{now boolean} +%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to +%\cs{gls@nonumberlist@val} and \cs{gls@nonumberlist@nr}} +% \begin{macrocode} +\define@choicekey{glossentry}{nonumberlist}% + [\gls@nonumberlist@val\gls@nonumberlist@nr]{true,false}[true]% +{% + \ifcase\gls@nonumberlist@nr\relax + \def\@glo@prefix{\glsnonextpages}% + \@gls@savenonumberlist{true}% + \else + \def\@glo@prefix{\glsnextpages}% + \@gls@savenonumberlist{false}% + \fi +} +% \end{macrocode} +%\end{key} +% +%\begin{macro}{\@gls@savenonumberlist} +%\changes{4.25}{2016-06-09}{new} +%The \gloskey{nonumberlist} option isn't saved by default (as it +%just sets the prefix) which isn't a problem when the entries are +%defined in the preamble, but causes a problem when entries are +%defined in the document. In this case, the value needs to be saved +%so that it can be written to the \texttt{.glsdefs} file. +% \begin{macrocode} +\newcommand*{\@gls@savenonumberlist}[1]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@initnonumberlist} +%\changes{4.25}{2016-06-09}{new} +% \begin{macrocode} +\newcommand*{\@gls@initnonumberlist}{}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@initnonumberlist} +%\changes{4.25}{2016-06-09}{new} +% \begin{macrocode} +\newcommand*{\@gls@storenonumberlist}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@enablesavenonumberlist} +%\changes{4.25}{2016-06-09}{new} +% Allow the \gloskey{nonumberlist} value to be saved. +% \begin{macrocode} +\newcommand*{\@gls@enablesavenonumberlist}{% + \renewcommand*{\@gls@initnonumberlist}{% + \undef\@glo@nonumberlist + }% + \renewcommand*{\@gls@savenonumberlist}[1]{% + \def\@glo@nonumberlist{##1}% + }% + \renewcommand*{\@gls@storenonumberlist}[1]{% + \ifdef\@glo@nonumberlist + {% + \cslet{glo@\glsdetoklabel{##1}@nonumberlist}{\@glo@nonumberlist}% + }% + {}% + }% + \appto\@gls@keymap{,{nonumberlist}{nonumberlist}}% +} +% \end{macrocode} +%\end{macro} +% +% Define some generic user keys. (Additional keys can be added by +% the user.) +%\begin{key}{user1} +% \begin{macrocode} +\define@key{glossentry}{user1}{% + \def\@glo@useri{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{user2} +% \begin{macrocode} +\define@key{glossentry}{user2}{% + \def\@glo@userii{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{user3} +% \begin{macrocode} +\define@key{glossentry}{user3}{% + \def\@glo@useriii{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{user4} +% \begin{macrocode} +\define@key{glossentry}{user4}{% + \def\@glo@useriv{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{user5} +% \begin{macrocode} +\define@key{glossentry}{user5}{% + \def\@glo@userv{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{user6} +% \begin{macrocode} +\define@key{glossentry}{user6}{% + \def\@glo@uservi{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{short} +%\changes{3.0}{2011-04-02}{new} +% This key is provided for use by \ics{newacronym}. It's not +% designed for general purpose use, so isn't described in the user +% manual. +% \begin{macrocode} +\define@key{glossentry}{short}{% + \def\@glo@short{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{shortplural} +%\changes{3.0}{2011-04-02}{new} +% This key is provided for use by \ics{newacronym}. +% \begin{macrocode} +\define@key{glossentry}{shortplural}{% + \def\@glo@shortpl{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{long} +%\changes{3.0}{2011-04-02}{new} +% This key is provided for use by \ics{newacronym}. +% \begin{macrocode} +\define@key{glossentry}{long}{% + \def\@glo@long{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{key}{longplural} +%\changes{3.0}{2011-04-02}{new} +% This key is provided for use by \ics{newacronym}. +% \begin{macrocode} +\define@key{glossentry}{longplural}{% + \def\@glo@longpl{#1}% +} +% \end{macrocode} +%\end{key} +% +%\begin{macro}{\@glsnoname} +% \changes{1.17}{2008-12-26}{new} +% Define command to generate error if \gloskey{name} key is missing. +% \begin{macrocode} +\newcommand*{\@glsnoname}{% + \PackageError{glossaries}{name key required in + \string\newglossaryentry\space for entry `\@glo@label'}{You + haven't specified the entry name}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsnodesc} +% \changes{3.10a}{2013-10-13}{new} +% Define command to generate error if \gloskey{description} key is missing. +% \begin{macrocode} +\newcommand*\@glsnodesc{% + \PackageError{glossaries} + {% + description key required in \string\newglossaryentry\space + for entry `\@glo@label'% + }% + {% + You haven't specified the entry description% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdefaultplural} +% \changes{1.17}{2008-12-26}{new} +%\changes{3.10a}{2013-10-13}{Obsolete} +% Now obsolete. Don't use. +% \begin{macrocode} +\newcommand*{\@glsdefaultplural}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@missingnumberlist} +%\changes{3.02}{2012-05-21}{new} +% Define a command to generate warning when numberlist not set. +% \begin{macrocode} +\newcommand*{\@gls@missingnumberlist}[1]{% + ??% + \ifglssavenumberlist + \GlossariesWarning{Missing number list for entry `#1'. + Maybe makeglossaries + rerun required}% + \else + \PackageError{glossaries}% + {Package option `savenumberlist=true' required}% + {% + You must use the `savenumberlist' package option + to reference location lists.% + }% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdefaultsort} +% Define command to set default sort. +% \changes{1.17}{2008-12-26}{new} +% \begin{macrocode} +\newcommand*{\@glsdefaultsort}{\@glo@name} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@level} +% Register to increment entry levels. +% \begin{macrocode} +\newcount\gls@level +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@noexpand@field} +% \begin{macrocode} +\newcommand{\@@gls@noexpand@field}[3]{% + \expandafter\global\expandafter + \let\csname glo@#1@#2\endcsname#3% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@noexpand@fields} +% \begin{macrocode} +\newcommand{\@gls@noexpand@fields}[4]{% + \ifcsdef{gls@assign@#3@field} + {% + \ifdefequal{#4}{\@gls@default@value}% + {% + \edef\@gls@value{\expandonce{#1}}% + \csuse{gls@assign@#3@field}{#2}{\@gls@value}% + }% + {% + \csuse{gls@assign@#3@field}{#2}{#4}% + }% + }% + {% + \ifdefequal{#4}{\@gls@default@value}% + {% + \edef\@gls@value{\expandonce{#1}}% +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{Fixed bug \texttt{expand} replaced with +%\texttt{noexpand}} +% \begin{macrocode} + \@@gls@noexpand@field{#2}{#3}{\@gls@value}% + }% + {% + \@@gls@noexpand@field{#2}{#3}{#4}% + }% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@@gls@expand@field} +% \begin{macrocode} +\newcommand{\@@gls@expand@field}[3]{% + \expandafter + \protected@xdef\csname glo@#1@#2\endcsname{#3}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{@gls@expand@fields} +% \begin{macrocode} +\newcommand{\@gls@expand@fields}[4]{% + \ifcsdef{gls@assign@#3@field} + {% + \ifdefequal{#4}{\@gls@default@value}% + {% + \edef\@gls@value{\expandonce{#1}}% + \csuse{gls@assign@#3@field}{#2}{\@gls@value}% + }% + {% + \expandafter\@gls@startswithexpandonce#4\relax\relax\gls@endcheck + {% + \@@gls@expand@field{#2}{#3}{#4}% + }% + {% + \csuse{gls@assign@#3@field}{#2}{#4}% + }% + }% + }% + {% + \ifdefequal{#4}{\@gls@default@value}% + {% + \@@gls@expand@field{#2}{#3}{#1}% + }% + {% + \@@gls@expand@field{#2}{#3}{#4}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@startswithexpandonce} +% \begin{macrocode} +\def\@gls@expandonce{\expandonce} +\def\@gls@startswithexpandonce#1#2\gls@endcheck#3#4{% + \def\@gls@tmp{#1}% + \ifdefequal{\@gls@expandonce}{\@gls@tmp}{#3}{#4}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@assign@field} +%\begin{definition} +%\cs{gls@assign@field}\marg{def value}\marg{label}\marg{field}\marg{tmp +%cs} +%\end{definition} +% Assigns an entry field. Expansion performed by default (except for +% name, symbol and description where backward compatibility required). +% If \meta{tmp cs} is \meta{@gls@default@value}, \meta{def value} is +% used instead. +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\let\gls@assign@field\@gls@expand@fields +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsexpandfields} +%\changes{3.08a}{2013-09-28}{new} +% Fully expand values when assigning fields (except for specific +% fields that are overridden by \cs{glssetnoexpandfield}). +% \begin{macrocode} +\newcommand*{\glsexpandfields}{% + \let\gls@assign@field\@gls@expand@fields +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsnoexpandfields} +%\changes{3.08a}{2013-09-28}{new} +% Don't expand values when assigning fields (except for specific +% fields that are overridden by \cs{glssetexpandfield}). +% \begin{macrocode} +\newcommand*{\glsnoexpandfields}{% + \let\gls@assign@field\@gls@noexpand@fields +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\newglossaryentry} +% Define \cs{newglossaryentry}% +% \marg{label} \marg{key-val list}. +% There are two required fields in \meta{key-val list}: +% \gloskey{name} (or \gloskey{parent}) and +% \gloskey{description}. (See above.) +%\changes{3.0}{2011-04-02}{replaced \cs{DeclareRobustCommand} with +%\cs{newrobustcmd}} +% \begin{macrocode} +\newrobustcmd{\newglossaryentry}[2]{% +% \end{macrocode} +% Check to see if this glossary entry has already been defined: +% \begin{macrocode} + \glsdoifnoexists{#1}% + {% + \gls@defglossaryentry{#1}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@defdocnewglossaryentry} +%\changes{4.14}{2015-02-28}{new} +% The definition of \cs{newglossaryentry} is changed at the start of +% the \env{document} environment. The \gloskey{see} key doesn't work +% for entries that have been defined in the document environment. +% \begin{macrocode} +\newcommand*{\gls@defdocnewglossaryentry}{% + \let\gls@checkseeallowed\gls@checkseeallowed@preambleonly + \let\newglossaryentry\new@glossaryentry +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\provideglossaryentry} +% Like \cs{newglossaryentry} but does nothing if the entry has +% already been defined. +%\changes{3.14a}{2013-11-12}{new} +% \begin{macrocode} +\newrobustcmd{\provideglossaryentry}[2]{% + \ifglsentryexists{#1}% + {}% + {% + \gls@defglossaryentry{#1}{#2}% + }% +} +\@onlypreamble{\provideglossaryentry} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\new@glossaryentry} +%\changes{3.10a}{2013-10-13}{new} +% For use in document environment. This opens the \texttt{.glsdefs} +% file, if not already open, so that the entry definition can be +% saved for the next \LaTeX\ run. This means that any glossaries at +% the start of the document can access the entry information. +% \begin{macrocode} +\newrobustcmd{\new@glossaryentry}[2]{% + \ifundef\@gls@deffile + {% + \global\newwrite\@gls@deffile + \immediate\openout\@gls@deffile=\jobname.glsdefs + }% + {}% + \ifglsentryexists{#1}{}% + {% + \gls@defglossaryentry{#1}{#2}% + }% + \@gls@writedef{#1}% +} +% \end{macrocode} +%At the start of the document input the \texttt{.glsdefs} file if it +%exists. This is now done by \cs{gls@begindocdefs}, which is +%redefined by \sty{glossaries-extra}, so that +%this step can be skipped to avoid loading an obsolete +%\texttt{.glsdefs} file if the user switches to +%\sty{glossaries-extra} with \texttt{docdef=restricted}. +% \begin{macrocode} +\AtBeginDocument{\gls@begindocdefs} +% \end{macrocode} +%The end of the document needs to check if the \texttt{.glsdefs} +%file has been opened, in which case it needs to be closed. +% \begin{macrocode} +\AtEndDocument{\ifdef\@gls@deffile{\closeout\@gls@deffile}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@begindocdefs} +%\changes{4.37}{2018-04-07}{new} +%Input the \verb|.glsdefs| file if it exists and enable document +%definitions if permitted. +% \begin{macrocode} +\newcommand*{\gls@begindocdefs}{% + \@gls@enablesavenonumberlist + \edef\@gls@restoreat{\noexpand\catcode`\noexpand\@=\number\catcode`\@\relax}% + \makeatletter + \InputIfFileExists{\jobname.glsdefs}{}{}% + \@gls@restoreat + \undef\@gls@restoreat + \gls@defdocnewglossaryentry +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@writedef} +%\changes{3.10a}{2013-10-13}{new} +% Writes glossary entry definition to \cs{@gls@deffile}. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\@gls@writedef}[1]{% + \immediate\write\@gls@deffile + {% + \string\ifglsentryexists{#1}{}\glspercentchar^^J% + \expandafter\@gobble\string\{\glspercentchar^^J% + \string\gls@defglossaryentry{\glsdetoklabel{#1}}\glspercentchar^^J% + \expandafter\@gobble\string\{\glspercentchar% + }% +% \end{macrocode} +% Write key value information: +% \begin{macrocode} + \@for\@gls@map:=\@gls@keymap\do + {% + \letcs\glo@value{glo@\glsdetoklabel{#1}@\expandafter\@secondoftwo\@gls@map}% + \ifdef\glo@value + {% + \@onelevel@sanitize\glo@value + \immediate\write\@gls@deffile + {% + \expandafter\@firstoftwo\@gls@map + =\expandafter\@gobble\string\{\glo@value\expandafter\@gobble\string\},% + \glspercentchar + }% + }% + {}% + }% +% \end{macrocode} +% Provide hook: +% \begin{macrocode} + \glswritedefhook + \immediate\write\@gls@deffile + {% + \glspercentchar^^J% + \expandafter\@gobble\string\}\glspercentchar^^J% + \expandafter\@gobble\string\}\glspercentchar% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@keymap} +%\changes{3.10a}{2013-10-13}{new} +% List of entry definition key names and corresponding tag in +% control sequence used to store the value. +% \begin{macrocode} +\newcommand*{\@gls@keymap}{% + {name}{name},% + {sort}{sortvalue},% unescaped sort value + {type}{type},% + {first}{first},% + {firstplural}{firstpl},% + {text}{text},% + {plural}{plural},% + {description}{desc},% + {descriptionplural}{descplural},% + {symbol}{symbol},% + {symbolplural}{symbolplural},% + {user1}{useri},% + {user2}{userii},% + {user3}{useriii},% + {user4}{useriv},% + {user5}{userv},% + {user6}{uservi},% + {long}{long},% + {longplural}{longpl},% + {short}{short},% + {shortplural}{shortpl},% + {counter}{counter},% + {parent}{parent}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@fetchfield} +%\changes{4.03}{2014-01-20}{new} +%\begin{definition} +%\cs{@gls@fetchfield}\marg{cs}\marg{field} +%\end{definition} +% Fetches the internal field label from the given user \meta{field} and +% stores in \meta{cs}. +% \begin{macrocode} +\newcommand*{\@gls@fetchfield}[2]{% +% \end{macrocode} +% Ensure user field name is fully expanded +% \begin{macrocode} + \edef\@gls@thisval{#2}% +% \end{macrocode} +% Iterate through known mappings until we find the one for this +% field. +% \begin{macrocode} + \@for\@gls@map:=\@gls@keymap\do{% + \edef\@this@key{\expandafter\@firstoftwo\@gls@map}% + \ifdefequal{\@this@key}{\@gls@thisval}% + {% +% \end{macrocode} +% Found it. +% \begin{macrocode} + \edef#1{\expandafter\@secondoftwo\@gls@map}% +% \end{macrocode} +% Break out of loop. +% \begin{macrocode} + \@endfortrue + }% + {}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaddstoragekey} +%\begin{definition} +%\cs{glsaddstoragekey}\marg{key}\marg{default value}\marg{no link cs} +%\end{definition} +%\changes{4.16}{2015-06-18}{new} +% Similar to \cs{glsaddkey} but intended for keys whose values +% aren't explicitly used in the document, but might be required +% behind the scenes by other commands. +% \begin{macrocode} +\newcommand*{\glsaddstoragekey}{\@ifstar\@sglsaddstoragekey\@glsaddstoragekey} +% \end{macrocode} +% Starred version switches on expansion for this key. +% \begin{macrocode} +\newcommand*{\@sglsaddstoragekey}[1]{% + \key@ifundefined{glossentry}{#1}% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname gls@assign@#1@field\endcsname}[2]{% + \@@gls@expand@field{##1}{#1}{##2}% + }% + }% + {}% + \@glsaddstoragekey{#1}% +} +% \end{macrocode} +% Unstarred version doesn't override default expansion. +% \begin{macrocode} +\newcommand*{\@glsaddstoragekey}[3]{% +% \end{macrocode} +% Check the specified key doesn't already exist. +% \begin{macrocode} + \key@ifundefined{glossentry}{#1}% + {% +% \end{macrocode} +% Set up the key. +% \begin{macrocode} + \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}% + \appto\@gls@keymap{,{#1}{#1}}% +% \end{macrocode} +% Set the default value. +% \begin{macrocode} + \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}% +% \end{macrocode} +% Assignment code. +% \begin{macrocode} + \appto\@newglossaryentryposthook{% + \letcs{\@glo@tmp}{@glo@#1}% + \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}% + }% +% \end{macrocode} +% Define the no-link commands. +% \begin{macrocode} + \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}% + }% + {% + \PackageError{glossaries}{Key `#1' already exists}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaddkey} +%\begin{definition} +%\cs{glsaddkey}\marg{key}\marg{default value}\marg{no link cs}\marg{no link ucfirst +%cs}\marg{link cs}\marg{link ucfirst cs}\marg{link allcaps cs} +%\end{definition} +%\changes{3.12a}{2013-10-16}{new} +% Allow user to add their own custom keys. +% \begin{macrocode} +\newcommand*{\glsaddkey}{\@ifstar\@sglsaddkey\@glsaddkey} +% \end{macrocode} +% Starred version switches on expansion for this key. +% \begin{macrocode} +\newcommand*{\@sglsaddkey}[1]{% + \key@ifundefined{glossentry}{#1}% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname gls@assign@#1@field\endcsname}[2]{% + \@@gls@expand@field{##1}{#1}{##2}% + }% + }% + {}% + \@glsaddkey{#1}% +} +% \end{macrocode} +% Unstarred version doesn't override default expansion. +% \begin{macrocode} +\newcommand*{\@glsaddkey}[7]{% +% \end{macrocode} +% Check the specified key doesn't already exist. +% \begin{macrocode} + \key@ifundefined{glossentry}{#1}% + {% +% \end{macrocode} +% Set up the key. +% \begin{macrocode} + \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}% + \appto\@gls@keymap{,{#1}{#1}}% +% \end{macrocode} +% Set the default value. +% \begin{macrocode} + \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}% +% \end{macrocode} +% Assignment code. +% \begin{macrocode} + \appto\@newglossaryentryposthook{% + \letcs{\@glo@tmp}{@glo@#1}% + \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}% + }% +% \end{macrocode} +% Define the no-link commands. +% \begin{macrocode} + \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: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@field@link}} +% \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}% + {}% + }% + {% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +%\changes{4.08}{2014-07-30}{removed \cs{@sgls@user@\meta{key}}} +%\changes{4.09}{2014-08-12}{fixed bug in user commands} +% \begin{macrocode} + \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: +% \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}% + {}% + }% + {% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +%\changes{4.08}{2014-07-30}{removed \cs{@sGls@user@\meta{key}}} +% \begin{macrocode} + \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}{#4{##2}##3}% + }% + \newrobustcmd*{#6}{% + \expandafter\@gls@hyp@opt\csname @Gls@user@#1\endcsname}% + }% +% \end{macrocode} +% Finally the all caps version: +% \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}% + {}% + }% + {% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLS@user@\meta{key}}} +% \begin{macrocode} + \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}{\mfirstucMakeUppercase{#3{##2}##3}}% + }% + \newrobustcmd*{#7}{% + \expandafter\@gls@hyp@opt\csname @GLS@user@#1\endcsname}% + }% + }% + {% + \PackageError{glossaries}{Key `#1' already exists}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfieldxdef} +%\begin{definition} +%\cs{glsfieldxdef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +%\changes{4.42}{2019-01-06}{changed from \cs{edef} to \cs{protected@csxdef}} +% \begin{macrocode} +\newcommand{\glsfieldxdef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \protected@csxdef{glo@\@glo@label @#2}{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfieldedef} +%\begin{definition} +%\cs{glsfieldedef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +%\changes{4.42}{2019-01-06}{changed from \cs{edef} to \cs{protected@csedef}} +% \begin{macrocode} +\newcommand{\glsfieldedef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \protected@csedef{glo@\@glo@label @#2}{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfieldgdef} +%\begin{definition} +%\cs{glsfieldgdef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand{\glsfieldgdef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\gdef\csname glo@\@glo@label @#2\endcsname{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfielddef} +%\begin{definition} +%\cs{glsfielddef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand{\glsfielddef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\def\csname glo@\@glo@label @#2\endcsname{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfieldfetch} +%\begin{definition} +%\cs{glsfieldfetch}\marg{label}\marg{field}\marg{cs} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% Fetches the value of the given field and stores in the given +% control sequence. +% \begin{macrocode} +\newcommand{\glsfieldfetch}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \letcs#3{glo@\@glo@label @#2}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsfieldeq} +%\begin{definition} +%\cs{ifglsfieldeq}\marg{label}\marg{field}\marg{string}\marg{true}\marg{false} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% Tests if the value of the given field is equal to the given +% string. +% \begin{macrocode} +\newcommand{\ifglsfieldeq}[5]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \ifcsstring{glo@\@glo@label @#2}{#3}{#4}{#5}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsfielddefeq} +%\begin{definition} +%\cs{ifglsfielddefeq}\marg{label}\marg{field}\marg{command}\marg{true}\marg{false} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% Tests if the value of the given field is equal to the replacement +% text of the given command. +% \begin{macrocode} +\newcommand{\ifglsfielddefeq}[5]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\ifdefstrequal + \csname glo@\@glo@label @#2\endcsname{#3}{#4}{#5}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsfieldcseq} +%\begin{definition} +%\cs{ifglsfieldcseq}\marg{label}\marg{field}\marg{cs name}\marg{true}\marg{false} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +%As above but uses \cs{ifcsstrequal} instead of \cs{ifdefstrequal} +% \begin{macrocode} +\newcommand{\ifglsfieldcseq}[5]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \ifcsstrequal{glo@\@glo@label @#2}{#3}{#4}{#5}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glswritedefhook} +%\changes{3.10a}{2013-10-13}{new} +% \begin{macrocode} +\newcommand*{\glswritedefhook}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@assign@desc} +%\changes{3.11a}{2013-10-15}{new} +% \begin{macrocode} +\newcommand*{\gls@assign@desc}[1]{% + \gls@assign@field{}{#1}{desc}{\@glo@desc}% + \gls@assign@field{\@glo@desc}{#1}{descplural}{\@glo@descplural}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\longnewglossaryentry} +%\changes{3.11a}{2013-10-15}{new} +% \begin{macrocode} +\newcommand{\longnewglossaryentry}[3]{% + \glsdoifnoexists{#1}% + {% + \bgroup + \let\@org@newglossaryentryprehook\@newglossaryentryprehook + \long\def\@newglossaryentryprehook{% + \long\def\@glo@desc{#3\leavevmode\unskip\nopostdesc}% + \@org@newglossaryentryprehook + }% + \renewcommand*{\gls@assign@desc}[1]{% + \global\cslet{glo@\glsdetoklabel{#1}@desc}{\@glo@desc}% + \global\cslet{glo@\glsdetoklabel{#1}@descplural}{\@glo@desc}% + } + \gls@defglossaryentry{#1}{#2}% + \egroup + } +} +% \end{macrocode} +% Only allowed in the preamble. (Otherwise a long description could +% cause problems when writing the entry definition to the temporary +% file.) +% \begin{macrocode} +\@onlypreamble{\longnewglossaryentry} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\longprovideglossaryentry} +%\changes{3.14a}{2013-11-12}{new} +% As the above but only defines the entry if it doesn't already +% exist. +% \begin{macrocode} +\newcommand{\longprovideglossaryentry}[3]{% + \ifglsentryexists{#1}{}% + {\longnewglossaryentry{#1}{#2}{#3}}% +} +\@onlypreamble{\longprovideglossaryentry} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@defglossaryentry} +%\begin{definition} +%\cs{gls@defglossaryentry}\marg{label}\marg{key-val list} +%\end{definition} +% Defines a new entry without checking if it already exists. +%\changes{3.10a}{2013-10-13}{new} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand{\gls@defglossaryentry}[2]{% +% \end{macrocode} +% Prevent any further use of \cs{GlsSetQuote}: +% \begin{macrocode} + \let\GlsSetQuote\gls@nosetquote +% \end{macrocode} +% Store label +% \begin{macrocode} + \edef\@glo@label{\glsdetoklabel{#1}}% +% \end{macrocode} +% \changes{3.12a}{2013-10-16}{added \cs{glslabel}} +% Provide a means for user defined keys to reference the label: +% \begin{macrocode} + \let\glslabel\@glo@label +% \end{macrocode} +% Set up defaults. If the \gloskey{name} or \gloskey{description} +% keys are omitted, an error will be generated. +% \begin{macrocode} + \let\@glo@name\@glsnoname + \let\@glo@desc\@glsnodesc +% \end{macrocode} +% \changes{1.12}{2008-03-08}{descriptionplural support added} +% \begin{macrocode} + \let\@glo@descplural\@gls@default@value +% \end{macrocode} +% \begin{macrocode} + \let\@glo@type\@gls@default@value + \let\@glo@symbol\@gls@default@value +% \end{macrocode} +% \changes{1.12}{2008-03-08}{symbolplural support added} +% \begin{macrocode} + \let\@glo@symbolplural\@gls@default@value +% \end{macrocode} +% \begin{macrocode} + \let\@glo@text\@gls@default@value +% \end{macrocode} +% \begin{macrocode} + \let\@glo@plural\@gls@default@value +% \end{macrocode} +% \changes{1.13}{2008-05-10}{Changed default first value} +% Using \cs{let} instead of \cs{def} to make later comparison +% avoid expansion issues. (Thanks to Ulrich~Diez for suggesting +% this.) +% \changes{1.16}{2008-08-27}{Changed def to let} +%\changes{3.10a}{2013-10-13}{Changed to using \cs{@gls@default@value}} +% \begin{macrocode} + \let\@glo@first\@gls@default@value +% \end{macrocode} +% \changes{1.12}{2008-03-08}{Changed default first plural to be first +% key with s appended (was text key with s appended)} +% \changes{1.13}{2008-05-10}{Changed default firstplural value} +% \begin{macrocode} + \let\@glo@firstplural\@gls@default@value +% \end{macrocode} +% Set the default sort: +%\changes{3.10a}{2013-10-13}{Changed to using \cs{@gls@default@value}} +%\changes{1.05}{2007-08-10}{Changed the default value of the sort +% key to just the value of the name key}% +%\changes{1.18}{2009-01-14}{Changed default value of sort +% to \cs{@glsdefaultsort}} +% \begin{macrocode} + \let\@glo@sort\@gls@default@value +% \end{macrocode} +% Set the default counter: +% \begin{macrocode} + \let\@glo@counter\@gls@default@value +% \end{macrocode} +%\changes{1.17}{2008-12-26}{added see key} +% \begin{macrocode} + \def\@glo@see{}% +% \end{macrocode} +%\changes{1.17}{2008-12-26}{added parent key} +% \begin{macrocode} + \def\@glo@parent{}% +% \end{macrocode} +%\changes{1.17}{2008-12-26}{added nonumberlist key} +% \begin{macrocode} + \def\@glo@prefix{}% +% \end{macrocode} +% Initialise nonumberlist setting if we're in the \env{document} +% environment. +% \begin{macrocode} + \@gls@initnonumberlist +% \end{macrocode} +%\changes{2.04}{2009-11-10}{added user1-6 keys} +% \begin{macrocode} + \def\@glo@useri{}% + \def\@glo@userii{}% + \def\@glo@useriii{}% + \def\@glo@useriv{}% + \def\@glo@userv{}% + \def\@glo@uservi{}% +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added short and long keys} +% \begin{macrocode} + \def\@glo@short{}% + \def\@glo@shortpl{}% + \def\@glo@long{}% + \def\@glo@longpl{}% +% \end{macrocode} +% Add start hook in case another package wants to add extra keys. +% \begin{macrocode} + \@newglossaryentryprehook +% \end{macrocode} +% Extract key-val information from third parameter: +% \begin{macrocode} + \setkeys{glossentry}{#2}% +% \end{macrocode} +%\changes{3.14a}{2013-11-12}{added check for existence of default glossary} +% Check there is a default glossary. +% \begin{macrocode} + \ifundef\glsdefaulttype + {% + \PackageError{glossaries}% + {No default glossary type (have you used `nomain' by mistake?)}% + {If you use package option `nomain' you must define + a new glossary before you can define entries}% + }% + {}% +% \end{macrocode} +% Assign type. This must be fully expandable +%\changes{4.03}{2014-01-20}{replaced \#1 with \cs{@glo@label}} +% \begin{macrocode} + \gls@assign@field{\glsdefaulttype}{\@glo@label}{type}{\@glo@type}% + \edef\@glo@type{\glsentrytype{\@glo@label}}% +% \end{macrocode} +% Check to see if this glossary type has been defined, if it has, +% add this label to the relevant list, otherwise generate an error. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} + \ifcsundef{glolist@\@glo@type}% + {% + \PackageError{glossaries}% + {Glossary type `\@glo@type' has not been defined}% + {You need to define a new glossary type, before making entries + in it}% + }% + {% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{added check for ignored glossary} +% Check if it's an ignored glossary +% \begin{macrocode} + \ifignoredglossary\@glo@type + {% +% \end{macrocode} +% The description may be omitted for an entry in an ignored +% glossary. +% \begin{macrocode} + \ifx\@glo@desc\@glsnodesc + \let\@glo@desc\@empty + \fi + }% + {% + }% + \protected@edef\@glolist@{\csname glolist@\@glo@type\endcsname}% + \expandafter\xdef\csname glolist@\@glo@type\endcsname{% + \@glolist@{\@glo@label},}% + }% +% \end{macrocode} +% Initialise level to 0. +% \begin{macrocode} + \gls@level=0\relax +% \end{macrocode} +% Has this entry been assigned a parent? +% \begin{macrocode} + \ifx\@glo@parent\@empty +% \end{macrocode} +% Doesn't have a parent. Set \cs{glo@}\meta{label}"@parent" to +% empty. +% \begin{macrocode} + \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}% + \else +% \end{macrocode} +% Has a parent. Check to ensure this entry isn't its own parent. +%\changes{4.03}{2014-01-20}{replaced \cs{ifthenelse} with +%\cs{ifdefequal}} +% \begin{macrocode} + \ifdefequal\@glo@label\@glo@parent% + {% + \PackageError{glossaries}{Entry `\@glo@label' can't be its own parent}{}% + \def\@glo@parent{}% + \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}% + }% + {% +% \end{macrocode} +% Check the parent exists: +% \begin{macrocode} + \ifglsentryexists{\@glo@parent}% + {% +% \end{macrocode} +% Parent exists. Set \cs{glo@}\meta{label}"@parent". +% \begin{macrocode} + \expandafter\xdef\csname glo@\@glo@label @parent\endcsname{% + \@glo@parent}% +% \end{macrocode} +% Determine level. +% \begin{macrocode} + \gls@level=\csname glo@\@glo@parent @level\endcsname\relax + \advance\gls@level by 1\relax +% \end{macrocode} +% If name hasn't been specified, use same as the parent name +% \begin{macrocode} + \ifx\@glo@name\@glsnoname + \expandafter\let\expandafter\@glo@name + \csname glo@\@glo@parent @name\endcsname +% \end{macrocode} +% If name and plural haven't been specified, use same as the parent +% \begin{macrocode} + \ifx\@glo@plural\@gls@default@value + \expandafter\let\expandafter\@glo@plural + \csname glo@\@glo@parent @plural\endcsname + \fi + \fi + }% + {% +% \end{macrocode} +% Parent doesn't exist, so issue an error message and change this +% entry to have no parent +% \begin{macrocode} + \PackageError{glossaries}% + {% + Invalid parent `\@glo@parent' + for entry `\@glo@label' - parent doesn't exist% + }% + {% + Parent entries must be defined before their children% + }% + \def\@glo@parent{}% + \expandafter\gdef\csname glo@\@glo@label @parent\endcsname{}% + }% + }% + \fi +% \end{macrocode} +% Set the level for this entry +% \begin{macrocode} + \expandafter\xdef\csname glo@\@glo@label @level\endcsname{\number\gls@level}% +% \end{macrocode} +% Define commands associated with this entry: +% \begin{macrocode} + \gls@assign@field{\@glo@name}{\@glo@label}{sortvalue}{\@glo@sort}% + \letcs\@glo@sort{glo@\@glo@label @sortvalue}% + \gls@assign@field{\@glo@name}{\@glo@label}{text}{\@glo@text}% + \expandafter\gls@assign@field\expandafter + {\csname glo@\@glo@label @text\endcsname\glspluralsuffix}% + {\@glo@label}{plural}{\@glo@plural}% + \expandafter\gls@assign@field\expandafter + {\csname glo@\@glo@label @text\endcsname}% + {\@glo@label}{first}{\@glo@first}% +% \end{macrocode} +%\changes{3.14a}{2013-11-12}{set the default for firstplural to be the value +%of plural} +%\changes{4.0}{2013-11-14}{added check for first key} +% If \gloskey{first} has been specified, make the default by appending +% \cs{glspluralsuffix}, otherwise make the default the value of the +% \gloskey{plural} key. +% \begin{macrocode} + \ifx\@glo@first\@gls@default@value + \expandafter\gls@assign@field\expandafter + {\csname glo@\@glo@label @plural\endcsname}% + {\@glo@label}{firstpl}{\@glo@firstplural}% + \else + \expandafter\gls@assign@field\expandafter + {\csname glo@\@glo@label @first\endcsname\glspluralsuffix}% + {\@glo@label}{firstpl}{\@glo@firstplural}% + \fi +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{Fixed default counter if none supplied} +% \begin{macrocode} + \ifcsundef{@glotype@\@glo@type @counter}% + {% + \def\@glo@defaultcounter{\glscounter}% + }% + {% + \letcs\@glo@defaultcounter{@glotype@\@glo@type @counter}% + }% + \gls@assign@field{\@glo@defaultcounter}{\@glo@label}{counter}{\@glo@counter}% + \gls@assign@field{}{\@glo@label}{useri}{\@glo@useri}% + \gls@assign@field{}{\@glo@label}{userii}{\@glo@userii}% + \gls@assign@field{}{\@glo@label}{useriii}{\@glo@useriii}% + \gls@assign@field{}{\@glo@label}{useriv}{\@glo@useriv}% + \gls@assign@field{}{\@glo@label}{userv}{\@glo@userv}% + \gls@assign@field{}{\@glo@label}{uservi}{\@glo@uservi}% + \gls@assign@field{}{\@glo@label}{short}{\@glo@short}% + \gls@assign@field{}{\@glo@label}{shortpl}{\@glo@shortpl}% + \gls@assign@field{}{\@glo@label}{long}{\@glo@long}% + \gls@assign@field{}{\@glo@label}{longpl}{\@glo@longpl}% + \ifx\@glo@name\@glsnoname + \@glsnoname + \let\@gloname\@gls@default@value + \fi + \gls@assign@field{}{\@glo@label}{name}{\@glo@name}% +% \end{macrocode} +%\changes{3.02}{2012-05-21}{added numberlist element} +% Set default numberlist if not defined: +% \begin{macrocode} + \ifcsundef{glo@\@glo@label @numberlist}% + {% + \csxdef{glo@\@glo@label @numberlist}{% + \noexpand\@gls@missingnumberlist{\@glo@label}}% + }% + {}% +% \end{macrocode} +% Store nonumberlist setting if we're in the \env{document} +% environment. +% \begin{macrocode} + \@gls@storenonumberlist{\@glo@label}% +% \end{macrocode} +% The smaller and smallcaps options set the description to +% \cs{@glo@first}. Need to check for this, otherwise it won't get +% expanded if the description gets sanitized. +%\changes{1.15}{2008-08-15}{check for \cs{@glo@first} in description}% +% \begin{macrocode} + \def\@glo@@desc{\@glo@first}% + \ifx\@glo@desc\@glo@@desc + \let\@glo@desc\@glo@first + \fi + \ifx\@glo@desc\@glsnodesc + \@glsnodesc + \let\@glodesc\@gls@default@value + \fi + \gls@assign@desc{\@glo@label}% +% \end{macrocode} +%\changes{1.18}{2009-01-14}{moved sort sanitization to +% \cs{newglossaryentry}} +%\changes{3.0}{2011-04-02}{added \cs{@gls@defsort}} +% Set the sort key for this entry: +% \begin{macrocode} + \@gls@defsort{\@glo@type}{\@glo@label}% +% \end{macrocode} +%\changes{1.15}{2008-08-15}{check for \cs{@glo@text} in symbol}% +% \begin{macrocode} + \def\@glo@@symbol{\@glo@text}% + \ifx\@glo@symbol\@glo@@symbol + \let\@glo@symbol\@glo@text + \fi + \gls@assign@field{\relax}{\@glo@label}{symbol}{\@glo@symbol}% + \expandafter + \gls@assign@field\expandafter + {\csname glo@\@glo@label @symbol\endcsname} + {\@glo@label}{symbolplural}{\@glo@symbolplural}% +% \end{macrocode} +% Define an associated boolean variable to determine whether this +% entry has been used yet (needs to be defined globally): +% \begin{macrocode} + \expandafter\xdef\csname glo@\@glo@label @flagfalse\endcsname{% + \noexpand\global + \noexpand\let\expandafter\noexpand + \csname ifglo@\@glo@label @flag\endcsname\noexpand\iffalse + }% + \expandafter\xdef\csname glo@\@glo@label @flagtrue\endcsname{% + \noexpand\global + \noexpand\let\expandafter\noexpand + \csname ifglo@\@glo@label @flag\endcsname\noexpand\iftrue + }% + \csname glo@\@glo@label @flagfalse\endcsname +% \end{macrocode} +% Sort out any cross-referencing if required. +%\changes{4.04}{2014-03-06}{replaced \cs{ifx} with \cs{ifdefvoid}} +% \begin{macrocode} + \@glo@autosee +% \end{macrocode} +% Determine and store main part of the entry's index format. +%\changes{1.17}{2008-12-26}{Stored main part of entry +% format when entry +% is defined}% +% \begin{macrocode} + \ifignoredglossary\@glo@type + {% + \csdef{glo@\@glo@label @index}{}% + } + {% + \do@glo@storeentry{\@glo@label}% + }% +% \end{macrocode} +% Define entry counters if enabled: +% \begin{macrocode} + \@newglossaryentry@defcounters +% \end{macrocode} +% Add end hook in case another package wants to add extra keys. +% \begin{macrocode} + \@newglossaryentryposthook +} +% \end{macrocode} +%\changes{1.13}{2008-05-10}{Removed restriction on only using +% \cs{newglossaryentry} in the preamble} +%\end{macro} +% +%\begin{macro}{\@glo@autosee} +%\changes{4.30}{2017-06-11}{new} +%Automatically implement \cs{glssee}. +% \begin{macrocode} +\newcommand*{\@glo@autosee}{% + \ifdefvoid\@glo@see{}% + {% + \protected@edef\@do@glssee{% + \noexpand\@gls@fixbraces\noexpand\@glo@list\@glo@see\noexpand\@nil + \noexpand\expandafter\noexpand\@glssee\noexpand\@glo@list{\@glo@label}}% + \@do@glssee + }% + \@glo@autoseehook +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@autoseehook} +%\changes{4.30}{2017-06-11}{new} +% \begin{macrocode} +\newcommand*{\@glo@autoseehook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@newglossaryentryprehook} +% Allow extra information to be added to glossary entries: +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\@newglossaryentryprehook}{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@newglossaryentryposthook} +% Allow extra information to be added to glossary entries: +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\@newglossaryentryposthook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@newglossaryentry@defcounters} +%\changes{4.14}{2015-02-28}{new} +% \begin{macrocode} +\newcommand*{\@newglossaryentry@defcounters}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsmoveentry} +%\changes{3.02}{2012-05-21}{new} +% Moves entry whose label is given by first argument to the glossary +% named in the second argument. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\glsmoveentry}[2]{% + \edef\@glo@thislabel{\glsdetoklabel{#1}}% + \edef\glo@type{\csname glo@\@glo@thislabel @type\endcsname}% + \def\glo@list{,}% + \forglsentries[\glo@type]{\glo@label}% + {% +% \end{macrocode} +%\changes{4.03}{2014-01-20}{replaced \cs{ifthenelse} with +%\cs{ifdefequal}} +% \begin{macrocode} + \ifdefequal\@glo@thislabel\glo@label + {}{\eappto\glo@list{\glo@label,}}% + }% + \cslet{glolist@\glo@type}{\glo@list}% + \csdef{glo@\@glo@thislabel @type}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glossaryentryfield} +% Indicate what command should be used to display each entry in +% the glossary. (This enables the \sty{glossaries-accsupp} package +% to use \cs{accsuppglossaryentryfield} instead.) +%\changes{2.04}{2009-11-10}{new} +%\changes{3.08a}{2013-09-28}{switched to \cs{glossentry}} +% \begin{macrocode} +\ifglsxindy + \newcommand*{\@glossaryentryfield}{\string\\glossentry} +\else + \newcommand*{\@glossaryentryfield}{\string\glossentry} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glossarysubentryfield} +% Indicate what command should be used to display each subentry in +% the glossary. (This enables the \sty{glossaries-accsupp} package +% to use \cs{accsuppglossarysubentryfield} instead.) +%\changes{2.04}{2009-11-10}{new} +%\changes{3.08a}{2013-09-28}{switched to \cs{subglossentry}} +% \begin{macrocode} +\ifglsxindy + \newcommand*{\@glossarysubentryfield}{% + \string\\subglossentry} +\else + \newcommand*{\@glossarysubentryfield}{% + \string\subglossentry} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@storeentry} +%\begin{definition} +%\cs{@glo@storeentry}\marg{label} +%\end{definition} +%\changes{1.17}{2008-12-26}{new} +% Determine the format to write the entry in the glossary +% output (\filetype{.glo}) file. +% The argument is the entry's label (should already have been +% de-tok'ed if required). +% The result is stored in \cs{glo@}\meta{label}"@index", where +% \meta{label} is the entry's label. (This doesn't include +% any formatting or location information.) +% \begin{macrocode} +\newcommand{\@glo@storeentry}[1]{% +% \end{macrocode} +% Escape makeindex/xindy special characters in the label: +% \begin{macrocode} + \edef\@glo@esclabel{#1}% + \@gls@checkmkidxchars\@glo@esclabel +% \end{macrocode} +% Get the sort string and escape any special characters +% \begin{macrocode} + \protected@edef\@glo@sort{\csname glo@#1@sort\endcsname}% + \@gls@checkmkidxchars\@glo@sort +% \end{macrocode} +% Same again for the name string. +%\changes{3.08a}{2013-09-28}{no longer need to check for special characters +%in any of the fields other than sort} +% Escape any special characters in the prefix +% \begin{macrocode} + \@gls@checkmkidxchars\@glo@prefix +% \end{macrocode} +% Get the parent, if one exists +% \begin{macrocode} + \edef\@glo@parent{\csname glo@#1@parent\endcsname}% +% \end{macrocode} +% Write the information to the glossary file. +% \begin{macrocode} + \ifglsxindy +% \end{macrocode} +% Store using \app{xindy} syntax. +% \begin{macrocode} + \ifx\@glo@parent\@empty +% \end{macrocode} +% Entry doesn't have a parent +%\changes{3.08a}{2013-09-28}{updated for \cs{glossentry}} +% \begin{macrocode} + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + (\string"\@glo@sort\string" % + \string"\@glo@prefix\@glossaryentryfield{\@glo@esclabel}\string") % + }% + \else +% \end{macrocode} +% Entry has a parent +% \begin{macrocode} + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + \csname glo@\@glo@parent @index\endcsname + (\string"\@glo@sort\string" % + \string"\@glo@prefix\@glossarysubentryfield + {\csname glo@#1@level\endcsname}{\@glo@esclabel}\string") % + }% + \fi + \else +% \end{macrocode} +% Store using \app{makeindex} syntax. +% \begin{macrocode} + \ifx\@glo@parent\@empty +% \end{macrocode} +% Sanitize \cs{@glo@prefix} +% \begin{macrocode} + \@onelevel@sanitize\@glo@prefix +% \end{macrocode} +% Entry doesn't have a parent +% \begin{macrocode} + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + \@glo@sort\@gls@actualchar\@glo@prefix + \@glossaryentryfield{\@glo@esclabel}% + }% + \else +% \end{macrocode} +% Entry has a parent +% \begin{macrocode} + \expandafter\protected@xdef\csname glo@#1@index\endcsname{% + \csname glo@\@glo@parent @index\endcsname\@gls@levelchar + \@glo@sort\@gls@actualchar\@glo@prefix + \@glossarysubentryfield + {\csname glo@#1@level\endcsname}{\@glo@esclabel}% + }% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\section{Resetting and unsetting entry flags} +% Each glossary entry is assigned a conditional of the form +%\cs{ifglo@}\meta{label}\texttt{@flag} which determines +% whether or not the entry has been used (see also +% \ics{ifglsused} defined below). These flags can +% be set and unset using the following macros, but first we need to +% know if we're in \sty{amsmath}'s \env{align} environment's +% measuring pass. +% +%\begin{macro}{\gls@ifnotmeasuring} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{amsmath}% + {\let\gls@ifnotmeasuring\@gls@ifnotmeasuring}% + {}% +} +\newcommand*{\@gls@ifnotmeasuring}[1]{% + \ifmeasuring@ + \else + #1% + \fi +} +\newcommand*\gls@ifnotmeasuring[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspatchtabularx} +%\changes{4.28}{2017-01-07}{new} +%Patch \cs{TX@trial} (as per David Carlisle's answer in +%\url{http://tex.stackexchange.com/a/94895}). This does nothing +%if \cs{TX@trial} hasn't been defined. +% \begin{macrocode} +\def\@gls@patchtabularx#1\hbox#2#3!!{% + \def\TX@trial##1{#1\hbox{\let\glsunset\@gobble#2}#3}% +} +\newcommand*\glspatchtabularx{% + \ifdef\TX@trial + {% + \expandafter\@gls@patchtabularx\TX@trial{##1}!!% + \let\glspatchtabularx\relax + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsreset} +% The command \cs{glsreset}\marg{label} can be used +% to set the entry flag to indicate that it hasn't been used yet. The +% required argument is the entry label. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.14}{2015-02-28}{switched to \cs{@glsreset}} +% \begin{macrocode} +\newcommand*{\glsreset}[1]{% + \gls@ifnotmeasuring + {% + \glsdoifexists{#1}% + {% + \@glsreset{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslocalreset} +% As above, but with only a local effect: +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.14}{2015-02-28}{switched to \cs{@glslocalreset}} +% \begin{macrocode} +\newcommand*{\glslocalreset}[1]{% + \gls@ifnotmeasuring + {% + \glsdoifexists{#1}% + {% + \@glslocalreset{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsunset} +% The command \cs{glsunset}\marg{label} can be used to +% set the entry flag to indicate that it has been used. The required +% argument is the entry label. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.14}{2015-02-28}{switched to \cs{@glsunset}} +% \begin{macrocode} +\newcommand*{\glsunset}[1]{% + \gls@ifnotmeasuring + {% + \glsdoifexists{#1}% + {% + \@glsunset{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslocalunset} +% As above, but with only a local effect: +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.14}{2015-02-28}{switched to \cs{@glslocalunset}} +% \begin{macrocode} +\newcommand*{\glslocalunset}[1]{% + \gls@ifnotmeasuring + {% + \glsdoifexists{#1}% + {% + \@glslocalunset{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslocalunset} +% Local unset. This defaults to just \cs{@@glslocalunset} but is changed +% by \cs{glsenableentrycount}. +%\changes{4.14}{2015-02-28}{new} +% \begin{macrocode} +\newcommand*{\@glslocalunset}{\@@glslocalunset} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glslocalunset} +%\changes{4.14}{2015-02-28}{new} +% Local unset without checks. +% \begin{macrocode} +\newcommand*{\@@glslocalunset}[1]{% + \expandafter\let\csname ifglo@\glsdetoklabel{#1}@flag\endcsname\iftrue +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsunset} +% Global unset. This defaults to just \cs{@@glsunset} but is changed +% by \cs{glsenableentrycount}. +%\changes{4.14}{2015-02-28}{new} +% \begin{macrocode} +\newcommand*{\@glsunset}{\@@glsunset} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsunset} +%\changes{4.14}{2015-02-28}{new} +% Global unset without checks. +% \begin{macrocode} +\newcommand*{\@@glsunset}[1]{% + \expandafter\global\csname glo@\glsdetoklabel{#1}@flagtrue\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslocalreset} +% Local reset. This defaults to just \cs{@@glslocalreset} but is changed +% by \cs{glsenableentrycount}. +%\changes{4.14}{2015-02-28}{new} +% \begin{macrocode} +\newcommand*{\@glslocalreset}{\@@glslocalreset} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glslocalreset} +%\changes{4.14}{2015-02-28}{new} +% Local reset without checks. +% \begin{macrocode} +\newcommand*{\@@glslocalreset}[1]{% + \expandafter\let\csname ifglo@\glsdetoklabel{#1}@flag\endcsname\iffalse +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsreset} +% Global reset. This defaults to just \cs{@@glsreset} but is changed +% by \cs{glsenableentrycount}. +%\changes{4.14}{2015-02-28}{new} +% \begin{macrocode} +\newcommand*{\@glsreset}{\@@glsreset} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsreset} +%\changes{4.14}{2015-02-28}{new} +% Global reset without checks. +% \begin{macrocode} +\newcommand*{\@@glsreset}[1]{% + \expandafter\global\csname glo@\glsdetoklabel{#1}@flagfalse\endcsname +} +% \end{macrocode} +%\end{macro} +% +% Reset all entries for the named glossaries (supplied in a +% comma-separated list). +% Syntax: \cs{glsresetall}\oarg{glossary-list} +%\begin{macro}{\glsresetall} +% \begin{macrocode} +\newcommand*{\glsresetall}[1][\@glo@types]{% + \forallglsentries[#1]{\@glsentry}% + {% + \glsreset{\@glsentry}% + }% +} +% \end{macrocode} +%\end{macro} +% As above, but with only a local effect: +%\begin{macro}{\glslocalresetall} +% \begin{macrocode} +\newcommand*{\glslocalresetall}[1][\@glo@types]{% + \forallglsentries[#1]{\@glsentry}% + {% + \glslocalreset{\@glsentry}% + }% +} +% \end{macrocode} +%\end{macro} +% Unset all entries for the named glossaries (supplied in a +% comma-separated list). +% Syntax: \cs{glsunsetall}\oarg{glossary-list} +%\begin{macro}{\glsunsetall} +% \begin{macrocode} +\newcommand*{\glsunsetall}[1][\@glo@types]{% + \forallglsentries[#1]{\@glsentry}% + {% + \glsunset{\@glsentry}% + }% +} +% \end{macrocode} +%\end{macro} +% As above, but with only a local effect: +%\begin{macro}{\glslocalunsetall} +% \begin{macrocode} +\newcommand*{\glslocalunsetall}[1][\@glo@types]{% + \forallglsentries[#1]{\@glsentry}% + {% + \glslocalunset{\@glsentry}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\section{Keeping Track of How Many Times an Entry Has Been Unset} +%Version 4.14 introduced \cs{glsenableentrycount} that keeps track +%of how many times an entry is marked as used. The counter is reset +%back to zero when the first use flag is reset. Note that although +%the word ``counter'' is used here, it's not an actual \LaTeX\ +%counter or even an explicit \TeX\ count register but is just a +%macro. Any of the commands that use \cs{glsunset} or +%\cs{glslocalunset}, such as \cs{gls}, will automatically increment this value. +%Commands that don't modify the first use flag (such as \cs{glstext} +%or \cs{glsentrytext}) don't modify this value. +% +%\begin{macro}{\@@newglossaryentry@defcounters} +%\changes{4.14}{2015-02-28}{new} +% Define entry fields to keep track of how many times that entry has +% been marked as used. +% \begin{macrocode} +\newcommand*{\@@newglossaryentry@defcounters}{% + \csdef{glo@\@glo@label @currcount}{0}% + \csdef{glo@\@glo@label @prevcount}{0}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsenableentrycount} +%\changes{4.14}{2015-02-28}{new} +% Enables tracking of how many times an entry has been marked as +% used. +% \begin{macrocode} +\newcommand*{\glsenableentrycount}{% +% \end{macrocode} +% Enable new entry fields. +% \begin{macrocode} + \let\@newglossaryentry@defcounters\@@newglossaryentry@defcounters +% \end{macrocode} +% Disable \cs{newglossaryentry} in the \env{document} environment. +% \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} +% Define commands \ics{glsentrycurrcount} and \ics{glsentryprevcount} to +% access these new fields. Default to zero if undefined. +% \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} +% Make the unset and reset functions also increment or reset the +% entry counter. +% \begin{macrocode} + \renewcommand*{\@glsunset}[1]{% + \@@glsunset{##1}% + \@gls@increment@currcount{##1}% + }% + \renewcommand*{\@glslocalunset}[1]{% + \@@glslocalunset{##1}% + \@gls@local@increment@currcount{##1}% + }% + \renewcommand*{\@glsreset}[1]{% + \@@glsreset{##1}% + \csgdef{glo@\glsdetoklabel{##1}@currcount}{0}% + }% + \renewcommand*{\@glslocalreset}[1]{% + \@@glslocalreset{##1}% + \csdef{glo@\glsdetoklabel{##1}@currcount}{0}% + }% +% \end{macrocode} +% Alter behaviour of \cs{cgls}. (Only global unset is used if +% previous count was one as it doesn't make sense to have a~local +% unset here given that the previous count was global.) +% \begin{macrocode} + \def\@cgls@##1##2[##3]{% + \ifnum\glsentryprevcount{##2}=1\relax + \cglsformat{##2}{##3}% + \glsunset{##2}% + \else + \@gls@{##1}{##2}[##3]% + \fi + }% +% \end{macrocode} +% Similarly for the analogous commands. No case change plural: +% \begin{macrocode} + \def\@cglspl@##1##2[##3]{% + \ifnum\glsentryprevcount{##2}=1\relax + \cglsplformat{##2}{##3}% + \glsunset{##2}% + \else + \@glspl@{##1}{##2}[##3]% + \fi + }% +% \end{macrocode} +% First letter uppercase singular: +% \begin{macrocode} + \def\@cGls@##1##2[##3]{% + \ifnum\glsentryprevcount{##2}=1\relax + \cGlsformat{##2}{##3}% + \glsunset{##2}% + \else + \@Gls@{##1}{##2}[##3]% + \fi + }% +% \end{macrocode} +% First letter uppercase plural: +% \begin{macrocode} + \def\@cGlspl@##1##2[##3]{% + \ifnum\glsentryprevcount{##2}=1\relax + \cGlsplformat{##2}{##3}% + \glsunset{##2}% + \else + \@Glspl@{##1}{##2}[##3]% + \fi + }% +% \end{macrocode} +% Write information to aux file at the end of the document +% \begin{macrocode} + \AtEndDocument{\@gls@write@entrycounts}% +% \end{macrocode} +% Fetch previous count information from aux file. (No check here to +% determine if the entry is still defined.) +% \begin{macrocode} + \renewcommand*{\@gls@entry@count}[2]{% + \csgdef{glo@\glsdetoklabel{##1}@prevcount}{##2}% + }% +% \end{macrocode} +% \cs{glsenableentrycount} may only be used once and only in the +% preamble. +% \begin{macrocode} + \let\glsenableentrycount\relax +} +\@onlypreamble\glsenableentrycount +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@increment@currcount} +%\changes{4.14}{2015-02-28}{new} +% \begin{macrocode} +\newcommand*{\@gls@increment@currcount}[1]{% + \csxdef{glo@\glsdetoklabel{#1}@currcount}{% + \number\numexpr\glsentrycurrcount{#1}+1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@local@increment@currcount} +%\changes{4.14}{2015-02-28}{new} +% \begin{macrocode} +\newcommand*{\@gls@local@increment@currcount}[1]{% + \csedef{glo@\glsdetoklabel{#1}@currcount}{% + \number\numexpr\glsentrycurrcount{#1}+1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@write@entrycounts} +%\changes{4.14}{2015-02-28}{new} +% Write the entry counts to the aux file. Use \cs{immediate} since +% this occurs right at the end of the document. Only write +% information for entries that have been used. (Some users have a +% file containing vast numbers of entries, many of which may not be +% used. There's no point writing information about the entries that +% haven't been used and it will only slow things down.) +% \begin{macrocode} +\newcommand*{\@gls@write@entrycounts}{% + \immediate\write\@auxout + {\string\providecommand*{\string\@gls@entry@count}[2]{}}% + \forallglsentries{\@glsentry}{% + \ifglsused{\@glsentry}% + {\immediate\write\@auxout + {\string\@gls@entry@count{\@glsentry}{\glsentrycurrcount{\@glsentry}}}}% + {}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@entry@count} +%\changes{4.14}{2015-02-28}{new} +% Default behaviour is to ignore arguments. Activated by +% \cs{glsenableentrycount}. +% \begin{macrocode} +\newcommand*{\@gls@entry@count}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cgls} +%\changes{4.14}{2015-02-28}{new} +% Define command that works like \cs{gls} but behaves differently if +% the entry count function is enabled. (If not enabled, it behaves +% the same as \cs{gls} but issues a warning.) +% \begin{macrocode} +\newrobustcmd*{\cgls}{\@gls@hyp@opt\@cgls} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cgls} +%\changes{4.14}{2015-02-28}{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{4.14}{2015-02-28}{new} +% Read in the final optional argument. This defaults to same behaviour +% as \cs{gls} but issues a warning. +% \begin{macrocode} +\def\@cgls@#1#2[#3]{% + \GlossariesWarning{\string\cgls\space is defaulting to + \string\gls\space since you haven't enabled entry counting}% + \@gls@{#1}{#2}[#3]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cglsformat} +%\changes{4.14}{2015-02-28}{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]{% + \ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGls} +%\changes{4.14}{2015-02-28}{new} +% Define command that works like \cs{Gls} but behaves differently if +% the entry count function is enabled. (If not enabled, it behaves +% the same as \cs{Gls} but issues a warning.) +% \begin{macrocode} +\newrobustcmd*{\cGls}{\@gls@hyp@opt\@cGls} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGls} +%\changes{4.14}{2015-02-28}{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{4.14}{2015-02-28}{new} +% Read in the final optional argument. This defaults to same behaviour +% as \cs{Gls} but issues a warning. +% \begin{macrocode} +\def\@cGls@#1#2[#3]{% + \GlossariesWarning{\string\cGls\space is defaulting to + \string\Gls\space since you haven't enabled entry counting}% + \@Gls@{#1}{#2}[#3]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGlsformat} +%\changes{4.14}{2015-02-28}{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]{% + \ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cglspl} +%\changes{4.14}{2015-02-28}{new} +% Define command that works like \cs{glspl} but behaves differently if +% the entry count function is enabled. (If not enabled, it behaves +% the same as \cs{glspl} but issues a warning.) +% \begin{macrocode} +\newrobustcmd*{\cglspl}{\@gls@hyp@opt\@cglspl} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cglspl} +%\changes{4.14}{2015-02-28}{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{4.14}{2015-02-28}{new} +% Read in the final optional argument. This defaults to same behaviour +% as \cs{glspl} but issues a warning. +% \begin{macrocode} +\def\@cglspl@#1#2[#3]{% + \GlossariesWarning{\string\cglspl\space is defaulting to + \string\glspl\space since you haven't enabled entry counting}% + \@glspl@{#1}{#2}[#3]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cglsplformat} +%\changes{4.14}{2015-02-28}{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]{% + \ifglshaslong{#1}{\glsentrylongpl{#1}}{\glsentryfirstplural{#1}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGlspl} +%\changes{4.14}{2015-02-28}{new} +% Define command that works like \cs{Glspl} but behaves differently if +% the entry count function is enabled. (If not enabled, it behaves +% the same as \cs{Glspl} but issues a warning.) +% \begin{macrocode} +\newrobustcmd*{\cGlspl}{\@gls@hyp@opt\@cGlspl} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cglspl} +%\changes{4.14}{2015-02-28}{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{4.14}{2015-02-28}{new} +% Read in the final optional argument. This defaults to same behaviour +% as \cs{Glspl} but issues a warning. +% \begin{macrocode} +\def\@cGlspl@#1#2[#3]{% + \GlossariesWarning{\string\cGlspl\space is defaulting to + \string\Glspl\space since you haven't enabled entry counting}% + \@Glspl@{#1}{#2}[#3]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGlsplformat} +%\changes{4.14}{2015-02-28}{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]{% + \ifglshaslong{#1}{\Glsentrylongpl{#1}}{\Glsentryfirstplural{#1}}#2% +} +% \end{macrocode} +%\end{macro} +% +% \section{Loading files containing glossary entries} +%\label{sec:load} +% Glossary entries can be defined in an external file. +% These external files can contain \ics{newglossaryentry} +% and \ics{newacronym} commands.\footnote{and any other valid +%\LaTeX\ code that can be used in the preamble.} +%\begin{definition} +% \cs{loadglsentries}\oarg{type}\marg{filename} +%\end{definition} +% This command will input the file using \cs{input}. +% The optional argument specifies to which glossary the +% entries should be assigned if they haven't used the \gloskey{type} +% key. If the optional argument is not specified, the default +% glossary is used. Only those entries used in the document (via +% \ics{glslink}, \ics{gls}, \ics{glspl} and uppercase +% variants or \ics{glsadd} and \ics{glsaddall} +% will appear in the glossary). The mandatory argument is +% the filename (with or without .tex extension). +%\begin{macro}{\loadglsentries} +% \begin{macrocode} +\newcommand*{\loadglsentries}[2][\@gls@default]{% + \let\@gls@default\glsdefaulttype + \def\glsdefaulttype{#1}\input{#2}% + \let\glsdefaulttype\@gls@default +} +% \end{macrocode} +%\end{macro} +% \cs{loadglsentries} can only be used in the preamble: +% \begin{macrocode} +\@onlypreamble{\loadglsentries} +% \end{macrocode} +% +%\section{Using glossary entries in the text} +%\label{sec:code:glslink} +% +% Any term that has been defined using \ics{newglossaryentry} +% (or \ics{newacronym}) can be displayed in the text +% (i.e.\ outside of the glossary) using +% one of the commands defined in this section. Unless you use +% \ics{glslink}, the way the term appears in the text is +% determined by \ics{glsdisplayfirst} (if it is the first +% time the term has been used) or \ics{glsdisplay} (for +% subsequent use). Any formatting commands (such as \cs{textbf} +% is governed by \ics{glstextformat}. By default this just +% displays the \term{link text} ``as is''. +%\changes{1.04}{2007-08-03}{Added \cs{glstextformat}}% +%\begin{macro}{\glstextformat} +% \begin{macrocode} +\newcommand*{\glstextformat}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryfmt} +% As from version 3.11a, the way in which an entry is displayed is now +% governed by \cs{glsentryfmt}. This doesn't take any arguments. The +% required information is set by commands like \cs{gls}. +% To ensure backward compatibility, the default use the old +% \cs{glsdisplay} and \cs{glsdisplayfirst} style of commands +% \begin{macrocode} +\newcommand*{\glsentryfmt}{% + \@@gls@default@entryfmt\glsdisplayfirst\glsdisplay +} +% \end{macrocode} +% Format that provides backwards compatibility: +% \begin{macrocode} +\newcommand*{\@@gls@default@entryfmt}[2]{% + \ifdefempty\glscustomtext + {% + \glsifplural + {% +% \end{macrocode} +% Plural form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + #2{\glsentryplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glsentryfirstplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use. (Expansion was used in version 3.07 and below +% in case the name wasn't the first thing to be displayed, but now +% the user can sort out the upper casing in \ics{defglsentryfmt}, +% which avoids the issues caused by fragile commands.) +% \begin{macrocode} + \ifbool{glscompatible-3.07}% + {% + \protected@edef\@glo@etext{% + #2{\glsentryplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}}% + \xmakefirstuc\@glo@etext + }% + {% + #2{\Glsentryplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}% + }% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \ifbool{glscompatible-3.07}% + {% + \protected@edef\@glo@etext{% + #1{\glsentryfirstplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}}% + \xmakefirstuc\@glo@etext + }% + {% + #1{\Glsentryfirstplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}% + }% + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \mfirstucMakeUppercase{#2{\glsentryplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \mfirstucMakeUppercase{#1{\glsentryfirstplural{\glslabel}}% + {\glsentrydescplural{\glslabel}}% + {\glsentrysymbolplural{\glslabel}}{\glsinsert}}% + }% + }% + }% + {% +% \end{macrocode} +% Singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + #2{\glsentrytext{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glsentryfirst{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \ifbool{glscompatible-3.07}% + {% + \protected@edef\@glo@etext{% + #2{\glsentrytext{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}}% + \xmakefirstuc\@glo@etext + }% + {% + #2{\Glsentrytext{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}% + }% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \ifbool{glscompatible-3.07}% + {% + \protected@edef\@glo@etext{% + #1{\glsentryfirst{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}}% + \xmakefirstuc\@glo@etext + }% + {% + #1{\Glsentryfirst{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}% + }% + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \mfirstucMakeUppercase{#2{\glsentrytext{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \mfirstucMakeUppercase{#1{\glsentryfirst{\glslabel}}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{\glsinsert}}% + }% + }% + }% + }% + {% +% \end{macrocode} +% Custom text provided in \cs{glsdisp} +% \begin{macrocode} + \ifglsused{\glslabel}% + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + #2{\glscustomtext}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glscustomtext}% + {\glsentrydesc{\glslabel}}% + {\glsentrysymbol{\glslabel}}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgenentryfmt} +% Define a generic format that just uses the first, text, plural or +% first plural keys (or the custom text) with the insert text appended. +%\changes{3.11a}{2013-10-15}{new} +% \begin{macrocode} +\newcommand*{\glsgenentryfmt}{% + \ifdefempty\glscustomtext + {% + \glsifplural + {% +% \end{macrocode} +% Plural form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \glsentryplural{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsentryfirstplural{\glslabel}\glsinsert + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use. +% \begin{macrocode} + \Glsentryplural{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \Glsentryfirstplural{\glslabel}\glsinsert + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsentryplural{\glslabel}\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsentryfirstplural{\glslabel}\glsinsert}% + }% + }% + }% + {% +% \end{macrocode} +% Singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \glsentrytext{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsentryfirst{\glslabel}\glsinsert + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \Glsentrytext{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \Glsentryfirst{\glslabel}\glsinsert + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \mfirstucMakeUppercase{\glsentrytext{\glslabel}\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \mfirstucMakeUppercase{\glsentryfirst{\glslabel}\glsinsert}% + }% + }% + }% + }% + {% +% \end{macrocode} +% Custom text provided in \cs{glsdisp}. (The insert is most likely +% to be empty at this point.) +% \begin{macrocode} + \glscustomtext\glsinsert + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgenacfmt} +%\changes{4.02}{2013-12-05}{new} +% Define a generic acronym format that uses the \gloskey{long} and +% \gloskey{short} keys (or their plurals) and \ics{acrfullformat}, +% \ics{firstacronymfont} and \ics{acronymfont}. +% \begin{macrocode} +\newcommand*{\glsgenacfmt}{% + \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} + \acronymfont{\glsentryshortpl{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent plural form, make first letter upper case: +% \begin{macrocode} + \acronymfont{\Glsentryshortpl{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\acronymfont{\glsentryshortpl{\glslabel}}\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Subsequent singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Subsequent singular form, don't adjust case: +% \begin{macrocode} + \acronymfont{\glsentryshort{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, make first letter upper case: +% \begin{macrocode} + \acronymfont{\Glsentryshort{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\acronymfont{\glsentryshort{\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} + \genplacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, make first letter upper case: +% \begin{macrocode} + \Genplacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\genplacrfullformat{\glslabel}{\glsinsert}}% + }% + }% + {% +% \end{macrocode} +% First use singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% First use singular form, don't adjust case: +% \begin{macrocode} + \genacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, make first letter upper case: +% \begin{macrocode} + \Genacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\genacrfullformat{\glslabel}{\glsinsert}}% + }% + }% + }% + }% + {% +% \end{macrocode} +% User supplied text. +% \begin{macrocode} + \glscustomtext + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\genacrfullformat} +%\changes{4.02}{2013-12-05}{new} +%\begin{definition} +%\cs{genacrfullformat}\marg{label}\marg{insert} +%\end{definition} +% The full format used by \cs{glsgenacfmt} (singular). +% \begin{macrocode} +\newcommand*{\genacrfullformat}[2]{% + \glsentrylong{#1}#2\space + (\protect\firstacronymfont{\glsentryshort{#1}})% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Genacrfullformat} +%\changes{4.02}{2013-12-05}{new} +%\begin{definition} +%\cs{Genacrfullformat}\marg{label}\marg{insert} +%\end{definition} +% As above but makes the first letter upper case. +% \begin{macrocode} +\newcommand*{\Genacrfullformat}[2]{% + \protected@edef\gls@text{\genacrfullformat{#1}{#2}}% + \xmakefirstuc\gls@text +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\genplacrfullformat} +%\changes{4.02}{2013-12-05}{new} +%\begin{definition} +%\cs{genplacrfullformat}\marg{label}\marg{insert} +%\end{definition} +% The full format used by \cs{glsgenacfmt} (plural). +% \begin{macrocode} +\newcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{#1}#2\space + (\protect\firstacronymfont{\glsentryshortpl{#1}})% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Genplacrfullformat} +%\changes{4.02}{2013-12-05}{new} +%\begin{definition} +%\cs{Genplacrfullformat}\marg{label}\marg{insert} +%\end{definition} +% As above but makes the first letter upper case. +% \begin{macrocode} +\newcommand*{\Genplacrfullformat}[2]{% + \protected@edef\gls@text{\genplacrfullformat{#1}{#2}}% + \xmakefirstuc\gls@text +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdisplayfirst} +% Deprecated. Kept for backward compatibility. +%\changes{3.11a}{2013-10-15}{obsoleted} +% \begin{macrocode} +\newcommand*{\glsdisplayfirst}[4]{#1#4} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdisplay} +% Deprecated. Kept for backward compatibility. +%\changes{3.11a}{2013-10-15}{obsoleted} +% \begin{macrocode} +\newcommand*{\glsdisplay}[4]{#1#4} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\defglsdisplay} +%\changes{3.11a}{2013-10-15}{obsoleted} +% Deprecated. Kept for backward compatibility. +% \begin{macrocode} +\newcommand*{\defglsdisplay}[2][\glsdefaulttype]{% + \GlossariesWarning{\string\defglsdisplay\space is now obsolete.^^J + Use \string\defglsentryfmt\space instead}% + \expandafter\def\csname gls@#1@display\endcsname##1##2##3##4{#2}% + \edef\@gls@doentrydef{% + \noexpand\defglsentryfmt[#1]{% + \noexpand\ifcsdef{gls@#1@displayfirst}% + {% + \noexpand\@@gls@default@entryfmt + {\noexpand\csuse{gls@#1@displayfirst}}% + {\noexpand\csuse{gls@#1@display}}% + }% + {% + \noexpand\@@gls@default@entryfmt + {\noexpand\glsdisplayfirst}% + {\noexpand\csuse{gls@#1@display}}% + }% + }% + }% + \@gls@doentrydef +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\defglsdisplayfirst} +% Deprecated. Kept for backward compatibility. +%\changes{3.11a}{2013-10-15}{obsoleted} +% \begin{macrocode} +\newcommand*{\defglsdisplayfirst}[2][\glsdefaulttype]{% + \GlossariesWarning{\string\defglsdisplayfirst\space is now obsolete.^^J + Use \string\defglsentryfmt\space instead}% + \expandafter\def\csname gls@#1@displayfirst\endcsname##1##2##3##4{#2}% + \edef\@gls@doentrydef{% + \noexpand\defglsentryfmt[#1]{% + \noexpand\ifcsdef{gls@#1@display}% + {% + \noexpand\@@gls@default@entryfmt + {\noexpand\csuse{gls@#1@displayfirst}}% + {\noexpand\csuse{gls@#1@display}}% + }% + {% +% \end{macrocode} +%\changes{4.04}{2014-03-06}{fixed unwanted space} +% \begin{macrocode} + \noexpand\@@gls@default@entryfmt + {\noexpand\csuse{gls@#1@displayfirst}}% + {\noexpand\glsdisplay}% + }% + }% + }% + \@gls@doentrydef +} +% \end{macrocode} +%\end{macro} +% +%\subsubsection{Links to glossary entries} +% The links to glossary entries all have a first optional +% argument that can be used to change the format and counter +% of the associated entry number. Except for \cs{glslink} +% and \cs{glsdisp}, +% the commands like \cs{gls} have a final optional +% argument that can be used to insert additional text in the +% link (this will usually be appended, but can be redefined using +% \ics{defglsentryfmt}). +% It goes against the \LaTeX\ norm to have an optional +% argument after the mandatory arguments, but it makes more +% sense to write, say, \verb|\gls{label}['s]| rather than, say, +% \verb|\gls[append='s]{label}|. Since these control sequences +% are defined to include the final square bracket, spaces +% will be ignored after them. This is likely to lead to +% confusion as most users would not expect, say, "\gls{"\meta{label}"}" +% to ignore following spaces, so \cs{new@ifnextchar} from the +% \isty{amsgen} package is required. +% +% The following keys can be used in the first optional +% argument. The \gloskey[glslink]{counter} key checks that the +% value is the name of a valid counter. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\define@key{glslink}{counter}{% + \ifcsundef{c@#1}% + {% + \PackageError{glossaries}% + {There is no counter called `#1'}% + {% + The counter key should have the name of a valid counter + as its value% + }% + }% + {% + \def\@gls@counter{#1}% + }% +} +% \end{macrocode} +% The value of the \gloskey[glslink]{format} key should be the name of a +% command (without the initial backslash) that has a single mandatory +% argument which can be used to format the associated entry +% number. +% \begin{macrocode} +\define@key{glslink}{format}{% + \def\@glsnumberformat{#1}} +% \end{macrocode} +% The \gloskey[glslink]{hyper} key is a boolean key, it can either have the +% value true or false, and indicates whether or not to make a +% hyperlink to the relevant glossary entry. If hyper is false, an +% entry will still be made in the glossary, but the given text +% won't be a hyperlink. +% \begin{macrocode} +\define@boolkey{glslink}{hyper}[true]{} +% \end{macrocode} +%\changes{4.08}{2014-07-30}{explicitly initialise hyper key} +% Initialise hyper key. +% \begin{macrocode} +\ifdef{\hyperlink}{\KV@glslink@hypertrue}{\KV@glslink@hyperfalse} +% \end{macrocode} +%\changes{3.04}{2012-11-18}{added local key} +% The \gloskey[glslink]{local} key is a boolean key. If true this +% indicates that commands such as \ics{gls} should only do a local +% reset rather than a global one. +% \begin{macrocode} +\define@boolkey{glslink}{local}[true]{} +% \end{macrocode} +% +% The original \cs{glsifhyper} command isn't particularly useful +% as it makes more sense to check the actual hyperlink setting +% rather than testing whether the starred or unstarred version +% has been used. Therefore, as from version 4.08, \cs{glsifhyper} +% is deprecated in favour of \ics{glsifhyperon}. In case there is +% a particular need to know whether the starred or unstarred version +% was used, provide a new command that determines whether the +% *-version, +-version or unmodified version was used. +%\begin{definition} +%\cs{glslinkvar}\marg{unmodified case}\marg{star case}\marg{plus case} +%\end{definition} +%\begin{macro}{\glslinkvar} +%\changes{4.08}{2014-07-30}{new} +% Initialise to unmodified case. +% \begin{macrocode} +\newcommand*{\glslinkvar}[3]{#1} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsifhyper} +% Now deprecated. +%\changes{4.08}{2014-07-30}{deprecated} +% \begin{macrocode} +\newcommand*{\glsifhyper}[2]{% + \glslinkvar{#1}{#2}{#1}% + \GlossariesWarning{\string\glsifhyper\space is deprecated. Did + you mean \string\glsifhyperon\space or \string\glslinkvar?}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@hyp@opt} +% Used by the commands such as \cs{glslink} to determine whether to +% modify the hyper option. +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\@gls@hyp@opt}[1]{% + \let\glslinkvar\@firstofthree + \let\@gls@hyp@opt@cs#1\relax + \@ifstar{\s@gls@hyp@opt}% + {\@ifnextchar+{\@firstoftwo{\p@gls@hyp@opt}}{#1}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\s@gls@hyp@opt} +% Starred version +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\s@gls@hyp@opt}[1][]{% + \let\glslinkvar\@secondofthree + \@gls@hyp@opt@cs[hyper=false,#1]} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\p@gls@hyp@opt} +% Plus version +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\p@gls@hyp@opt}[1][]{% + \let\glslinkvar\@thirdofthree + \@gls@hyp@opt@cs[hyper=true,#1]} +% \end{macrocode} +%\end{macro} +% +%Syntax: +%\begin{definition} +% \cs{glslink}\oarg{options}\marg{label}\marg{text} +%\end{definition} +% Display \meta{text} in the document, and add the entry information +% for \meta{label} into the relevant glossary. The optional +% argument should be a key value list using the \texttt{glslink} +% keys defined above. +% +% There is also a starred version: +%\begin{definition} +% \cs{glslink*}\oarg{options}\marg{label}\marg{text} +%\end{definition} +% which is equivalent to +% \cs{glslink}"[hyper=false,"\meta{options}"]"\marg{label}\marg{text} +% +% First determine which version is being used: +%\begin{macro}{\glslink} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glslink}{% + \@gls@hyp@opt\@gls@@link +} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sgls@link}} +%\begin{macro}{\@gls@@link} +%\changes{2.03}{2009-09-23}{new} +% The main part of the business is in \cs{@gls@link} +% which shouldn't check if the term is defined as it's called by +% \cs{gls} etc which also perform that check. +% \begin{macrocode} +\newcommand*{\@gls@@link}[3][]{% + \glsdoifexistsordo{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax + \@gls@link[#1]{#2}{#3}% + }{% +% \end{macrocode} +% Display the specified text. (The entry doesn't exist so +% there's nothing to link it to.) +% \begin{macrocode} + \glstextformat{#3}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspostlinkhook} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand*{\glspostlinkhook}{} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\@gls@link@checkfirsthyper} +% Check for first use and switch off \gloskey[glslink]{hyper} key +% if hyperlink not wanted. (Should be off if first use and +% hyper=false is on or if first use and both the entry is in an acronym +% list and the acrfootnote setting is on.) +% This assumes the glossary type is stored in \cs{glstype} and the +% label is stored in \cs{glslabel}. +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\@gls@link@checkfirsthyper}{% + \ifglsused{\glslabel}% + {% + }% + {% + \gls@checkisacronymlist\glstype + \ifglshyperfirst + \if@glsisacronymlist + \ifglsacrfootnote + \KV@glslink@hyperfalse + \fi + \fi + \else + \KV@glslink@hyperfalse + \fi + }% +% \end{macrocode} +% Allow user to hook into this +% \begin{macrocode} + \glslinkcheckfirsthyperhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslinkcheckfirsthyperhook} +% Allow used to hook into the \cs{@gls@link@checkfirsthyper} macro +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\glslinkcheckfirsthyperhook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslinkpostsetkeys} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand*{\glslinkpostsetkeys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifhyperon} +%\changes{4.16}{2015-07-08}{moved definition of \cs{glsifhyperon}} +% Check the value of the \gloskey[glslink]{hyper} key: +% \begin{macrocode} +\newcommand{\glsifhyperon}[2]{\ifKV@glslink@hyper#1\else#2\fi} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\do@glsdisablehyperinlist} +% Disable hyperlink if in the ``nohyper'' list. +%\changes{4.19}{2015-11-22}{new} +% \begin{macrocode} +\newcommand*{\do@glsdisablehyperinlist}{% + \expandafter\DTLifinlist\expandafter{\glstype}{\@gls@nohyperlist}% + {\KV@glslink@hyperfalse}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@setdefault@glslink@opts} +% Hook to set default options for \cs{@glslink}. +%\changes{4.20}{2015-11-30}{new} +% \begin{macrocode} +\newcommand*{\@gls@setdefault@glslink@opts}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@link} +%\changes{1.07}{2007-09-13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon} +%\changes{1.15}{2008-08-15}{added \cs{glslabel}} +% \begin{macrocode} +\def\@gls@link[#1]#2#3{% +% \end{macrocode} +%\changes{2.03}{2009-09-23}{Moved entry existence check to +% avoid duplicate code} +% Inserting \cs{leavevmode} suggested by Donald~Arseneau (avoids +% problem with tabularx). +%\changes{2.03}{2009-09-23}{added \cs{leavevmode}} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} + \leavevmode + \edef\glslabel{\glsdetoklabel{#2}}% +% \end{macrocode} +% Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label} +%\changes{4.03}{2014-01-20}{moved \cs{@gls@link@opts} and +%\cs{@gls@link@label} to \cs{@gls@link}} +% \begin{macrocode} + \def\@gls@link@opts{#1}% + \let\@gls@link@label\glslabel +% \end{macrocode} +% \begin{macrocode} + \def\@glsnumberformat{glsnumberformat}% + \edef\@gls@counter{\csname glo@\glslabel @counter\endcsname}% +% \end{macrocode} +%\changes{3.05}{2013-04-21}{added check for ``nohypertypes''}% +%\changes{3.07}{2013-07-05}{fixed bug that failed to find entry in list}% +% If this is in one of the ``nohypertypes'' glossaries, suppress the +% hyperlink by default +%\changes{4.08}{2014-07-30}{renamed \cs{gls@type} to \cs{glstype}} +% \begin{macrocode} + \edef\glstype{\csname glo@\glslabel @type\endcsname}% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{removed redundancy} +% Save original setting +% \begin{macrocode} + \let\org@ifKV@glslink@hyper\ifKV@glslink@hyper +% \end{macrocode} +% Set defaults: +%\changes{4.20}{2015-11-30}{added \cs{@gls@setdefault@glslink@opts}} +% \begin{macrocode} + \@gls@setdefault@glslink@opts +% \end{macrocode} +% Switch off hyper setting if the glossary type has been identified +% in nohyperlist. +% \begin{macrocode} + \do@glsdisablehyperinlist +% \end{macrocode} +% Macros must set this before calling \cs{@gls@link}. The +% commands that check the first use flag should set this to +% \cs{@gls@link@checkfirsthyper} otherwise it should be set to +% \cs{relax}. +% \begin{macrocode} + \do@gls@link@checkfirsthyper + \setkeys{glslink}{#1}% +% \end{macrocode} +% Add a hook for the user to customise things after the keys have +% been set. +% \begin{macrocode} + \glslinkpostsetkeys +% \end{macrocode} +%\changes{4.16}{2015-07-08}{moved definition of \cs{glsifhyperon} +%outside of this macro} +% Store the entry's counter in \cs{theglsentrycounter} +%\changes{3.0}{2011-04-02}{added \cs{@gls@saveentrycounter}} +% \begin{macrocode} + \@gls@saveentrycounter +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added \cs{@gls@setsort}} +% Define sort key if necessary: +% \begin{macrocode} + \@gls@setsort{\glslabel}% +% \end{macrocode} +%\changes{2.01}{2009 May 30}{moved \cs{@do@wrglossary} before term is displayed +% to prevent unwanted whatsit} +% (De-tok'ing done by \cs{@@do@wrglossary}) +% \begin{macrocode} + \@do@wrglossary{#2}% + \ifKV@glslink@hyper + \@glslink{\glolinkprefix\glslabel}{\glstextformat{#3}}% + \else +% \end{macrocode} +%\changes{3.13a}{2013-11-05}{removed \cs{relax}} +%\changes{4.20}{2015-11-30}{added \cs{glsdonohyperlink} when hyperlink is +%suppressed} +% \begin{macrocode} + \glsdonohyperlink{\glolinkprefix\glslabel}{\glstextformat{#3}}% + \fi +% \end{macrocode} +% Restore original setting +% \begin{macrocode} + \let\ifKV@glslink@hyper\org@ifKV@glslink@hyper +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glolinkprefix} +% \begin{macrocode} +\newcommand*{\glolinkprefix}{glo:} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentrycounter} +% Set default value of entry counter +%\changes{3.02}{2012-05-21}{set default value} +% \begin{macrocode} +\def\glsentrycounter{\glscounter}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@saveentrycounter} +%\changes{3.0}{2011-04-02}{new} +% Need to check if using \ctr{equation} counter in \env{align} +% environment: +% \begin{macrocode} +\newcommand*{\@gls@saveentrycounter}{% + \def\@gls@Hcounter{}% +% \end{macrocode} +% Are we using \ctr{equation} counter? +% \begin{macrocode} + \ifthenelse{\equal{\@gls@counter}{equation}}% + { +% \end{macrocode} +% If we're in \env{align} environment, \cs{xatlevel@} will be defined. +% (Can't test for \cs{@currenvir} as may be inside an inner +% environment.) +% \begin{macrocode} + \ifcsundef{xatlevel@}% + {% + \edef\theglsentrycounter{\expandafter\noexpand + \csname the\@gls@counter\endcsname}% + }% + {% + \ifx\xatlevel@\@empty + \edef\theglsentrycounter{\expandafter\noexpand + \csname the\@gls@counter\endcsname}% + \else + \savecounters@ + \advance\c@equation by 1\relax + \edef\theglsentrycounter{\csname the\@gls@counter\endcsname}% +% \end{macrocode} +% Check if hyperref version of this counter +% \begin{macrocode} + \ifcsundef{theH\@gls@counter}% + {% + \def\@gls@Hcounter{\theglsentrycounter}% + }% + {% + \def\@gls@Hcounter{\csname theH\@gls@counter\endcsname}% + }% + \protected@edef\theHglsentrycounter{\@gls@Hcounter}% + \restorecounters@ + \fi + }% + }% + {% +% \end{macrocode} +% Not using \ctr{equation} counter so no special measures: +% \begin{macrocode} + \edef\theglsentrycounter{\expandafter\noexpand + \csname the\@gls@counter\endcsname}% + }% +% \end{macrocode} +% Check if hyperref version of this counter +% \begin{macrocode} + \ifx\@gls@Hcounter\@empty + \ifcsundef{theH\@gls@counter}% + {% + \def\theHglsentrycounter{\theglsentrycounter}% + }% + {% + \protected@edef\theHglsentrycounter{\expandafter\noexpand + \csname theH\@gls@counter\endcsname}% + }% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\changes{1.01}{2007-05-17}{Added range facility in format key}% +%\begin{macro}{\@set@glo@numformat} +% Set the formatting information in the format required by +% \app{makeindex}. The first argument is the format specified +% by the user (via the format key), the second argument is the +% name of the counter used to indicate the location, the third +% argument is a control sequence which stores the required format +% and the fourth argument (new to v3.0) is the hyper-prefix. +%\changes{3.0}{2010/03/31}{added 4th argument} +% \begin{macrocode} +\def\@set@glo@numformat#1#2#3#4{% + \expandafter\@glo@check@mkidxrangechar#3\@nil + \protected@edef#1{% + \@glo@prefix setentrycounter[#4]{#2}% + \expandafter\string\csname\@glo@suffix\endcsname + }% + \@gls@checkmkidxchars#1% +} +% \end{macrocode} +%\end{macro} +% Check to see if the given string starts with a ( or ). If it +% does set \cs{@glo@prefix} to the starting character, +% and \cs{@glo@suffix} to the rest (or "glsnumberformat" +% if there is nothing else), +% otherwise set \cs{@glo@prefix} to nothing and +% \cs{@glo@suffix} to all of it. +% \begin{macrocode} +\def\@glo@check@mkidxrangechar#1#2\@nil{% +\if#1(\relax + \def\@glo@prefix{(}% + \if\relax#2\relax + \def\@glo@suffix{glsnumberformat}% + \else + \def\@glo@suffix{#2}% + \fi +\else + \if#1)\relax + \def\@glo@prefix{)}% + \if\relax#2\relax + \def\@glo@suffix{glsnumberformat}% + \else + \def\@glo@suffix{#2}% + \fi + \else + \def\@glo@prefix{}\def\@glo@suffix{#1#2}% + \fi +\fi} +% \end{macrocode} +% +%\begin{macro}{\@gls@escbsdq} +% Escape backslashes and double quote marks. The argument must be +% a control sequence. +% \begin{macrocode} +\newcommand*{\@gls@escbsdq}[1]{% + \def\@gls@checkedmkidx{}% + \let\gls@xdystring=#1\relax + \@onelevel@sanitize\gls@xdystring + \edef\do@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash\gls@xdystring\noexpand\@nil + \@backslashchar\@backslashchar\noexpand\null}% + \do@gls@xdycheckbackslash + \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@xdycheckquote\gls@xdystring\@nil""\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}% +% \end{macrocode} +%\changes{3.04}{2012-11-18}{unsanitize \cs{gls@numberpage}, +%\cs{gls@alphpage}, \cs{gls@Alphpage} and \cs{gls@romanpage}} +% Unsanitize \cs{gls@numberpage}, \cs{gls@alphpage}, +% \cs{gls@Alphpage} and \cs{glsromanpage} (thanks to David~Carlise +% for the suggestion.) +% \begin{macrocode} + \@for\@gls@tmp:=\gls@protected@pagefmts\do + {% + \edef\@gls@sanitized@tmp{\expandafter\@gobble\string\\\expandonce\@gls@tmp}% + \@onelevel@sanitize\@gls@sanitized@tmp + \edef\gls@dosubst{% + \noexpand\DTLsubstituteall\noexpand\gls@xdystring + {\@gls@sanitized@tmp}{\expandonce\@gls@tmp}% + }% + \gls@dosubst + }% +% \end{macrocode} +% Assign to required control sequence +% \begin{macrocode} + \let#1=\gls@xdystring +} +% \end{macrocode} +%\end{macro} +% Catch special characters\mkidxspch\ (argument must be a +% control sequence): +%\begin{macro}{\@gls@checkmkidxchars} +% \begin{macrocode} +\newcommand{\@gls@checkmkidxchars}[1]{% + \ifglsxindy + \@gls@escbsdq{#1}% + \else + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkquote#1\@nil""\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkescquote#1\@nil\"\"\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkescactual#1\@nil\?\?\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkactual#1\@nil??\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkbar#1\@nil||\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checkescbar#1\@nil\|\|\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \def\@gls@checkedmkidx{}% + \expandafter\@gls@checklevel#1\@nil!!\null + \expandafter\@gls@updatechecked\@gls@checkedmkidx{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +% Update the control sequence and strip trailing \cs{@nil}: +%\begin{macro}{\@gls@updatechecked} +% \begin{macrocode} +\def\@gls@updatechecked#1\@nil#2{\def#2{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@tmpb} +%\changes{1.1}{2008-02-22}{changed \cs{toksdef} to \cs{newtoks}} +% Define temporary token +% \begin{macrocode} +\newtoks\@gls@tmpb +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checkquote} +% Replace \verb|"| with \verb|""| since \verb|"| is a makeindex +% special character\mkidxspch. +% \begin{macrocode} +\def\@gls@checkquote#1"#2"#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checkquote{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@quotechar\@gls@quotechar\@gls@quotechar}% + \def\@@gls@checkquote{\@gls@checkquote#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@quotechar}% + \ifx\null#3\null + \def\@@gls@checkquote{\@gls@checkquote#2""\null}% + \else + \def\@@gls@checkquote{\@gls@checkquote#2"#3\null}% + \fi + \fi + \@@gls@checkquote +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checkescquote} +% Do the same for \verb|\"|: +% \begin{macrocode} +\def\@gls@checkescquote#1\"#2\"#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checkescquote{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@quotechar + \@gls@quotechar\string\"\@gls@quotechar}% + \def\@@gls@checkescquote{\@gls@checkescquote#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@quotechar}% + \ifx\null#3\null + \def\@@gls@checkescquote{\@gls@checkescquote#2\"\"\null}% + \else + \def\@@gls@checkescquote{\@gls@checkescquote#2\"#3\null}% + \fi + \fi +\@@gls@checkescquote +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checkescactual} +% Similarly for \verb|\?| (which is replaces @ as +% \app{makeindex}'s special character): +% \begin{macrocode} +\def\@gls@checkescactual#1\?#2\?#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checkescactual{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@actualchar + \@gls@quotechar\string\"\@gls@actualchar}% + \def\@@gls@checkescactual{\@gls@checkescactual#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@actualchar}% + \ifx\null#3\null + \def\@@gls@checkescactual{\@gls@checkescactual#2\?\?\null}% + \else + \def\@@gls@checkescactual{\@gls@checkescactual#2\?#3\null}% + \fi + \fi +\@@gls@checkescactual +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checkescbar} +% Similarly for \verb"\|": +% \begin{macrocode} +\def\@gls@checkescbar#1\|#2\|#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checkescbar{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@encapchar + \@gls@quotechar\string\"\@gls@encapchar}% + \def\@@gls@checkescbar{\@gls@checkescbar#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@encapchar}% + \ifx\null#3\null + \def\@@gls@checkescbar{\@gls@checkescbar#2\|\|\null}% + \else + \def\@@gls@checkescbar{\@gls@checkescbar#2\|#3\null}% + \fi + \fi +\@@gls@checkescbar +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checkesclevel} +% Similarly for \verb"\!": +% \begin{macrocode} +\def\@gls@checkesclevel#1\!#2\!#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checkesclevel{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@levelchar + \@gls@quotechar\string\"\@gls@levelchar}% + \def\@@gls@checkesclevel{\@gls@checkesclevel#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\string\"\@gls@levelchar}% + \ifx\null#3\null + \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!\!\null}% + \else + \def\@@gls@checkesclevel{\@gls@checkesclevel#2\!#3\null}% + \fi + \fi +\@@gls@checkesclevel +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checkbar} +% and for \verb"|": +% \begin{macrocode} +\def\@gls@checkbar#1|#2|#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checkbar{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@encapchar\@gls@quotechar\@gls@encapchar}% + \def\@@gls@checkbar{\@gls@checkbar#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@encapchar}% + \ifx\null#3\null + \def\@@gls@checkbar{\@gls@checkbar#2||\null}% + \else + \def\@@gls@checkbar{\@gls@checkbar#2|#3\null}% + \fi + \fi + \@@gls@checkbar +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checklevel} +% and for \verb"!": +% \begin{macrocode} +\def\@gls@checklevel#1!#2!#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checklevel{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@levelchar\@gls@quotechar\@gls@levelchar}% + \def\@@gls@checklevel{\@gls@checklevel#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@levelchar}% + \ifx\null#3\null + \def\@@gls@checklevel{\@gls@checklevel#2!!\null}% + \else + \def\@@gls@checklevel{\@gls@checklevel#2!#3\null}% + \fi + \fi + \@@gls@checklevel +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@checkactual} +% and for \verb"?": +% \begin{macrocode} +\def\@gls@checkactual#1?#2?#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@checkactual{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@actualchar\@gls@quotechar\@gls@actualchar}% + \def\@@gls@checkactual{\@gls@checkactual#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@gls@quotechar\@gls@actualchar}% + \ifx\null#3\null + \def\@@gls@checkactual{\@gls@checkactual#2??\null}% + \else + \def\@@gls@checkactual{\@gls@checkactual#2?#3\null}% + \fi + \fi + \@@gls@checkactual +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdycheckquote} +% As before but for use with \app{xindy} +% \begin{macrocode} +\def\@gls@xdycheckquote#1"#2"#3\null{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#1}% + \ifx\null#2\null + \ifx\null#3\null + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@gls@xdycheckquote{\relax}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \string\"\string\"}% + \def\@@gls@xdycheckquote{\@gls@xdycheckquote#3\null}% + \fi + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \string\"}% + \ifx\null#3\null + \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2""\null}% + \else + \def\@@gls@xdycheckquote{\@gls@xdycheckquote#2"#3\null}% + \fi + \fi + \@@gls@xdycheckquote +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@xdycheckbackslash} +% Need to escape all backslashes for \app{xindy}. +% Define command that will define \cs{@gls@xdycheckbackslash} +% \begin{macrocode} +\edef\def@gls@xdycheckbackslash{% + \noexpand\def\noexpand\@gls@xdycheckbackslash##1\@backslashchar + ##2\@backslashchar##3\noexpand\null{% + \noexpand\@gls@tmpb=\noexpand\expandafter + {\noexpand\@gls@checkedmkidx}% + \noexpand\toks@={##1}% + \noexpand\ifx\noexpand\null##2\noexpand\null + \noexpand\ifx\noexpand\null##3\noexpand\null + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}% + \noexpand\def\noexpand\@@gls@xdycheckbackslash{\relax}% + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \@backslashchar\@backslashchar\@backslashchar\@backslashchar}% + \noexpand\def\noexpand\@@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash##3\noexpand\null}% + \noexpand\fi + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \@backslashchar\@backslashchar}% + \noexpand\ifx\noexpand\null##3\noexpand\null + \noexpand\def\noexpand\@@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash##2\@backslashchar + \@backslashchar\noexpand\null}% + \noexpand\else + \noexpand\def\noexpand\@@gls@xdycheckbackslash{% + \noexpand\@gls@xdycheckbackslash##2\@backslashchar + ##3\noexpand\null}% + \noexpand\fi + \noexpand\fi + \noexpand\@@gls@xdycheckbackslash + }% +} +% \end{macrocode} +% Now go ahead and define \cs{@gls@xdycheckbackslash} +% \begin{macrocode} +\def@gls@xdycheckbackslash +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\glsdohypertarget} +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newlength\gls@tmplen +\newcommand*{\glsdohypertarget}[2]{% + \@glsshowtarget{#1}% + \settoheight{\gls@tmplen}{#2}% + \raisebox{\gls@tmplen}{\hypertarget{#1}{}}#2% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsdohyperlink} +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\glsdohyperlink}[2]{% + \@glsshowtarget{#1}% + \hyperlink{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdonohyperlink} +%\changes{4.20}{2015-11-30}{new} +% \begin{macrocode} +\newcommand*{\glsdonohyperlink}[2]{#2} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslink} +% If \ics{hyperlink} is not defined \cs{@glslink} +% ignores its first argument and just does the second argument, +% otherwise it is equivalent to \ics{hyperlink}. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifcsundef{hyperlink}% +{% + \let\@glslink\glsdonohyperlink +}% +{% + \let\@glslink\glsdohyperlink +} +% \end{macrocode} +%\end{macro} +%\changes{1.12}{2008-03-08}{added check for \cs{hypertarget} separate +% to \cs{hyperlink} (memoir defines \cs{hyperlink} but not +% \cs{hypertarget})} +%\begin{macro}{\@glstarget} +% If \ics{hypertarget} is not defined, \cs{@glstarget} +% ignores its first argument and just does the second argument, +% otherwise it is equivalent to \ics{hypertarget}. +%\changes{1.16}{2008-08-27}{raised the hypertarget so the target text doesn't +% scroll off the top of the page} +% \begin{macrocode} +\ifcsundef{hypertarget}% +{% + \let\@glstarget\@secondoftwo +}% +{% + \let\@glstarget\glsdohypertarget +} +% \end{macrocode} +%\end{macro} +% +% Glossary hyperlinks can be disabled using \cs{glsdisablehyper} +% (effect can be localised): +%\begin{macro}{\glsdisablehyper} +%\changes{4.08}{2014-07-30}{added \cs{KV@glslink@hyperfalse} +% to definition} +% \begin{macrocode} +\newcommand{\glsdisablehyper}{% + \KV@glslink@hyperfalse + \let\@glslink\glsdonohyperlink + \let\@glstarget\@secondoftwo +} +% \end{macrocode} +%\end{macro} +% Glossary hyperlinks can be enabled using \cs{glsenablehyper} +% (effect can be localised): +%\begin{macro}{\glsenablehyper} +%\changes{4.08}{2014-07-30}{added \cs{KV@glslink@hypertrue} +% to definition} +% \begin{macrocode} +\newcommand{\glsenablehyper}{% + \KV@glslink@hypertrue + \let\@glslink\glsdohyperlink + \let\@glstarget\glsdohypertarget +} +% \end{macrocode} +%\end{macro} +% +% +% Provide some convenience commands if not already defined: +%\changes{4.08}{2014-07-30}{removed \cs{@thirdofthree} (defined in kernel)} +% \begin{macrocode} +\providecommand{\@firstofthree}[3]{#1} +\providecommand{\@secondofthree}[3]{#2} +% \end{macrocode} +% +%Syntax: +%\begin{definition} +% \cs{gls}\oarg{options}\marg{label}\oarg{insert text} +%\end{definition} +% Link to glossary entry using singular form. The link text +% is taken from the value of the \gloskey{text} or \gloskey{first} +% keys used when the entry was defined. +% +% The first optional argument is a key-value list, the same as +% \ics{glslink}\igloskey[glslink]{hyper}\igloskey[glslink]{format}\igloskey[glslink]{counter}, +% the mandatory argument is the entry label. +% After the mandatory argument, there is another optional argument +% to insert extra text in the link text (the location of the inserted +% text is governed by \ics{glsdisplay} and +% \ics{glsdisplayfirst}). As with \cs{glslink} +% there is a starred version which is the same as the unstarred +% version but with the \gloskey[glslink]{hyper} key set to \texttt{false}. +% (Additional options can also be specified +% in the first optional argument.) +% +% First determine which version is being used: +%\begin{macro}{\gls} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\gls}{\@gls@hyp@opt\@gls} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sgls}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +%\begin{macro}{\@gls} +% \begin{macrocode} +\newcommand*{\@gls}[2][]{% + \new@ifnextchar[{\@gls@{#1}{#2}}{\@gls@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@gls@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glscustomtext\@empty + \def\glsinsert{#3}% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Determine what the link text should be (this is stored in +% \cs{@glo@text}) +%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style +%commands} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% +% \end{macrocode} +% Call \cs{@gls@link}. +% If \pkgopt{footnote} package option has been used and the glossary +% type is \cs{acronymtype}, suppress +% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst} +% package option is used. +%\changes{1.16}{2008-08-27}{Test glossary type is +%\cs{acronymtype} in addition to +%checking if footnote option has been used} +%\changes{2.03}{2009-09-23}{Added check for hyperfirst} +%\changes{2.04}{2009-11-10}{Changed test to check if glossary type +%has been identified as a list of acronyms} +%\changes{4.08}{2014-07-30}{moved check for first use to +%\cs{@gls@link}} +% \begin{macrocode} + \@gls@link[#1]{#2}{\@glo@text}% +% \end{macrocode} +% Indicate that this entry has now been used +% \begin{macrocode} + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% \cs{Gls} behaves like \cs{gls}, but the first letter +% of the link text is converted to uppercase (note that if the +% first letter has an accent, the accented letter will need to +% be grouped when you define the entry). It is mainly intended +% for terms that start a sentence: +%\begin{macro}{\Gls} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Gls}{\@gls@hyp@opt\@Gls} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGls}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Gls}[2][]{% + \new@ifnextchar[{\@Gls@{#1}{#2}}{\@Gls@{#1}{#2}[]}% +} +% \end{macrocode} +%\begin{macro}{\@Gls@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Gls@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper +% \end{macrocode} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +%\changes{3.11a}{2013-10-15}{add \cs{glsifplural}, +% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glscustomtext\@empty + \def\glsinsert{#3}% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved check for first use to +%\cs{@gls@link}} +% Determine what the link text should be (this is stored in +% \cs{@glo@text}) +%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style +%commands} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% +% \end{macrocode} +% Call \cs{@gls@link} +% If \pkgopt{footnote} package option has been used and the glossary +% type is \cs{acronymtype}, suppress +% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst} +% package option is used. +%\changes{1.16}{2008-08-27}{Test glossary type is +%\cs{acronymtype} in addition to +%checking if footnote option has been used} +%\changes{2.03}{2009-09-23}{Added check for hyperfirst} +%\changes{2.04}{2009-11-10}{Changed test to check if glossary type +%has been identified as a list of acronyms} +%\changes{3.11a}{2013-10-15}{removed \cs{makefirstuc} (now dealt +%with in \cs{glsentryfmt})} +% \begin{macrocode} + \@gls@link[#1]{#2}{\@glo@text}% +% \end{macrocode} +% Indicate that this entry has now been used +% \begin{macrocode} + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% \cs{GLS} behaves like \ics{gls}, but the link +% text is converted to uppercase: +%\changes{3.01}{2011-04-12}{made robust} +%\begin{macro}{\GLS} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLS}{\@gls@hyp@opt\@GLS} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLS}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLS}[2][]{% + \new@ifnextchar[{\@GLS@{#1}{#2}}{\@GLS@{#1}{#2}[]}% +} +% \end{macrocode} +%\begin{macro}{\@GLS@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLS@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper +% \end{macrocode} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glscustomtext\@empty + \def\glsinsert{#3}% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved check for first use to +%\cs{@gls@link}} +% Determine what the link text should be (this is stored in +% \cs{@glo@text}). +%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style +%commands} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% +% \end{macrocode} +% Call \cs{@gls@link} +% If \pkgopt{footnote} package option has been used and the glossary +% type is \cs{acronymtype}, suppress +% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst} +% package option is used. +%\changes{1.16}{2008-08-27}{Test glossary type is +%\cs{acronymtype} in addition to +%checking if footnote option has been used} +%\changes{2.03}{2009-09-23}{Added check for hyperfirst} +%\changes{2.04}{2009-11-10}{Changed test to check if glossary type +%has been identified as a list of acronyms} +%\changes{3.11a}{2013-10-15}{removed \cs{MakeUppercase} (now moved +%to \cs{glsentryfmt})} +% \begin{macrocode} + \@gls@link[#1]{#2}{\@glo@text}% +% \end{macrocode} +% Indicate that this entry has now been used +% \begin{macrocode} + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% \cs{glspl} behaves in the same way as \ics{gls} except +% it uses the plural form. +%\begin{macro}{\glspl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glspl}{\@gls@hyp@opt\@glspl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglspl}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glspl}[2][]{% + \new@ifnextchar[{\@glspl@{#1}{#2}}{\@glspl@{#1}{#2}[]}% +} +% \end{macrocode} +%\begin{macro}{\@glspl@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glspl@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper +% \end{macrocode} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}} +% \begin{macrocode} + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glscustomtext\@empty + \def\glsinsert{#3}% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved check for first use to +%\cs{@gls@link}} +% Determine what the link text should be (this is stored in +% \cs{@glo@text}) +%\changes{1.12}{2008-03-08}{now uses \cs{glsentrydescplural} and +% \cs{glsentrysymbolplural} instead of \cs{glsentrydesc} and +% \cs{glsentrysymbol}} +%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style +%commands} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% +% \end{macrocode} +% Call \cs{@gls@link}. +% If \pkgopt{footnote} package option has been used and the glossary +% type is \cs{acronymtype}, suppress +% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst} +% package option is used. +%\changes{1.16}{2008-08-27}{Test glossary type is +%\cs{acronymtype} in addition to +%checking if footnote option has been used} +%\changes{2.03}{2009-09-23}{Added check for hyperfirst} +%\changes{2.04}{2009-11-10}{Changed test to check if glossary type +%has been identified as a list of acronyms} +% \begin{macrocode} + \@gls@link[#1]{#2}{\@glo@text}% +% \end{macrocode} +% Indicate that this entry has now been used +% \begin{macrocode} + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% \cs{Glspl} behaves in the same way as \ics{glspl}, except +% that the first letter of the link text is converted to uppercase +% (as with \ics{Gls}, if the first letter has an accent, it +% will need to be grouped). +%\begin{macro}{\Glspl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glspl}{\@gls@hyp@opt\@Glspl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlspl}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glspl}[2][]{% + \new@ifnextchar[{\@Glspl@{#1}{#2}}{\@Glspl@{#1}{#2}[]}% +} +% \end{macrocode} +%\begin{macro}{\@Glspl@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glspl@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper +% \end{macrocode} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +%\changes{3.11a}{2013-10-15}{add \cs{glsifplural}, +% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}} +% \begin{macrocode} + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glscustomtext\@empty + \def\glsinsert{#3}% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved check for first use to +%\cs{@gls@link}} +% Determine what the link text should be (this is stored in +% \cs{@glo@text}). This needs to be expanded so that the +% \cs{@glo@text} can be passed to \cs{xmakefirstuc}. +%\changes{1.12}{2008-03-08}{now uses \cs{glsentrydescplural} and +% \cs{glsentrysymbolplural} instead of \cs{glsentrydesc} and +% \cs{glsentrysymbol}} +%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style +%commands} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% +% \end{macrocode} +% Call \cs{@gls@link}. +% If \pkgopt{footnote} package option has been used and the glossary +% type is \cs{acronymtype}, suppress +% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst} +% package option is used. +%\changes{1.16}{2008-08-27}{Test glossary type is +%\cs{acronymtype} in addition to +%checking if footnote option has been used} +%\changes{2.03}{2009-09-23}{Added check for hyperfirst} +%\changes{2.04}{2009-11-10}{Changed test to check if glossary type +%has been identified as a list of acronyms} +%\changes{3.11a}{2013-10-15}{removed \cs{makefirstuc} (now dealt +%with in \cs{glsentryfmt})} +% \begin{macrocode} + \@gls@link[#1]{#2}{\@glo@text}% +% \end{macrocode} +% Indicate that this entry has now been used +% \begin{macrocode} + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% \cs{GLSpl} behaves like \ics{glspl} except that all the +% link text is converted to uppercase. +%\begin{macro}{\GLSpl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSpl}{\@gls@hyp@opt\@GLSpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSpl}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSpl}[2][]{% + \new@ifnextchar[{\@GLSpl@{#1}{#2}}{\@GLSpl@{#1}{#2}[]}% +} +% \end{macrocode} +%\begin{macro}{\@GLSpl} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSpl@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper +% \end{macrocode} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}} +% \begin{macrocode} + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glscustomtext\@empty + \def\glsinsert{#3}% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved check for first use to +%\cs{@gls@link}} +% Determine what the link text should be (this is stored in +% \cs{@glo@text}) +%\changes{1.12}{2008-03-08}{now uses \cs{glsentrydescplural} and +% \cs{glsentrysymbolplural} instead of \cs{glsentrydesc} and +% \cs{glsentrysymbol}} +%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style +%commands} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% +% \end{macrocode} +% Call \cs{@gls@link}. +% If \pkgopt{footnote} package option has been used and the glossary +% type is \cs{acronymtype}, suppress +% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst} +% package option is used. +%\changes{1.16}{2008-08-27}{Test glossary type is +%\cs{acronymtype} in addition to +%checking if footnote option has been used} +%\changes{2.03}{2009-09-23}{Added check for hyperfirst} +%\changes{2.04}{2009-11-10}{Changed test to check if glossary type +%has been identified as a list of acronyms} +%\changes{3.11a}{2013-10-15}{removed \cs{MakeUppercase} as now dealt +%with in \cs{glsentryfmt}} +% \begin{macrocode} + \@gls@link[#1]{#2}{\@glo@text}% +% \end{macrocode} +% Indicate that this entry has now been used +% \begin{macrocode} + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdisp} +%\changes{1.19}{2009-03-02}{new} +%\cs{glsdisp}\oarg{options}\marg{label}\marg{text} +% This is like \cs{gls} except that the link text is provided. +% This differs from \cs{glslink} in that it uses +% \cs{glsdisplay} or \cs{glsdisplayfirst} and unsets the first use +% flag. +% +% First determine if we are using the starred form: +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsdisp}{\@gls@hyp@opt\@glsdisp} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsdisp}} +% Defined the un-starred form. +%\begin{macro}{\@glsdisp} +% \begin{macrocode} +\newcommand*{\@glsdisp}[3][]{% + \glsdoifexists{#2}{% +% \end{macrocode} +%\changes{2.05}{2010-02-06}{Added closing brace. Patch provided by Sergiu Dotenco} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@checkfirsthyper +% \end{macrocode} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +%\changes{3.11a}{2013-10-15}{add \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glscustomtext} and \cs{glsinsert}} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \def\glscustomtext{#3}% + \def\glsinsert{}% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved check for first use to +%\cs{@gls@link}} +% Determine what the link text should be (this is stored in +% \cs{@glo@text}) +%\changes{3.11a}{2013-10-15}{change to using \cs{glsentryfmt} style +%commands} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \def\@glo@text{\csname gls@\glstype @entryfmt\endcsname}% +% \end{macrocode} +% Call \cs{@gls@link}. +% If \pkgopt{footnote} package option has been used and the glossary +% type is \cs{acronymtype}, suppress +% hyperlink for first use. Likewise if the \pkgopt[false]{hyperfirst} +% package option is used. +%\changes{1.16}{2008-08-27}{Test glossary type is +%\cs{acronymtype} in addition to +%checking if footnote option has been used} +%\changes{2.03}{2009-09-23}{Added check for hyperfirst} +%\changes{2.04}{2009-11-10}{Changed test to check if glossary type +%has been identified as a list of acronyms} +% \begin{macrocode} + \@gls@link[#1]{#2}{\@glo@text}% +% \end{macrocode} +% Indicate that this entry has now been used +%\changes{2.05}{2010-02-06}{Removed spurious brace. Patch provided by Sergiu Dotenco} +% \begin{macrocode} + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@link@nocheckfirsthyper} +%\changes{4.19}{2015-11-22}{new} +% Instead of just setting \cs{do@gls@link@checkfirsthyper} to +% \cs{relax} in \cs{@gls@field@link}, set it to +% \cs{@gls@link@nocheckfirsthyper} in case some other action needs +% to take place. +% \begin{macrocode} +\newcommand*{\@gls@link@nocheckfirsthyper}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@field@link} +%\changes{4.03}{2014-01-20}{new} +%\changes{4.08}{2014-07-30}{added assignment of \cs{do@gls@link@checkfirsthyper}} +% \begin{macrocode} +\newcommand{\@gls@field@link}[3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \@gls@link[#1]{#2}{#3}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% \cs{glstext} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{text} key and it doesn't mark the entry as +% used. +%\begin{macro}{\glstext} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glstext}{\@gls@hyp@opt\@glstext} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglstext}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glstext}[2][]{% + \new@ifnextchar[{\@glstext@{#1}{#2}}{\@glstext@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrytext}} +% \begin{macrocode} +\def\@glstext@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentrytext{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLStext} behaves like \cs{glstext} except the text is converted +% to uppercase. +%\begin{macro}{\GLStext} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLStext}{\@gls@hyp@opt\@GLStext} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLStext}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLStext}[2][]{% + \new@ifnextchar[{\@GLStext@{#1}{#2}}{\@GLStext@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +% \begin{macrocode} +\def\@GLStext@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrytext{#2}#3}}% +} +% \end{macrocode} +% +% \cs{Glstext} behaves like \cs{glstext} except that the first letter +% of the text is converted to uppercase. +%\begin{macro}{\Glstext} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glstext}{\@gls@hyp@opt\@Glstext} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlstext}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glstext}[2][]{% + \new@ifnextchar[{\@Glstext@{#1}{#2}}{\@Glstext@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{Changed to just use \cs{Glsentrytext}} +% \begin{macrocode} +\def\@Glstext@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentrytext{#2}#3}% +} +% \end{macrocode} +% +% \cs{glsfirst} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{first} key and it doesn't mark the entry as +% used. +%\begin{macro}{\glsfirst} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsfirst}{\@gls@hyp@opt\@glsfirst} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsfirst}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsfirst}[2][]{% + \new@ifnextchar[{\@glsfirst@{#1}{#2}}{\@glsfirst@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryfirst}} +% \begin{macrocode} +\def\@glsfirst@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryfirst{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsfirst} behaves like \ics{glsfirst} except it displays the +% first letter in uppercase. +%\begin{macro}{\Glsfirst} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsfirst}{\@gls@hyp@opt\@Glsfirst} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsfirst}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsfirst}[2][]{% + \new@ifnextchar[{\@Glsfirst@{#1}{#2}}{\@Glsfirst@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryfirst}} +% \begin{macrocode} +\def\@Glsfirst@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryfirst{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSfirst} behaves like \ics{Glsfirst} except it displays the +% text in uppercase. +%\begin{macro}{\GLSfirst} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSfirst}{\@gls@hyp@opt\@GLSfirst} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSfirst}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSfirst}[2][]{% + \new@ifnextchar[{\@GLSfirst@{#1}{#2}}{\@GLSfirst@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryfirst}} +% \begin{macrocode} +\def\@GLSfirst@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryfirst{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsplural} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{plural} key and it doesn't mark the entry as +% used. +%\begin{macro}{\glsplural} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsplural}{\@gls@hyp@opt\@glsplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsplural}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsplural}[2][]{% + \new@ifnextchar[{\@glsplural@{#1}{#2}}{\@glsplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryplural}} +% \begin{macrocode} +\def\@glsplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsplural} behaves like \ics{glsplural} except that the first +% letter is converted to uppercase. +%\begin{macro}{\Glsplural} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsplural}{\@gls@hyp@opt\@Glsplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsplural}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsplural}[2][]{% + \new@ifnextchar[{\@Glsplural@{#1}{#2}}{\@Glsplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryplural}} +% \begin{macrocode} +\def\@Glsplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSplural} behaves like \ics{glsplural} except that the +% text is converted to uppercase. +%\begin{macro}{\GLSplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSplural}{\@gls@hyp@opt\@GLSplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSplural}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSplural}[2][]{% + \new@ifnextchar[{\@GLSplural@{#1}{#2}}{\@GLSplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryplural}} +% \begin{macrocode} +\def\@GLSplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryplural{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsfirstplural} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{firstplural} key and it doesn't mark the entry as +% used. +%\begin{macro}{\glsfirstplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsfirstplural}{\@gls@hyp@opt\@glsfirstplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsfirstplural}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsfirstplural}[2][]{% + \new@ifnextchar[{\@glsfirstplural@{#1}{#2}}{\@glsfirstplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{glsentryfirstplural}} +% \begin{macrocode} +\def\@glsfirstplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryfirstplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsfirstplural} behaves like \ics{glsfirstplural} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsfirstplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsfirstplural}{\@gls@hyp@opt\@Glsfirstplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsfirstplural}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsfirstplural}[2][]{% + \new@ifnextchar[{\@Glsfirstplural@{#1}{#2}}{\@Glsfirstplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{Glsentryfirstplural}} +% \begin{macrocode} +\def\@Glsfirstplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryfirstplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSfirstplural} behaves like \ics{glsfirstplural} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSfirstplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSfirstplural}{\@gls@hyp@opt\@GLSfirstplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSfirstplural}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSfirstplural}[2][]{% + \new@ifnextchar[{\@GLSfirstplural@{#1}{#2}}{\@GLSfirstplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{glsentryfirstplural}} +% \begin{macrocode} +\def\@GLSfirstplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryfirstplural{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsname} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{name} key and it doesn't mark the entry as +% used. +%\begin{macro}{\glsname} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsname}{\@gls@hyp@opt\@glsname} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsname}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsname}[2][]{% + \new@ifnextchar[{\@glsname@{#1}{#2}}{\@glsname@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryname}} +% \begin{macrocode} +\def\@glsname@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryname{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsname} behaves like \ics{glsname} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsname} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsname}{\@gls@hyp@opt\@Glsname} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsname}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsname}[2][]{% + \new@ifnextchar[{\@Glsname@{#1}{#2}}{\@Glsname@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryname}} +% \begin{macrocode} +\def\@Glsname@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryname{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSname} behaves like \ics{glsname} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSname} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSname}{\@gls@hyp@opt\@GLSname} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSname}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSname}[2][]{% + \new@ifnextchar[{\@GLSname@{#1}{#2}}{\@GLSname@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryname}} +% \begin{macrocode} +\def\@GLSname@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryname{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsdesc} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{description} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsdesc} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsdesc}{\@gls@hyp@opt\@glsdesc} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsdesc}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsdesc}[2][]{% + \new@ifnextchar[{\@glsdesc@{#1}{#2}}{\@glsdesc@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrydesc}} +% \begin{macrocode} +\def\@glsdesc@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentrydesc{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsdesc} behaves like \ics{glsdesc} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsdesc} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsdesc}{\@gls@hyp@opt\@Glsdesc} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsdesc}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsdesc}[2][]{% + \new@ifnextchar[{\@Glsdesc@{#1}{#2}}{\@Glsdesc@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentrydesc}} +% \begin{macrocode} +\def\@Glsdesc@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentrydesc{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSdesc} behaves like \ics{glsdesc} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSdesc} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSdesc}{\@gls@hyp@opt\@GLSdesc} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSdesc}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSdesc}[2][]{% + \new@ifnextchar[{\@GLSdesc@{#1}{#2}}{\@GLSdesc@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrydesc}} +% \begin{macrocode} +\def\@GLSdesc@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrydesc{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsdescplural} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{descriptionplural} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsdescplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsdescplural}{\@gls@hyp@opt\@glsdescplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsdescplural}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsdescplural}[2][]{% + \new@ifnextchar[{\@glsdescplural@{#1}{#2}}{\@glsdescplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{glsentrydescplural}} +% \begin{macrocode} +\def\@glsdescplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentrydescplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsdescplural} behaves like \ics{glsdescplural} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsdescplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsdescplural}{\@gls@hyp@opt\@Glsdescplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsdescplural}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsdescplural}[2][]{% + \new@ifnextchar[{\@Glsdescplural@{#1}{#2}}{\@Glsdescplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{Glsentrydescplural}} +% \begin{macrocode} +\def\@Glsdescplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentrydescplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSdescplural} behaves like \ics{glsdescplural} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSdescplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSdescplural}{\@gls@hyp@opt\@GLSdescplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSdescplural}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSdescplural}[2][]{% + \new@ifnextchar[{\@GLSdescplural@{#1}{#2}}{\@GLSdescplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +% \changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{glsentrydescplural}} +% \begin{macrocode} +\def\@GLSdescplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrydescplural{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glssymbol} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{symbol} key and it doesn't mark the entry as +% used. +%\begin{macro}{\glssymbol} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glssymbol}{\@gls@hyp@opt\@glssymbol} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglssymbol}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glssymbol}[2][]{% + \new@ifnextchar[{\@glssymbol@{#1}{#2}}{\@glssymbol@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrysymbol}} +% \begin{macrocode} +\def\@glssymbol@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentrysymbol{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glssymbol} behaves like \ics{glssymbol} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glssymbol} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glssymbol}{\@gls@hyp@opt\@Glssymbol} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlssymbol}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glssymbol}[2][]{% + \new@ifnextchar[{\@Glssymbol@{#1}{#2}}{\@Glssymbol@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentrysymbol}} +% \begin{macrocode} +\def\@Glssymbol@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentrysymbol{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSsymbol} behaves like \ics{glssymbol} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSsymbol} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSsymbol}{\@gls@hyp@opt\@GLSsymbol} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSsymbol}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSsymbol}[2][]{% + \new@ifnextchar[{\@GLSsymbol@{#1}{#2}}{\@GLSsymbol@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentrysymbol}} +% \begin{macrocode} +\def\@GLSsymbol@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbol{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glssymbolplural} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{symbolplural} key and it doesn't mark the entry as +% used. +%\begin{macro}{\glssymbolplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glssymbolplural}{\@gls@hyp@opt\@glssymbolplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglssymbolplural}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glssymbolplural}[2][]{% + \new@ifnextchar[{\@glssymbolplural@{#1}{#2}}{\@glssymbolplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{glsentrysymbolplural}} +% \begin{macrocode} +\def\@glssymbolplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentrysymbolplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glssymbolplural} behaves like \ics{glssymbolplural} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glssymbolplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glssymbolplural}{\@gls@hyp@opt\@Glssymbolplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlssymbolplural}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glssymbolplural}[2][]{% + \new@ifnextchar[{\@Glssymbolplural@{#1}{#2}}{\@Glssymbolplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{Glsentrysymbolplural}} +% \begin{macrocode} +\def\@Glssymbolplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentrysymbolplural{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSsymbolplural} behaves like \ics{glssymbolplural} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSsymbolplural} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSsymbolplural}{\@gls@hyp@opt\@GLSsymbolplural} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSsymbolplural}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSsymbolplural}[2][]{% + \new@ifnextchar[{\@GLSsymbolplural@{#1}{#2}}{\@GLSsymbolplural@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{1.13}{2008-05-10}{fixed bug that ignored 3rd parameter} +%\changes{3.11a}{2013-10-15}{changed to just use +%\cs{glsentrysymbolplural}} +% \begin{macrocode} +\def\@GLSsymbolplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbolplural{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsuseri} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{user1} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsuseri} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsuseri}{\@gls@hyp@opt\@glsuseri} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsuseri}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsuseri}[2][]{% + \new@ifnextchar[{\@glsuseri@{#1}{#2}}{\@glsuseri@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseri}} +% \begin{macrocode} +\def\@glsuseri@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryuseri{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsuseri} behaves like \ics{glsuseri} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsuseri} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsuseri}{\@gls@hyp@opt\@Glsuseri} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuseri}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsuseri}[2][]{% + \new@ifnextchar[{\@Glsuseri@{#1}{#2}}{\@Glsuseri@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuseri}} +% \begin{macrocode} +\def\@Glsuseri@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryuseri{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSuseri} behaves like \ics{glsuseri} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSuseri} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSuseri}{\@gls@hyp@opt\@GLSuseri} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuseri}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSuseri}[2][]{% + \new@ifnextchar[{\@GLSuseri@{#1}{#2}}{\@GLSuseri@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseri}} +% \begin{macrocode} +\def\@GLSuseri@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseri{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsuserii} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{user2} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsuserii} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsuserii}{\@gls@hyp@opt\@glsuserii} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsuserii}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsuserii}[2][]{% + \new@ifnextchar[{\@glsuserii@{#1}{#2}}{\@glsuserii@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserii}} +% \begin{macrocode} +\def\@glsuserii@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryuserii{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsuserii} behaves like \ics{glsuserii} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsuserii} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsuserii}{\@gls@hyp@opt\@Glsuserii} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuserii}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsuserii}[2][]{% + \new@ifnextchar[{\@Glsuserii@{#1}{#2}}{\@Glsuserii@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuserii}} +% \begin{macrocode} +\def\@Glsuserii@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryuserii{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSuserii} behaves like \ics{glsuserii} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSuserii} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSuserii}{\@gls@hyp@opt\@GLSuserii} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuserii}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSuserii}[2][]{% + \new@ifnextchar[{\@GLSuserii@{#1}{#2}}{\@GLSuserii@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserii}} +% \begin{macrocode} +\def\@GLSuserii@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuserii{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsuseriii} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{user3} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsuseriii} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsuseriii}{\@gls@hyp@opt\@glsuseriii} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsuseriii}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsuseriii}[2][]{% + \new@ifnextchar[{\@glsuseriii@{#1}{#2}}{\@glsuseriii@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriii}} +% \begin{macrocode} +\def\@glsuseriii@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryuseriii{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsuseriii} behaves like \ics{glsuseriii} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsuseriii} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsuseriii}{\@gls@hyp@opt\@Glsuseriii} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuseriii}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsuseriii}[2][]{% + \new@ifnextchar[{\@Glsuseriii@{#1}{#2}}{\@Glsuseriii@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuseriii}} +% \begin{macrocode} +\def\@Glsuseriii@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryuseriii{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSuseriii} behaves like \ics{glsuseriii} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSuseriii} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSuseriii}{\@gls@hyp@opt\@GLSuseriii} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuseriii}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSuseriii}[2][]{% + \new@ifnextchar[{\@GLSuseriii@{#1}{#2}}{\@GLSuseriii@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriii}} +% \begin{macrocode} +\def\@GLSuseriii@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriii{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsuseriv} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{user4} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsuseriv} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsuseriv}{\@gls@hyp@opt\@glsuseriv} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsuseriv}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsuseriv}[2][]{% + \new@ifnextchar[{\@glsuseriv@{#1}{#2}}{\@glsuseriv@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriv}} +% \begin{macrocode} +\def\@glsuseriv@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryuseriv{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsuseriv} behaves like \ics{glsuseriv} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsuseriv} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsuseriv}{\@gls@hyp@opt\@Glsuseriv} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuseriv}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsuseriv}[2][]{% + \new@ifnextchar[{\@Glsuseriv@{#1}{#2}}{\@Glsuseriv@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuseriv}} +% \begin{macrocode} +\def\@Glsuseriv@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryuseriv{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSuseriv} behaves like \ics{glsuseriv} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSuseriv} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSuseriv}{\@gls@hyp@opt\@GLSuseriv} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuseriv}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSuseriv}[2][]{% + \new@ifnextchar[{\@GLSuseriv@{#1}{#2}}{\@GLSuseriv@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuseriv}} +% \begin{macrocode} +\def\@GLSuseriv@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriv{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsuserv} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{user5} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsuserv} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsuserv}{\@gls@hyp@opt\@glsuserv} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsuserv}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsuserv}[2][]{% + \new@ifnextchar[{\@glsuserv@{#1}{#2}}{\@glsuserv@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserv}} +% \begin{macrocode} +\def\@glsuserv@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryuserv{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsuserv} behaves like \ics{glsuserv} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsuserv} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsuserv}{\@gls@hyp@opt\@Glsuserv} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuserv}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsuserv}[2][]{% +\new@ifnextchar[{\@Glsuserv@{#1}{#2}}{\@Glsuserv@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuserv}} +% \begin{macrocode} +\def\@Glsuserv@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryuserv{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSuserv} behaves like \ics{glsuserv} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSuserv} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSuserv}{\@gls@hyp@opt\@GLSuserv} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuserv}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSuserv}[2][]{% +\new@ifnextchar[{\@GLSuserv@{#1}{#2}}{\@GLSuserv@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuserv}} +% \begin{macrocode} +\def\@GLSuserv@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuserv{#2}#3}}% +} +% \end{macrocode} +% +% \cs{glsuservi} behaves like \ics{gls} except it always uses the value +% given by the \gloskey{user6} key and it doesn't mark the entry +% as used. +%\begin{macro}{\glsuservi} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\glsuservi}{\@gls@hyp@opt\@glsuservi} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sglsuservi}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@glsuservi}[2][]{% + \new@ifnextchar[{\@glsuservi@{#1}{#2}}{\@glsuservi@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuservi}} +% \begin{macrocode} +\def\@glsuservi@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsentryuservi{#2}#3}% +} +% \end{macrocode} +% +% \cs{Glsuservi} behaves like \ics{glsuservi} except that the +% first letter is converted to uppercase. +%\begin{macro}{\Glsuservi} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Glsuservi}{\@gls@hyp@opt\@Glsuservi} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGlsuservi}} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@Glsuservi}[2][]{% + \new@ifnextchar[{\@Glsuservi@{#1}{#2}}{\@Glsuservi@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{Glsentryuservi}} +% \begin{macrocode} +\def\@Glsuservi@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsentryuservi{#2}#3}% +} +% \end{macrocode} +% +% \cs{GLSuservi} behaves like \ics{glsuservi} except that the +% link text is converted to uppercase. +%\begin{macro}{\GLSuservi} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\GLSuservi}{\@gls@hyp@opt\@GLSuservi} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sGLSuservi}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@GLSuservi}[2][]{% + \new@ifnextchar[{\@GLSuservi@{#1}{#2}}{\@GLSuservi@{#1}{#2}[]}} +% \end{macrocode} +% Read in the final optional argument: +%\changes{3.11a}{2013-10-15}{changed to just use \cs{glsentryuservi}} +% \begin{macrocode} +\def\@GLSuservi@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\mfirstucMakeUppercase{\glsentryuservi{#2}#3}}% +} +% \end{macrocode} +% +% Now deal with acronym related keys. First the short form: +%\begin{macro}{\acrshort} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\acrshort}{\@gls@hyp@opt\ns@acrshort} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sacrshort}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@acrshort}[2][]{% + \new@ifnextchar[{\@acrshort{#1}{#2}}{\@acrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsentryshort{#2}}#3% + }% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\Acrshort} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Acrshort}{\@gls@hyp@opt\ns@Acrshort} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sAcrshort}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Acrshort}[2][]{% + \new@ifnextchar[{\@Acrshort{#1}{#2}}{\@Acrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsentryshort{#2}}#3% + }% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\ACRshort} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\ACRshort}{\@gls@hyp@opt\ns@ACRshort} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sACRshort}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@ACRshort}[2][]{% + \new@ifnextchar[{\@ACRshort{#1}{#2}}{\@ACRshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@ACRshort#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsentryshort{#2}}#3}% + }% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +% Short plural: +%\begin{macro}{\acrshortpl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\acrshortpl}{\@gls@hyp@opt\ns@acrshortpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sacrshortpl}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@acrshortpl}[2][]{% + \new@ifnextchar[{\@acrshortpl{#1}{#2}}{\@acrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@acrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsentryshortpl{#2}}#3% + }% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\Acrshortpl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Acrshortpl}{\@gls@hyp@opt\ns@Acrshortpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sAcrshortpl}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Acrshortpl}[2][]{% + \new@ifnextchar[{\@Acrshortpl{#1}{#2}}{\@Acrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Acrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsentryshortpl{#2}}#3% + }% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\ACRshortpl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\ACRshortpl}{\@gls@hyp@opt\ns@ACRshortpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sACRshortpl}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@ACRshortpl}[2][]{% + \new@ifnextchar[{\@ACRshortpl{#1}{#2}}{\@ACRshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@ACRshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{#2}}#3}% + }% +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\acrlong} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\acrlong}{\@gls@hyp@opt\ns@acrlong} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sacrlong}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@acrlong}[2][]{% + \new@ifnextchar[{\@acrlong{#1}{#2}}{\@acrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext} +% (\cs{acronymfont} only designed for short form). +% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}} +% \begin{macrocode} + \def\glscustomtext{% + \glsentrylong{#2}#3% + }% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link} +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\Acrlong} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Acrlong}{\@gls@hyp@opt\ns@Acrlong} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sAcrlong}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Acrlong}[2][]{% + \new@ifnextchar[{\@Acrlong{#1}{#2}}{\@Acrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext} +% (\cs{acronymfont} only designed for short form). +% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}} +% \begin{macrocode} + \def\glscustomtext{% + \Glsentrylong{#2}#3% + }% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link}. +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\ACRlong} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\ACRlong}{\@gls@hyp@opt\ns@ACRlong} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sACRlong}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@ACRlong}[2][]{% + \new@ifnextchar[{\@ACRlong{#1}{#2}}{\@ACRlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@ACRlong#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext} +% (\cs{acronymfont} only designed for short form). +% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}} +% \begin{macrocode} + \def\glscustomtext{% + \mfirstucMakeUppercase{\glsentrylong{#2}#3}% + }% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link}. +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +% Short plural: +%\begin{macro}{\acrlongpl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\acrlongpl}{\@gls@hyp@opt\ns@acrlongpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sacrlongpl}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@acrlongpl}[2][]{% + \new@ifnextchar[{\@acrlongpl{#1}{#2}}{\@acrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@acrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext} +% (\cs{acronymfont} only designed for short form). +% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}} +% \begin{macrocode} + \def\glscustomtext{% + \glsentrylongpl{#2}#3% + }% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link}. +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\Acrlongpl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Acrlongpl}{\@gls@hyp@opt\ns@Acrlongpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sAcrlongpl}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Acrlongpl}[2][]{% + \new@ifnextchar[{\@Acrlongpl{#1}{#2}}{\@Acrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Acrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext} +% (\cs{acronymfont} only designed for short form). +% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}} +% \begin{macrocode} + \def\glscustomtext{% + \Glsentrylongpl{#2}#3% + }% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link}. +% Note that \cs{@gls@link} sets \cs{glstype}. +%\changes{4.15}{2015-03-16}{bug fix replaced \cs{@glo@type} with \cs{glstype}} +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +%\begin{macro}{\ACRlongpl} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\ACRlongpl}{\@gls@hyp@opt\ns@ACRlongpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \cs{@sACRlongpl}} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@ACRlongpl}[2][]{% + \new@ifnextchar[{\@ACRlongpl{#1}{#2}}{\@ACRlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@ACRlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{changed checkfirsthyper assignment} +% \begin{macrocode} + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +% \begin{macrocode} + \def\glslabel{#2}% + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty +% \end{macrocode} +%\changes{4.06}{2014-03-12}{added \cs{glsifhyper}} +% Bug fix v4.02 removed \cs{acronymfont} from \cs{glscustomtext} +% (\cs{acronymfont} only designed for short form). +% \changes{4.02}{2013-12-05}{Removed \cs{acronymfont}} +% \begin{macrocode} + \def\glscustomtext{% + \mfirstucMakeUppercase{\glsentrylongpl{#2}#3}% + }% +% \end{macrocode} +%\changes{4.08}{2014-07-30}{moved \cs{glsifhyper}} +% Call \cs{@gls@link}. +% Note that \cs{@gls@link} sets \cs{glstype}. +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +% +% \subsubsection{Displaying entry details without adding +% information to the glossary} +%\label{sec:code:glsnolink} +% +% These commands merely display entry information without adding +% entries in the associated file or having hyperlinks. +% +%\begin{macro}{\@gls@entry@field} +% Generic version. +%\changes{4.03}{2014-01-20}{new} +%\begin{definition} +%\cs{@gls@entry@field}\marg{label}\marg{field} +%\end{definition} +% \begin{macrocode} +\newcommand*{\@gls@entry@field}[2]{% + \csname glo@\glsdetoklabel{#1}@#2\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsletentryfield} +%\changes{4.07}{2014-04-04}{new} +%\begin{definition} +%\cs{glsletentryfield}\marg{cs}\marg{label}\marg{field} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsletentryfield}[3]{% + \letcs{#1}{glo@\glsdetoklabel{#2}@#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Gls@entry@field} +% Generic first letter uppercase version. +%\changes{4.03}{2014-01-20}{new} +%\begin{definition} +%\cs{@Gls@entry@field}\marg{label}\marg{field} +%\end{definition} +% \begin{macrocode} +\newcommand*{\@Gls@entry@field}[2]{% + \glsdoifexistsordo{#1}% + {% + \letcs\@glo@text{glo@\glsdetoklabel{#1}@#2}% + \ifdef\@glo@text + {% + \xmakefirstuc{\@glo@text}% + }% + {% + ??\PackageError{glossaries}{The field `#2' doesn't exist for glossary + entry `\glsdetoklabel{#1}'}{Check you have correctly spelt the entry + label and the field name}% + }% + }% + {% + ??% + }% +} +% \end{macrocode} +%\end{macro} +% +% Get the entry name (as specified by the \gloskey{name} key +% when the entry was defined). The argument +% is the label associated with the entry. Note that unless you +% used \texttt{name=false} in the \pkgopt{sanitize} package option +% you may get unexpected results if the \gloskey{name} key contains +% any commands. +%\begin{macro}{\glsentryname} +% \begin{macrocode} +\newcommand*{\glsentryname}[1]{\@gls@entry@field{#1}{name}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryname} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryname}[1]{% + \@Gls@entryname{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Gls@entryname} +%\changes{4.10}{2014-08-27}{new} +% This is a workaround in the event that the user defies the warning +% in the manual about not using \cs{Glsname} or \cs{Glsentryname} with acronyms. +% First the default behaviour: +% \begin{macrocode} +\newcommand*{\@Gls@entryname}[1]{% + \@Gls@entry@field{#1}{name}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@Gls@acrentryname} +%\changes{4.10}{2014-08-27}{new} +% Now the behaviour when \cs{setacronymstyle} is used: +% \begin{macrocode} +\newcommand*{\@Gls@acrentryname}[1]{% + \ifglshaslong{#1}% + {% + \letcs\@glo@text{glo@\glsdetoklabel{#1}@name}% + \expandafter\@gls@getbody\@glo@text{}\@nil + \expandafter\ifx\@gls@body\glsentrylong\relax + \expandafter\Glsentrylong\@gls@rest + \else + \expandafter\ifx\@gls@body\glsentryshort\relax + \expandafter\Glsentryshort\@gls@rest + \else + \expandafter\ifx\@gls@body\acronymfont\relax +% \end{macrocode} +% Temporarily make \cs{glsentryshort} behave like +% \cs{Glsentryshort}. (This is on the assumption that the argument +% of \cs{acronymfont} is \cs{glsentryshort}\marg{label}, as that's +% the behaviour of the predefined acronym styles.) +% This is scoped to localise the effect of the assignment. +% \begin{macrocode} + {% + \let\glsentryshort\Glsentryshort + \@glo@text + }% + \else + \xmakefirstuc{\@glo@text}% + \fi + \fi + \fi + }% + {% +% \end{macrocode} +% Not an acronym +% \begin{macrocode} + \@Gls@entry@field{#1}{name}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Get the entry description (as specified by the +% \gloskey{description} when the entry was defined). The argument +% is the label associated with the entry. Note that unless you +% used \texttt{description=false} in the \pkgopt{sanitize} package +% option you may get unexpected results if the \gloskey{description} +% key contained any commands. +%\begin{macro}{\glsentrydesc} +% \begin{macrocode} +\newcommand*{\glsentrydesc}[1]{\@gls@entry@field{#1}{desc}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentrydesc} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentrydesc}[1]{% + \@Gls@entry@field{#1}{desc}% +} +% \end{macrocode} +%\end{macro} +% Plural form: +%\begin{macro}{\glsentrydescplural} +%\changes{1.12}{2008-03-08}{New} +% \begin{macrocode} +\newcommand*{\glsentrydescplural}[1]{% + \@gls@entry@field{#1}{descplural}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentrydescplural} +%\changes{1.12}{2008-03-08}{New} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentrydescplural}[1]{% + \@Gls@entry@field{#1}{descplural}% +} +% \end{macrocode} +%\end{macro} +% +% Get the entry text, as specified by the \gloskey{text} key when +% the entry was defined. The argument +% is the label associated with the entry: +%\begin{macro}{\glsentrytext} +% \begin{macrocode} +\newcommand*{\glsentrytext}[1]{\@gls@entry@field{#1}{text}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentrytext} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentrytext}[1]{% + \@Gls@entry@field{#1}{text}% +} +% \end{macrocode} +%\end{macro} +% +% Get the plural form: +%\begin{macro}{\glsentryplural} +% \begin{macrocode} +\newcommand*{\glsentryplural}[1]{% + \@gls@entry@field{#1}{plural}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryplural} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryplural}[1]{% + \@Gls@entry@field{#1}{plural}% +} +% \end{macrocode} +%\end{macro} +% +% Get the symbol associated with this entry. The argument +% is the label associated with the entry. +%\begin{macro}{\glsentrysymbol} +% \begin{macrocode} +\newcommand*{\glsentrysymbol}[1]{% + \@gls@entry@field{#1}{symbol}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentrysymbol} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentrysymbol}[1]{% + \@Gls@entry@field{#1}{symbol}% +} +% \end{macrocode} +%\end{macro} +% Plural form: +%\begin{macro}{\glsentrysymbolplural} +%\changes{1.12}{2008-03-08}{New} +% \begin{macrocode} +\newcommand*{\glsentrysymbolplural}[1]{% + \@gls@entry@field{#1}{symbolplural}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentrysymbolplural} +%\changes{1.12}{2008-03-08}{New} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentrysymbolplural}[1]{% + \@Gls@entry@field{#1}{symbolplural}% +} +% \end{macrocode} +%\end{macro} +% +% Get the entry text to be used when the entry is first used in +% the document (as specified by the \gloskey{first} key when +% the entry was defined). +%\begin{macro}{\glsentryfirst} +% \begin{macrocode} +\newcommand*{\glsentryfirst}[1]{% + \@gls@entry@field{#1}{first}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryfirst} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryfirst}[1]{% + \@Gls@entry@field{#1}{first}% +} +% \end{macrocode} +%\end{macro} +% +% Get the plural form (as specified by the \gloskey{firstplural} +% key when the entry was defined). +%\begin{macro}{\glsentryfirstplural} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\glsentryfirstplural}[1]{% + \@gls@entry@field{#1}{firstpl}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryfirstplural} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryfirstplural}[1]{% + \@Gls@entry@field{#1}{firstpl}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentrytitlecase} +%\changes{4.22}{2016-04-19}{new} +% \begin{macrocode} +\newrobustcmd*{\@glsentrytitlecase}[2]{% + \glsfieldfetch{#1}{#2}{\@gls@value}% + \xcapitalisewords{\@gls@value}% +} +\ifdef\texorpdfstring +{ + \newcommand*{\glsentrytitlecase}[2]{% + \texorpdfstring + {\@glsentrytitlecase{#1}{#2}}% + {\@gls@entry@field{#1}{#2}}% + } +} +{ + \newcommand*{\glsentrytitlecase}[2]{\@glsentrytitlecase{#1}{#2}} +} +% \end{macrocode} +%\end{macro} +% +% Display the glossary type with which this entry is associated +% (as specified by the \gloskey{type} key used when the entry was +% defined) +%\begin{macro}{\glsentrytype} +% \begin{macrocode} +\newcommand*{\glsentrytype}[1]{\@gls@entry@field{#1}{type}} +% \end{macrocode} +%\end{macro} +% +% Display the sort text used for this entry. Note that the +% \gloskey{sort} key is sanitize, so unexpected results may +% occur if the \gloskey{sort} key contained commands. +%\begin{macro}{\glsentrysort} +% \begin{macrocode} +\newcommand*{\glsentrysort}[1]{% + \@gls@entry@field{#1}{sort}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryuseri} +% Get the first user key (as specified by the +% \gloskey{user1} when the entry was defined). The argument +% is the label associated with the entry. +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\glsentryuseri}[1]{% + \@gls@entry@field{#1}{useri}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryuseri} +%\changes{2.04}{2009-11-10}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryuseri}[1]{% + \@Gls@entry@field{#1}{useri}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryuserii} +% Get the second user key (as specified by the +% \gloskey{user2} when the entry was defined). The argument +% is the label associated with the entry. +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\glsentryuserii}[1]{% + \@gls@entry@field{#1}{userii}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryuserii} +%\changes{2.04}{2009-11-10}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryuserii}[1]{% + \@Gls@entry@field{#1}{userii}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryuseriii} +% Get the third user key (as specified by the +% \gloskey{user3} when the entry was defined). The argument +% is the label associated with the entry. +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\glsentryuseriii}[1]{% + \@gls@entry@field{#1}{useriii}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryuseriii} +%\changes{2.04}{2009-11-10}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryuseriii}[1]{% + \@Gls@entry@field{#1}{useriii}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryuseriv} +% Get the fourth user key (as specified by the +% \gloskey{user4} when the entry was defined). The argument +% is the label associated with the entry. +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\glsentryuseriv}[1]{% + \@gls@entry@field{#1}{useriv}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryuseriv} +%\changes{2.04}{2009-11-10}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryuseriv}[1]{% + \@Gls@entry@field{#1}{useriv}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryuserv} +% Get the fifth user key (as specified by the +% \gloskey{user5} when the entry was defined). The argument +% is the label associated with the entry. +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\glsentryuserv}[1]{% + \@gls@entry@field{#1}{userv}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryuserv} +%\changes{2.04}{2009-11-10}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryuserv}[1]{% + \@Gls@entry@field{#1}{userv}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryuservi} +% Get the sixth user key (as specified by the +% \gloskey{user6} when the entry was defined). The argument +% is the label associated with the entry. +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\glsentryuservi}[1]{% + \@gls@entry@field{#1}{uservi}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryuservi} +%\changes{2.04}{2009-11-10}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryuservi}[1]{% + \@Gls@entry@field{#1}{uservi}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryshort} +% Get the short key (as specified by the +% \gloskey{short} the entry was defined). The argument +% is the label associated with the entry. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\newcommand*{\glsentryshort}[1]{\@gls@entry@field{#1}{short}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryshort} +%\changes{3.0}{2011-04-02}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryshort}[1]{% + \@Gls@entry@field{#1}{short}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryshortpl} +% Get the short plural key (as specified by the +% \gloskey{shortplural} the entry was defined). The argument +% is the label associated with the entry. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\newcommand*{\glsentryshortpl}[1]{\@gls@entry@field{#1}{shortpl}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryshortpl} +%\changes{3.0}{2011-04-02}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentryshortpl}[1]{% + \@Gls@entry@field{#1}{shortpl}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentrylong} +% Get the long key (as specified by the +% \gloskey{long} the entry was defined). The argument +% is the label associated with the entry. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\newcommand*{\glsentrylong}[1]{\@gls@entry@field{#1}{long}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentrylong} +%\changes{3.0}{2011-04-02}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentrylong}[1]{% + \@Gls@entry@field{#1}{long}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentrylongpl} +% Get the long plural key (as specified by the +% \gloskey{longplural} the entry was defined). The argument +% is the label associated with the entry. +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\newcommand*{\glsentrylongpl}[1]{\@gls@entry@field{#1}{longpl}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentrylongpl} +%\changes{3.0}{2011-04-02}{new} +%\changes{3.09a}{2013-10-09}{made robust} +% \begin{macrocode} +\newrobustcmd*{\Glsentrylongpl}[1]{% + \@Gls@entry@field{#1}{longpl}% +} +% \end{macrocode} +%\end{macro} +% +% Short cut macros to access full form: +%\begin{macro}{\glsentryfull} +%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}} +%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}} +% \begin{macrocode} +\newcommand*{\glsentryfull}[1]{% + \acrfullformat{\glsentrylong{#1}}{\acronymfont{\glsentryshort{#1}}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryfull} +%\changes{3.09a}{2013-10-09}{made robust} +%\changes{3.02}{2012-05-21}{fixed bug (replaced \cs{glsentryshortpl} +%with \cs{glsentryshort})} +%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}} +%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}} +% \begin{macrocode} +\newrobustcmd*{\Glsentryfull}[1]{% + \acrfullformat{\Glsentrylong{#1}}{\acronymfont{\glsentryshort{#1}}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentryfullpl} +%\changes{3.02}{2012-05-21}{fixed bug (replaced \cs{glsentryshort} +%with \cs{glsentryshortpl})} +%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}} +%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}} +% \begin{macrocode} +\newcommand*{\glsentryfullpl}[1]{% + \acrfullformat{\glsentrylongpl{#1}}{\acronymfont{\glsentryshortpl{#1}}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryfullpl} +%\changes{3.09a}{2013-10-09}{made robust} +%\changes{3.13a}{2013-11-05}{changed to use \cs{acrfullformat}} +%\changes{4.02}{2013-12-05}{bug fix: added missing \cs{acronymfont}} +% \begin{macrocode} +\newrobustcmd*{\Glsentryfullpl}[1]{% + \acrfullformat{\Glsentrylongpl{#1}}{\acronymfont{\glsentryshortpl{#1}}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentrynumberlist} +%\changes{3.02}{2012-05-21}{new} +%Displays the number list as is. +% \begin{macrocode} +\newcommand*{\glsentrynumberlist}[1]{% + \glsdoifexists{#1}% + {% + \@gls@entry@field{#1}{numberlist}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdisplaynumberlist} +%\changes{3.02}{2012-05-21}{new} +% Formats the number list for the given entry label. +% Doesn't work with hyperref. +% \begin{macrocode} +\@ifpackageloaded{hyperref} {% + \newcommand*{\glsdisplaynumberlist}[1]{% + \GlossariesWarning + {% + \string\glsdisplaynumberlist\space + doesn't work with hyperref.^^JUsing + \string\glsentrynumberlist\space instead% + }% + \glsentrynumberlist{#1}% + }% +}% +{% + \newcommand*{\glsdisplaynumberlist}[1]{% + \glsdoifexists{#1}% + {% + \bgroup +% \end{macrocode} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} + \edef\@glo@label{\glsdetoklabel{#1}}% + \let\@org@glsnumberformat\glsnumberformat + \def\glsnumberformat##1{##1}% + \protected@edef\the@numberlist{% + \csname glo@\@glo@label @numberlist\endcsname}% + \def\@gls@numlist@sep{}% + \def\@gls@numlist@nextsep{}% + \def\@gls@numlist@lastsep{}% + \def\@gls@thislist{}% + \def\@gls@donext@def{}% + \renewcommand\do[1]{% + \protected@edef\@gls@thislist{% + \@gls@thislist + \noexpand\@gls@numlist@sep + ##1% + }% + \let\@gls@numlist@sep\@gls@numlist@nextsep + \def\@gls@numlist@nextsep{\glsnumlistsep}% + \@gls@donext@def + \def\@gls@donext@def{% + \def\@gls@numlist@lastsep{\glsnumlistlastsep}% + }% + }% + \expandafter \glsnumlistparser \expandafter{\the@numberlist}% + \let\@gls@numlist@sep\@gls@numlist@lastsep + \@gls@thislist + \egroup + }% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnumlistsep} +%\changes{3.02}{2012-05-19}{new} +% \begin{macrocode} +\newcommand*{\glsnumlistsep}{, } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsnumlistlastsep} +%\changes{3.02}{2012-05-19}{new} +% \begin{macrocode} +\newcommand*{\glsnumlistlastsep}{ \& } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glshyperlink} +% Provide a hyperlink to a glossary entry without adding information +% to the glossary file. The entry needs to be added using a +% command like \ics{glslink} or \ics{glsadd} to ensure that +% the target is defined. The first (optional) argument specifies +% the link text. The entry name is used by default. The second +% argument is the entry label. +%\changes{1.17}{2008-12-26}{new} +%\changes{3.0}{2011-04-02}{changed default from \cs{glsentryname} +%to \cs{glsentrytext}} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\glshyperlink}[2][\glsentrytext{\@glo@label}]{% + \def\@glo@label{#2}% + \@glslink{\glolinkprefix\glsdetoklabel{#2}}{#1}} +% \end{macrocode} +%\end{macro} +% +%\section{Adding an entry to the glossary without generating +% text} +% The following keys are provided for \cs{glsadd} and +% \cs{glsaddall}: +% \begin{macrocode} +\define@key{glossadd}{counter}{\def\@gls@counter{#1}} +% \end{macrocode} +%\changes{2.07}{2010-07-10}{glsadd format key stored in \cs{@glsnumberformat} +%(was mistakenly stored in \cs{@glo@format})} +% \begin{macrocode} +\define@key{glossadd}{format}{\def\@glsnumberformat{#1}} +% \end{macrocode} +% This key is only used by \cs{glsaddall}: +% \begin{macrocode} +\define@key{glossadd}{types}{\def\@glo@type{#1}} +% \end{macrocode} +% +%\begin{definition} +%\cs{glsadd}\oarg{options}\marg{label} +%\end{definition} +% Add a term to the glossary without generating any link text. +% The optional argument indicates which counter to use, +% and how to format it (using a key-value list) +% the second argument is the entry label. Note that \meta{options} +% only has two keys: \gloskey[glsadd]{counter} and \gloskey[glsadd]{format} (the \gloskey[glsaddall]{types} key will be ignored). +%\begin{macro}{\glsadd} +%\changes{1.07}{2007-09-13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon} +%\changes{2.04}{2009-11-10}{fixed bug that ignored counter} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.12}{2014-11-22}{added check for vertical mode} +% \begin{macrocode} +\newrobustcmd*{\glsadd}[2][]{% +% \end{macrocode} +% Need to move to horizontal mode if not already in it, but only if +% not in preamble. +% \begin{macrocode} + \@gls@adjustmode + \glsdoifexists{#2}% + {% + \def\@glsnumberformat{glsnumberformat}% + \edef\@gls@counter{\csname glo@\glsdetoklabel{#2}@counter\endcsname}% + \setkeys{glossadd}{#1}% +% \end{macrocode} +% Store the entry's counter in \cs{theglsentrycounter} +%\changes{3.0}{2011-04-02}{added \cs{@gls@saveentrycounter}} +%\changes{4.16}{2015-07-08}{changed \cs{@do@wrglossary} to +%\cs{@@do@wrglossary}} +% \begin{macrocode} + \@gls@saveentrycounter +% \end{macrocode} +% Define sort key if necessary: +%\changes{4.35}{2017-11-14}{added \cs{@gls@setsort} (in case of +%\pkgopt[use]{sort})} +% \begin{macrocode} + \@gls@setsort{#2}% +% \end{macrocode} +% This should use \cs{@@do@wrglossary} rather than +% \cs{@do@wrglossary} since the whole point of \cs{glsadd} is to add +% a line to the glossary. +% \begin{macrocode} + \@@do@wrglossary{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@adjustmode} +%\changes{4.12}{2014-11-22}{new} +% \begin{macrocode} +\newcommand*{\@gls@adjustmode}{} +\AtBeginDocument{\renewcommand*{\@gls@adjustmode}{\ifvmode\mbox{}\fi}} +% \end{macrocode} +%\end{macro} +% +%\begin{definition} +%\cs{glsaddall}\oarg{option list} +%\end{definition} +% Add all terms defined for the listed glossaries (without displaying +% any text). If \gloskey[glsaddall]{types} key is omitted, apply to all +% glossary types. +%\begin{macro}{\glsaddall} +%\changes{3.01}{2011-04-12}{made robust} +% \begin{macrocode} +\newrobustcmd*{\glsaddall}[1][]{% + \edef\@glo@type{\@glo@types}% + \setkeys{glossadd}{#1}% + \forallglsentries[\@glo@type]{\@glo@entry}{% + \glsadd[#1]{\@glo@entry}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsaddallunused} +%\begin{definition} +%\cs{glsaddallunused}\oarg{glossary type} +%\end{definition} +% Add all used terms defined for the listed glossaries (without displaying +% any text). If optional argument is omitted, apply to all +% glossary types. This should typically go at the end of the +% document. +%\changes{3.08a}{2013-09-28}{new} +%\changes{3.13a}{2013-11-05}{set default to \cs{@glo@types}} +%\changes{4.12}{2014-11-22}{replaced @gobble with glsignore} +% \begin{macrocode} +\newrobustcmd*{\glsaddallunused}[1][\@glo@types]{% + \forallglsentries[#1]{\@glo@entry}% + {% + \ifglsused{\@glo@entry}{}{\glsadd[format=glsignore]{\@glo@entry}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsignore} +%\changes{4.12}{2014-11-22}{new} +% \begin{macrocode} +\newcommand*{\glsignore}[1]{} +% \end{macrocode} +%\end{macro} +% +%\section{Creating associated files} +% The \cs{writeist} command creates the associated +% customized \filetype{.ist} \app{makeindex} style file. +% While defining this command, some characters have their +% catcodes temporarily changed to ensure they get written to +% the \filetype{.ist} file correctly. The \app{makeindex} +% actual character (usually "@") is redefined to be a "?", to allow +% internal commands to be written to the glossary file output file. +% +% The special characters\mkidxspch\ are stored in \cs{@gls@actualchar}, +% \cs{@gls@encapchar}, \cs{@glsl@levelchar} and +% \cs{@gls@quotechar} to make them easier to use later, +% but don't change these values, because the characters are +% encoded in the command definitions that are used to escape +% the special characters (which means that the user no longer +% needs to worry about \app{makeindex} special characters). +% +% The symbols and numbers label for group headings are hardwired into +% the \filetype{.ist} file as \texttt{glssymbols} and +% \texttt{glsnumbers}, the group titles can be translated +% (so that \ics{glssymbolsgroupname} replaces \texttt{glssymbols} +% and \ics{glsnumbersgroupname} replaces \texttt{glsnumbers}) +% using the command \ics{glsgetgrouptitle} which is +% defined in \isty{glossary-hypernav}. This is done to prevent +% any problem characters in \ics{glssymbolsgroupname} +% and \ics{glsnumbersgroupname} from breaking hyperlinks. +% +%\begin{macro}{\glsopenbrace} +% Define \cs{glsopenbrace} to make it easier to write an opening +% brace to a file. +% \begin{macrocode} +\edef\glsopenbrace{\expandafter\@gobble\string\{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsclosebrace} +% Define \cs{glsclosebrace} to make it easier to write an opening +% brace to a file. +% \begin{macrocode} +\edef\glsclosebrace{\expandafter\@gobble\string\}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsbackslash} +%\changes{4.11}{2014-09-01}{new} +% Define \cs{glsbackslash} to make it easier to write a backslash to a file. +% \begin{macrocode} +\edef\glsbackslash{\expandafter\@gobble\string\\} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsquote} +% Define command that makes it easier to write quote marks to +% a file in the event that the double quote character has been +% made active. +% \begin{macrocode} +\edef\glsquote#1{\string"#1\string"} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspercentchar} +%\changes{4.10}{2014-08-27}{new} +% Define \cs{glspercentchar} to make it easier to write a percent +% character to a file. +% \begin{macrocode} +\edef\glspercentchar{\expandafter\@gobble\string\%} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstildechar} +%\changes{4.10}{2014-08-27}{new} +% Define \cs{glstildechar} to make it easier to write a tilde +% character to a file. +% \begin{macrocode} +\edef\glstildechar{\string~} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsfirstletter} +% Define the first letter to come after the digits 0,\ldots,9. +% Only required for \app{xindy}. +% \begin{macrocode} +\ifglsxindy + \newcommand*{\@glsfirstletter}{A} +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsSetXdyFirstLetterAfterDigits} +%\changes{4.33}{2017-09-20}{added starred version} +% Sets the first letter to come after the digits 0,\ldots,9. +%The starred version sanitizes. +% \begin{macrocode} +\newcommand*{\GlsSetXdyFirstLetterAfterDigits}{% + \@ifstar\s@GlsSetXdyFirstLetterAfterDigits\@GlsSetXdyFirstLetterAfterDigits} +\ifglsxindy + \newcommand*{\@GlsSetXdyFirstLetterAfterDigits}[1]{% + \renewcommand*{\@glsfirstletter}{#1}} + \newcommand*{\s@GlsSetXdyFirstLetterAfterDigits}[1]{% + \renewcommand*{\@glsfirstletter}{#1}% + \@onelevel@sanitize\@glsfirstletter + } +\else + \newcommand*{\@GlsSetXdyFirstLetterAfterDigits}[1]{% + \glsnoxindywarning\GlsSetXdyFirstLetterAfterDigits} + \newcommand*{\s@GlsSetXdyFirstLetterAfterDigits}{% + \@GlsSetXdyFirstLetterAfterDigits + } +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@xdynumbergrouporder} +% Specifies the order of the number group. +% \begin{macrocode} +\ifglsxindy + \newcommand*{\@xdynumbergrouporder}{:before \string"\@glsfirstletter\string"} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsSetXdyNumberGroupOrder} +%\changes{4.33}{2017-09-20}{new} +% Sets the relative location of the number group. +%The starred version sanitizes. +% \begin{macrocode} +\newcommand*{\GlsSetXdyNumberGroupOrder}[1]{% + \@ifstar\s@GlsSetXdyNumberGroupOrder\@GlsSetXdyNumberGroupOrder +} +\ifglsxindy + \newcommand*{\@GlsSetXdyNumberGroupOrder}[1]{% + \renewcommand*{\@xdynumbergrouporder}{#1}% + } + \newcommand*{\s@GlsSetXdyNumberGroupOrder}[1]{% + \renewcommand*{\@xdynumbergrouporder}{#1}% + \@onelevel@sanitize\@xdynumbergrouporder + } +\else + \newcommand*{\@GlsSetXdyNumberGroupOrder}[1]{% + \glsnoxindywarning\GlsSetXdyNumberGroupOrder} + \newcommand*{\s@GlsSetXdyNumberGroupOrder}{% + \@GlsSetXdyNumberGroupOrder} +\fi +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\@glsminrange} +% Define the minimum number of successive location references +% to merge into a range. +% \begin{macrocode} +\newcommand*{\@glsminrange}{2} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsSetXdyMinRangeLength} +% Set the minimum range length. The value must either be "none" +% or a positive integer. The \sty{glossaries} package doesn't +% check if the argument is valid, that is left to \app{xindy}. +% \begin{macrocode} +\ifglsxindy + \newcommand*{\GlsSetXdyMinRangeLength}[1]{% + \renewcommand*{\@glsminrange}{#1}} +\else + \newcommand*{\GlsSetXdyMinRangeLength}[1]{% + \glsnoxindywarning\GlsSetXdyMinRangeLength} +\fi +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\writeist} +%\changes{1.17}{2008-12-26}{added xindy support} +%\changes{1.01}{2007-05-17}{Added spaces after \cs{delimN} and +%\cs{delimR} in ist file}% +%\changes{3.0}{2011-04-02}{modified to support new format} +% \begin{macrocode} +\ifglsxindy +% \end{macrocode} +% Code to use if \app{xindy} is required. +% \begin{macrocode} + \def\writeist{% +% \end{macrocode} +% Define write register if not already defined +%\changes{4.04}{2014-03-06}{checked for definition of \cs{glswrite}} +% \begin{macrocode} + \ifundef{\glswrite}{\newwrite\glswrite}{}% +% \end{macrocode} +% Update attributes list +% \begin{macrocode} + \@gls@addpredefinedattributes +% \end{macrocode} +% Open the file. +% \begin{macrocode} + \openout\glswrite=\istfilename +% \end{macrocode} +% Write header comment at the start of the file +% \begin{macrocode} + \write\glswrite{;; xindy style file created by the glossaries + package}% + \write\glswrite{;; for document '\jobname' on + \the\year-\the\month-\the\day}% +% \end{macrocode} +% Specify the required styles +% \begin{macrocode} + \write\glswrite{^^J; required styles^^J} + \@for\@xdystyle:=\@xdyrequiredstyles\do{% + \ifx\@xdystyle\@empty + \else + \protected@write\glswrite{}{(require + \string"\@xdystyle.xdy\string")}% + \fi + }% +% \end{macrocode} +% List the allowed attributes (possible values used by the +% \gloskey{format} key) +% \begin{macrocode} + \write\glswrite{^^J% + ; list of allowed attributes (number formats)^^J}% + \write\glswrite{(define-attributes ((\@xdyattributes)))}% +% \end{macrocode} +% Define any additional alphabets +% \begin{macrocode} + \write\glswrite{^^J; user defined alphabets^^J}% + \write\glswrite{\@xdyuseralphabets}% +% \end{macrocode} +% Define location classes. +% \begin{macrocode} + \write\glswrite{^^J; location class definitions^^J}% +% \end{macrocode} +% As from version 3.0, locations are now specified as +% \marg{Hprefix}\marg{number}, so need to add all possible +% combinations of location types. +% \begin{macrocode} + \@for\@gls@classI:=\@gls@xdy@locationlist\do{% +% \end{macrocode} +% Case where \meta{Hprefix} is empty: +% \begin{macrocode} + \protected@write\glswrite{}{(define-location-class + \string"\@gls@classI\string"^^J\space\space\space + ( + :sep "{}{" + \csname @gls@xdy@Lclass@\@gls@classI\endcsname\space + :sep "}" + ) + ^^J\space\space\space + :min-range-length \@glsminrange^^J% + ) + }% +% \end{macrocode} +% Nested iteration over all classes: +% \begin{macrocode} + {% + \@for\@gls@classII:=\@gls@xdy@locationlist\do{% + \protected@write\glswrite{}{(define-location-class + \string"\@gls@classII-\@gls@classI\string" + ^^J\space\space\space + ( + :sep "{" + \csname @gls@xdy@Lclass@\@gls@classII\endcsname\space + :sep "}{" + \csname @gls@xdy@Lclass@\@gls@classI\endcsname\space + :sep "}" + ) + ^^J\space\space\space + :min-range-length \@glsminrange^^J% + ) + }% + }% + }% + }% +% \end{macrocode} +% User defined location classes (needs checking for new location format). +% \begin{macrocode} + \write\glswrite{^^J; user defined location classes}% + \write\glswrite{\@xdyuserlocationdefs}% +% \end{macrocode} +% Cross-reference class. (The unverified option is used as the +% cross-references are supplied using the list of labels along with +% the optional argument for \ics{glsseeformat} which +% \app{xindy} won't recognise.) +% \begin{macrocode} + \write\glswrite{^^J; define cross-reference class^^J}% + \write\glswrite{(define-crossref-class \string"see\string" + :unverified )}% +% \end{macrocode} +% Define how cross-references should be displayed. This adds an +% empty set of braces after the cross-referencing information +% allowing for the final argument of \cs{glsseeformat} which +% gets ignored. (When using \app{makeindex} this final argument +% contains the location information which is not required.) +% \begin{macrocode} + \write\glswrite{(markup-crossref-list + :class \string"see\string"^^J\space\space\space + :open \string"\string\glsseeformat\string" + :close \string"{}\string")}% +% \end{macrocode} +% Provide hook to write extra material here (used by +% \sty{glossaries-extra} to define a seealso class). +% \begin{macrocode} + \@xdycrossrefhook +% \end{macrocode} +% List the order to sort the classes. +% \begin{macrocode} + \write\glswrite{^^J; define the order of the location classes}% + \write\glswrite{(define-location-class-order + (\@xdylocationclassorder))}% +% \end{macrocode} +% Specify what to write to the start and end of the glossary file. +% \begin{macrocode} + \write\glswrite{^^J; define the glossary markup^^J}% +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added xindy-only macro definitions to +%glossary open tag} +% \begin{macrocode} + \write\glswrite{(markup-index^^J\space\space\space + :open \string"\string + \glossarysection[\string\glossarytoctitle]{\string + \glossarytitle}\string\glossarypreamble}% +% \end{macrocode} +% Add all the xindy-only macro definitions (needed to prevent errors +% in the event that the user changes from \pkgopt{xindy} to +% \pkgopt{makeindex}) +% \begin{macrocode} + \@for\@this@ctr:=\@xdycounters\do{% + {% + \@for\@this@attr:=\@xdyattributelist\do{% + \protected@write\glswrite{}{\string\providecommand*% + \expandafter\string + \csname glsX\@this@ctr X\@this@attr\endcsname[2]% + {% + \string\setentrycounter + [\expandafter\@gobble\string\#1]{\@this@ctr}% + \expandafter\string + \csname\@this@attr\endcsname + {\expandafter\@gobble\string\#2}% + }% + }% + }% + }% + }% +% \end{macrocode} +% Add the end part of the open tag and the rest of the markup-index +% information: +% \begin{macrocode} + \write\glswrite{% + \string\begin + {theglossary}\string\glossaryheader\glstildechar n\string" ^^J\space + \space\space:close \string"\glspercentchar\glstildechar n\string + \end{theglossary}\string\glossarypostamble + \glstildechar n\string" ^^J\space\space\space + :tree)}% +% \end{macrocode} +% Specify what to put between letter groups +% \begin{macrocode} + \write\glswrite{(markup-letter-group-list + :sep \string"\string\glsgroupskip\glstildechar n\string")}% +% \end{macrocode} +% Specify what to put between entries +% \begin{macrocode} + \write\glswrite{(markup-indexentry + :open \string"\string\relax \string\glsresetentrylist + \glstildechar n\string")}% +% \end{macrocode} +% Specify how to format entries +% \begin{macrocode} + \write\glswrite{(markup-locclass-list :open + \string"\glsopenbrace\string\glossaryentrynumbers + \glsopenbrace\string\relax\space \string"^^J\space\space\space + :sep \string", \string" + :close \string"\glsclosebrace\glsclosebrace\string")}% +% \end{macrocode} +% Specify how to separate location numbers +% \begin{macrocode} + \write\glswrite{(markup-locref-list + :sep \string"\string\delimN\space\string")}% +% \end{macrocode} +% Specify how to indicate location ranges +% \begin{macrocode} + \write\glswrite{(markup-range + :sep \string"\string\delimR\space\string")}% +% \end{macrocode} +% Specify 2-page and 3-page suffixes, if defined. +% First, the values must be sanitized to write them explicity. +% \begin{macrocode} + \@onelevel@sanitize\gls@suffixF + \@onelevel@sanitize\gls@suffixFF +% \end{macrocode} +% \begin{macrocode} + \ifx\gls@suffixF\@empty + \else + \write\glswrite{(markup-range + :close "\gls@suffixF" :length 1 :ignore-end)}% + \fi + \ifx\gls@suffixFF\@empty + \else + \write\glswrite{(markup-range + :close "\gls@suffixFF" :length 2 :ignore-end)}% + \fi +% \end{macrocode} +% Specify how to format locations. +% \begin{macrocode} + \write\glswrite{^^J; define format to use for locations^^J}% + \write\glswrite{\@xdylocref}% +% \end{macrocode} +% Specify how to separate letter groups. +% \begin{macrocode} + \write\glswrite{^^J; define letter group list format^^J}% + \write\glswrite{(markup-letter-group-list + :sep \string"\string\glsgroupskip\glstildechar n\string")}% +% \end{macrocode} +% Define letter group headings. +% \begin{macrocode} + \write\glswrite{^^J; letter group headings^^J}% + \write\glswrite{(markup-letter-group + :open-head \string"\string\glsgroupheading + \glsopenbrace\string"^^J\space\space\space + :close-head \string"\glsclosebrace\string")}% +% \end{macrocode} +% Define additional letter groups. +% \begin{macrocode} + \write\glswrite{^^J; additional letter groups^^J}% + \write\glswrite{\@xdylettergroups}% +% \end{macrocode} +% Define additional sort rules +% \begin{macrocode} + \write\glswrite{^^J; additional sort rules^^J} + \write\glswrite{\@xdysortrules}% +% \end{macrocode} +%Hook for any additional information: +% \begin{macrocode} + \@gls@writeisthook +% \end{macrocode} +% Close the style file +% \begin{macrocode} + \closeout\glswrite +% \end{macrocode} +% Suppress any further calls. +% \begin{macrocode} + \let\writeist\relax + } +\else +% \end{macrocode} +% Code to use if \app{makeindex} is required. +%\changes{2.01}{2009 May 30}{removed item\_02 - no such makeindex key} +%\changes{4.04}{2014-03-06}{checked for definition of \cs{glswrite}} +% \begin{macrocode} + \edef\@gls@actualchar{\string?} + \edef\@gls@encapchar{\string|} + \edef\@gls@levelchar{\string!} + \edef\@gls@quotechar{\string"}% + \let\GlsSetQuote\gls@nosetquote + \def\writeist{\relax + \ifundef{\glswrite}{\newwrite\glswrite}{}\relax + \openout\glswrite=\istfilename + \write\glswrite{\glspercentchar\space makeindex style file + created by the glossaries package} + \write\glswrite{\glspercentchar\space for document + '\jobname' on \the\year-\the\month-\the\day} + \write\glswrite{actual '\@gls@actualchar'} + \write\glswrite{encap '\@gls@encapchar'} + \write\glswrite{level '\@gls@levelchar'} + \write\glswrite{quote '\@gls@quotechar'} + \write\glswrite{keyword \string"\string\\glossaryentry\string"} + \write\glswrite{preamble \string"\string\\glossarysection[\string + \\glossarytoctitle]{\string\\glossarytitle}\string + \\glossarypreamble\string\n\string\\begin{theglossary}\string + \\glossaryheader\string\n\string"} + \write\glswrite{postamble \string"\string\%\string\n\string + \\end{theglossary}\string\\glossarypostamble\string\n + \string"} + \write\glswrite{group_skip \string"\string\\glsgroupskip\string\n + \string"} + \write\glswrite{item_0 \string"\string\%\string\n\string"} + \write\glswrite{item_1 \string"\string\%\string\n\string"} + \write\glswrite{item_2 \string"\string\%\string\n\string"} + \write\glswrite{item_01 \string"\string\%\string\n\string"} + \write\glswrite{item_x1 + \string"\string\\relax \string\\glsresetentrylist\string\n + \string"} + \write\glswrite{item_12 \string"\string\%\string\n\string"} + \write\glswrite{item_x2 + \string"\string\\relax \string\\glsresetentrylist\string\n + \string"} +% \end{macrocode} +%\changes{2.05}{2010-02-06}{Added \cs{string} before opening +% and closing braces. Patch provided by Segiu Dotenco} +% \begin{macrocode} + \write\glswrite{delim_0 \string"\string\{\string + \\glossaryentrynumbers\string\{\string\\relax \string"} + \write\glswrite{delim_1 \string"\string\{\string + \\glossaryentrynumbers\string\{\string\\relax \string"} + \write\glswrite{delim_2 \string"\string\{\string + \\glossaryentrynumbers\string\{\string\\relax \string"} + \write\glswrite{delim_t \string"\string\}\string\}\string"} + \write\glswrite{delim_n \string"\string\\delimN \string"} + \write\glswrite{delim_r \string"\string\\delimR \string"} + \write\glswrite{headings_flag 1} + \write\glswrite{heading_prefix + \string"\string\\glsgroupheading\string\{\string"} + \write\glswrite{heading_suffix + \string"\string\}\string\\relax + \string\\glsresetentrylist \string"} + \write\glswrite{symhead_positive \string"glssymbols\string"} + \write\glswrite{numhead_positive \string"glsnumbers\string"} + \write\glswrite{page_compositor \string"\glscompositor\string"} + \@gls@escbsdq\gls@suffixF + \@gls@escbsdq\gls@suffixFF + \ifx\gls@suffixF\@empty + \else + \write\glswrite{suffix_2p \string"\gls@suffixF\string"} + \fi + \ifx\gls@suffixFF\@empty + \else + \write\glswrite{suffix_3p \string"\gls@suffixFF\string"} + \fi +% \end{macrocode} +%Hook for any additional information: +% \begin{macrocode} + \@gls@writeisthook +% \end{macrocode} +% Close the file and disable \cs{writeist}. +% \begin{macrocode} + \closeout\glswrite + \let\writeist\relax + } +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsSetWriteIstHook} +%\changes{4.24}{2016-05-27}{new} +%Allow user to append information to the style file. +% \begin{macrocode} +\newcommand*{\GlsSetWriteIstHook}[1]{\renewcommand*{\@gls@writeisthook}{#1}} +\@onlypremakeg\GlsSetWriteIstHook +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@writeisthook} +% \begin{macrocode} +\newcommand*{\@gls@writeisthook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsSetQuote} +%\changes{4.24}{2016-05-27}{new} +%Allow user to set the \app{makeindex} quote character. This is primarily for +%\sty{ngerman} users who want to use \app{makeindex}'s -g option. +% \begin{macrocode} +\ifglsxindy + \newcommand*{\GlsSetQuote}[1]{\glsnomakeindexwarning\GlsSetQuote} + \newcommand*{\gls@nosetquote}[1]{\glsnomakeindexwarning\GlsSetQuote} +\else + \newcommand*{\GlsSetQuote}[1]{\edef\@gls@quotechar{\string#1}% +% \end{macrocode} +% If German is in use, set +% the extra \app{makeindex} option so \app{makeglossaries} can pick +% it up. +% \begin{macrocode} + \@ifpackageloaded{tracklang}% + {% + \IfTrackedLanguage{german}% + {% + \def\@@gls@extramakeindexopts{-g}% + }% + {}% + }% + {}% +% \end{macrocode} +% Need to redefine \cs{@gls@checkquote} +% \begin{macrocode} + \edef\@gls@docheckquotedef{% + \noexpand\def\noexpand\@gls@checkquote####1#1####2#1####3\noexpand\null{% + \noexpand\@gls@tmpb=\noexpand\expandafter{\noexpand\@gls@checkedmkidx}% + \noexpand\toks@={####1}% + \noexpand\ifx\noexpand\null####2\noexpand\null + \noexpand\ifx\noexpand\null####3\noexpand\null + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}% + \noexpand\def\noexpand\@@gls@checkquote{\noexpand\relax}% + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \noexpand\@gls@quotechar\noexpand\@gls@quotechar + \noexpand\@gls@quotechar\noexpand\@gls@quotechar}% + \noexpand\def\noexpand\@@gls@checkquote{% + \noexpand\@gls@checkquote####3\noexpand\null}% + \noexpand\fi + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \noexpand\@gls@quotechar\noexpand\@gls@quotechar}% + \noexpand\ifx\noexpand\null####3\noexpand\null + \noexpand\def\noexpand\@@gls@checkquote{% + \noexpand\@gls@checkquote####2#1#1\noexpand\null}% + \noexpand\else + \noexpand\def\noexpand\@@gls@checkquote{% + \noexpand\@gls@checkquote####2#1####3\noexpand\null}% + \noexpand\fi + \noexpand\fi + \noexpand\@@gls@checkquote + }% + }% + \@gls@docheckquotedef + \edef\@gls@docheckquotedef{% + \noexpand\renewcommand{\noexpand\@gls@checkmkidxchars}[1]{% + \noexpand\def\noexpand\@gls@checkedmkidx{}% + \noexpand\expandafter\noexpand\@gls@checkquote####1\noexpand\@nil + #1#1\noexpand\null + \noexpand\expandafter\noexpand\@gls@updatechecked + \noexpand\@gls@checkedmkidx{####1}% + \noexpand\def\noexpand\@gls@checkedmkidx{}% + \noexpand\expandafter\noexpand\@gls@checkescquote####1\noexpand\@nil + \expandonce{\csname#1\endcsname}\expandonce{\csname#1\endcsname}% + \noexpand\null + \noexpand\expandafter\noexpand\@gls@updatechecked + \noexpand\@gls@checkedmkidx{####1}% + \noexpand\def\noexpand\@gls@checkedmkidx{}% + \noexpand\expandafter\noexpand\@gls@checkescactual####1\noexpand\@nil + \noexpand\?\noexpand\?\noexpand\null + \noexpand\expandafter\noexpand\@gls@updatechecked + \noexpand\@gls@checkedmkidx{####1}% + \noexpand\def\noexpand\@gls@checkedmkidx{}% + \noexpand\expandafter\noexpand\@gls@checkactual####1\noexpand\@nil + \noexpand?\noexpand?\noexpand\null + \noexpand\expandafter\noexpand\@gls@updatechecked + \noexpand\@gls@checkedmkidx{####1}% + \noexpand\def\noexpand\@gls@checkedmkidx{}% + \noexpand\expandafter\noexpand\@gls@checkbar####1\noexpand\@nil + \noexpand|\noexpand|\noexpand\null + \noexpand\expandafter\noexpand\@gls@updatechecked + \noexpand\@gls@checkedmkidx{####1}% + \noexpand\def\noexpand\@gls@checkedmkidx{}% + \noexpand\expandafter\noexpand\@gls@checkescbar####1\noexpand\@nil + \noexpand\|\noexpand\|\noexpand\null + \noexpand\expandafter\noexpand\@gls@updatechecked + \noexpand\@gls@checkedmkidx{####1}% + \noexpand\def\noexpand\@gls@checkedmkidx{}% + \noexpand\expandafter\noexpand\@gls@checklevel####1\noexpand\@nil + \noexpand!\noexpand!\noexpand\null + \noexpand\expandafter\noexpand\@gls@updatechecked + \noexpand\@gls@checkedmkidx{####1}% + }% + }% + \@gls@docheckquotedef + \edef\@gls@docheckquotedef{% + \noexpand\def\noexpand\@gls@checkescquote####1% + \expandonce{\csname#1\endcsname}####2\expandonce{\csname#1\endcsname}% + ####3\noexpand\null{% + \noexpand\@gls@tmpb=\noexpand\expandafter{\noexpand\@gls@checkedmkidx}% + \noexpand\toks@={####1}% + \noexpand\ifx\noexpand\null####2\noexpand\null + \noexpand\ifx\noexpand\null####3\noexpand\null + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@}% + \noexpand\def\noexpand\@@gls@checkescquote{\noexpand\relax}% + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \noexpand\@gls@quotechar\noexpand\string\expandonce{% + \csname#1\endcsname}\noexpand\@gls@quotechar + \noexpand\@gls@quotechar\noexpand\string\expandonce{% + \csname#1\endcsname}\noexpand\@gls@quotechar}% + \noexpand\def\noexpand\@@gls@checkescquote{% + \noexpand\@gls@checkescquote####3\noexpand\null}% + \noexpand\fi + \noexpand\else + \noexpand\edef\noexpand\@gls@checkedmkidx{% + \noexpand\the\noexpand\@gls@tmpb\noexpand\the\noexpand\toks@ + \noexpand\@gls@quotechar\noexpand\string + \expandonce{\csname#1\endcsname}\noexpand\@gls@quotechar}% + \noexpand\ifx\noexpand\null####3\noexpand\null + \noexpand\def\noexpand\@@gls@checkescquote{% + \noexpand\@gls@checkescquote####2\expandonce{\csname#1\endcsname}% + \expandonce{\csname#1\endcsname}\noexpand\null}% + \noexpand\else + \noexpand\def\noexpand\@@gls@checkescquote{% + \noexpand\@gls@checkescquote####2\expandonce{\csname#1\endcsname}% + ####3\noexpand\null}% + \noexpand\fi + \noexpand\fi + \noexpand\@@gls@checkescquote + }% + }% + \@gls@docheckquotedef + } + \newcommand*{\gls@nosetquote}[1]{\PackageError{glossaries}% + {\string\GlsSetQuote\space not permitted here}% + {Move \string\GlsSetQuote\space earlier in the preamble, as + soon as possible after glossaries.sty has been loaded}} +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@extramakeindexopts} +%\changes{4.24}{2016-05-27}{new} +% \begin{macrocode} +\newcommand*{\@gls@extramakeindexopts}[1]{} +% \end{macrocode} +%\end{macro} +% +%The command \cs{noist} will suppress the creation of +% the \filetype{.ist} file. Obviously you need to use this +% command before \cs{writeist} to have any effect. +%\begin{macro}{\noist} +% \begin{macrocode} +\newcommand{\noist}{% +% \end{macrocode} +% Update attributes list +% \begin{macrocode} + \@gls@addpredefinedattributes + \let\writeist\relax +} +% \end{macrocode} +%\end{macro} +% +% \cs{@makeglossary} is an internal command that takes an +% argument indicating the glossary type. This command will +% create the glossary file required by \app{makeindex} for the +% given glossary type, using the extension supplied by the +% \meta{out-ext} parameter used in \ics{newglossary} +% (and it will also activate the \ics{glossary} command, +% and create the customized \filetype{.ist} \app{makeindex} +% style file). +% +% Note that you can't use \cs{@makeglossary} for only some of the +% defined glossaries. You either need to have a \cs{makeglossary} +% for all glossaries or none (otherwise you will end up with a +% situation where \TeX\ is trying to write to a non-existant +% file). The relevant glossary must be +% defined prior to using \cs{@makeglossary}. +%\begin{macro}{\@makeglossary} +% \begin{macrocode} +\newcommand*{\@makeglossary}[1]{% + \ifglossaryexists{#1}% + {% +% \end{macrocode} +% Only create a new write if \pkgopt[false]{savewrites} otherwise +% create a token to collect the information. +%\changes{3.0}{2010-07-12}{Added check for \pkgopt{savewrites}} +% \begin{macrocode} + \ifglssavewrites + \expandafter\newtoks\csname glo@#1@filetok\endcsname + \else + \expandafter\newwrite\csname glo@#1@file\endcsname + \expandafter\@glsopenfile\csname glo@#1@file\endcsname{#1}% + \fi + \@gls@renewglossary + \writeist + }% + {% + \PackageError{glossaries}% + {Glossary type `#1' not defined}% + {New glossaries must be defined before using \string\makeglossaries}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsopenfile} +% Open write file associated with the given glossary. +% \begin{macrocode} +\newcommand*{\@glsopenfile}[2]{% + \immediate\openout#1=\jobname.\csname @glotype@#2@out\endcsname + \PackageInfo{glossaries}{Writing glossary file + \jobname.\csname @glotype@#2@out\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@closegls} +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newcommand*{\@closegls}[1]{% + \closeout\csname glo@#1@file\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@automake} +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\ifglsxindy + \newcommand*{\@gls@automake}[1]{% + \ifglossaryexists{#1} + {% + \@closegls{#1}% + \ifdefstring{\glsorder}{letter}% + {\def\@gls@order{-M ord/letorder }}% + {\let\@gls@order\@empty}% + \ifcsundef{@xdy@#1@language}% + {\let\@gls@langmod\@xdy@main@language}% + {\letcs\@gls@langmod{@xdy@#1@language}}% + \edef\@gls@dothiswrite{\noexpand\write18{xindy + -I xindy + \@gls@order + -L \@gls@langmod\space + -M \gls@istfilebase\space + -C \gls@codepage\space + -t \jobname.\csuse{@glotype@#1@log} + -o \jobname.\csuse{@glotype@#1@in} + \jobname.\csuse{@glotype@#1@out}}% + }% + \@gls@dothiswrite + }% + {% + \GlossariesWarning{Can't make glossary `#1', it doesn't exist}% + }% + } +\else + \newcommand*{\@gls@automake}[1]{% + \ifglossaryexists{#1} + {% + \@closegls{#1}% + \ifdefstring{\glsorder}{letter}% + {\def\@gls@order{-l }}% + {\let\@gls@order\@empty}% + \edef\@gls@dothiswrite{\noexpand\write18{makeindex \@gls@order + -s \istfilename\space + -t \jobname.\csuse{@glotype@#1@log} + -o \jobname.\csuse{@glotype@#1@in} + \jobname.\csuse{@glotype@#1@out}}% + }% + \@gls@dothiswrite + }% + {% + \GlossariesWarning{Can't make glossary `#1', it doesn't exist}% + }% + } +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@automake@immediate} +%\changes{4.42}{2019-01-06}{new} +% \begin{macrocode} +\ifglsxindy + \newcommand*{\@gls@automake@immediate}[1]{% + \ifglossaryexists{#1} + {% + \IfFileExists{\jobname.\csuse{@glotype@#1@out}}% + {% + \ifdefstring{\glsorder}{letter}% + {\def\@gls@order{-M ord/letorder }}% + {\let\@gls@order\@empty}% + \ifcsundef{@xdy@#1@language}% + {\let\@gls@langmod\@xdy@main@language}% + {\letcs\@gls@langmod{@xdy@#1@language}}% + \edef\@gls@dothiswrite{\noexpand\immediate\noexpand\write18{xindy + -I xindy + \@gls@order + -L \@gls@langmod\space + -M \gls@istfilebase\space + -C \gls@codepage\space + -t \jobname.\csuse{@glotype@#1@log} + -o \jobname.\csuse{@glotype@#1@in} + \jobname.\csuse{@glotype@#1@out}}% + }% + \@gls@dothiswrite + }% + {\GlossariesWarning{can't automake `#1': \jobname.\csuse{@glotype@#1@out} + doesn't exist. Rerun may be required}}% + }% + {% + \GlossariesWarning{Can't make glossary `#1', it doesn't exist}% + }% + } +\else + \newcommand*{\@gls@automake@immediate}[1]{% + \ifglossaryexists{#1} + {% + \IfFileExists{\jobname.\csuse{@glotype@#1@out}}% + {% + \ifdefstring{\glsorder}{letter}% + {\def\@gls@order{-l }}% + {\let\@gls@order\@empty}% + \edef\@gls@dothiswrite{\noexpand\immediate\noexpand\write18{makeindex \@gls@order + -s \istfilename\space + -t \jobname.\csuse{@glotype@#1@log} + -o \jobname.\csuse{@glotype@#1@in} + \jobname.\csuse{@glotype@#1@out}}% + }% + \@gls@dothiswrite + }% + {\GlossariesWarning{can't automake `#1': \jobname.\csuse{@glotype@#1@out} + doesn't exist. Rerun may be required}}% + }% + {% + \GlossariesWarning{Can't make glossary `#1', it doesn't exist}% + }% + } +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\warn@nomakeglossaries} +% Issue warning that \cs{makeglossaries} hasn't been used. +% \begin{macrocode} +\newcommand*{\@warn@nomakeglossaries}{} +% \end{macrocode} +% Only use this if warning if \cs{printglossary} has been used +% without \cs{makeglossaries} +% \begin{macrocode} +\newcommand*{\warn@nomakeglossaries}{\@warn@nomakeglossaries} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@@automake@immediate} +%\changes{4.42}{2019-01-06}{new} +% \begin{macrocode} +\newcommand{\@gls@@automake@immediate}{% + \ifnum\gls@automake@nr=2\relax + \@for\@gls@type:=\@glo@types\do{% + \ifdefempty{\@gls@type}{}% + {\@gls@automake@immediate{\@gls@type}}% + }% + \glsautomakefalse + \renewcommand*{\@gls@doautomake}{}% + \fi +} +% \end{macrocode} +%\end{macro} +% +% \cs{makeglossaries} will use \cs{@makeglossary} +% for each glossary type that has been defined. New glossaries +% need to be defined before using \cs{makeglossary}, so +% have \cs{makeglossaries} redefine \cs{newglossary} +% to prevent it being used afterwards. +%\begin{macro}{\makeglossaries} +% \begin{macrocode} +\newcommand*{\makeglossaries}{% +% \end{macrocode} +%If automake=immediate setting is on, use the shell escape now. +% \begin{macrocode} + \@gls@@automake@immediate +% \end{macrocode} +% Define the write used for style file also used for all other output files +% if \pkgopt[true]{savewrites}. +%\changes{4.04}{2014-03-06}{Moved definition of \cs{glswrite} to +%\cs{makeglossaries}} +% \begin{macrocode} + \ifundef{\glswrite}{\newwrite\glswrite}{}% +% \end{macrocode} +%\changes{3.10a}{2013-10-13}{Added providecommand code to aux file} +% If the user removes the glossary package from their document, +% ensure the next run doesn't throw a load of undefined control +% sequence errors when the aux file is parsed. +% \begin{macrocode} + \protected@write\@auxout{}{\string\providecommand\string\@glsorder[1]{}} + \protected@write\@auxout{}{\string\providecommand\string\@istfilename[1]{}} +% \end{macrocode} +%If \cs{@@gls@extramakeindexopts} has been defined, write it: +% \begin{macrocode} + \ifundef\@@gls@extramakeindexopts + {}% + {% + \protected@write\@auxout{}{\string\providecommand + \string\@gls@extramakeindexopts[1]{}} + \protected@write\@auxout{}{\string\@gls@extramakeindexopts + {\@@gls@extramakeindexopts}}% + }% +% \end{macrocode} +% Write the name of the style file to the aux file +% (needed by \app{makeglossaries}) +% \begin{macrocode} + \protected@write\@auxout{}{\string\@istfilename{\istfilename}}% + \protected@write\@auxout{}{\string\@glsorder{\glsorder}} +% \end{macrocode} +% Iterate through each glossary type and activate it. +% \begin{macrocode} + \@for\@glo@type:=\@glo@types\do{% + \ifthenelse{\equal{\@glo@type}{}}{}{% + \@makeglossary{\@glo@type}}% + }% +% \end{macrocode} +% New glossaries must be created before \cs{makeglossaries} +% so disable \ics{newglossary}. +% \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. +% The deprecated \cs{makeglossary} is not redefined here as it either +% implements \cs{makeglossaries} or has been restored to its original +% definition (in which case it shouldn't be changed). +%\changes{4.41}{2018-07-23}{removed redefinition of \cs{makeglossary}} +% \begin{macrocode} + \let\@makeglossary\relax + \let\makeglossaries\relax +% \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} +% Suppress warning about no \cs{makeglossaries} +% \begin{macrocode} + \let\warn@nomakeglossaries\relax +% \end{macrocode} +% Activate warning about missing \cs{printglossary} +% \begin{macrocode} + \def\warn@noprintglossary{% + \ifdefstring{\@glo@types}{,}% + {% + \GlossariesWarningNoLine{No glossaries have been defined}% + }% + {% + \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} +% Declare list parser for \cs{glsdisplaynumberlist} +%\changes{3.02}{2012-05-21}{added list parser} +% \begin{macrocode} + \ifglssavenumberlist + \edef\@gls@dodeflistparser{\noexpand\DeclareListParser + {\noexpand\glsnumlistparser}{\delimN}}% + \@gls@dodeflistparser + \fi +% \end{macrocode} +% Prevent user from also using \cs{makenoidxglossaries} +% \begin{macrocode} + \let\makenoidxglossaries\@no@makeglossaries +% \end{macrocode} +% Prohibit sort key in printgloss family: +% \begin{macrocode} + \renewcommand*{\@printgloss@setsort}{% + \let\@glo@assign@sortkey\@glo@no@assign@sortkey + }% +% \end{macrocode} +% Check the automake setting: +% \begin{macrocode} + \ifglsautomake + \renewcommand*{\@gls@doautomake}{% + \@for\@gls@type:=\@glo@types\do{% + \ifdefempty{\@gls@type}{}% + {\@gls@automake{\@gls@type}}% + }% + }% + \fi +% \end{macrocode} +% Check the sort setting: +% \begin{macrocode} + \@glo@check@sortallowed\makeglossaries +} +% \end{macrocode} +%\changes{4.02}{2013-13-05}{made preamble only} +% Must occur in the preamble: +% \begin{macrocode} +\@onlypreamble{\makeglossaries} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glswrite} +% The definition of \cs{glswrite} has now been moved to +% \cs{makeglossaries} so that it's only defined if needed. +%\end{macro} +% +% If \ics{makeglossaries} hasn't been used, issue a warning. +% Also issue a warning if neither \ics{printglossaries} nor +% \ics{printglossary} have been used. +% \begin{macrocode} +\AtEndDocument{% + \warn@nomakeglossaries + \warn@noprintglossary +} +% \end{macrocode} +% +%\begin{macro}{\makenoidxglossaries} +%\changes{4.04}{2014-03-06}{new} +% Analogous to \cs{makeglossaries} this activates the commands +% needed for \cs{printnoidxglossary} +% \begin{macrocode} +\newcommand*{\makenoidxglossaries}{% +% \end{macrocode} +% Redefine empty glossary warning: +% \begin{macrocode} + \renewcommand{\@gls@noref@warn}[1]{% + \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} +% Don't escape makeindex/xindy characters: +% \begin{macrocode} + \let\@gls@checkmkidxchars\@gobble +% \end{macrocode} +% Don't escape locations: +%\changes{4.40}{2018-06-01}{added esclocations=false} +% \begin{macrocode} + \glsesclocationsfalse +% \end{macrocode} +% Write glossary information to aux instead of glossary files +% \begin{macrocode} + \let\@@do@@wrglossary\gls@noidxglossary +% \end{macrocode} +% Switch on group headings that use the character code: +% \begin{macrocode} + \let\@gls@getgrouptitle\@gls@noidx@getgrouptitle +% \end{macrocode} +% Allow \gloskey{see} key: +% \begin{macrocode} + \let\gls@checkseeallowed\relax +% \end{macrocode} +% Redefine cross-referencing macro: +% \begin{macrocode} + \renewcommand{\@do@seeglossary}[2]{% + \edef\@gls@label{\glsdetoklabel{##1}}% + \protected@write\@auxout{}{% + \string\@gls@reference + {\csname glo@\@gls@label @type\endcsname}% + {\@gls@label}% + {% + \string\glsseeformat##2{}% + }% + }% + }% +% \end{macrocode} +% If user removes the glossaries package from their document, ensure +% the next run doesn't throw a load of undefined control sequence +% errors when the aux file is parsed. +% \begin{macrocode} + \AtBeginDocument + {% + \write\@auxout{\string\providecommand\string\@gls@reference[3]{}}% + }% +% \end{macrocode} +% Change warning about no glossaries +% \begin{macrocode} + \def\warn@noprintglossary{% + \GlossariesWarningNoLine{No \string\printnoidxglossary\space + or \string\printnoidxglossaries ^^J + found. (Remove \string\makenoidxglossaries\space if you + don't want any glossaries.)^^JThis document will not have a glossary}% + }% +% \end{macrocode} +% Suppress warning about no \cs{makeglossaries} +% \begin{macrocode} + \let\warn@nomakeglossaries\relax +% \end{macrocode} +% Prevent user from also using \cs{makeglossaries} +% \begin{macrocode} + \let\makeglossaries\@no@makeglossaries +% \end{macrocode} +% Allow sort key in printgloss family: +% \begin{macrocode} + \renewcommand*{\@printgloss@setsort}{% + \let\@glo@assign@sortkey\@@glo@assign@sortkey +% \end{macrocode} +% Initialise default sort order: +% \begin{macrocode} + \def\@glo@sorttype{\@glo@default@sorttype}% + }% +% \end{macrocode} +% All entries must be defined in the preamble: +% \begin{macrocode} + \renewcommand*\new@glossaryentry[2]{% + \PackageError{glossaries}{Glossary entries must be + defined in the preamble^^Jwhen you use + \string\makenoidxglossaries}% + {Either move your definitions to the preamble or use + \string\makeglossaries}% + }% +% \end{macrocode} +% Redefine \ics{glsentrynumberlist} +% \begin{macrocode} + \renewcommand*{\glsentrynumberlist}[1]{% + \letcs{\@gls@loclist}{glo@\glsdetoklabel{##1}@loclist}% + \ifdef\@gls@loclist + {% + \glsnoidxloclist{\@gls@loclist}% + }% + {% + ??\glsdoifexists{##1}% + {% + \GlossariesWarning{Missing location list for `##1'. Either + a rerun is required or you haven't referenced the entry}% + }% + }% + }% +% \end{macrocode} +% Redefine \ics{glsdisplaynumberlist} +% \begin{macrocode} + \renewcommand*{\glsdisplaynumberlist}[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 + }% + {% + ??\glsdoifexists{##1}% + {% + \GlossariesWarning{Missing location list for `##1'. Either + a rerun is required or you haven't referenced the entry}% + }% + }% + }% +% \end{macrocode} +% Provide a generic way of iterating through the number list: +% \begin{macrocode} + \renewcommand*{\glsnumberlistloop}[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}% + }% + {% + ??\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} +% Modify sanitize sort function +% \begin{macrocode} + \let\@@gls@sanitizesort\@gls@noidx@sanitizesort + \let\@@gls@nosanitizesort\@@gls@noidx@nosanitizesort + \@gls@noidx@setsanitizesort +% \end{macrocode} +% Check sort option allowed. +% \begin{macrocode} + \@glo@check@sortallowed\makenoidxglossaries +} +% \end{macrocode} +% Preamble-only command: +% \begin{macrocode} +\@onlypreamble{\makenoidxglossaries} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnumberlistloop} +%\begin{definition} +%\cs{glsnumberlistloop}\marg{label}\marg{handler} +%\end{definition} +% \begin{macrocode} +\newcommand*{\glsnumberlistloop}[2]{% + \PackageError{glossaries}{\string\glsnumberlistloop\space + only works with \string\makenoidxglossaries}{}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsnoidxnumberlistloophandler} +% Handler macro for \cs{glsnumberlistloop}. +% (The argument should be in the form +% \cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{n}) +% \begin{macrocode} +\newcommand*{\glsnoidxnumberlistloophandler}[1]{% + #1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@no@makeglossaries} +%\changes{4.04}{2014-03-06}{new} +% Can't use both \cs{makeglossaries} and \cs{makenoidxglossaries} +% \begin{macrocode} +\newcommand*{\@no@makeglossaries}{% + \PackageError{glossaries}{You can't use both + \string\makeglossaries\space and \string\makenoidxglossaries}% + {Either use one or other (or none) of those commands but not both + together.}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@noref@warn} +%\changes{4.04}{2014-03-06}{new} +% Warning when no instances of \cs{@gls@reference} found. +% \begin{macrocode} +\newcommand{\@gls@noref@warn}[1]{% + \GlossariesWarning{\string\makenoidxglossaries\space + is required to make \string\printnoidxglossary[type={#1}] work}% +} +% \end{macrocode} +%\end{macro} +% +%\section{Writing information to associated files} +%\label{sec:wrgloss} +% +%\begin{macro}{\gls@noidxglossary} +% Write the glossary information to the aux file (for the `noidx' +% method): +% \begin{macrocode} +\newcommand*{\gls@noidxglossary}{% + \protected@write\@auxout{}{% + \string\@gls@reference + {\csname glo@\@gls@label @type\endcsname}% + {\@gls@label}% + {\string\glsnoidxdisplayloc + {\@glo@counterprefix}% + {\@gls@counter}% + {\@glsnumberformat}% + {\@glslocref}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\istfile} +%\changes{3.0}{2011-04-02}{deprecated} +%\changes{4.40}{2018-06-01}{changed \cs{def} to \cs{providecommand}} +% Deprecated. +% \begin{macrocode} +\providecommand\istfile{\glswrite} +% \end{macrocode} +%\end{macro} +% +% At the end of the document, the files should be created if +% \pkgopt[true]{savewrites}. +% \begin{macrocode} +\AtEndDocument{% + \glswritefiles +} +% \end{macrocode} +%\begin{macro}{\@glswritefiles} +% Only write the files if \pkgopt[true]{savewrites}. +%\changes{3.14a}{2013-11-12}{renamed \cs{glswritefiles} to +%\cs{@glswritefiles} and used ``savewrites'' option to set +%\cs{glswritefiles}} +% \begin{macrocode} +\newcommand*{\@glswritefiles}{% +% \end{macrocode} +% Iterate through all the glossaries. +%\changes{3.01}{2011-04-12}{added check for empty glossaries} +%\changes{3.02}{2012-05-21}{added check for existence of token +% in case \cs{makeglossaries has been omitted}} +% \begin{macrocode} + \forallglossaries{\@glo@type}{% +% \end{macrocode} +% Check for empty glossaries (patch provided by Patrick H\"acker) +% \begin{macrocode} + \ifcsundef{glo@\@glo@type @filetok}% + {% + \def\gls@tmp{}% + }% + {% + \edef\gls@tmp{\expandafter\the + \csname glo@\@glo@type @filetok\endcsname}% + }% + \ifx\gls@tmp\@empty + \ifx\@glo@type\glsdefaulttype + \GlossariesWarningNoLine{Glossary `\@glo@type' has no + entries.^^JRemember to use package option `nomain' if +you + don't want to^^Juse the main glossary}% + \else + \GlossariesWarningNoLine{Glossary `\@glo@type' has no + entries}% + \fi + \else + \@glsopenfile{\glswrite}{\@glo@type}% + \immediate\write\glswrite{% + \expandafter\the + \csname glo@\@glo@type @filetok\endcsname}% + \immediate\closeout\glswrite + \fi + }% +} +% \end{macrocode} +%\end{macro} +% +% As from v4.10, the \cs{glossary} command isn't +% used by the \styfmt{glossaries} package. Since the +% user isn't expected to use this command (as \styfmt{glossaries} +% takes care of the particular format required for +% \gls{makeindex}\slash\gls{xindy}) there's no need for a user level +% command. Using a custom internal command prevents any conflict +% with other packages (and with the \cs{mark} mechanism). +% +% The associated number should be stored in \cs{theglsentrycounter} +% before using \cs{gls@glossary}. +%\begin{macro}{\gls@glossary} +% \begin{macrocode} +\newcommand*{\gls@glossary}[1]{% + \@gls@glossary{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@glossary} +%\begin{definition} +%\cs{@gls@glossary}\marg{type}\marg{indexing info} +%\end{definition} +% (In v4.10, \cs{@glossary} was redefined to \cs{@gls@glossary} to +% avoid conflict with other packages.) +% Initially define internal \cs{@gls@glossary} to ignore its argument. +% Indexing will be enabled when \cs{@gls@glossary} is redefined by +% \cs{@makeglossary}. +% +% This command was originally +% defined to do \cs{@index}\marg{indexing info} so that it behaved +% much like \cs{index}. The definition was then changed to +% use \cs{index} as \cls{memoir} changes the definition of +% \cs{@index}. (Thanks to Dan Luecking for pointing this out.) +%\changes{1.17}{2008-12-26}{changed definition to use +%\cs{index} instead of \cs{@index}} +%\changes{4.10}{2014-08-27}{Renamed \cs{@glossary} to \cs{@gls@glossary}} +%\changes{4.24}{2016-05-27}{added check for debug mode} +% +%However, if normal indexing is enabled (for example with \cs{makeindex}) but no +%glossary lists are required (so \cs{@makeglossary} isn't used), +%then \cs{index} will cause a problem here. +%The \cs{@index} trick allows for special characters within +%\meta{indexing info} (so you can do, for example, \verb|\index{%@\%}|), +%and the original design of \cs{@glossary} here +%was actually a legacy from the old \styfmt{glossary} package. With +%the \styfmt{glossaries} package, the indexing information supplied in +%the second argument is more constrained and just consists of the sort +%value (given by the \gloskey{sort} key), the actual value +%(given by \cs{glossentry}\marg{label} or +%\cs{subglossentry}\marg{level}\marg{label}), and the format. This means that +%there's no need to worry about special characters appearing in the +%second argument as they can't be in the label or sort value. (If +%they are in the sort value then the category code would've needed +%to be changed when the entry was defined or \cs{glspercentchar} +%would be needed with the sort sanitization switched off.) +%This means that it's safe to simply ignore the second argument. +%\changes{4.36}{2018-03-07}{removed \cs{index}} +% \begin{macrocode} +\newcommand*{\@gls@glossary}[2]{% + \if@gls@debug + \PackageInfo{glossaries}{wrglossary(#1)(#2)}% + \fi +} +% \end{macrocode} +%\end{macro} +% This is a convenience command to set \cs{@gls@glossary}. +% It's used by \cs{@makeglossary} and then redefined to +% do nothing, as it only needs to be done once. +%\begin{macro}{\@gls@renewglossary} +% \begin{macrocode} +\newcommand{\@gls@renewglossary}{% + \gdef\@gls@glossary##1{\@bsphack\begingroup\gls@wrglossary{##1}}% + \let\@gls@renewglossary\@empty +} +% \end{macrocode} +%\end{macro} +% The \cs{gls@wrglossary} command is defined to have +% two arguments. The first argument is the glossary type, +% the second argument is the glossary entry +% (the format of which is set in \cs{glslink}). +%\begin{macro}{\gls@wrglossary} +%\changes{1.17}{2008-12-26}{modified to allow for xindy support} +%\changes{3.0}{2010-07-12}{modified to take into account +%\pkgopt{savewrites}} +%\changes{4.11}{2014-09-01}{renamed from \cs{@wrglossary} to +%\cs{gls@wrglossary}} +% \begin{macrocode} +\newcommand*{\gls@wrglossary}[2]{% + \ifglssavewrites + \protected@edef\@gls@tmp{\the\csname glo@#1@filetok\endcsname#2}% + \expandafter\global\expandafter\csname glo@#1@filetok\endcsname + \expandafter{\@gls@tmp^^J}% + \else +% \end{macrocode} +%\changes{3.02}{2012-05-21}{added check for glossary file defined}% +% \begin{macrocode} + \ifcsdef{glo@#1@file}% + {% + \expandafter\protected@write\csname glo@#1@file\endcsname{% + \gls@disablepagerefexpansion}{#2}% + }% + {% + \ifignoredglossary{#1}{}% + {% + \GlossariesWarning{No file defined for glossary `#1'}% + }% + }% + \fi + \endgroup\@esphack +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@do@wrglossary} +%\changes{3.02}{2012-05-21}{changed \cs{@do@wr@glossary} to test for +%\pkgopt{indexonlyfirst} option; put old \cs{@do@wr@glossary} code +%into \cs{@@do@wrglossary}} +% \begin{macrocode} +\newcommand*{\@do@wrglossary}[1]{% + \glswriteentry{#1}{\@@do@wrglossary{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glswriteentry} +%\changes{4.16}{2015-07-08}{new} +% Provide a user level command so the user can customize whether or +% not a line should be added to the glossary. The arguments are the +% label and the code that writes to the glossary file. +% \begin{macrocode} +\newcommand*{\glswriteentry}[2]{% + \ifglsindexonlyfirst + \ifglsused{#1}{}{#2}% + \else + #2% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@protected@pagefmts} +%\changes{3.04}{2012-11-18}{new} +%\changes{3.05}{2013-04-21}{added Roman to list} +% List of page formats to be protected against expansion. +%\changes{4.22}{2016-04-19}{added arabic to list} +% \begin{macrocode} +\newcommand{\gls@protected@pagefmts}{\gls@numberpage,\gls@alphpage,% + \gls@Alphpage,\gls@romanpage,\gls@Romanpage,\gls@arabicpage} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@disablepagerefexpansion} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@disablepagerefexpansion}{% + \@for\@gls@this:=\gls@protected@pagefmts\do + {% + \expandafter\let\@gls@this\relax + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@alphpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@alphpage}{\@alph\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@Alphpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@Alphpage}{\@Alph\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@numberpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@numberpage}{\number\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@arabicpage} +%\changes{4.22}{2016-04-19}{new} +% \begin{macrocode} +\newcommand*{\gls@arabicpage}{\@arabic\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@romanpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@romanpage}{\romannumeral\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@Romanpage} +%\changes{3.05}{2013-04-21}{new} +% \begin{macrocode} +\newcommand*{\gls@Romanpage}{\@Roman\c@page} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaddprotectedpagefmt} +%\begin{definition} +%\cs{glsaddprotectedpagefmt}\marg{cs name} +%\end{definition} +% Added a page format to the list of protected page formats. +% The argument should be the name (without a backslash) of the +% command that takes a \TeX\ register as the argument +% (\verb|\|\meta{csname}\verb|\c@page| must be valid). +%\changes{4.11}{2014-09-01}{new} +% \begin{macrocode} +\newcommand*{\glsaddprotectedpagefmt}[1]{% + \eappto\gls@protected@pagefmts{,\expandonce{\csname gls#1page\endcsname}}% + \csedef{gls#1page}{\expandonce{\csname#1\endcsname}\noexpand\c@page}% + \eappto\@wrglossarynumberhook{% + \noexpand\let\expandonce{\csname org@gls#1\endcsname}% + \expandonce{\csname#1\endcsname}% + \noexpand\def\expandonce{\csname#1\endcsname}{% + \noexpand\@wrglossary@pageformat + \expandonce{\csname gls#1page\endcsname}% + \expandonce{\csname org@gls#1\endcsname}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@wrglossarynumberhook} +% Hook used by \cs{@@do@wrglossary} +% \begin{macrocode} +\newcommand*\@wrglossarynumberhook{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@wrglossary@pageformat} +% \begin{macrocode} +\newcommand{\@wrglossary@pageformat}[3]{% + \ifx#3\c@page #1\else #2#3\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@do@wrglossary} +%\changes{4.33}{2017-09-20}{changed to check for \pkgopt{esclocations}} +% Write the glossary entry in the appropriate format. +% \begin{macrocode} +\newcommand*{\@@do@wrglossary}[1]{% + \ifglsesclocations + \@@do@esc@wrglossary{#1}% + \else + \@@do@noesc@wrglossary{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@do@noesc@wrglossary} +%\changes{4.33}{2017-09-20}{new} +% Write the glossary entry in the appropriate format. +% The locations don't need to be pre-processed before writing the +% information to the glossary file, but the prefix still needs to be +% found. +% \begin{macrocode} +\newcommand*{\@@do@noesc@wrglossary}[1]{% +% \end{macrocode} +% Don't fully expand yet. +% \begin{macrocode} + \expandafter\def\expandafter\@glslocref\expandafter{\theglsentrycounter}% + \expandafter\def\expandafter\@glsHlocref\expandafter{\theHglsentrycounter}% +% \end{macrocode} +% Find the prefix if \cs{@glsHlocref} and \cs{@glslocref} aren't the same. +% \begin{macrocode} + \ifx\@glsHlocref\@glslocref + \def\@glo@counterprefix{}% + \else +% \end{macrocode} +% The value of the counter isn't important here as it's the prefix +% that's of interest. (\cs{c@page} will have the same value in +% both \cs{theglsentrycounter} and \cs{theHglsentrycounter} at this +% point, even if it hasn't been updated yet. The page number is not +% expected to occur in the prefix.) +% \begin{macrocode} + \protected@edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix + {\@glslocref}{\@glsHlocref}% + }% + \@do@gls@getcounterprefix + \fi +% \end{macrocode} +% De-tok label if required. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} + \edef\@gls@label{\glsdetoklabel{#1}}% +% \end{macrocode} +% Write the information to file: +% \begin{macrocode} + \@@do@@wrglossary +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglswrallowprimitivemods} +%\changes{4.22}{2016-04-19}{new} +% Conditional to determine whether or not \cs{@@do@esc@wrglossary} +% should be allowed to temporarily redefine \cs{the} and +% \cs{number}. +% \begin{macrocode} +\newif\ifglswrallowprimitivemods +\glswrallowprimitivemodstrue +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@do@esc@wrglossary} +%\changes{4.33}{2017-09-20}{renamed from \cs{@@do@esc@wrglossary}} +%\changes{1.17}{2008-12-26}{new} +% Write the glossary entry in the appropriate format. +% (Need to set \cs{@glsnumberformat} and \cs{@gls@counter} prior to use.) +% The argument is the entry's label. +%\changes{3.0}{2011-04-02}{modified to use new format} +%This is far more complicated with \app{xindy} than with other +%indexing methods. There are two necessary but +%conflicting requirements with \app{xindy}: +%\begin{enumerate} +%\item all backslashes in the location must be escaped; +%\item \cs{c@page} can't be prematurely expanded. +%\end{enumerate} +% (With \app{makeindex} there's the remote possibility that the page +% compositor is a \app{makeindex} special character, so that would +% also need to be escaped.) +% +%For example, suppose \cs{thepage} is defined as +%\begin{verbatim} +%\renewcommand{\thepage}{\tally{page}} +%\newcommand{\tally}[1]{\tallynum{\expandafter\the\csname c@#1\endcsname}} +%\end{verbatim} +%where \cs{tallynum} is a robust command that takes a number as its +%argument. With all indexing methods other than \app{xindy}, a +%deferred write with \cs{thepage} as the location will expand to +%\cs{tallynum}\marg{n} where \meta{n} is the page number. Since the +%write is deferred, the page number is correct. (\app{makeindex} +%won't accept this location format, but \cs{makenoidxglossaries} +%and \app{bib2gls} are quite happy with it.) Unfortunately, this +%fails with \app{xindy} because \app{xindy} interprets this location +%as \texttt{tallynum}\marg{n} because \cs{t} represents a +%the character \qt{t}. The location must be written as +%\verb|\\tallynum|\marg{n}. +% +%This means that the location +%\verb|\tally{page}| must be expanded and then the backslashes must +%be doubled. Unfortunately \cs{c@page} mustn't be expanded until the +%deferred write is performed, so the location actually needs to be +%expanded to \verb|\tallynum{\the\c@page}| but the backslashes in +%\verb|\the\c@page| mustn't be escaped. All other backslashes must be +%escaped. (In this case, only the backslash in \cs{tallynum} but the +%location format may include other control sequences.) The code +%below works on the assumption that commands like \cs{tally} are +%defined in the form +%\begin{verbatim} +%\newcommand{\tally}[1]{\tallynum{\expandafter\the\csname c@#1\endcsname}} +%\end{verbatim} +%(note the use of \cs{expandafter} and \cs{name}) +%or in the form +%\begin{verbatim} +%\newcommand{\tally}[1]{\tallynum{\arabic{#1}}} +%\end{verbatim} +%In the second case, \cs{arabic} is one of the known commands that's +%temporarily adjusted to prevent \cs{c@page} from being prematurely +%expanded. In the first case, \cs{the} is temporarily modified +%(unless \cs{glswrallowprimitivemodsfalse}) to +%check if it's followed by \cs{c@page}. The \cs{expandafter} ensures +%that it is. If \cs{tally} is defined in another way that hides +%\cs{c@page} for example using \verb|\the\value{#1}| then the +%process fails. +% +%With \app{makeindex}, \cs{tallynum} needs to expand to just the +%decimal number while writing the location to the glossary file, +%otherwise \app{makeindex} will reject it. This can +%be done by defining \cs{glstallypage} so that \cs{tally} can +%locally be set to \cs{arabic} while expansion is occurring. Again, \cs{c@page} +%must be protected from expansion until the deferred write occurs. +% +%The expansion before the write occurs also allows the hyper prefix +%to be determined where \cs{theH}\meta{counter} is defined in the +%form \meta{prefix}\verb|.|\cs{the}\meta{counter}. It's possible (although +%again unlikely) that a \app{makeindex} character might occur in the +%prefix, which therefore needs escaping. The prefix is passed as the +%optional argument of \cs{setentrycounter} which is needed by commands like +%\cs{glshypernumber} to create a hyperlink for a given counter (like +%\cs{hyperpage} but for an arbitrary counter). +% +% \begin{macrocode} +\newcommand*{\@@do@esc@wrglossary}[1]{% please read documented code! + \begingroup +% \end{macrocode} +% First a bit of hackery to prevent premature +% expansion of \cs{c@page}. Store original definitions (scoped): +%\changes{3.04}{2012-11-18}{modified to compensate for possible +%incorrect page number} +%\changes{4.22}{2016-04-19}{added check for \cs{@arabic}} +% \begin{macrocode} + \let\gls@orgthe\the + \let\gls@orgnumber\number + \let\gls@orgarabic\@arabic + \let\gls@orgromannumeral\romannumeral + \let\gls@orgalph\@alph + \let\gls@orgAlph\@Alph + \let\gls@orgRoman\@Roman +% \end{macrocode} +% Redefine: +%\changes{3.05}{2013-04-21}{add Roman case. Fixed bugs in the else statements} +%\changes{4.22}{2016-04-19}{added test to allow temporary primitive +%modifications and added arabic case} +% \begin{macrocode} + \ifglswrallowprimitivemods +% \end{macrocode} +%The redefinition of \cs{the} to use \cs{expandafter} solves the +%problem of \verb|\the\csname c@|\meta{counter}\verb|\endcsname| but +%is only a partial solution to the problem of \verb|\the\value|. +%With \cs{value}, \cs{c@page} is too deeply hidden and will be +%expanded too soon, but at least there won't be an error. +%\changes{4.33}{2017-09-20}{added \cs{gls@the} and \cs{gls@number}} +% \begin{macrocode} + \def\gls@the##1{% + \ifx##1\c@page \gls@numberpage\else\gls@orgthe##1\fi}% + \def\the{\expandafter\gls@the}% + \def\gls@number##1{% + \ifx##1\c@page \gls@numberpage\else\gls@orgnumber##1\fi}% + \def\number{\expandafter\gls@number}% + \fi + \def\@arabic##1{% + \ifx##1\c@page \gls@arabicpage\else\gls@orgarabic##1\fi}% + \def\romannumeral##1{% + \ifx##1\c@page \gls@romanpage\else\gls@orgromannumeral##1\fi}% + \def\@Roman##1{% + \ifx##1\c@page \gls@Romanpage\else\gls@orgRoman##1\fi}% + \def\@alph##1{% + \ifx##1\c@page \gls@alphpage\else\gls@orgalph##1\fi}% + \def\@Alph##1{% + \ifx##1\c@page \gls@Alphpage\else\gls@orgAlph##1\fi}% +% \end{macrocode} +% Add hook to allow for other number formats: +%\changes{4.11}{2014-09-01}{added hook} +% \begin{macrocode} + \@wrglossarynumberhook +% \end{macrocode} +% Prevent expansion: +% \begin{macrocode} + \gls@disablepagerefexpansion +% \end{macrocode} +% Now store location in \cs{@glslocref}: +% \begin{macrocode} + \protected@xdef\@glslocref{\theglsentrycounter}% + \endgroup +% \end{macrocode} +% Escape any special characters. It's possible that with +% \app{makeindex} the separator might be a \app{makeindex} special character. +% Although not likely, it still needs to be taken into account. +% \begin{macrocode} + \@gls@checkmkidxchars\@glslocref +% \end{macrocode} +% Check if the hyper-location is the same as the location and set +% the hyper prefix. +%\changes{3.0}{2011-04-02}{added check for hyper location prefix} +% \begin{macrocode} + \expandafter\ifx\theHglsentrycounter\theglsentrycounter\relax + \def\@glo@counterprefix{}% + \else + \protected@edef\@glsHlocref{\theHglsentrycounter}% + \@gls@checkmkidxchars\@glsHlocref + \edef\@do@gls@getcounterprefix{\noexpand\@gls@getcounterprefix + {\@glslocref}{\@glsHlocref}% + }% + \@do@gls@getcounterprefix + \fi +% \end{macrocode} +% De-tok label if required +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} + \edef\@gls@label{\glsdetoklabel{#1}}% +% \end{macrocode} +% Write the information to file: +% \begin{macrocode} + \@@do@@wrglossary +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@do@@wrglossary} +% \begin{macrocode} +\newcommand*{\@@do@@wrglossary}{% +% \end{macrocode} +% Determine whether to use \app{xindy} or \app{makeindex} +% syntax +% \begin{macrocode} + \ifglsxindy +% \end{macrocode} +% Need to determine if the formatting information starts with +% a ( or ) indicating a range. +% \begin{macrocode} + \expandafter\@glo@check@mkidxrangechar\@glsnumberformat\@nil + \def\@glo@range{}% + \expandafter\if\@glo@prefix(\relax + \def\@glo@range{:open-range}% + \else + \expandafter\if\@glo@prefix)\relax + \def\@glo@range{:close-range}% + \fi + \fi +% \end{macrocode} +% Write to the glossary file using \app{xindy} syntax. +% \begin{macrocode} + \gls@glossary{\csname glo@\@gls@label @type\endcsname}{% + (indexentry :tkey (\csname glo@\@gls@label @index\endcsname) +% \end{macrocode} +%\changes{3.02}{2012-05-21}{changed \cs{@glslocref} to \cs{theglsentrycounter}} +%\changes{3.04}{2012-11-18}{changed \cs{theglsentrycounter} back to \cs{@glslocref}} +% \begin{macrocode} + :locref \string"{\@glo@counterprefix}{\@glslocref}\string" % + :attr \string"\@gls@counter\@glo@suffix\string" + \@glo@range + ) + }% + \else +% \end{macrocode} +% Convert the format information into the format required for +% \app{makeindex} +% \begin{macrocode} + \@set@glo@numformat{\@glo@numfmt}{\@gls@counter}{\@glsnumberformat}% + {\@glo@counterprefix}% +% \end{macrocode} +% Write to the glossary file using \app{makeindex} syntax. +% \begin{macrocode} + \gls@glossary{\csname glo@\@gls@label @type\endcsname}{% + \string\glossaryentry{\csname glo@\@gls@label @index\endcsname + \@gls@encapchar\@glo@numfmt}{\@glslocref}}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@getcounterprefix} +% Get the prefix that needs to be prepended to counter in order to +% get the hyper counter. (For example, with the standard +% \cls{article} class and \sty{hyperref}, \ics{theequation} needs to +% be prefixed with \meta{section num}|.| to get the equivalent +% \ics{theHequation}.) NB this assumes that the prefix ends with a +% dot, which is the standard. (Otherwise it makes the xindy location +% classes more complicated.) +% \begin{macrocode} +\newcommand*\@gls@getcounterprefix[2]{% + \edef\@gls@thisloc{#1}\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. +%\changes{4.04}{2014-03-04}{added warning if no prefix can be formed} +% \begin{macrocode} + \ifx\@glo@counterprefix\@empty + \GlossariesWarning{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"}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\section{Glossary Entry Cross-References} +%\begin{macro}{\@do@seeglossary} +%\changes{1.17}{2008-12-26}{new} +% Write the glossary entry with a cross reference. +% The first argument is the entry's label, the second must be in +% the form \oarg{tag}\marg{list}, where \meta{tag} is a tag +% such as ``see'' and \meta{list} is a list of labels. +%\changes{3.0}{2011-04-02}{Sanitize and escape cross-referencing +%information} +% \begin{macrocode} +\newcommand{\@do@seeglossary}[2]{% +\def\@gls@xref{#2}% +\@onelevel@sanitize\@gls@xref +\@gls@checkmkidxchars\@gls@xref +\ifglsxindy + \gls@glossary{\csname glo@#1@type\endcsname}{% + (indexentry + :tkey (\csname glo@#1@index\endcsname) + :xref (\string"\@gls@xref\string") + :attr \string"see\string" + ) + }% +\else + \gls@glossary{\csname glo@#1@type\endcsname}{% + \string\glossaryentry{\csname glo@#1@index\endcsname + \@gls@encapchar glsseeformat\@gls@xref}{Z}}% +\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@fixbraces} +% If no optional argument is specified, list needs to be enclosed +% in a set of braces. +% \begin{macrocode} +\def\@gls@fixbraces#1#2#3\@nil{% + \ifx#2[\relax + \@@gls@fixbraces#1#2#3\@end@fixbraces + \else + \def#1{{#2#3}}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@@gls@fixbraces} +% \begin{macrocode} +\def\@@gls@fixbraces#1[#2]#3\@end@fixbraces{% + \def#1{[#2]{#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssee} +%\cs{glssee}\marg{label}\marg{cross-ref list} +%\changes{1.17}{2008-12-26}{new} +%\changes{3.08a}{2013-09-28}{made robust} +% \begin{macrocode} +\DeclareRobustCommand*{\glssee}[3][\seename]{% + \@do@seeglossary{#2}{[#1]{#3}}} +\newcommand*{\@glssee}[3][\seename]{% + \glssee[#1]{#3}{#2}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsseeformat} +%\changes{1.17}{2008-12-26}{new} +%\changes{3.08a}{2013-09-28}{made robust} +% The first argument specifies what tag to use (e.g.\ ``see''), +% the second argument is a comma-separated list of labels. +% The final argument (the location) is ignored. +% \begin{macrocode} +\DeclareRobustCommand*{\glsseeformat}[3][\seename]{% + \emph{#1} \glsseelist{#2}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsseelist} +%\cs{glsseelist}\marg{list} formats list of entry labels. +%\changes{3.08a}{2013-09-28}{made robust} +% \begin{macrocode} +\DeclareRobustCommand*{\glsseelist}[1]{% +% \end{macrocode} +% If there is only one item in the list, set the last separator +% to do nothing. +% \begin{macrocode} + \let\@gls@dolast\relax +% \end{macrocode} +% Don't display separator on the first iteration of the loop +% \begin{macrocode} + \let\@gls@donext\relax +% \end{macrocode} +% Iterate through the labels +% \begin{macrocode} + \@for\@gls@thislabel:=#1\do{% +% \end{macrocode} +% Check if on last iteration of loop +% \begin{macrocode} + \ifx\@xfor@nextelement\@nnil + \@gls@dolast + \else + \@gls@donext + \fi +% \end{macrocode} +% Display the entry for this label. +% (Expanding label as it's a temporary control sequence that's used +% elsewhere.) +%\changes{4.03}{2014-01-20}{added \cs{expandafter} commands} +% \begin{macrocode} + \expandafter\glsseeitem\expandafter{\@gls@thislabel}% +% \end{macrocode} +% Update separators +% \begin{macrocode} + \let\@gls@dolast\glsseelastsep + \let\@gls@donext\glsseesep + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsseelastsep} +% Separator to use between penultimate and ultimate entries in a +% cross-referencing list. +% \begin{macrocode} +\newcommand*{\glsseelastsep}{\space\andname\space} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsseesep} +% Separator to use between entries in a cross-referencing list. +% \begin{macrocode} +\newcommand*{\glsseesep}{, } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsseeitem} +%\cs{glsseeitem}\marg{label} formats individual entry in a +% cross-referencing list. +%\changes{3.0}{2011-04-02}{hyperlink uses \cs{glsseeitemformat} instead +%of \cs{glsentryname}} +%\changes{3.08a}{2013-09-28}{made robust} +% \begin{macrocode} +\DeclareRobustCommand*{\glsseeitem}[1]{\glshyperlink[\glsseeitemformat{#1}]{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsseeitemformat} +%\changes{3.0}{2011-04-02}{new} +% As from v3.0, default is to use \ics{glsentrytext} instead of +% \ics{glsentryname}. (To avoid problems with the \gloskey{name} key being +% sanitized, although this is no longer a problem now.) +% \begin{macrocode} +\newcommand*{\glsseeitemformat}[1]{\glsentrytext{#1}} +% \end{macrocode} +%\end{macro} +% +% \section{Displaying the glossary}\label{sec:code:printglos} +% An individual glossary is displayed in the text using +% \cs{printglossary}\oarg{key-val list}. If the +% \gloskey[printglossary]{type} key is omitted, the default glossary is displayed. +% The optional argument can be used to specify an alternative +% glossary, and can also be used to set the style, title and +% entry in the table of contents. Available keys are defined below. +% +%\begin{macro}{\gls@save@numberlist} +%\changes{3.02}{2012-05-21}{new} +% Provide command to store number list. +% \begin{macrocode} +\newcommand*{\gls@save@numberlist}[1]{% + \ifglssavenumberlist + \toks@{#1}% + \edef\@do@writeaux@info{% + \noexpand\csgdef{glo@\glscurrententrylabel @numberlist}{\the\toks@}% + }% + \@onelevel@sanitize\@do@writeaux@info + \protected@write\@auxout{}{\@do@writeaux@info}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\warn@noprintglossary} +% Warn the user if they have forgotten \ics{printglossaries} +% or \ics{printglossary}. (Will be suppressed if there is at +% least one occurrence of \ics{printglossary}. There is no check +% to ensure that there is a \ics{printglossary} for each defined +% glossary.) +%\changes{4.04}{2014-03-06}{Activate warning in \cs{makeglossaries}} +% \begin{macrocode} +\newcommand*{\warn@noprintglossary}{}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printglossary} +%\changes{1.17}{2008-12-26}{added print language to aux file} +%\changes{1.15}{2008-08-15}{changed the way the TOC title is set} +%\changes{1.17}{2008-12-26}{added check to determine if +%\cs{printglossary} is already +% defined} +% The TOC title needs to be processed in a different manner +% to the main title in case the \sty{translator} and \sty{hyperref} packages +% are both being used. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifcsundef{printglossary}{}% +{% +% \end{macrocode} +% If \cs{printglossary} is already defined, issue a warning +% and undefine it. +% \begin{macrocode} + \@gls@warnonglossdefined + \undef\printglossary +} +% \end{macrocode} +% \cs{printglossary} has an optional argument. The default +% value is to set the glossary type to the main glossary. +%\changes{4.04}{2014-03-06}{changed to use new \cs{@printglossary}} +% \begin{macrocode} +\newcommand*{\printglossary}[1][type=\glsdefaulttype]{% + \@printglossary{#1}{\@print@glossary}% +} +% \end{macrocode} +%\end{macro} +% +% The \cs{printglossaries} command will do \cs{printglossary} +% for each glossary type that has been defined. It is better +% to use \cs{printglossaries} rather than individual +% \cs{printglossary} commands to ensure that you don't forget +% any new glossaries you may have created. It also makes it easier to +% chop and change the value of the \pkgopt{acronym} package option. +% However, if you want to list the glossaries in a different order, +% or if you want to set the title or table of contents entry, or +% if you want to use different glossary styles for each glossary, you +% will need to use \cs{printglossary} explicitly for each +% glossary type. +%\begin{macro}{\printglossaries} +% \begin{macrocode} +\newcommand*{\printglossaries}{% + \forallglossaries{\@@glo@type}{\printglossary[type=\@@glo@type]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printnoidxglossary} +%\changes{4.04}{2014-03-06}{new} +% Provide an alternative to \cs{printglossary} that doesn't require +% an external indexing application. Entries won't be sorted and the +% location list will be empty. +% \begin{macrocode} +\newcommand*{\printnoidxglossary}[1][type=\glsdefaulttype]{% + \@printglossary{#1}{\@print@noidx@glossary}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\printnoidxglossaries} +% Analogous to \cs{printglossaries} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\printnoidxglossaries}{% + \forallglossaries{\@@glo@type}{\printnoidxglossary[type=\@@glo@type]}% +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\@printgloss@setsort} +% Initialise to do nothing. +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\@printgloss@setsort}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@preglossaryhook} +%\changes{4.19}{2015-11-22}{new} +% \begin{macrocode} +\newcommand*{\@gls@preglossaryhook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@printglossary} +%\changes{4.04}{2014-03-06}{new} +% Sets up the glossary for either \cs{printglossary} or +% \cs{printnoidxglossary}. The first argument is the options list, +% the second argument is the handler macro that +% deals with the actual glossary. +% \begin{macrocode} +\newcommand{\@printglossary}[2]{% +% \end{macrocode} +% Set up defaults. +% \begin{macrocode} + \def\@glo@type{\glsdefaulttype}% + \def\glossarytitle{\csname @glotype@\@glo@type @title\endcsname}% +% \end{macrocode} +%\changes{3.03}{2012/09/21}{allow title to override default toctitle} +% \begin{macrocode} + \def\glossarytoctitle{\glossarytitle}% + \let\org@glossarytitle\glossarytitle +% \end{macrocode} +%\changes{4.21}{2016-01-24}{warn if no style has been set} +% \begin{macrocode} + \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}}% +% \end{macrocode} +% Store current value of \ics{glossaryentrynumbers}. (This may +% be changed via the optional argument) +% \begin{macrocode} + \let\@org@glossaryentrynumbers\glossaryentrynumbers +% \end{macrocode} +% Localise the effects of the optional argument +% \begin{macrocode} + \bgroup +% \end{macrocode} +% Activate or deactivate sort key: +% \begin{macrocode} + \@printgloss@setsort +% \end{macrocode} +% Determine settings specified in the optional argument. +% \begin{macrocode} + \setkeys{printgloss}{#1}% +% \end{macrocode} +% Does the glossary exist? +% \begin{macrocode} + \ifglossaryexists{\@glo@type}% + {% +% \end{macrocode} +% If title has been set, but toctitle hasn't, make toctitle the same +% as given title (rather than the title used when the glossary was +% defined) +%\changes{3.0}{2011-04-02}{make toctitle default to title} +% \begin{macrocode} + \ifx\glossarytitle\org@glossarytitle + \else + \expandafter\let\csname @glotype@\@glo@type @title\endcsname + \glossarytitle + \fi +% \end{macrocode} +% Allow a high-level user command to indicate the current glossary +%\changes{3.0}{2011-04-02}{added \cs{currentglossary}} +% \begin{macrocode} + \let\currentglossary\@glo@type +% \end{macrocode} +%Enable individual number lists to be suppressed. +% \begin{macrocode} + \let\org@glossaryentrynumbers\glossaryentrynumbers + \let\glsnonextpages\@glsnonextpages +% \end{macrocode} +% Enable individual number list to be activated: +%\changes{3.0}{2011-04-02}{added \cs{glsnextpages}} +% \begin{macrocode} + \let\glsnextpages\@glsnextpages +% \end{macrocode} +% Enable suppression of description terminators. +% \begin{macrocode} + \let\nopostdesc\@nopostdesc +% \end{macrocode} +% Set up the entry for the TOC +% \begin{macrocode} + \gls@dotoctitle +% \end{macrocode} +% Set the glossary style +% \begin{macrocode} + \@glossarystyle +% \end{macrocode} +%\changes{3.02}{2012-05-21}{add a way to fetch current entry label} +% Added a way to fetch the current entry label (v3.08 updated for +% new \cs{glossentry} and \cs{subglossentry}, but this is now only +% needed for backward compatibility): +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} + \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}% + }% +% \end{macrocode} +%\changes{4.19}{2015-11-22}{added \cs{@gls@preglossaryhook}} +% \begin{macrocode} + \@gls@preglossaryhook +% \end{macrocode} +% Now do the handler macro that deals with the actual glossary: +% \begin{macrocode} + #2% + }% + {\GlossariesWarning{Glossary `\@glo@type' doesn't exist}}% +% \end{macrocode} +% End the current scope +% \begin{macrocode} + \egroup +% \end{macrocode} +% Reset \ics{glossaryentrynumbers} +% \begin{macrocode} + \global\let\glossaryentrynumbers\@org@glossaryentrynumbers +% \end{macrocode} +% Suppress warning about no \ics{printglossary} +%\changes{2.02}{2007-07-13}{suppressed warning globally rather than locally} +% \begin{macrocode} + \global\let\warn@noprintglossary\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@print@glossary} +%\changes{4.04}{2014-03-06}{new} +% Internal workings of \cs{printglossary} dealing with reading the +% external file. +% \begin{macrocode} +\newcommand{\@print@glossary}{% +% \end{macrocode} +% Some macros may end up being expanded into internals in the +% glossary, so need to make @ a letter. (Unlikely to be a problem +% since v3.08a but kept for backward compatibility.) +% \begin{macrocode} + \makeatletter +% \end{macrocode} +% Input the glossary file, if it exists. +% \begin{macrocode} + \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}% +% \end{macrocode} +% If the glossary file doesn't exist, do \cs{null}. (This ensures +% that the page is shipped out and all write commands are done.) +% This might produce an empty page, but at this point the document +% isn't complete, so it shouldn't matter. +% \begin{macrocode} + \IfFileExists{\jobname.\csname @glotype@\@glo@type @in\endcsname}% + {}% + {\null}% +% \end{macrocode} +% If \app{xindy} is being used, need to write the language +% dependent information to the \filetype{.aux} file for +% \app{makeglossaries}. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +%\changes{3.04}{2012-11-18}{Moved aux write to end of document to +%prevent unwanted whatsit occurring here.} +% \begin{macrocode} + \ifglsxindy + \ifcsundef{@xdy@\@glo@type @language}% + {% + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% +% \end{macrocode} +%\changes{3.10a}{2013-10-13}{Added providecommand code to aux file} +% If the user removes the glossary package from their document, +% ensure the next run doesn't throw a load of undefined control +% sequence errors when the aux file is parsed. +% \begin{macrocode} + \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{% +% \end{macrocode} +%\changes{3.10a}{2013-10-13}{Added providecommand code to aux file} +% If the user removes the glossaries package from their document, +% ensure the next run doesn't throw a load of undefined control +% sequence errors when the aux file is parsed. +% \begin{macrocode} + \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 +% \end{macrocode} +% Activate warning if \cs{makeglossaries} hasn't been used. +% \begin{macrocode} + \renewcommand*{\@warn@nomakeglossaries}{% + \GlossariesWarningNoLine{\string\makeglossaries\space + hasn't been used,^^Jthe glossaries will not be updated}% + }% +} +% \end{macrocode} +%\end{macro} +% +% The sort macros all have the syntax: +%\begin{definition} +%\cs{@glo@sortmacro@\meta{order}}\marg{type} +%\end{definition} +% where \meta{order} is the sort order as specified by the sort key +% and \meta{type} is the glossary type. (The referenced entry list +% is stored in \cs{@glsref@\meta{type}.} The actual sorting is done +% by \cs{@glo@sortentries}\marg{handler}\marg{type}. +% +%\begin{macro}{\@glo@sortentries} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\@glo@sortentries}[2]{% + \glosortentrieswarning + \def\@glo@sortinglist{}% + \def\@glo@sortinghandler{#1}% + \edef\@glo@type{#2}% + \forlistcsloop{\@glo@do@sortentries}{@glsref@#2}% + \csdef{@glsref@#2}{}% + \@for\@this@label:=\@glo@sortinglist\do{% +% \end{macrocode} +% Has this entry already been added? +% \begin{macrocode} + \xifinlistcs{\@this@label}{@glsref@#2}% + {}% + {% + \listcsxadd{@glsref@#2}{\@this@label}% + }% + \ifcsdef{@glo@sortingchildren@\@this@label}% + {% + \@glo@addchildren{#2}{\@this@label}% + }% + {}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glo@addchildren} +%\changes{4.04}{2014-03-06}{new} +%\begin{definition} +%\cs{@glo@addchildren}\marg{type}\marg{parent} +%\end{definition} +% \begin{macrocode} +\newcommand*{\@glo@addchildren}[2]{% +% \end{macrocode} +% Scope to allow nesting. +% \begin{macrocode} + \bgroup + \letcs{\@glo@childlist}{@glo@sortingchildren@#2}% + \@for\@this@childlabel:=\@glo@childlist\do + {% +% \end{macrocode} +% Check this label hasn't already been added. +% \begin{macrocode} + \xifinlistcs{\@this@childlabel}{@glsref@#1}% + {}% + {% + \listcsxadd{@glsref@#1}{\@this@childlabel}% + }% +% \end{macrocode} +% Does this child have children? +% \begin{macrocode} + \ifcsdef{@glo@sortingchildren@\@this@childlabel}% + {% + \@glo@addchildren{#1}{\@this@childlabel}% + }% + {% + }% + }% + \egroup +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@do@sortentries} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\@glo@do@sortentries}[1]{% + \ifglshasparent{#1}% + {% +% \end{macrocode} +% This entry has a parent, so add it to the child list +% \begin{macrocode} + \edef\@glo@parent{\csuse{glo@\glsdetoklabel{#1}@parent}}% + \ifcsundef{@glo@sortingchildren@\@glo@parent}% + {% + \csdef{@glo@sortingchildren@\@glo@parent}{}% + }% + {}% + \expandafter\@glo@sortedinsert + \csname @glo@sortingchildren@\@glo@parent\endcsname{#1}% +% \end{macrocode} +% Has the parent been added? +% \begin{macrocode} + \xifinlistcs{\@glo@parent}{@glsref@\@glo@type}% + {% +% \end{macrocode} +% Yes, it has so do nothing. +% \begin{macrocode} + }% + {% +% \end{macrocode} +% No, it hasn't so add it now. +% \begin{macrocode} + \expandafter\@glo@do@sortentries\expandafter{\@glo@parent}% + }% + }% + {% + \@glo@sortedinsert{\@glo@sortinglist}{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortedinsert} +%\changes{4.04}{2014-03-06}{new} +%\begin{definition} +%\cs{@glo@sortedinsert}\marg{list}\marg{entry label} +%\end{definition} +% Insert into list. +% \begin{macrocode} +\newcommand*{\@glo@sortedinsert}[2]{% + \dtl@insertinto{#2}{#1}{\@glo@sortinghandler}% +}% +% \end{macrocode} +%\end{macro} +% +% The sort handlers need to be in the form required by +% \sty{datatool}'s \cs{dtl@sortlist} macro. These must set the count +% register \cs{dtl@sortresult} to either $-1$ (\#1 less than \#2), 0 +% (\#1 = \#2) or $+1$ (\#1 greater than \#2). +%\begin{macro}{\@glo@sorthandler@word} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\@glo@sorthandler@word}[2]{% + \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}% + \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}% + \edef\glo@do@compare{% + \noexpand\dtlwordindexcompare{\noexpand\dtl@sortresult}% + {\expandonce\@gls@sort@B}% + {\expandonce\@gls@sort@A}% + }% + \glo@do@compare +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sorthandler@letter} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\newcommand*{\@glo@sorthandler@letter}[2]{% + \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}% + \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}% + \edef\glo@do@compare{% + \noexpand\dtlletterindexcompare{\noexpand\dtl@sortresult}% + {\expandonce\@gls@sort@B}% + {\expandonce\@gls@sort@A}% + }% + \glo@do@compare +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sorthandler@case} +%\changes{4.04}{2014-03-06}{new} +% Case-sensitive sort. +% \begin{macrocode} +\newcommand*{\@glo@sorthandler@case}[2]{% + \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}% + \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}% + \edef\glo@do@compare{% + \noexpand\dtlcompare{\noexpand\dtl@sortresult}% + {\expandonce\@gls@sort@B}% + {\expandonce\@gls@sort@A}% + }% + \glo@do@compare +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sorthandler@nocase} +%\changes{4.04}{2014-03-06}{new} +% Case-insensitive sort. +% \begin{macrocode} +\newcommand*{\@glo@sorthandler@nocase}[2]{% + \letcs\@gls@sort@A{glo@\glsdetoklabel{#1}@sort}% + \letcs\@gls@sort@B{glo@\glsdetoklabel{#2}@sort}% + \edef\glo@do@compare{% + \noexpand\dtlicompare{\noexpand\dtl@sortresult}% + {\expandonce\@gls@sort@B}% + {\expandonce\@gls@sort@A}% + }% + \glo@do@compare +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@word} +%\changes{4.04}{2014-03-06}{new} +% Sort macro for `word' +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@word}[1]{% + \ifdefstring{\@glo@default@sorttype}{standard}% + {% + \@glo@sortentries{\@glo@sorthandler@word}{#1}% + }% + {% + \PackageError{glossaries}{Conflicting sort options:^^J + \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J + \string\printnoidxglossary[sort=word]}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@letter} +%\changes{4.04}{2014-03-06}{new} +% Sort macro for `letter' +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@letter}[1]{% + \ifdefstring{\@glo@default@sorttype}{standard}% + {% + \@glo@sortentries{\@glo@sorthandler@letter}{#1}% + }% + {% + \PackageError{glossaries}{Conflicting sort options:^^J + \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J + \string\printnoidxglossary[sort=letter]}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@standard} +%\changes{4.04}{2014-03-06}{new} +% Sort macro for `standard'. (Use either `word' or `letter' order.) +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@standard}[1]{% + \ifdefstring{\@glo@default@sorttype}{standard}% + {% + \ifcsdef{@glo@sorthandler@\glsorder}% + {% + \@glo@sortentries{\csuse{@glo@sorthandler@\glsorder}}{#1}% + }% + {% + \PackageError{glossaries}{Unknown sort handler `\glsorder'}{}% + }% + }% + {% + \PackageError{glossaries}{Conflicting sort options:^^J + \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J + \string\printnoidxglossary[sort=standard]}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@case} +%\changes{4.04}{2014-03-06}{new} +% Sort macro for `case' +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@case}[1]{% + \ifdefstring{\@glo@default@sorttype}{standard}% + {% + \@glo@sortentries{\@glo@sorthandler@case}{#1}% + }% + {% + \PackageError{glossaries}{Conflicting sort options:^^J + \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J + \string\printnoidxglossary[sort=case]}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@nocase} +%\changes{4.04}{2014-03-06}{new} +% Sort macro for `nocase' +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@nocase}[1]{% + \ifdefstring{\@glo@default@sorttype}{standard}% + {% + \@glo@sortentries{\@glo@sorthandler@nocase}{#1}% + }% + {% + \PackageError{glossaries}{Conflicting sort options:^^J + \string\usepackage[sort=\@glo@default@sorttype]{glossaries}^^J + \string\printnoidxglossary[sort=nocase]}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@def} +%\changes{4.04}{2014-03-06}{new} +% Sort macro for `def'. The order of definition is given in +% \cs{glolist@\meta{type}}. +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@def}[1]{% + \def\@glo@sortinglist{}% + \forglsentries[#1]{\@gls@thislabel}% + {% + \xifinlistcs{\@gls@thislabel}{@glsref@#1}% + {% + \listeadd{\@glo@sortinglist}{\@gls@thislabel}% + }% + {% +% \end{macrocode} +% Hasn't been referenced. +% \begin{macrocode} + }% + }% + \cslet{@glsref@#1}{\@glo@sortinglist}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@def@do} +%\changes{4.04}{2014-03-06}{new} +% This won't include parent entries that haven't been referenced. +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@def@do}[1]{% + \ifinlistcs{#1}{@glsref@\@glo@type}% + {}% + {% + \listcsadd{@glsref@\@glo@type}{#1}% + }% + \ifcsdef{@glo@sortingchildren@#1}% + {% + \@glo@addchildren{\@glo@type}{#1}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@sortmacro@use} +%\changes{4.04}{2014-03-06}{new} +% Sort macro for `use'. (No sorting is required, as the entries are +% already in order of use, so do nothing.) +% \begin{macrocode} +\newcommand*{\@glo@sortmacro@use}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@print@noidx@glossary} +%\changes{4.04}{2014-03-06}{new} +% Glossary handler for \cs{printnoidxglossary} which doesn't use an +% indexing application. Since \cs{printnoidxglossary} may occur at +% the start of the document, we can't just check if an entry has +% been used. Instead, the first pass needs to write information to +% the aux file every time an entry is referenced. This needs to be +% read in on the second run and stored in a~list corresponding to +% the appropriate glossary. +% \begin{macrocode} +\newcommand*{\@print@noidx@glossary}{% + \ifcsdef{@glsref@\@glo@type}% + {% +% \end{macrocode} +% Sort the entries: +% \begin{macrocode} + \ifcsdef{@glo@sortmacro@\@glo@sorttype}% + {% + \csuse{@glo@sortmacro@\@glo@sorttype}{\@glo@type}% + }% + {% + \PackageError{glossaries}{Unknown sort handler `\@glo@sorttype'}{}% + }% +% \end{macrocode} +% Do the glossary heading and preamble +% \begin{macrocode} + \glossarysection[\glossarytoctitle]{\glossarytitle}% + \glossarypreamble +% \end{macrocode} +% \changes{4.29}{2017-01-19}{moved definition of +% \cs{@gls@currentlettergroup} outside of \envfmt{theglossary} environment} +%The glossary style might use a tabular-like environment, which may +%cause scoping problems when setting the current letter group. +%The predefined tabular-like styles don't support letter group +%headings, but there's nothing to stop the user from defining their +%own custom style that might, so any redefinition of this command +%within \env{theglossary} will have to be done globally. +% \begin{macrocode} + \def\@gls@currentlettergroup{}% + \begin{theglossary}% + \glossaryheader + \glsresetentrylist +% \end{macrocode} +% Iterate through the entries. +% \begin{macrocode} + \forlistcsloop{\@gls@noidx@do}{@glsref@\@glo@type}% +% \end{macrocode} +% Finally end the glossary and do the postamble: +% \begin{macrocode} + \end{theglossary}% + \glossarypostamble + }% + {% + \@gls@noref@warn{\@glo@type}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glo@grabfirst} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\def\glo@grabfirst#1#2\@nil{% + \def\@gls@firsttok{#1}% + \ifdefempty\@gls@firsttok + {% + \def\@glo@thislettergrp{0}% + }% + {% +% \end{macrocode} +% Sanitize it: +% \begin{macrocode} + \@onelevel@sanitize\@gls@firsttok +% \end{macrocode} +% Fetch the first letter: +% \begin{macrocode} + \expandafter\@glo@grabfirst\@gls@firsttok{}{}\@nil + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glo@grabfirst} +%\changes{4.04}{2014-03-06}{new} +% \begin{macrocode} +\def\@glo@grabfirst#1#2\@nil{% + \ifdefempty\@glo@thislettergrp + {% + \def\@glo@thislettergrp{glssymbols}% + }% + {% + \count@=\uccode`#1\relax + \ifnum\count@=0\relax + \def\@glo@thislettergrp{glssymbols}% + \else + \ifdefstring\@glo@sorttype{case}% + {% + \count@=`#1\relax + }% + {% + }% + \edef\@glo@thislettergrp{\the\count@}% + \fi + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@noidx@do} +%\changes{4.04}{2014-03-06}{new} +% Handler for list iteration used by \cs{@print@noidx@glossary}. +% The argument is the entry label. This only allows one sublevel. +% \begin{macrocode} +\newcommand{\@gls@noidx@do}[1]{% +% \end{macrocode} +% Get this entry's location list +%\changes{4.07}{2014-04-04}{added \cs{global} in case it's used in a +%tabular-like style} +% \begin{macrocode} + \global\letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}% +% \end{macrocode} +% Does this entry have a~parent? +% \begin{macrocode} + \ifglshasparent{#1}% + {% +% \end{macrocode} +% Has a~parent. +% \begin{macrocode} + \gls@level=\csuse{glo@\glsdetoklabel{#1}@level}\relax + \ifdefvoid{\@gls@loclist} + {% + \subglossentry{\gls@level}{#1}{}% + }% + {% + \subglossentry{\gls@level}{#1}% + {% + \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}% + }% + }% + }% + {% +% \end{macrocode} +% Doesn't have a parent +% Get this entry's sort key +% \begin{macrocode} + \letcs{\@gls@sort}{glo@\glsdetoklabel{#1}@sort}% +% \end{macrocode} +% Fetch the first letter: +% \begin{macrocode} + \expandafter\glo@grabfirst\@gls@sort{}{}\@nil + \ifdefequal{\@glo@thislettergrp}{\@gls@currentlettergroup}% + {}% + {% +% \end{macrocode} +% Do the group header: +% \begin{macrocode} + \ifdefempty{\@gls@currentlettergroup}{}% + {% +% \end{macrocode} +%\changes{4.30}{2017-06-11}{letter group assignment made +%global} +%The group skip may start a new scope, so make a global assignment. +% \begin{macrocode} + \global\let\@glo@thislettergrp\@glo@thislettergrp + \glsgroupskip + }% + \glsgroupheading{\@glo@thislettergrp}% + }% +% \end{macrocode} +%\changes{4.29}{2017-01-19}{current letter group assignment made +%global} +% \begin{macrocode} + \global\let\@gls@currentlettergroup\@glo@thislettergrp +% \end{macrocode} +% Do this entry: +% \begin{macrocode} + \ifdefvoid{\@gls@loclist} + {% + \glossentry{#1}{}% + }% + {% + \glossentry{#1}% + {% + \glossaryentrynumbers{\glsnoidxloclist{\@gls@loclist}}% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnoidxloclist} +%\changes{4.04}{2014-03-06}{new} +%\begin{definition} +%\cs{glsnoidxloclist}\marg{list cs} +%\end{definition} +% Display location list. +% \begin{macrocode} +\newcommand*{\glsnoidxloclist}[1]{% + \def\@gls@noidxloclist@sep{}% + \def\@gls@noidxloclist@prev{}% + \forlistloop{\glsnoidxloclisthandler}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnoidxloclisthandler} +%\changes{4.04}{2014-03-06}{new} +% Handler for location list iterator. +% \begin{macrocode} +\newcommand*{\glsnoidxloclisthandler}[1]{% + \ifdefstring{\@gls@noidxloclist@prev}{#1}% + {% +% \end{macrocode} +% Same as previous location so skip. +% \begin{macrocode} + }% + {% + \@gls@noidxloclist@sep + #1% + \def\@gls@noidxloclist@sep{\delimN}% + \def\@gls@noidxloclist@prev{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnoidxdisplayloclisthandler} +%\changes{4.04}{2014-03-06}{new} +% Handler for location list iterator when used with +% \ics{glsdisplaynumberlist}. +% \begin{macrocode} +\newcommand*{\glsnoidxdisplayloclisthandler}[1]{% + \ifdefstring{\@gls@noidxloclist@prev}{#1}% + {% +% \end{macrocode} +% Same as previous location so skip. +% \begin{macrocode} + }% + {% + \@gls@noidxloclist@sep + \@gls@noidxloclist@prev + \def\@gls@noidxloclist@prev{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnoidxdisplayloc} +%\changes{4.04}{2014-03-06}{new} +%\begin{definition} +%\cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{location} +%\end{definition} +% Display a location in the location list. +% \begin{macrocode} +\newcommand*\glsnoidxdisplayloc[4]{% + \setentrycounter[#1]{#2}% + \csuse{#3}{#4}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@reference} +%\changes{4.04}{2014-03-06}{new} +%\begin{definition} +%\cs{@gls@reference}\marg{type}\marg{label}\marg{loc} +%\end{definition} +% Identifies that a reference has been used (for use in the aux file). +% All entries must be defined in the preamble. +% \begin{macrocode} +\newcommand*{\@gls@reference}[3]{% +% \end{macrocode} +% Add to label list +% \begin{macrocode} + \glsdoifexistsorwarn{#2}% + {% + \ifcsundef{@glsref@#1}{\csgdef{@glsref@#1}{}}{}% + \ifinlistcs{#2}{@glsref@#1}% + {}% + {\listcsgadd{@glsref@#1}{#2}}% +% \end{macrocode} +% Add to location list +% \begin{macrocode} + \ifcsundef{glo@\glsdetoklabel{#2}@loclist}% + {\csgdef{glo@\glsdetoklabel{#2}@loclist}{}}% + {}% + \listcsgadd{glo@\glsdetoklabel{#2}@loclist}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +% The keys that can be used in the optional argument to +% \ics{printglossary} or \ics{printnoidxglossary} are as follows: +% The \gloskey[printglossary]{type} key sets the glossary type. +% \begin{macrocode} +\define@key{printgloss}{type}{\def\@glo@type{#1}} +% \end{macrocode} +% The \gloskey[printglossary]{title} key sets the title used in the glossary section +% header. This overrides the title used in \ics{newglossary}. +%\changes{3.03}{2012/09/21}{allow title to set toctitle} +% \begin{macrocode} +\define@key{printgloss}{title}{% + \def\glossarytitle{#1}% + \let\gls@dotoctitle\relax +} +% \end{macrocode} +% The \gloskey[printglossary]{toctitle} sets the text used for the relevant entry +% in the table of contents. +% \begin{macrocode} +\define@key{printgloss}{toctitle}{% + \def\glossarytoctitle{#1}% + \let\gls@dotoctitle\relax +} +% \end{macrocode} +% The \gloskey[printglossary]{style} key sets the glossary style (but only for +% the given glossary). +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\define@key{printgloss}{style}{% + \ifcsundef{@glsstyle@#1}% + {% + \PackageError{glossaries}% + {Glossary style `#1' undefined}{}% + }% + {% + \def\@glossarystyle{\setglossentrycompatibility + \csname @glsstyle@#1\endcsname}% + }% +} +% \end{macrocode} +% \changes{1.14}{2008-06-17}{added numberedsection key to +% \cs{printglossary}} +% The \gloskey[printglossary]{numberedsection} key determines if this +% glossary should be in a numbered section. +%\changes{4.41}{2018-07-23}{changed \cs{val} and \cs{nr} to +%\cs{gls@numberedsection@val} and \cs{gls@numberedsection@nr}} +% \begin{macrocode} +\define@choicekey{printgloss}{numberedsection}% + [\gls@numberedsection@val\gls@numberedsection@nr]% + {false,nolabel,autolabel,nameref}[nolabel]% +{% + \ifcase\gls@numberedsection@nr\relax + \renewcommand*{\@@glossarysecstar}{*}% + \renewcommand*{\@@glossaryseclabel}{}% + \or + \renewcommand*{\@@glossarysecstar}{}% + \renewcommand*{\@@glossaryseclabel}{}% + \or + \renewcommand*{\@@glossarysecstar}{}% + \renewcommand*{\@@glossaryseclabel}{\label{\glsautoprefix\@glo@type}}% + \or + \renewcommand*{\@@glossarysecstar}{*}% + \renewcommand*{\@@glossaryseclabel}{% + \protected@edef\@currentlabelname{\glossarytoctitle}% + \label{\glsautoprefix\@glo@type}}% + \fi +} +% \end{macrocode} +% +%\changes{3.08a}{2013-09-28}{added nogroupskip key to \cs{printglossary}} +% The \gloskey[printglossary]{nogroupskip} key determines whether or +% not there should be a vertical gap between glossary groups. +% \begin{macrocode} +\define@choicekey{printgloss}{nogroupskip}{true,false}[true]{% + \csuse{glsnogroupskip#1}% +} +% \end{macrocode} +% +%\changes{4.08}{2014-07-30}{added nopostdot option to +%\texttt{printgloss} family} +% The \gloskey[printglossary]{nopostdot} key has the same effect as +% the package option of the same name. +% \begin{macrocode} +\define@choicekey{printgloss}{nopostdot}{true,false}[true]{% + \csuse{glsnopostdot#1}% +} +% \end{macrocode} +% +%\begin{macro}{\GlsEntryCounterLabelPrefix} +%\changes{4.38}{2018-05-10}{new} +%Make it easier to redefine the label prefix. +% \begin{macrocode} +\newcommand*{\GlsEntryCounterLabelPrefix}{glsentry-} +% \end{macrocode} +%\end{macro} +% +%The conditionals have been moved inside the appropriate commands to +%make it easier for the user to redefine them in the preamble +%and selectively switch the counter display on and off. Previously +%the helper commands were redefined by the \gloskey{entrycounter} +%option, which would counteract any earlier customisation. +% +%\changes{4.08}{2014-07-30}{added entrycounter option to +%\texttt{printgloss} family} +% The \gloskey[printglossary]{entrycounter} key is the same as the +% package option but localised to the current glossary. +% \begin{macrocode} +\define@choicekey{printgloss}{entrycounter}{true,false}[true]{% + \csuse{glsentrycounter#1}% + \@gls@define@glossaryentrycounter +} +% \end{macrocode} +% +%\changes{4.08}{2014-07-30}{added subentrycounter option to +%\texttt{printgloss} family} +% The \gloskey[printglossary]{subentrycounter} key is the same as the +% package option but localised to the current glossary. +% Note that this doesn't affect the master/slave counter attributes, +% which occurs if \pkgopt{subentrycounter} and \pkgopt{entrycounter} +% package options are set to true. +% \begin{macrocode} +\define@choicekey{printgloss}{subentrycounter}{true,false}[true]{% + \csuse{glssubentrycounter#1}% + \@gls@define@glossarysubentrycounter +} +% \end{macrocode} +% +% \changes{1.14}{2008-06-17}{added nonumberlist key to +% \cs{printglossary}} +% The \gloskey[printglossary]{nonumberlist} key determines if this +% glossary should have a number list. +% \begin{macrocode} +\define@boolkey{printgloss}[gls]{nonumberlist}[true]{% +\ifglsnonumberlist + \def\glossaryentrynumbers##1{}% +\else + \def\glossaryentrynumbers##1{##1}% +\fi} +% \end{macrocode} +% +%\changes{4.04}{2014-03-06}{added sort key to printgloss group} +% The \gloskey[printnoidxglossary]{sort} key sets the glossary sort +% handler (\cs{printnoidxglossary} only). +% \begin{macrocode} +\define@key{printgloss}{sort}{\@glo@assign@sortkey{#1}} +% \end{macrocode} +% +%\begin{macro}{\@glo@no@assign@sortkey} +% Issue error if used with \cs{printglossary} +% \begin{macrocode} +\newcommand*{\@glo@no@assign@sortkey}[1]{% + \PackageError{glossaries}{`sort' key not permitted with + \string\printglossary}% + {The `sort' key may only be used with \string\printnoidxglossary}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glo@assign@sortkey} +% For use with \cs{printnoidxglossary} +% \begin{macrocode} +\newcommand*{\@@glo@assign@sortkey}[1]{% + \def\@glo@sorttype{#1}% +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\@glsnonextpages} +%\changes{1.17}{2008-12-26}{new}% +% Suppresses the next number list only. Global assignments required +% as it may not occur in the same level of grouping as the +% next numberlist. (For example, if \cs{glsnonextpages} is place +% in the entry's description and 3 column tabular style glossary +% is used.) \cs{org@glossaryentrynumbers} needs to be set at +% the start of each glossary, in the event that +% \ics{glossaryentrynumber} is redefined. +% \begin{macrocode} +\newcommand*{\@glsnonextpages}{% + \gdef\glossaryentrynumbers##1{% + \glsresetentrylist + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsnextpages} +%\changes{3.0}{2011-04-02}{new}% +% Activate the next number list only. Global assignments required +% as it may not occur in the same level of grouping as the +% next numberlist. (For example, if \cs{glsnextpages} is place +% in the entry's description and 3 column tabular style glossary +% is used.) \cs{org@glossaryentrynumbers} needs to be set at +% the start of each glossary, in the event that +% \ics{glossaryentrynumber} is redefined. +% \begin{macrocode} +\newcommand*{\@glsnextpages}{% + \gdef\glossaryentrynumbers##1{% + ##1\glsresetentrylist}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsresetentrylist} +% Resets \cs{glossaryentrynumbers} +% \begin{macrocode} +\newcommand*{\glsresetentrylist}{% + \global\let\glossaryentrynumbers\org@glossaryentrynumbers} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\glsnonextpages} +% Outside of \cs{printglossary} this does nothing. +% \begin{macrocode} +\newcommand*{\glsnonextpages}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnextpages} +% Outside of \cs{printglossary} this does nothing. +% \begin{macrocode} +\newcommand*{\glsnextpages}{} +% \end{macrocode} +%\end{macro} +% +%Process \pkgopt{entrycounter} and then \pkgopt{subentrycounter} +%options (this ensures the sub-counter can pick up the main counter +%as the master if required): +% \begin{macrocode} +\@gls@define@glossaryentrycounter +\@gls@define@glossarysubentrycounter +% \end{macrocode} +%\begin{macro}{\glsresetsubentrycounter} +%\changes{3.0}{2011-04-02}{new} +% Resets the \ctr{glossarysubentry} counter. +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% \begin{macrocode} +\newcommand*{\glsresetsubentrycounter}{% + \ifglssubentrycounter + \setcounter{glossarysubentry}{0}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsresetsubentrycounter} +%\changes{3.02}{2012-05-21}{new} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% Resets the \ctr{glossaryentry} counter. +% \begin{macrocode} +\newcommand*{\glsresetentrycounter}{% + \ifglsentrycounter + \setcounter{glossaryentry}{0}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsstepentry} +%\changes{3.0}{2011-04-02}{new} +% Advance the \ctr{glossaryentry} counter if in use. The argument is +% the label associated with the entry. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% \begin{macrocode} +\newcommand*{\glsstepentry}[1]{% + \ifglsentrycounter + \refstepcounter{glossaryentry}% + \label{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsstepsubentry} +%\changes{3.0}{2011-04-02}{new} +% Advance the \ctr{glossarysubentry} counter if in use. The argument is +% the label associated with the subentry. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% \begin{macrocode} +\newcommand*{\glsstepsubentry}[1]{% + \ifglssubentrycounter + \edef\currentglssubentry{\glsdetoklabel{#1}}% + \refstepcounter{glossarysubentry}% + \label{\GlsEntryCounterLabelPrefix\currentglssubentry}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsrefentry} +%\changes{3.0}{2011-04-02}{new} +% Reference the entry or sub-entry counter if in use, otherwise just do +% \ics{gls}. +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% \begin{macrocode} +\newcommand*{\glsrefentry}[1]{% + \ifglsentrycounter + \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \ifglssubentrycounter + \ref{\GlsEntryCounterLabelPrefix\glsdetoklabel{#1}}% + \else + \gls{#1}% + \fi + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentrycounterlabel} +%\changes{3.0}{2011-04-02}{new} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% Defines how to display the \ctr{glossaryentry} counter. +% \begin{macrocode} +\newcommand*{\glsentrycounterlabel}{% + \ifglsentrycounter + \theglossaryentry.\space + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssubentrycounterlabel} +%\changes{3.0}{2011-04-02}{new} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% Defines how to display the \ctr{glossarysubentry} counter. +% \begin{macrocode} +\newcommand*{\glssubentrycounterlabel}{% + \ifglssubentrycounter + \theglossarysubentry)\space + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryitem} +% Step and display \ctr{glossaryentry} counter, if appropriate. +%\changes{3.0}{2011-04-02}{new} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% \begin{macrocode} +\newcommand*{\glsentryitem}[1]{% + \ifglsentrycounter + \glsstepentry{#1}\glsentrycounterlabel + \else + \glsresetsubentrycounter + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssubentryitem} +% Step and display \ctr{glossarysubentry} counter, if appropriate. +%\changes{3.0}{2011-04-02}{new} +%\changes{4.38}{2018-05-10}{bug fix: move conditional inside command} +% \begin{macrocode} +\newcommand*{\glssubentryitem}[1]{% + \ifglssubentrycounter + \glsstepsubentry{#1}\glssubentrycounterlabel + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{environment}{theglossary} +% If the \env{theglossary} environment has +% already been defined, a warning will be issued. +% This environment should be redefined by glossary styles. +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifcsundef{theglossary}% +{% + \newenvironment{theglossary}{}{}% +}% +{% + \@gls@warnontheglossdefined + \renewenvironment{theglossary}{}{}% +} +% \end{macrocode} +%\end{environment} +% +% The glossary header is given by \cs{glossaryheader}. +% This forms part of the glossary style, and +% must indicate what should appear immediately after the start of the +% \env{theglossary} environment. (For example, if the glossary +% uses a tabular-like environment, it may be used to set the +% header row.) Note that if you don't want a header row, the glossary +% style must redefine \cs{glossaryheader} to do nothing. +%\begin{macro}{\glossaryheader} +% \begin{macrocode} +\newcommand*{\glossaryheader}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstarget} +%\changes{1.18}{2009-01-14}{new} +%\begin{definition} +%\cs{glstarget}\marg{label}\marg{name} +%\end{definition} +% Provide user interface to \cs{@glstarget} to make it easier to +% modify the glossary style in the document. +% \begin{macrocode} +\newcommand*{\glstarget}[2]{\@glstarget{\glolinkprefix#1}{#2}} +% \end{macrocode} +%\end{macro} +% +% As from version 3.08, glossary information is now written to the +% external files using \ics{glossentry} and \ics{subglossentry} +% instead of \cs{glossaryentryfield} and \cs{glossarysubentryfield}. +% The default definition provides backward compatibility for +% glossary styles that use the old forms. +%\begin{macro}{\compatibleglossentry} +%\changes{3.08a}{2013-09-28}{new} +%\begin{definition} +% \cs{glossentry}\marg{label}\marg{page-list} +%\end{definition} +% \begin{macrocode} +\providecommand*{\compatibleglossentry}[2]{% + \toks@{#2}% + \protected@edef\@do@glossentry{\noexpand\glossaryentryfield{#1}% + {\noexpand\glsnamefont + {\expandafter\expandonce\csname glo@#1@name\endcsname}}% + {\expandafter\expandonce\csname glo@#1@desc\endcsname}% + {\expandafter\expandonce\csname glo@#1@symbol\endcsname}% + {\the\toks@}% + }% + \@do@glossentry +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentryname} +%\changes{3.08a}{2013-09-28}{new} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\glossentryname}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \expandafter\glsnamefont\expandafter{\glo@name}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentryname} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\newcommand*{\Glossentryname}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glsnamefont{\Glsentryname{#1}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentrydesc} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\newcommand*{\glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glsentrydesc{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentrydesc} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\newcommand*{\Glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \Glsentrydesc{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentrysymbol} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\newcommand*{\glossentrysymbol}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glsentrysymbol{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentrysymbol} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\newcommand*{\Glossentrysymbol}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \Glsentrysymbol{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\compatiblesubglossentry} +%\changes{3.08a}{2013-09-28}{new} +%\begin{definition} +% \cs{subglossentry}\marg{level}\marg{label}\marg{page-list} +%\end{definition} +% \begin{macrocode} +\providecommand*{\compatiblesubglossentry}[3]{% + \toks@{#3}% + \protected@edef\@do@subglossentry{\noexpand\glossarysubentryfield{\number#1}% + {#2}% + {\noexpand\glsnamefont + {\expandafter\expandonce\csname glo@#2@name\endcsname}}% + {\expandafter\expandonce\csname glo@#2@desc\endcsname}% + {\expandafter\expandonce\csname glo@#2@symbol\endcsname}% + {\the\toks@}% + }% + \@do@subglossentry +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\setglossentrycompatibility} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\newcommand*{\setglossentrycompatibility}{% + \let\glossentry\compatibleglossentry + \let\subglossentry\compatiblesubglossentry +} +\setglossentrycompatibility +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\glossaryentryfield} +%\begin{definition} +% \cs{glossaryentryfield}\marg{label}\marg{name}\marg{description}\marg{symbol}\marg{page-list} +%\end{definition} +% This command formerly governed how each entry row should be formatted +% in the glossary. Now deprecated. +%\changes{3.08a}{2013-09-28}{deprecated} +% \begin{macrocode} +\newcommand{\glossaryentryfield}[5]{% + \GlossariesWarning + {Deprecated use of \string\glossaryentryfield.^^J + I recommend you change to \string\glossentry.^^J + If you've just upgraded, try removing your gls auxiliary + files^^J and recompile}% + \noindent\textbf{\glstarget{#1}{#2}} #4 #3. #5\par} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glossarysubentryfield} +%\begin{definition} +% \cs{glossarysubentryfield}\marg{level}\marg{label}\marg{name}\marg{description}\marg{symbol}\marg{page-list} +%\end{definition} +% This command governs how each subentry should be formatted +% in the glossary. Glossary styles need to redefine this command. +% Most of the predefined styles ignore \meta{symbol}. The first +% argument is a number indicating the level. (The level should +% be greater than or equal to 1.) +% \begin{macrocode} +\newcommand*{\glossarysubentryfield}[6]{% + \GlossariesWarning + {Deprecated use of \string\glossarysubentryfield.^^J + I recommend you change to \string\subglossentry.^^J + If you've just upgraded, try removing your gls auxiliary + files^^J and recompile}% + \glstarget{#2}{\strut}#4. #6\par} +% \end{macrocode} +%\end{macro} +% +% Within each glossary, the entries form distinct groups +% which are determined by the first character of the \gloskey{sort} +% key. When using \app{makeindex}, there will be a maximum of 28 groups: symbols, numbers, +% and the 26 alphabetical groups A, \ldots, Z\@. If you use +% \app{xindy} the groups will depend on whatever alphabet +% is used. This is determined by the language or custom +% alphabets can be created in the \app{xindy} style file. +% The command \cs{glsgroupskip} +% specifies what to do between glossary groups. Glossary styles +% must redefine this command. (Note that \cs{glsgroupskip} +% only occurs between groups, not at the start or end of the +% glossary.) +%\begin{macro}{\glsgroupskip} +% \begin{macrocode} +\newcommand*{\glsgroupskip}{} +% \end{macrocode} +%\end{macro} +% +% Each of the 28 glossary groups described above is preceded by a +% group heading. +% This is formatted by the command \cs{glsgroupheading} +% which takes one argument which is the \emph{label} assigned to that +% group (not the title). The corresponding labels are: \texttt{glssymbols}, +% \texttt{glsnumbers}, \texttt{A}, \ldots, \texttt{Z}. +% Glossary styles must redefined this command. (In between groups, +% \cs{glsgroupheading} comes immediately after \cs{glsgroupskip}.) +%\begin{macro}{\glsgroupheading} +% \begin{macrocode} +\newcommand*{\glsgroupheading}[1]{} +% \end{macrocode} +%\end{macro} +% It is possible to ``trick'' \app{makeindex} into +% treating entries as though they belong to the same group, +% even if the terms don't start with the same letter, by +% modifying the \gloskey{sort} key. For example, all entries +% belonging to one +% group could be defined so that the \gloskey{sort} key starts with an +% "a", while entries belonging to another group could be defined +% so that the \gloskey{sort} key starts with a "b", and so on. If +% you want each group to have a heading, you would then need to +% modify the translation control sequences \cs{glsgetgrouptitle} +% and \cs{glsgetgrouplabel} so that the label is translated +% into the required title (and vice-versa). +% +%\begin{definition} +%\cs{glsgetgrouptitle}\marg{label} +%\end{definition} +% This command produces the title for the glossary group +% whose label is given by \meta{label}. By default, the group +% labelled \texttt{glssymbols} produces +% \ics{glssymbolsgroupname}, the group labelled +% \texttt{glsnumbers} produces \ics{glsnumbersgroupname} +% and all the other groups simply produce their label. +% As mentioned above, the group labels are: \texttt{glssymbols}, \texttt{glsnumbers}, +% \texttt{A}, \ldots, \texttt{Z}\@. If you want to redefine +% the group titles, you will need to redefine this command. +% Languages other than English may produce labels that are +% non-expandable, so we need to check for that otherwise it will +% create a \qt{missing \cs{endcsname} inserted} error. +%\begin{macro}{\glsgetgrouptitle} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +%\changes{3.11a}{2013-10-15}{Added check in case non-Latin alphabet +%in use} +% \begin{macrocode} +\newcommand*{\glsgetgrouptitle}[1]{% + \@gls@getgrouptitle{#1}{\@gls@grptitle}% + \@gls@grptitle +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@getgrouptitle} +% Gets the group title specified by the label (first argument) and +% stores in the second argument, which must be a control sequence. +% \begin{macrocode} +\newcommand*{\@gls@getgrouptitle}[2]{% +% \end{macrocode} +% Even if the argument appears to be a single letter, it won't be +% considered a single letter by \cs{dtl@ifsingle} if it's an active +% character. +% \begin{macrocode} + \dtl@ifsingle{#1}% + {% + \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}% + }% + {% + \ifboolexpr{test{\ifstrequal{#1}{glssymbols}} + or test{\ifstrequal{#1}{glsnumbers}}}% + {% + \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}% + }% + {% + \def#2{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@gls@noidx@getgrouptitle} +%\changes{4.04}{2014-03-06}{new} +% Version for the no-indexing app option: +% \begin{macrocode} +\newcommand*{\@gls@noidx@getgrouptitle}[2]{% + \DTLifint{#1}% + {\edef#2{\char#1\relax}}% + {% + \ifcsundef{#1groupname}{\def#2{#1}}{\letcs#2{#1groupname}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{definition} +%\cs{glsgetgrouplabel}\marg{title} +%\end{definition} +%This command does the reverse to the previous command. The +% argument is the group title, and it produces the group label. +% Note that if you redefine \cs{glsgetgrouptitle}, you +% will also need to redefine \cs{glsgetgrouplabel}. +%\begin{macro}{\glsgetgrouplabel} +%\changes{3.05}{2013-04-21}{fixed bug (typo in \cs{equal})} +% \begin{macrocode} +\newcommand*{\glsgetgrouplabel}[1]{% +\ifthenelse{\equal{#1}{\glssymbolsgroupname}}{glssymbols}{% +\ifthenelse{\equal{#1}{\glsnumbersgroupname}}{glsnumbers}{#1}}} +% \end{macrocode} +%\end{macro} +% +% The command \cs{setentrycounter} sets the entry's +% associated counter (required by +% \cs{glshypernumber} etc.) \ics{glslink} and +% \ics{glsadd} encode the +% \ics{glossary} argument so that the relevant counter is +% set prior to the formatting command. +%\begin{macro}{\setentrycounter} +%\changes{3.0}{2011-04-02}{added optional argument} +% \begin{macrocode} +\newcommand*{\setentrycounter}[2][]{% + \def\@glo@counterprefix{#1}% + \ifx\@glo@counterprefix\@empty + \def\@glo@counterprefix{.}% + \else + \def\@glo@counterprefix{.#1.}% + \fi + \def\glsentrycounter{#2}% +} +% \end{macrocode} +%\end{macro} +% +% The current glossary style can be set using +% \cs{setglossarystyle}\marg{style}. +%\begin{macro}{\setglossarystyle} +%\changes{3.08a}{2013-09-28}{new} +% \begin{macrocode} +\newcommand*{\setglossarystyle}[1]{% + \ifcsundef{@glsstyle@#1}% + {% + \PackageError{glossaries}{Glossary style `#1' undefined}{}% + }% + {% + \csname @glsstyle@#1\endcsname + }% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{set default style if not already set} +% Set the default style if it's not already set. +% \begin{macrocode} + \ifx\@glossary@default@style\relax + \protected@edef\@glossary@default@style{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glossarystyle} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\newcommand*{\glossarystyle}[1]{% + \ifcsundef{@glsstyle@#1}% + {% + \PackageError{glossaries}{Glossary style `#1' undefined}{}% + }% + {% + \GlossariesWarning + {Deprecated command \string\glossarystyle.^^J + I recommend you switch to \string\setglossarystyle\space unless + you want to maintain backward compatibility}% + \setglossentrycompatibility + \csname @glsstyle@#1\endcsname +% \end{macrocode} +%\changes{3.13a}{2013-11-05}{fixed bug caused by using \cs{ifdef} instead of +%\cs{ifcsdef}} +% \begin{macrocode} + \ifcsdef{@glscompstyle@#1}% + {\setglossentrycompatibility\csuse{@glscompstyle@#1}}% + {}% + }% +% \end{macrocode} +%\changes{4.21}{2016-01-24}{set default style if not already set} +% Set the default style if it isn't already set so that +% \cs{printglossary} can warn if the fallback style is in use. +% \begin{macrocode} + \ifx\@glossary@default@style\relax + \protected@edef\@glossary@default@style{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newglossarystyle} +% New glossary styles can be defined using: +%\begin{definition} +% \cs{newglossarystyle}\marg{name}\marg{definition} +%\end{definition} +% The \meta{definition} argument should redefine +% \env{theglossary}, \ics{glossaryheader}, +% \ics{glsgroupheading}, \ics{glossaryentryfield} and +% \ics{glsgroupskip} (see \autoref{sec:code:styles} for the +% definitions of predefined styles). Glossary styles should not +% redefine \ics{glossarypreamble} and +% \ics{glossarypostamble}, as +% the user should be able to switch between styles without affecting +% the pre- and postambles. +%\changes{1.17}{2008-12-26}{made \cs{newglossarystyle} long} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\newcommand{\newglossarystyle}[2]{% + \ifcsundef{@glsstyle@#1}% + {% + \expandafter\def\csname @glsstyle@#1\endcsname{#2}% + }% + {% + \PackageError{glossaries}{Glossary style `#1' is already defined}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\renewglossarystyle} +%\changes{3.02}{2012-05-21}{new} +%Code for this macro supplied by Marco Daniel. +% \begin{macrocode} +\newcommand{\renewglossarystyle}[2]{% + \ifcsundef{@glsstyle@#1}% + {% + \PackageError{glossaries}{Glossary style `#1' isn't already defined}{}% + }% + {% + \csdef{@glsstyle@#1}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Glossary entries are encoded so that the second argument +% to \ics{glossaryentryfield} is always specified as +% \cs{glsnamefont}\marg{name}. This allows the +% user to change the font used to display the name term +% without having to redefine \ics{glossaryentryfield}. +% The default uses the surrounding font, so in the list type +% styles (which place the name in the optional argument to +% \ics{item}) the name will appear in bold. +%\begin{macro}{\glsnamefont} +% \begin{macrocode} +\newcommand*{\glsnamefont}[1]{#1} +% \end{macrocode} +%\end{macro} +% +% Each glossary entry has an associated number list (usually page +% numbers) that indicate where in the document the entry has been +% used. The format for these number lists can be changed using the +% \gloskey[glslink]{format}\igloskey[glsadd]{format} key in commands like \ics{glslink}. +% The default format is given by \cs{glshypernumber}. This takes +% a single argument which may be a single number, a number range +% or a number list. The number ranges are delimited with +% \ics{delimR}, the number lists are delimited with +% \ics{delimN}. +% +% If the document doesn't have hyperlinks, the numbers can be +% displayed just as they are, but if the document supports +% hyperlinks, the numbers should link to the relevant location. +% This means extracting the individual numbers from the list or +% ranges. The \isty{hyperref} package does this with the +% \ics{hyperpage} command, but this is encoded for comma and +% dash delimiters and only for the page counter, but this code needs +% to be more general. So I have adapted the code used in the +% \isty{hyperref} package. +%\begin{macro}{\glshypernumber} +%\changes{1.17}{2008-12-26}{modified to allow material +% to be attached to location} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\ifcsundef{hyperlink}% +{% + \def\glshypernumber#1{#1}% +}% +{% + \def\glshypernumber#1{\@glshypernumber#1\nohyperpage{}\@nil} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glshypernumber} +% This code was provided by Heiko~Oberdiek to allow material +% to be attached to the location. +%\changes{1.17}{2008-12-26}{new} +% \begin{macrocode} +\def\@glshypernumber#1\nohyperpage#2#3\@nil{% + \ifx\\#1\\% + \else + \@delimR#1\delimR\delimR\\% + \fi + \ifx\\#2\\% + \else + #2% + \fi + \ifx\\#3\\% + \else + \@glshypernumber#3\@nil + \fi +} +% \end{macrocode} +%\end{macro} +% \cs{@delimR} displays a range of numbers for the counter +% whose name is given by +% \cs{@gls@counter} (which must be set prior to using +% \cs{glshypernumber}). +%\begin{macro}{\@delimR} +% \begin{macrocode} +\def\@delimR#1\delimR #2\delimR #3\\{% +\ifx\\#2\\% + \@delimN{#1}% +\else + \@gls@numberlink{#1}\delimR\@gls@numberlink{#2}% +\fi} +% \end{macrocode} +%\end{macro} +% \cs{@delimN} displays a list of individual numbers, +% instead of a range: +%\begin{macro}{\@delimN} +% \begin{macrocode} +\def\@delimN#1{\@@delimN#1\delimN \delimN\\} +\def\@@delimN#1\delimN #2\delimN#3\\{% +\ifx\\#3\\% + \@gls@numberlink{#1}% +\else + \@gls@numberlink{#1}\delimN\@gls@numberlink{#2}% +\fi +} +% \end{macrocode} +%\end{macro} +% The following code is modified from hyperref's +% \cs{HyInd@pagelink} where +% the name of the counter being used is given by +% \cs{@gls@counter}. +% \begin{macrocode} +\def\@gls@numberlink#1{% +\begingroup + \toks@={}% + \@gls@removespaces#1 \@nil +\endgroup} +% \end{macrocode} +% \begin{macrocode} +\def\@gls@removespaces#1 #2\@nil{% + \toks@=\expandafter{\the\toks@#1}% + \ifx\\#2\\% + \edef\x{\the\toks@}% + \ifx\x\empty + \else +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added prefix to hyperlink} +% \begin{macrocode} + \hyperlink{\glsentrycounter\@glo@counterprefix\the\toks@}% + {\the\toks@}% + \fi + \else + \@gls@ReturnAfterFi{% + \@gls@removespaces#2\@nil + }% + \fi +} +\long\def\@gls@ReturnAfterFi#1\fi{\fi#1} +% \end{macrocode} +% +% The following commands will switch to the +% appropriate font, and create a hyperlink, if hyperlinks are +% supported. If hyperlinks are not supported, they will just +% display their argument in the appropriate font. +%\begin{macro}{\hyperrm} +% \begin{macrocode} +\newcommand*{\hyperrm}[1]{\textrm{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hypersf} +% \begin{macrocode} +\newcommand*{\hypersf}[1]{\textsf{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hypertt} +% \begin{macrocode} +\newcommand*{\hypertt}[1]{\texttt{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hyperbf} +% \begin{macrocode} +\newcommand*{\hyperbf}[1]{\textbf{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hypermd} +% \begin{macrocode} +\newcommand*{\hypermd}[1]{\textmd{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hyperit} +% \begin{macrocode} +\newcommand*{\hyperit}[1]{\textit{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hypersl} +% \begin{macrocode} +\newcommand*{\hypersl}[1]{\textsl{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hyperup} +% \begin{macrocode} +\newcommand*{\hyperup}[1]{\textup{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hypersc} +% \begin{macrocode} +\newcommand*{\hypersc}[1]{\textsc{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\hyperemph} +% \begin{macrocode} +\newcommand*{\hyperemph}[1]{\emph{\glshypernumber{#1}}} +% \end{macrocode} +%\end{macro} +% +%\section{Acronyms}\label{sec:code:acronym} +%\begin{macro}{\oldacronym} +%\begin{definition} +%\cs{oldacronym}\oarg{label}\marg{abbrv}\marg{long}\marg{key-val list} +%\end{definition} +% This emulates the way the old \isty{glossary} package defined +% acronyms. It is equivalent to \ics{newacronym}\oarg{key-val +% list}\marg{label}\marg{abbrv}\marg{long} and it additionally +% defines the command \cs{}\meta{label} which is equivalent to +% \cs{gls}\marg{label} (thus \meta{label} must only contain +% alphabetical characters). If \meta{label} is omitted, \meta{abbrv} +% is used. This only emulates the syntax of the old \isty{glossary} +% package. The way the acronyms appear in the list of acronyms is +% determined by the definition of \ics{newacronym} and the +% glossary style. +% +% Note that \cs{}\meta{label} can't have an optional +% argument if the \isty{xspace} package is loaded. If +% \isty{xspace} hasn't been loaded then you can do +% \cs{}\meta{label}\oarg{insert} but you can't do +% \cs{}\meta{label}\oarg{key-val list}. For example if you define the +% acronym svm, then you can do "\svm['s]" but you can't do +% "\svm[format=textbf]". If the \isty{xspace} package is loaded, +% "\svm['s]" will appear as "svm ['s]" which is unlikely to be +% the desired result. In this case, you will need to use +% \cs{gls} explicitly, e.g.\ "\gls{svm}['s]". Note that it is +% up to the user to load \isty{xspace} if desired. +%\changes{1.18}{2009-01-14}{new} +%\changes{3.0}{2011-04-02}{replaced \cs{@ifundefined} with +%\cs{ifcsundef}} +% \begin{macrocode} +\newcommand{\oldacronym}[4][\gls@label]{% + \def\gls@label{#2}% + \newacronym[#4]{#1}{#2}{#3}% + \ifcsundef{xspace}% + {% + \expandafter\edef\csname#1\endcsname{% + \noexpand\@ifstar{\noexpand\Gls{#1}}{\noexpand\gls{#1}}% + }% + }% + {% + \expandafter\edef\csname#1\endcsname{% + \noexpand\@ifstar{\noexpand\Gls{#1}\noexpand\xspace}{% + \noexpand\gls{#1}\noexpand\xspace}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{definition} +% \cs{newacronym}\oarg{key-val list}\marg{label}\marg{abbrev}\marg{long} +%\end{definition} +% This is a quick way of defining acronyms, +% using \ics{newglossaryentry} with the appropriate +% values. It sets the +% glossary type to \ics{acronymtype} which will be +% "acronym" if the package option \pkgopt{acronym} has +% been used, otherwise it will be the default glossary. +% Since \cs{newacronym} merely calls \ics{newglossaryentry}, +% the acronym is treated like any other glossary entry. +% +% If you prefer a different format, you +% can redefine \cs{newacronym} as required. The optional +% argument can be used to override any of the settings. +% +% This is just a stub. It's redefined by commands like +% \cs{SetDefaultAcronymStyle}. +%\begin{macro}{\newacronym} +% \begin{macrocode} + \newcommand{\newacronym}[4][]{} +% \end{macrocode} +%\changes{1.13}{2008-05-10}{Removed restriction on only using +% \cs{newacronym} in the preamble} +%\end{macro} +% Set up some convenient short cuts. These need to be changed if +% \cs{newacronym} is changed (or if the \gloskey{description} key +% is changed). +% +%\begin{macro}{\acrpluralsuffix} +%\changes{1.13}{2008-05-10}{New} +% Plural suffix used by \cs{newacronym}. This just defaults to +% \cs{glspluralsuffix} but is changed to include \cs{textup} +% if the smallcaps option is used, so that the suffix doesn't appear +% in small caps as it doesn't look right. For example, +% \textsc{abcs} looks as though the ``s'' is part of the acronym, but +% \textsc{abc}s looks as though the ``s'' is a plural suffix. Since +% the entire text \texttt{abcs} is set in \cs{textsc}, \cs{textup} +% is need to cancel it out. +% \begin{macrocode} +\newcommand*{\acrpluralsuffix}{\glsacrpluralsuffix} +% \end{macrocode} +%\end{macro} +% If \sty{garamondx} has been loaded, need to use \cs{textulc} +% instead of \cs{textup}. +%\begin{macro}{\glstextup} +%\changes{3.09a}{2013-10-09}{new} +% \begin{macrocode} +\newrobustcmd*{\glstextup}[1]{\ifdef\textulc{\textulc{#1}}{\textup{#1}}} +% \end{macrocode} +%\end{macro} +% +% The following are defined for compatibility with version 2.07 and +% earlier. +%\begin{macro}{\glsshortkey} +% \begin{macrocode} +\newcommand*{\glsshortkey}{short} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsshortpluralkey} +% \begin{macrocode} +\newcommand*{\glsshortpluralkey}{shortplural} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongkey} +% \begin{macrocode} +\newcommand*{\glslongkey}{long} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongpluralkey} +% \begin{macrocode} +\newcommand*{\glslongpluralkey}{longplural} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\acrfull} +% Full form of the acronym. +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\acrfull}{\@gls@hyp@opt\ns@acrfull} +% \end{macrocode} +%\changes{4.08}{2014-07-30}{removed \cs{@sacrfull}} +%\changes{3.0}{2011-04-02}{added starred version} +% \begin{macrocode} +\newcommand*\ns@acrfull[2][]{% + \new@ifnextchar[{\@acrfull{#1}{#2}}% + {\@acrfull{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@acrfull} +%\changes{4.02}{2013-12-05}{now using \cs{acrfullfmt}} +% Low-level macro: +% \begin{macrocode} +\def\@acrfull#1#2[#3]{% +% \end{macrocode} +% Make it easier for acronym styles to change this: +% \begin{macrocode} + \acrfullfmt{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +% Using \cs{acrlinkfullformat} and \cs{acrfullformat} is now +% deprecated as it can cause complications with the first letter +% upper case variants, but the package needs to provide backward +% compatibility support. +% +%\begin{macro}{\acrfullfmt} +%\changes{4.02}{2013-12-05}{new} +% No case change full format. +% \begin{macrocode} +\newcommand*{\acrfullfmt}[3]{% + \acrlinkfullformat{\@acrlong}{\@acrshort}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\acrlinkfullformat} +% Format for full links like \ics{acrfull}. Syntax: +% \cs{acrlinkfullformat}\marg{long cs}\marg{short +% cs}\marg{options}\marg{label}\marg{insert} +% \begin{macrocode} +\newcommand{\acrlinkfullformat}[5]{% + \acrfullformat{#1{#3}{#4}[#5]}{#2{#3}{#4}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\acrfullformat} +% Default full form is \meta{long} \parg{short}. +%\changes{3.01}{2011-04-12}{removed \cs{acronymfont} as it should +%already be set in the second argument.} +% \begin{macrocode} +\newcommand{\acrfullformat}[2]{#1\glsspace(#2)} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsspace} +% Robust space to ensure it's written to the \texttt{.glsdefs} file. +%\changes{4.08}{2014-07-30}{new} +% \begin{macrocode} +\newrobustcmd{\glsspace}{\space} +% \end{macrocode} +%\end{macro} +% +% Default format for full acronym +%\begin{macro}{\Acrfull} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Acrfull}{\@gls@hyp@opt\ns@Acrfull} +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added starred version} +%\changes{4.08}{2014-07-30}{removed \cs{@sAcrfull}} +% \begin{macrocode} +\newcommand*\ns@Acrfull[2][]{% + \new@ifnextchar[{\@Acrfull{#1}{#2}}% + {\@Acrfull{#1}{#2}[]}% +} +% \end{macrocode} +% Low-level macro: +% \begin{macrocode} +\def\@Acrfull#1#2[#3]{% +% \end{macrocode} +% Make it easier for acronym styles to change this: +% \begin{macrocode} + \Acrfullfmt{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Acrfullfmt} +%\changes{4.02}{2013-12-05}{new} +% First letter upper case full format. +% \begin{macrocode} +\newcommand*{\Acrfullfmt}[3]{% + \acrlinkfullformat{\@Acrlong}{\@acrshort}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ACRfull} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\ACRfull}{\@gls@hyp@opt\ns@ACRfull} +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added starred version} +%\changes{4.08}{2014-07-30}{removed \cs{s@ACRfull}} +% \begin{macrocode} +\newcommand*\ns@ACRfull[2][]{% + \new@ifnextchar[{\@ACRfull{#1}{#2}}% + {\@ACRfull{#1}{#2}[]}% +} +% \end{macrocode} +% Low-level macro: +% \begin{macrocode} +\def\@ACRfull#1#2[#3]{% +% \end{macrocode} +% Make it easier for acronym styles to change this: +% \begin{macrocode} + \ACRfullfmt{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ACRfullfmt} +%\changes{4.02}{2013-12-05}{new} +% All upper case full format. +% \begin{macrocode} +\newcommand*{\ACRfullfmt}[3]{% + \acrlinkfullformat{\@ACRlong}{\@ACRshort}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +% +% Plural: +%\begin{macro}{\acrfullpl} +%\changes{1.13}{2008-05-10}{new} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\acrfullpl}{\@gls@hyp@opt\ns@acrfullpl} +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added starred version} +%\changes{4.08}{2014-07-30}{removed \cs{s@acrfullpl}} +% \begin{macrocode} +\newcommand*\ns@acrfullpl[2][]{% + \new@ifnextchar[{\@acrfullpl{#1}{#2}}% + {\@acrfullpl{#1}{#2}[]}% +} +% \end{macrocode} +% Low-level macro: +% \begin{macrocode} +\def\@acrfullpl#1#2[#3]{% +% \end{macrocode} +% Make it easier for acronym styles to change this: +% \begin{macrocode} + \acrfullplfmt{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\acrfullplfmt} +%\changes{4.02}{2013-12-05}{new} +% No case change plural full format. +% \begin{macrocode} +\newcommand*{\acrfullplfmt}[3]{% + \acrlinkfullformat{\@acrlongpl}{\@acrshortpl}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Acrfullpl} +%\changes{1.13}{2008-05-10}{new} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\Acrfullpl}{\@gls@hyp@opt\ns@Acrfullpl} +% \end{macrocode} +%\changes{4.08}{2014-07-30}{removed \cs{s@Acrfullpl}} +%\changes{3.0}{2011-04-02}{added starred version} +% \begin{macrocode} +\newcommand*\ns@Acrfullpl[2][]{% + \new@ifnextchar[{\@Acrfullpl{#1}{#2}}% + {\@Acrfullpl{#1}{#2}[]}% +} +% \end{macrocode} +% Low-level macro: +% \begin{macrocode} +\def\@Acrfullpl#1#2[#3]{% +% \end{macrocode} +% Make it easier for acronym styles to change this: +% \begin{macrocode} + \Acrfullplfmt{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Acrfullplfmt} +%\changes{4.02}{2013-12-05}{new} +% First letter upper case plural full format. +%\changes{4.07}{2014-04-04}{fixed no case change bug} +% \begin{macrocode} +\newcommand*{\Acrfullplfmt}[3]{% + \acrlinkfullformat{\@Acrlongpl}{\@acrshortpl}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\ACRfullpl} +%\changes{1.13}{2008-05-10}{new} +%\changes{3.01}{2011-04-12}{made robust} +%\changes{4.08}{2014-07-30}{switched to using \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd*{\ACRfullpl}{\@gls@hyp@opt\ns@ACRfullpl} +% \end{macrocode} +%\changes{3.0}{2011-04-02}{added starred version} +%\changes{4.08}{2014-07-30}{removed \cs{s@ACRfullpl}} +% \begin{macrocode} +\newcommand*\ns@ACRfullpl[2][]{% + \new@ifnextchar[{\@ACRfullpl{#1}{#2}}% + {\@ACRfullpl{#1}{#2}[]}% +} +% \end{macrocode} +% Low-level macro: +% \begin{macrocode} +\def\@ACRfullpl#1#2[#3]{% +% \end{macrocode} +% Make it easier for acronym styles to change this: +% \begin{macrocode} + \ACRfullplfmt{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ACRfullplfmt} +%\changes{4.02}{2013-12-05}{new} +% All upper case plural full format. +% \begin{macrocode} +\newcommand*{\ACRfullplfmt}[3]{% + \acrlinkfullformat{\@ACRlongpl}{\@ACRshortpl}{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\section{Predefined acronym styles} +%\begin{macro}{\acronymfont} +%This is only used with the additional acronym styles: +% \begin{macrocode} +\newcommand{\acronymfont}[1]{#1} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\firstacronymfont} +%This is only used with the additional acronym styles: +%\changes{1.14}{2008-06-17}{new} +% \begin{macrocode} +\newcommand{\firstacronymfont}[1]{\acronymfont{#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\acrnameformat} +% The styles that allow an additional description use +% \cs{acrnameformat}\marg{short}\marg{long} to determine what +% information is displayed in the name. +% \begin{macrocode} +\newcommand*{\acrnameformat}[2]{\acronymfont{#1}} +% \end{macrocode} +%\end{macro} +% +% Define some tokens used by \cs{newacronym}: +%\begin{macro}{\glskeylisttok} +% \begin{macrocode} +\newtoks\glskeylisttok +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslabeltok} +% \begin{macrocode} +\newtoks\glslabeltok +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsshorttok} +% \begin{macrocode} +\newtoks\glsshorttok +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongtok} +% \begin{macrocode} +\newtoks\glslongtok +% \end{macrocode} +%\end{macro} +%\begin{macro}{\newacronymhook} +% Provide a hook for \cs{newacronym}: +% \begin{macrocode} +\newcommand*{\newacronymhook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetGenericNewAcronym} +% New improved version of setting the acronym style. +%\changes{4.02}{2013-12-05}{new} +% \begin{macrocode} +\newcommand*{\SetGenericNewAcronym}{% +% \end{macrocode} +% Change the behaviour of \cs{Glsentryname} to workaround expansion +% issues that cause a problem for \cs{makefirstuc} +% \begin{macrocode} + \let\@Gls@entryname\@Gls@acrentryname +% \end{macrocode} +% Change the way acronyms are defined: +% \begin{macrocode} + \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},% + \GenericAcronymFields,% + \the\glskeylisttok + }% + }% + \@do@newglossaryentry + }% +% \end{macrocode} +% Make sure that \ics{acrfull} etc reflects the new style: +% \begin{macrocode} + \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}}}}% +% \end{macrocode} +% Make sure that \ics{glsentryfull} etc reflects the new style: +% \begin{macrocode} + \renewcommand*{\glsentryfull}[1]{\genacrfullformat{##1}{}}% + \renewcommand*{\Glsentryfull}[1]{\Genacrfullformat{##1}{}}% + \renewcommand*{\glsentryfullpl}[1]{\genplacrfullformat{##1}{}}% + \renewcommand*{\Glsentryfullpl}[1]{\Genplacrfullformat{##1}{}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GenericAcronymFields} +%\changes{4.02}{2013-12-05}{new} +% Fields used by \cs{SetGenericNewAcronym} that can be changed by +% the acronym style. +% \begin{macrocode} +\newcommand*{\GenericAcronymFields}{description={\the\glslongtok}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\acronymentry} +%\changes{4.02}{2013-12-05}{new} +%\begin{definition} +%\cs{acronymentry}\marg{label} +%\end{definition} +% Display style for the name field in the list of acronyms. +% \begin{macrocode} +\newcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{#1}}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\acronymsort} +%\begin{definition} +%\cs{acronymsort}\marg{short}\marg{long} +%\end{definition} +% Default sort format for acronyms. +% \begin{macrocode} +\newcommand*{\acronymsort}[2]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\setacronymstyle} +%\changes{4.02}{2013-12-05}{new} +%\begin{definition} +%\cs{setacronymstyle}\marg{style name} +%\end{definition} +% \begin{macrocode} +\newcommand*{\setacronymstyle}[1]{% + \ifcsundef{@glsacr@dispstyle@#1} + {% + \PackageError{glossaries}{Undefined acronym style `#1'}{}% + }% + {% + \ifdefempty{\@glsacronymlists}% + {% + \DeclareAcronymList{\acronymtype}% + }% + {}% + \SetGenericNewAcronym + \GlsUseAcrStyleDefs{#1}% + \@for\@gls@type:=\@glsacronymlists\do{% + \defglsentryfmt[\@gls@type]{\GlsUseAcrEntryDispStyle{#1}}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newacronymstyle} +%\changes{4.02}{2013-12-05}{new} +%\begin{definition} +%\cs{newacronymstyle}\marg{style name}\marg{entry format +%definition}\marg{display definitions} +%\end{definition} +% Defines a new acronym style called \meta{style name}. +% \begin{macrocode} +\newcommand*{\newacronymstyle}[3]{% + \ifcsdef{@glsacr@dispstyle@#1}% + {% + \PackageError{glossaries}{Acronym style `#1' already exists}{}% + }% + {% + \csdef{@glsacr@dispstyle@#1}{#2}% + \csdef{@glsacr@styledefs@#1}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\renewacronymstyle} +% Redefines the given acronym style. +%\changes{4.03}{2014-01-20}{new} +% \begin{macrocode} +\newcommand*{\renewacronymstyle}[3]{% + \ifcsdef{@glsacr@dispstyle@#1}% + {% + \csdef{@glsacr@dispstyle@#1}{#2}% + \csdef{@glsacr@styledefs@#1}{#3}% + }% + {% + \PackageError{glossaries}{Acronym style `#1' doesn't exist}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsUseAcrEntryDispStyle} +%\changes{4.02}{2013-12-05}{new} +% \begin{macrocode} +\newcommand*{\GlsUseAcrEntryDispStyle}[1]{\csuse{@glsacr@dispstyle@#1}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsUseAcrStyleDefs} +%\changes{4.02}{2013-12-05}{new} +% \begin{macrocode} +\newcommand*{\GlsUseAcrStyleDefs}[1]{\csuse{@glsacr@styledefs@#1}} +% \end{macrocode} +%\end{macro} +% +%Predefined acronym styles: +%\begin{acrstyle}{long-short} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\meta{short}) acronym style. +% \begin{macrocode} +\newacronymstyle{long-short}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sp-short} +%\changes{4.16}{2015-07-08}{new} +% Similar to the previous style but allows the space between the +% long and short form to be customized. +% \begin{macrocode} +\newacronymstyle{long-sp-short}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{macro}{\glsacspace} +%\changes{4.16}{2015-07-08}{new} +% Space between long and short form for the above style. +% This uses a non-breakable space if the short form is less than +% 3em, otherwise it uses a regular space. +% \begin{macrocode} +\newcommand*{\glsacspace}[1]{% + \settowidth{\dimen@}{(\firstacronymfont{\glsentryshort{#1}})}% + \ifdim\dimen@<3em~\else\space\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{acrstyle}{short-long} +%\changes{4.02}{2013-12-05}{new} +% \meta{short} (\meta{long}) acronym style. +% \begin{macrocode} +\newacronymstyle{short-long}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + \renewcommand*{\genacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylongpl{##1})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylongpl{##1})% + }% +% \end{macrocode} +%\changes{4.03}{2014-01-20}{commented spurious EOL} +% \begin{macrocode} + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sc-short} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\cs{textsc}\marg{short}) acronym style. +% \begin{macrocode} +\newacronymstyle{long-sc-short}% +{% + \GlsUseAcrEntryDispStyle{long-short}% +}% +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sm-short} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\cs{textsmaller}\marg{short}) acronym style. +% \begin{macrocode} +\newacronymstyle{long-sm-short}% +{% + \GlsUseAcrEntryDispStyle{long-short}% +}% +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand{\acronymfont}[1]{\textsmaller{##1}}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{sc-short-long} +%\changes{4.02}{2013-12-05}{new} +% \meta{short} (\cs{textsc}\marg{long}) acronym style. +% \begin{macrocode} +\newacronymstyle{sc-short-long}% +{% + \GlsUseAcrEntryDispStyle{short-long}% +}% +{% + \GlsUseAcrStyleDefs{short-long}% + \renewcommand{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{sm-short-long} +%\changes{4.02}{2013-12-05}{new} +% \meta{short} (\cs{textsmaller}\marg{long}) acronym style. +% \begin{macrocode} +\newacronymstyle{sm-short-long}% +{% + \GlsUseAcrEntryDispStyle{short-long}% +}% +{% + \GlsUseAcrStyleDefs{short-long}% + \renewcommand{\acronymfont}[1]{\textsmaller{##1}}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-short-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{long-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-short}% +}% +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sp-short-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +% The space between the long and short form is given by +% \cs{glsacspace}. +% \begin{macrocode} +\newacronymstyle{long-sp-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-sp-short}% +}% +{% + \GlsUseAcrStyleDefs{long-sp-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\glsacspace{##1}(\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sc-short-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{long-sc-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-sc-short}% +}% +{% + \GlsUseAcrStyleDefs{long-sc-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sm-short-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{long-sm-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-sm-short}% +}% +{% + \GlsUseAcrStyleDefs{long-sm-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{short-long-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{short} (\marg{long}) acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{short-long-desc}% +{% + \GlsUseAcrEntryDispStyle{short-long}% +}% +{% + \GlsUseAcrStyleDefs{short-long}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{sc-short-long-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{sc-short-long-desc}% +{% + \GlsUseAcrEntryDispStyle{sc-short-long}% +}% +{% + \GlsUseAcrStyleDefs{sc-short-long}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{sm-short-long-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{sm-short-long-desc}% +{% + \GlsUseAcrEntryDispStyle{sm-short-long}% +}% +{% + \GlsUseAcrStyleDefs{sm-short-long}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{dua} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} only acronym style. +% \begin{macrocode} +\newacronymstyle{dua}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifdefempty\glscustomtext + {% + \ifglshaslong{\glslabel}% + {% + \glsifplural + {% +% \end{macrocode} +% Plural form: +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Plural form, don't adjust case: +% \begin{macrocode} + \glsentrylongpl{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% Plural form, make first letter upper case: +% \begin{macrocode} + \Glsentrylongpl{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% Plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsentrylongpl{\glslabel}\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Singular form, don't adjust case: +% \begin{macrocode} + \glsentrylong{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, make first letter upper case: +% \begin{macrocode} + \Glsentrylong{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsentrylong{\glslabel}\glsinsert}% + }% + }% + }% + {% +% \end{macrocode} +% Not an acronym: +% \begin{macrocode} + \glsgenentryfmt + }% + }% + {\glscustomtext\glsinsert}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% +% \end{macrocode} +%\changes{4.03}{2014-01-20}{fixed bug in \cs{acrfullfmt}} +% \begin{macrocode} + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{\glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})}}% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{\Glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})}}% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})}}}% +% \end{macrocode} +%\changes{4.03}{2014-01-20}{fixed bug in \cs{acrfullplfmt}} +% \begin{macrocode} + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{\glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})}}% +% \end{macrocode} +%\changes{4.03}{2014-01-20}{fixed bug in \cs{Acrfullplfmt}} +% \begin{macrocode} + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{\Glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})}}% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})}}}% + \renewcommand*{\glsentryfull}[1]{% + \glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Glsentryfull}[1]{% + \Glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\glsentryfullpl}[1]{% + \glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Glsentryfullpl}[1]{% + \Glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{dua-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} only acronym style with user-supplied description. +% \begin{macrocode} +\newacronymstyle{dua-desc}% +{% + \GlsUseAcrEntryDispStyle{dua}% +}% +{% + \GlsUseAcrStyleDefs{dua}% + \renewcommand*{\GenericAcronymFields}{}% +% \end{macrocode} +%\changes{4.03}{2014-01-20}{commented spurious EOL} +% \begin{macrocode} + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentrylong{##1}}}% + \renewcommand*{\acronymsort}[2]{##2}% +}% +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote} +%\changes{4.02}{2013-12-05}{new} +% \meta{short}\cs{footnote}\marg{long} acronym style. +% \begin{macrocode} +\newacronymstyle{footnote}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% +% \end{macrocode} +% Need to ensure hyperlinks are switched off on first use: +% \begin{macrocode} + \glshyperfirstfalse + \renewcommand*{\genacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshort{##1}}##2% + \protect\footnote{\glsentrylong{##1}}% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \firstacronymfont{\Glsentryshort{##1}}##2% + \protect\footnote{\glsentrylong{##1}}% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshortpl{##1}}##2% + \protect\footnote{\glsentrylongpl{##1}}% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2% + \protect\footnote{\glsentrylongpl{##1}}% + }% + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% +% \end{macrocode} +% Don't use footnotes for \ics{acrfull}: +% \begin{macrocode} + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{\acronymfont{\glsentryshort{##2}}##3\space + (\glsentrylong{##2})}}% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{\acronymfont{\Glsentryshort{##2}}##3\space + (\glsentrylong{##2})}}% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\acronymfont{\glsentryshort{##2}}##3\space + (\glsentrylong{##2})}}}% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{\acronymfont{\glsentryshortpl{##2}}##3\space + (\glsentrylongpl{##2})}}% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{\acronymfont{\Glsentryshortpl{##2}}##3\space + (\glsentrylongpl{##2})}}% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{##2}}##3\space + (\glsentrylongpl{##2})}}}% +% \end{macrocode} +% Similarly for \ics{glsentryfull} etc: +% \begin{macrocode} + \renewcommand*{\glsentryfull}[1]{% + \acronymfont{\glsentryshort{##1}}\space(\glsentrylong{##1})}% + \renewcommand*{\Glsentryfull}[1]{% + \acronymfont{\Glsentryshort{##1}}\space(\glsentrylong{##1})}% + \renewcommand*{\glsentryfullpl}[1]{% + \acronymfont{\glsentryshortpl{##1}}\space(\glsentrylongpl{##1})}% + \renewcommand*{\Glsentryfullpl}[1]{% + \acronymfont{\Glsentryshortpl{##1}}\space(\glsentrylongpl{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sc} +%\changes{4.02}{2013-12-05}{new} +% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style. +% \begin{macrocode} +\newacronymstyle{footnote-sc}% +{% + \GlsUseAcrEntryDispStyle{footnote}% +}% +{% + \GlsUseAcrStyleDefs{footnote}% + \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}} + \renewcommand{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% +}% +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sm} +%\changes{4.02}{2013-12-05}{new} +% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style. +% \begin{macrocode} +\newacronymstyle{footnote-sm}% +{% + \GlsUseAcrEntryDispStyle{footnote}% +}% +{% + \GlsUseAcrStyleDefs{footnote}% + \renewcommand{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}} + \renewcommand{\acronymfont}[1]{\textsmaller{##1}}% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% +}% +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{short}\cs{footnote}\marg{long} acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{footnote-desc}% +{% + \GlsUseAcrEntryDispStyle{footnote}% +}% +{% + \GlsUseAcrStyleDefs{footnote}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sc-desc} +%\changes{4.02}{2013-12-05}{new} +% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{footnote-sc-desc}% +{% + \GlsUseAcrEntryDispStyle{footnote-sc}% +}% +{% + \GlsUseAcrStyleDefs{footnote-sc}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sm-desc} +%\changes{4.02}{2013-12-05}{new} +% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style that has an +% accompanying description (which the user needs to supply). +% \begin{macrocode} +\newacronymstyle{footnote-sm-desc}% +{% + \GlsUseAcrEntryDispStyle{footnote-sm}% +}% +{% + \GlsUseAcrStyleDefs{footnote-sm}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\space (\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% +% +% +%\begin{macro}{\DefineAcronymSynonyms} +%\changes{2.04}{2009-11-10}{new} +% \begin{macrocode} +\newcommand*{\DefineAcronymSynonyms}{% +% \end{macrocode} +%\end{macro} +% Short form +%\begin{macro}{\acs} +% \begin{macrocode} + \let\acs\acrshort +% \end{macrocode} +%\end{macro} +% First letter uppercase short form +%\begin{macro}{\Acs} +% \begin{macrocode} + \let\Acs\Acrshort +% \end{macrocode} +%\end{macro} +% Plural short form +%\begin{macro}{\acsp} +% \begin{macrocode} + \let\acsp\acrshortpl +% \end{macrocode} +%\end{macro} +% First letter uppercase plural short form +%\begin{macro}{\Acsp} +% \begin{macrocode} + \let\Acsp\Acrshortpl +% \end{macrocode} +%\end{macro} +% Long form +%\begin{macro}{\acl} +% \begin{macrocode} + \let\acl\acrlong +% \end{macrocode} +%\end{macro} +% Plural long form +%\begin{macro}{\aclp} +% \begin{macrocode} + \let\aclp\acrlongpl +% \end{macrocode} +%\end{macro} +% First letter upper case long form +%\begin{macro}{\Acl} +% \begin{macrocode} + \let\Acl\Acrlong +% \end{macrocode} +%\end{macro} +% First letter upper case plural long form +%\begin{macro}{\Aclp} +% \begin{macrocode} + \let\Aclp\Acrlongpl +% \end{macrocode} +%\end{macro} +% Full form +%\begin{macro}{\acf} +% \begin{macrocode} + \let\acf\acrfull +% \end{macrocode} +%\end{macro} +% Plural full form +%\begin{macro}{\acfp} +% \begin{macrocode} + \let\acfp\acrfullpl +% \end{macrocode} +%\end{macro} +% First letter upper case full form +%\begin{macro}{\Acf} +% \begin{macrocode} + \let\Acf\Acrfull +% \end{macrocode} +%\end{macro} +% First letter upper case plural full form +%\begin{macro}{\Acfp} +% \begin{macrocode} + \let\Acfp\Acrfullpl +% \end{macrocode} +%\end{macro} +% Standard form +%\begin{macro}{\ac} +% \begin{macrocode} + \let\ac\gls +% \end{macrocode} +%\end{macro} +% First upper case standard form +%\begin{macro}{\Ac} +% \begin{macrocode} + \let\Ac\Gls +% \end{macrocode} +%\end{macro} +% Standard plural form +%\begin{macro}{\acp} +% \begin{macrocode} + \let\acp\glspl +% \end{macrocode} +%\end{macro} +% Standard first letter upper case plural form +%\begin{macro}{\Acp} +% \begin{macrocode} + \let\Acp\Glspl +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +% \end{macrocode} +% Define synonyms if required +% \begin{macrocode} +\ifglsacrshortcuts + \DefineAcronymSynonyms +\fi +% \end{macrocode} +% +% These commands for setting the style are now deprecated but are +% kept for backward compatibility. +% +%\begin{macro}{\SetDefaultAcronymDisplayStyle} +% Sets the default acronym display style for given glossary. +%\changes{2.04}{2009-11-10}{new} +%\changes{3.11a}{2013-10-15}{changed to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetDefaultAcronymDisplayStyle}[1]{% + \defglsentryfmt[#1]{\glsgenentryfmt}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DefaultNewAcronymDef} +% Sets up the acronym definition for the default style. +% The information is provided by the tokens \cs{glslabeltok}, +% \cs{glsshorttok}, \cs{glslongtok} and \cs{glskeylisttok}. +% \begin{macrocode} +\newcommand*{\DefaultNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\the\glsshorttok},% + sort={\the\glsshorttok},% + text={\the\glsshorttok},% + first={\acrfullformat{\the\glslongtok}{\the\glsshorttok}},% + plural={\noexpand\expandonce\noexpand\@glo@shortpl},% + firstplural={\acrfullformat{\noexpand\expandonce\noexpand\@glo@longpl}% + {\noexpand\expandonce\noexpand\@glo@shortpl}},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + description={\the\glslongtok},% + descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},% +% \end{macrocode} +% Remaining options specified by the user: +% \begin{macrocode} + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@descplural\gls@assign@descplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@descplural##1##2{% + \@@gls@expand@field{##1}{descplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetDefaultAcronymStyle} +%\changes{2.04}{2009-11-10}{new} +% Set up the default acronym style: +% \begin{macrocode} +\newcommand*{\SetDefaultAcronymStyle}{% +% \end{macrocode} +% Set the display style: +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetDefaultAcronymDisplayStyle{\@gls@type}% + }% +% \end{macrocode} +% Set up the definition of \cs{newacronym}: +% \begin{macrocode} + \renewcommand{\newacronym}[4][]{% +% \end{macrocode} +% If user is just using the main glossary and hasn't identified it +% as a list of acronyms, then update. (This is done to ensure +% backwards compatibility with versions prior to 2.04). +% \begin{macrocode} + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetDefaultAcronymDisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \DefaultNewAcronymDef + }% + \renewcommand*{\acrpluralsuffix}{\glsacrpluralsuffix}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\acrfootnote} +%\changes{3.0}{2011-04-02}{new} +% Used by the footnote acronym styles. +% \begin{macrocode} +\newcommand*{\acrfootnote}[3]{\acrlinkfootnote{#1}{#2}{#3}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\acrlinkfootnote} +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\newcommand*{\acrlinkfootnote}[3]{% + \footnote{\glslink[#1]{#2}{#3}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\acrnolinkfootnote} +%\changes{3.0}{2011-04-02}{new} +% \begin{macrocode} +\newcommand*{\acrnolinkfootnote}[3]{% + \footnote{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetDescriptionFootnoteAcronymDisplayStyle} +% Sets the acronym display style for given glossary for the +% description and footnote combination. +%\changes{2.04}{2009-11-10}{new} +%\changes{3.0}{2011-04-02}{expanded options link options} +%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetDescriptionFootnoteAcronymDisplayStyle}[1]{% + \defglsentryfmt[#1]{% +% \end{macrocode} +%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent +%unwanted parenthetical material} +% \begin{macrocode} + \ifdefempty\glscustomtext + {% + \ifglsused{\glslabel}% + {% + \acronymfont{\glsgenentryfmt}% + }% + {% + \firstacronymfont{\glsgenentryfmt}% + \ifglshassymbol{\glslabel}% + {% + \expandafter\protect\expandafter\acrfootnote\expandafter + {\@gls@link@opts}{\@gls@link@label}% + {% + \glsifplural + {\glsentrysymbolplural{\glslabel}}% + {\glsentrysymbol{\glslabel}}% + }% + }% + }% + }% + {\glscustomtext\glsinsert}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DescriptionFootnoteNewAcronymDef} +% \begin{macrocode} +\newcommand*{\DescriptionFootnoteNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand\acronymfont{\the\glsshorttok}},% + sort={\the\glsshorttok},% + first={\the\glsshorttok},% + firstplural={\noexpand\expandonce\noexpand\@glo@shortpl},% + text={\the\glsshorttok},% + plural={\noexpand\expandonce\noexpand\@glo@shortpl},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + symbol={\the\glslongtok},% + symbolplural={\noexpand\expandonce\noexpand\@glo@longpl},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetDescriptionFootnoteAcronymStyle} +% If a description and footnote are both required, store the long form +% in the \gloskey{symbol} key. Store the short form in \gloskey{text} +% key. Note that since the long form is stored in the symbol key, +% if you want the long form to appear in the list of acronyms, you +% need to use a glossary style that displays the symbol key. +% \begin{macrocode} +\newcommand*{\SetDescriptionFootnoteAcronymStyle}{% + \renewcommand{\newacronym}[4][]{% + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetDescriptionFootnoteAcronymDisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \DescriptionFootnoteNewAcronymDef + }% +% \end{macrocode} +% +% If \pkgopt{footnote} package option is specified, set the first +% use to append the long form (stored in \gloskey{symbol}) as a +% footnote. +%\changes{1.12}{2008-03-08}{Added \cs{protect} before \cs{footnote} +% and \cs{glslink}} +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetDescriptionFootnoteAcronymDisplayStyle{\@gls@type}% + }% +% \end{macrocode} +% Redefine \ics{acronymfont} if small caps required. The plural suffix +% is set in an upright font so that it remains in normal lower case, +% otherwise it looks as though it's part of the acronym. +%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use +%\cs{textsmaller} instead +%of \cs{smaller}} +% \begin{macrocode} + \ifglsacrsmallcaps + \renewcommand*{\acronymfont}[1]{\textsc{##1}}% +% \end{macrocode} +% \begin{macrocode} + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% + \else + \ifglsacrsmaller + \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}% + \fi + \fi +% \end{macrocode} +% Check for package option clash +% \begin{macrocode} + \ifglsacrdua + \PackageError{glossaries}{Option clash: `footnote' and `dua' + can't both be set}{}% + \fi +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetDescriptionDUAAcronymDisplayStyle} +% Sets the acronym display style for given glossary with +% description and dua combination. +%\changes{2.04}{2009-11-10}{new} +%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetDescriptionDUAAcronymDisplayStyle}[1]{% + \defglsentryfmt[#1]{\glsgenentryfmt}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DescriptionDUANewAcronymDef} +% \begin{macrocode} +\newcommand*{\DescriptionDUANewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\the\glslongtok},% + sort={\the\glslongtok}, + text={\the\glslongtok},% + first={\the\glslongtok},% + plural={\noexpand\expandonce\noexpand\@glo@longpl},% + firstplural={\noexpand\expandonce\noexpand\@glo@longpl},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + symbol={\the\glsshorttok},% + symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetDescriptionDUAAcronymStyle} +% Description, don't use acronym and no footnote. +% Note that the short form is stored in the \gloskey{symbol} key, +% so if the short form needs to be displayed in the glossary, +% use a style the displays the symbol. +% \begin{macrocode} +\newcommand*{\SetDescriptionDUAAcronymStyle}{% + \ifglsacrsmallcaps + \PackageError{glossaries}{Option clash: `smallcaps' and `dua' + can't both be set}{}% + \else + \ifglsacrsmaller + \PackageError{glossaries}{Option clash: `smaller' and `dua' + can't both be set}{}% + \fi + \fi + \renewcommand{\newacronym}[4][]{% + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetDescriptionDUAAcronymDisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \DescriptionDUANewAcronymDef + }% +% \end{macrocode} +% Set display. +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetDescriptionDUAAcronymDisplayStyle{\@gls@type}% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetDescriptionAcronymDisplayStyle} +% Sets the acronym display style for given glossary using +% the description setting (but not \pkgopt{footnote} or \pkgopt{dua}). +%\changes{2.04}{2009-11-10}{new} +%\changes{3.07}{2013-07-05}{now using \cs{glsdoparenifnotempty}} +%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetDescriptionAcronymDisplayStyle}[1]{% + \defglsentryfmt[#1]{% +% \end{macrocode} +%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent +%unwanted parenthetical material} +% \begin{macrocode} + \ifdefempty\glscustomtext + {% + \ifglsused{\glslabel}% + {% +% \end{macrocode} +% Move the inserted text outside of \cs{acronymfont} +% \begin{macrocode} + \let\gls@org@insert\glsinsert + \let\glsinsert\@empty + \acronymfont{\glsgenentryfmt}\gls@org@insert + }% + {% + \glsgenentryfmt + \ifglshassymbol{\glslabel}% + {% + \glsifplural + {% + \def\@glo@symbol{\glsentrysymbolplural{\glslabel}}% + }% + {% + \def\@glo@symbol{\glsentrysymbol{\glslabel}}% + }% + \space(\protect\firstacronymfont + {\glscapscase + {\@glo@symbol} + {\@glo@symbol} + {\mfirstucMakeUppercase{\@glo@symbol}}})% + }% + {}% + }% + }% + {\glscustomtext\glsinsert}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DescriptionNewAcronymDef} +% \begin{macrocode} +\newcommand*{\DescriptionNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand + \acrnameformat{\the\glsshorttok}{\the\glslongtok}},% + sort={\the\glsshorttok},% + first={\the\glslongtok},% + firstplural={\noexpand\expandonce\noexpand\@glo@longpl},% + text={\the\glsshorttok},% + plural={\noexpand\expandonce\noexpand\@glo@shortpl},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + symbol={\noexpand\@glo@text},% + symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},% + \the\glskeylisttok}% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetDescriptionAcronymStyle} +% Option \pkgopt{description} is used, but not \pkgopt{dua} +% or \pkgopt{footnote}. +% Store long form in \gloskey{first} key +% and short form in \gloskey{text} and \gloskey{symbol} key. +% The name is stored using \ics{acrnameformat} to allow the +% user to override the way the name is displayed in the +% list of acronyms. +% \begin{macrocode} +\newcommand*{\SetDescriptionAcronymStyle}{% + \renewcommand{\newacronym}[4][]{% + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetDescriptionAcronymDisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \DescriptionNewAcronymDef + }% +% \end{macrocode} +% Set display. +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetDescriptionAcronymDisplayStyle{\@gls@type}% + }% +% \end{macrocode} +% Redefine \ics{acronymfont} if small caps required. The plural suffix +% is set in an upright font so that it remains in normal lower case, +% otherwise it looks as though it's part of the acronym. +%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use +%\cs{textsmaller} instead +%of \cs{smaller}} +% \begin{macrocode} + \ifglsacrsmallcaps + \renewcommand{\acronymfont}[1]{\textsc{##1}} + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% + \else + \ifglsacrsmaller + \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}% + \fi + \fi +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetFootnoteAcronymDisplayStyle} +% Sets the acronym display style for given glossary with +% footnote setting (but not \pkgopt{description} or \pkgopt{dua}). +%\changes{2.04}{2009-11-10}{new} +%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetFootnoteAcronymDisplayStyle}[1]{% + \defglsentryfmt[#1]{% +% \end{macrocode} +%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent +%unwanted parenthetical material} +% \begin{macrocode} + \ifdefempty\glscustomtext + {% +% \end{macrocode} +% Move the inserted text outside of \cs{acronymfont} +% \begin{macrocode} + \let\gls@org@insert\glsinsert + \let\glsinsert\@empty + \ifglsused{\glslabel}% + {% + \acronymfont{\glsgenentryfmt}\gls@org@insert + }% + {% + \firstacronymfont{\glsgenentryfmt}\gls@org@insert + \ifglshaslong{\glslabel}% + {% + \expandafter\protect\expandafter\acrfootnote\expandafter + {\@gls@link@opts}{\@gls@link@label}% + {% + \glsifplural + {\glsentrylongpl{\glslabel}}% + {\glsentrylong{\glslabel}}% + }% + }% +% \end{macrocode} +%\changes{3.13a}{2013-11-05}{fixed missing argument bug} +% \begin{macrocode} + {}% + }% + }% + {\glscustomtext\glsinsert}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\FootnoteNewAcronymDef} +% \begin{macrocode} +\newcommand*{\FootnoteNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand\acronymfont{\the\glsshorttok}},% + sort={\the\glsshorttok},% + text={\the\glsshorttok},% + plural={\noexpand\expandonce\noexpand\@glo@shortpl},% + first={\the\glsshorttok},% + firstplural={\noexpand\expandonce\noexpand\@glo@shortpl},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + description={\the\glslongtok},% + descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@descplural\gls@assign@descplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@descplural##1##2{% + \@@gls@expand@field{##1}{descplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@descplural\@org@gls@assign@descplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetFootnoteAcronymStyle} +% If \pkgopt{footnote} package option is specified, set the first +% use to append the long form (stored in \gloskey{description}) as a +% footnote. +% Use the \gloskey{description} key to store the long form. +% \begin{macrocode} +\newcommand*{\SetFootnoteAcronymStyle}{% + \renewcommand{\newacronym}[4][]{% + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetFootnoteAcronymDisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \FootnoteNewAcronymDef + }% +% \end{macrocode} +% Set display +%\changes{1.12}{2008-03-08}{Added \cs{protect} before \cs{footnote} and +% \cs{glslink}} +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetFootnoteAcronymDisplayStyle{\@gls@type}% + }% +% \end{macrocode} +% Redefine \ics{acronymfont} if small caps required. The plural suffix +% is set in an upright font so that it remains in normal lower case, +% otherwise it looks as though it's part of the acronym. +%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use +%\cs{textsmaller} instead +%of \cs{smaller}} +% \begin{macrocode} + \ifglsacrsmallcaps + \renewcommand*{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% + \else + \ifglsacrsmaller + \renewcommand*{\acronymfont}[1]{\textsmaller{##1}}% + \fi + \fi +% \end{macrocode} +% Check for option clash +% \begin{macrocode} + \ifglsacrdua + \PackageError{glossaries}{Option clash: `footnote' and `dua' + can't both be set}{}% + \fi +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoparenifnotempty} +% Do a space followed by the argument if the argument doesn't expand +% to empty or \cs{relax}. If argument isn't empty (or \cs{relax}), apply +% the macro to it given in the second argument. +% \begin{macrocode} +\DeclareRobustCommand*{\glsdoparenifnotempty}[2]{% + \protected@edef\gls@tmp{#1}% + \ifdefempty\gls@tmp + {}% + {% + \ifx\gls@tmp\@gls@default@value + \else + \space (#2{#1})% + \fi + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetSmallAcronymDisplayStyle} +% Sets the acronym display style for given glossary where neither +% footnote nor description is required, but smallcaps or smaller +% specified. +%\changes{2.04}{2009-11-10}{new} +%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetSmallAcronymDisplayStyle}[1]{% + \defglsentryfmt[#1]{% +% \end{macrocode} +%\changes{4.02}{2013-12-05}{Moved check for empty custom text to prevent +%unwanted parenthetical material} +% \begin{macrocode} + \ifdefempty\glscustomtext + {% +% \end{macrocode} +% Move the inserted text outside of \cs{acronymfont} +% \begin{macrocode} + \let\gls@org@insert\glsinsert + \let\glsinsert\@empty + \ifglsused{\glslabel}% + {% + \acronymfont{\glsgenentryfmt}\gls@org@insert + }% + {% + \glsgenentryfmt + \ifglshassymbol{\glslabel}% + {% + \glsifplural + {% + \def\@glo@symbol{\glsentrysymbolplural{\glslabel}}% + }% + {% + \def\@glo@symbol{\glsentrysymbol{\glslabel}}% + }% + \space + (\glscapscase + {\firstacronymfont{\@glo@symbol}}% + {\firstacronymfont{\@glo@symbol}}% + {\firstacronymfont{\mfirstucMakeUppercase{\@glo@symbol}}})% + }% + {}% + }% + }% + {\glscustomtext\glsinsert}% + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SmallNewAcronymDef} +%\changes{3.02}{2012-05-21}{fixed broken short and long plural} +% \begin{macrocode} +\newcommand*{\SmallNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand\acronymfont{\the\glsshorttok}},% + sort={\the\glsshorttok},% + text={\the\glsshorttok},% +% \end{macrocode} +% Default to the short plural. +% \begin{macrocode} + plural={\noexpand\expandonce\noexpand\@glo@shortpl},% + first={\the\glslongtok},% +% \end{macrocode} +% Default to the long plural. +% \begin{macrocode} + firstplural={\noexpand\expandonce\noexpand\@glo@longpl},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + description={\noexpand\@glo@first},% + descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},% + symbol={\the\glsshorttok},% +% \end{macrocode} +% Default to the short plural. +% \begin{macrocode} + symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@descplural\gls@assign@descplural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@descplural##1##2{% + \@@gls@expand@field{##1}{descplural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@descplural\@org@gls@assign@descplural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetSmallAcronymStyle} +% Neither footnote nor description required, but smallcaps or +% smaller specified. +% Use the \gloskey{symbol} key to store the short form and +% \gloskey{first} to store the long form. +% \begin{macrocode} +\newcommand*{\SetSmallAcronymStyle}{% + \renewcommand{\newacronym}[4][]{% + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetSmallAcronymDisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \SmallNewAcronymDef + }% +% \end{macrocode} +% Change the display since \gloskey{first} only contains long form. +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetSmallAcronymDisplayStyle{\@gls@type}% + }% +% \end{macrocode} +% Redefine \ics{acronymfont} if small caps required. The plural suffix +% is set in an upright font so that it remains in normal lower case, +% otherwise it looks as though it's part of the acronym. +%\changes{1.19}{2009-03-02}{changed \cs{acronymfont} to use +%\cs{textsmaller} instead +%of \cs{smaller}} +% \begin{macrocode} + \ifglsacrsmallcaps + \renewcommand*{\acronymfont}[1]{\textsc{##1}} + \renewcommand*{\acrpluralsuffix}{\glsupacrpluralsuffix}% + \else + \renewcommand*{\acronymfont}[1]{\textsmaller{##1}} + \fi +% \end{macrocode} +% check for option clash +% \begin{macrocode} + \ifglsacrdua + \ifglsacrsmallcaps + \PackageError{glossaries}{Option clash: `smallcaps' and `dua' + can't both be set}{}% + \else + \PackageError{glossaries}{Option clash: `smaller' and `dua' + can't both be set}{}% + \fi + \fi +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetDUADisplayStyle} +% Sets the acronym display style for given glossary with dua +% setting. +%\changes{2.04}{2009-11-10}{new} +%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetDUADisplayStyle}[1]{% + \defglsentryfmt[#1]{\glsgenentryfmt}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DUANewAcronymDef} +% \begin{macrocode} +\newcommand*{\DUANewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\the\glsshorttok},% + text={\the\glslongtok},% + first={\the\glslongtok},% + plural={\noexpand\expandonce\noexpand\@glo@longpl},% + firstplural={\noexpand\expandonce\noexpand\@glo@longpl},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + description={\the\glslongtok},% + descriptionplural={\noexpand\expandonce\noexpand\@glo@longpl},% + symbol={\the\glsshorttok},% + symbolplural={\noexpand\expandonce\noexpand\@glo@shortpl},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \let\@org@gls@assign@descplural\gls@assign@descplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \def\gls@assign@descplural##1##2{% + \@@gls@expand@field{##1}{descplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural + \let\gls@assign@descplural\@org@gls@assign@descplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetDUAStyle} +% Always expand acronyms. +% \begin{macrocode} +\newcommand*{\SetDUAStyle}{% + \renewcommand{\newacronym}[4][]{% + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetDUADisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \DUANewAcronymDef + }% +% \end{macrocode} +% Set the display +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetDUADisplayStyle{\@gls@type}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SetAcronymStyle} +% \begin{macrocode} +\newcommand*{\SetAcronymStyle}{% + \SetDefaultAcronymStyle + \ifglsacrdescription + \ifglsacrfootnote + \SetDescriptionFootnoteAcronymStyle + \else + \ifglsacrdua + \SetDescriptionDUAAcronymStyle + \else + \SetDescriptionAcronymStyle + \fi + \fi + \else + \ifglsacrfootnote + \SetFootnoteAcronymStyle + \else + \ifthenelse{\boolean{glsacrsmallcaps}\OR + \boolean{glsacrsmaller}}% + {% + \SetSmallAcronymStyle + }% + {% + \ifglsacrdua + \SetDUAStyle + \fi + }% + \fi + \fi +} +% \end{macrocode} +% Set the acronym style according to the package options +% \begin{macrocode} +\SetAcronymStyle +% \end{macrocode} +%\end{macro} +% +% Allow user to define their own custom acronyms. +% (For compatibility with versions before v3.0, the short form is +% stored in the user1 key, the plural short form is stored in the +% user2 key, the long form is stored in the user3 key and the +% plural long form is stored in the user4 key.) Defaults to +% displaying only the acronym with the long form as the description. +%\begin{macro}{\SetCustomDisplayStyle} +% Sets the acronym display style. +%\changes{2.06}{2010-06-14}{new} +%\changes{3.11a}{2013-10-15}{updated to use \cs{defglsentryfmt}} +% \begin{macrocode} +\newcommand*{\SetCustomDisplayStyle}[1]{% + \defglsentryfmt[#1]{\glsgenentryfmt}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\CustomAcronymFields} +%\changes{2.06}{2010-06-14}{new} +% \begin{macrocode} +\newcommand*{\CustomAcronymFields}{% + name={\the\glsshorttok},% + description={\the\glslongtok},% + first={\acrfullformat{\the\glslongtok}{\the\glsshorttok}},% + firstplural={\acrfullformat + {\noexpand\glsentrylongpl{\the\glslabeltok}}% + {\noexpand\glsentryshortpl{\the\glslabeltok}}},% +% \end{macrocode} +% \changes{4.01}{2013-11-16}{inserted missing comma} +% \begin{macrocode} + text={\the\glsshorttok},% + plural={\the\glsshorttok\noexpand\acrpluralsuffix}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\CustomNewAcronymDef} +%\changes{2.06}{2010-06-14}{new} +% \begin{macrocode} +\newcommand*{\CustomNewAcronymDef}{% + \protected@edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + user1={\the\glsshorttok},% + user2={\the\glsshorttok\noexpand\acrpluralsuffix},% + user3={\the\glslongtok},% + user4={\the\glslongtok\noexpand\acrpluralsuffix},% + \CustomAcronymFields,% + \the\glskeylisttok + }% + }% + \@do@newglossaryentry +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SetCustomStyle} +%\changes{2.06}{2010-06-14}{new} +% \begin{macrocode} +\newcommand*{\SetCustomStyle}{% + \renewcommand{\newacronym}[4][]{% + \ifx\@glsacronymlists\@empty + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + \SetCustomDisplayStyle{\@glo@type}% + \fi + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \CustomNewAcronymDef + }% +% \end{macrocode} +% Set the display +% \begin{macrocode} + \@for\@gls@type:=\@glsacronymlists\do{% + \SetCustomDisplayStyle{\@gls@type}% + }% +} +% \end{macrocode} +%\end{macro} +% +% +% \section{Predefined Glossary Styles}\label{sec:code:styles} +% The \sty{glossaries} bundle comes with some predefined glossary +% styles. These need to be loaded now for the \pkgopt{style} option +% to use them. +% +% First, the glossary hyper-navigation commands need to be loaded. +% \begin{macrocode} +\RequirePackage{glossary-hypernav} +% \end{macrocode} +% The styles that use list-like environments. These are not loaded +% if the \pkgopt{nolist} option is used: +% \begin{macrocode} +\@gls@loadlist +% \end{macrocode} +% The styles that use the \env{longtable} environment. These are +% not loaded if the \pkgopt{nolong} package option is used. +% \begin{macrocode} +\@gls@loadlong +% \end{macrocode} +% The styles that use the \env{supertabular} environment. These are +% not loaded if the \pkgopt{nosuper} package option is used or if +% the \isty{supertabular} package isn't installed. +% \begin{macrocode} +\@gls@loadsuper +% \end{macrocode} +% The tree-like styles. These are not loaded if the \pkgopt{notree} +% package option is used. +% \begin{macrocode} +\@gls@loadtree +% \end{macrocode} +% The default glossary style is set according to the \pkgopt{style} package +% option, but can be overridden by \ics{glossarystyle}. The +% required style must be defined at this point. +% \begin{macrocode} +\ifx\@glossary@default@style\relax +\else + \setglossarystyle{\@glossary@default@style} +\fi +% \end{macrocode} +% +%\section{Debugging Commands} +% +%\begin{macro}{\showgloparent} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showgloparent}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloparent}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@parent\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglolevel} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglolevel}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglolevel}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@level\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglotext} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglotext}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglotext}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@text\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showgloplural} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showgloplural}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloplural}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@plural\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglofirst} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglofirst}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglofirst}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@first\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglofirstpl} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglofirstpl}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglofirstpl}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@firstpl\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglotype} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglotype}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglotype}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@type\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglocounter} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglocounter}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglocounter}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@counter\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglouseri} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglouseri}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglouseri}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@useri\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglouserii} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglouserii}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglouserii}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@userii\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglouseriii} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglouseriii}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglouseriii}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@useriii\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglouseriv} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglouseriv}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglouseriv}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@useriv\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglouserv} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglouserv}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglouserv}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@userv\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglouservi} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglouservi}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglouservi}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@uservi\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showgloname} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showgloname}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloname}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@name\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglodesc} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglodesc}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglodesc}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@desc\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglodescplural} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglodescplural}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglodescplural}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@descplural\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglosort} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglosort}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglosort}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@sort\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglosymbol} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglosymbol}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglosymbol}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@symbol\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglosymbolplural} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglosymbolplural}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglosymbolplural}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@symbolplural\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showgloshort} +%\changes{3.11a}{2013-10-15}{new} +%\begin{definition} +%\cs{showgloshort}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloshort}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@short\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglolong} +%\changes{3.11a}{2013-10-15}{new} +%\begin{definition} +%\cs{showglolong}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglolong}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@long\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showgloindex} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showgloindex}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloindex}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@index\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showgloflag} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showgloflag}\marg{label} +%\end{definition} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloflag}[1]{% + \expandafter\show\csname ifglo@\glsdetoklabel{#1}@flag\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showgloloclist} +%\changes{4.04}{2014-03-06}{new} +%\begin{definition} +%\cs{showgloloclist}\marg{label} +%\end{definition} +% \begin{macrocode} +\newcommand*{\showgloloclist}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@loclist\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglofield} +%\changes{4.16}{2015-07-08}{new} +%\begin{definition} +%\cs{showglofield}\marg{label}\marg{field} +%\end{definition} +% \begin{macrocode} +\newcommand*{\showglofield}[2]{% + \csshow{glo@\glsdetoklabel{#1}@#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showacronymlists} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showacronymlists} +%\end{definition} +% Show list of glossaries that have been flagged as a list of +% acronyms. +% \begin{macrocode} +\newcommand*{\showacronymlists}{% + \show\@glsacronymlists +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglossaries} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglossaries} +%\end{definition} +% Show list of defined glossaries. +% \begin{macrocode} +\newcommand*{\showglossaries}{% + \show\@glo@types +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglossaryin} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglossaryin}\marg{glossary-label} +%\end{definition} +% Show the `in' extension for the given glossary. +% \begin{macrocode} +\newcommand*{\showglossaryin}[1]{% + \expandafter\show\csname @glotype@#1@in\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglossaryout} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglossaryout}\marg{glossary-label} +%\end{definition} +% Show the `out' extension for the given glossary. +% \begin{macrocode} +\newcommand*{\showglossaryout}[1]{% + \expandafter\show\csname @glotype@#1@out\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglossarytitle} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglossarytitle}\marg{glossary-label} +%\end{definition} +% Show the title for the given glossary. +% \begin{macrocode} +\newcommand*{\showglossarytitle}[1]{% + \expandafter\show\csname @glotype@#1@title\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglossarycounter} +%\changes{3.0}{2011-04-02}{new} +%\begin{definition} +%\cs{showglossarycounter}\marg{glossary-label} +%\end{definition} +% Show the counter for the given glossary. +% \begin{macrocode} +\newcommand*{\showglossarycounter}[1]{% + \expandafter\show\csname @glotype@#1@counter\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\showglossaryentries} +%\changes{3.0}{2011-04-02}{new} +%\changes{3.02}{2012-05-21}{fixed misspelt command} +%\begin{definition} +%\cs{showglossaryentries}\marg{glossary-label} +%\end{definition} +% Show the list of entry labels for the given glossary. +% \begin{macrocode} +\newcommand*{\showglossaryentries}[1]{% + \expandafter\show\csname glolist@#1\endcsname +} +% \end{macrocode} +%\end{macro} +% +%\section{Compatibility with version 2.07 and below} +% +% In order to fix some bugs in v3.0, it was necessary to change the +% way information is written to the \filetype{glo} file, which also meant +% a change in the format of the Xindy style file. The compatibility +% option is meant for documents that use a customised Xindy style +% file with \ics{noist}. With the compatibility option, hopefully +% \app{xindy} will still be able to process the old document, but +% the bugs will remain. The issues in versions 2.07 and below: +%\begin{itemize} +% \item With \pkgopt{xindy}, the counter used by the entry was +% hard-coded into the Xindy style file. This meant that you couldn't +% use the \gloskey[glslink]{counter} to swap counters. +% \item With both \pkgopt{xindy} and \pkgopt{makeindex}, if used +% with \sty{hyperref} and \cs{theH}\meta{counter} was different to +% \cs{thecounter}, the link in the location number would be +% undefined. +%\end{itemize} +% \begin{macrocode} +\csname ifglscompatible-2.07\endcsname + \RequirePackage{glossaries-compatible-207} +\fi +% \end{macrocode} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-prefix.sty> +% \end{macrocode} +%\fi +%\chapter{Prefix Support (glossaries-prefix Code)} +%\label{sec:code:prefix} +%\changes{3.14a}{2013-11-12}{new} +% This package provides a means of adding prefixes to your glossary +% entries. For example, you may want to use \qt{a +% \cs{gls}\marg{label}} on first use but use \qt{an +% \cs{gls}\marg{label}} on subsequent use. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-prefix}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Pass all options to \sty{glossaries}: +% \begin{macrocode} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{glossaries}} +% \end{macrocode} +% Process options: +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% Load \sty{glossaries}: +% \begin{macrocode} +\RequirePackage{glossaries} +% \end{macrocode} +% Add the new keys: +% \begin{macrocode} +\define@key{glossentry}{prefixfirst}{\def\@glo@entryprefixfirst{#1}}% +\define@key{glossentry}{prefixfirstplural}{\def\@glo@entryprefixfirstplural{#1}}% +\define@key{glossentry}{prefix}{\def\@glo@entryprefix{#1}}% +\define@key{glossentry}{prefixplural}{\def\@glo@entryprefixplural{#1}}% +% \end{macrocode} +% Add them to \ics{@gls@keymap}: +% \begin{macrocode} +\appto\@gls@keymap{,% + {prefixfirst}{prefixfirst},% + {prefixfirstplural}{prefixfirstplural},% + {prefix}{prefix},% + {prefixplural}{prefixplural}% + } +% \end{macrocode} +% Set the default values: +% \begin{macrocode} +\appto\@newglossaryentryprehook{% + \def\@glo@entryprefix{}% + \def\@glo@entryprefixplural{}% + \let\@glo@entryprefixfirst\@gls@default@value + \let\@glo@entryprefixfirstplural\@gls@default@value +} +% \end{macrocode} +% Set the assignment code: +% \begin{macrocode} +\appto\@newglossaryentryposthook{% + \gls@assign@field{}{\@glo@label}{prefix}{\@glo@entryprefix}% + \gls@assign@field{}{\@glo@label}{prefixplural}{\@glo@entryprefixplural}% +% \end{macrocode} +% If \gloskey{prefixfirst} has not been supplied, make it the same +% as \gloskey{prefix}. +% \begin{macrocode} + \expandafter\gls@assign@field\expandafter + {\csname glo@\@glo@label @prefix\endcsname}{\@glo@label}{prefixfirst}% + {\@glo@entryprefixfirst}% +% \end{macrocode} +% If \gloskey{prefixfirstplural} has not been supplied, make it the same +% as \gloskey{prefixplural}. +% \begin{macrocode} + \expandafter\gls@assign@field\expandafter + {\csname glo@\@glo@label @prefixplural\endcsname}{\@glo@label}% + {prefixfirstplural}{\@glo@entryprefixfirstplural}% +} +% \end{macrocode} +% +% Define commands to access these fields: +%\begin{macro}{\glsentryprefixfirst} +% \begin{macrocode} +\newcommand*{\glsentryprefixfirst}[1]{\csuse{glo@#1@prefixfirst}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentryprefixfirstplural} +% \begin{macrocode} +\newcommand*{\glsentryprefixfirstplural}[1]{\csuse{glo@#1@prefixfirstplural}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentryprefix} +% \begin{macrocode} +\newcommand*{\glsentryprefix}[1]{\csuse{glo@#1@prefix}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentryprefixplural} +% \begin{macrocode} +\newcommand*{\glsentryprefixplural}[1]{\csuse{glo@#1@prefixplural}} +% \end{macrocode} +%\end{macro} +% +% Now for the initial upper case variants: +%\begin{macro}{\Glsentryprefixfirst} +% \begin{macrocode} +\newrobustcmd*{\Glsentryprefixfirst}[1]{% + \protected@edef\@glo@text{\csname glo@#1@prefixfirst\endcsname}% + \xmakefirstuc\@glo@text +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryprefixfirstplural} +% \begin{macrocode} +\newrobustcmd*{\Glsentryprefixfirstplural}[1]{% + \protected@edef\@glo@text{\csname glo@#1@prefixfirstplural\endcsname}% + \xmakefirstuc\@glo@text +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryprefix} +% \begin{macrocode} +\newrobustcmd*{\Glsentryprefix}[1]{% + \protected@edef\@glo@text{\csname glo@#1@prefix\endcsname}% + \xmakefirstuc\@glo@text +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsentryprefixplural} +% \begin{macrocode} +\newrobustcmd*{\Glsentryprefixplural}[1]{% + \protected@edef\@glo@text{\csname glo@#1@prefixplural\endcsname}% + \xmakefirstuc\@glo@text +} +% \end{macrocode} +%\end{macro} +% +% Define commands to determine if the prefix keys have been set: +%\begin{macro}{\ifglshasprefix} +% \begin{macrocode} +\newcommand*{\ifglshasprefix}[3]{% + \ifcsempty{glo@#1@prefix}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ifglshasprefixplural} +% \begin{macrocode} +\newcommand*{\ifglshasprefixplural}[3]{% + \ifcsempty{glo@#1@prefixplural}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ifglshasprefixfirst} +% \begin{macrocode} +\newcommand*{\ifglshasprefixfirst}[3]{% + \ifcsempty{glo@#1@prefixfirst}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\ifglshasprefixfirstplural} +% \begin{macrocode} +\newcommand*{\ifglshasprefixfirstplural}[3]{% + \ifcsempty{glo@#1@prefixfirstplural}% + {#3}% + {#2}% +} +% \end{macrocode} +%\end{macro} +% +% Define commands that insert the prefix before commands like \ics{gls}: +%\begin{macro}{\pgls} +%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd{\pgls}{\@gls@hyp@opt\@pgls} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \@spgls} +%\begin{macro}{\@pgls} +% Unstarred version. +% \begin{macrocode} +\newcommand*{\@pgls}[2][]{% + \new@ifnextchar[% + {\@pgls@{#1}{#2}}% + {\@pgls@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@pgls@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@pgls@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \ifglsused{#2}% + {% + \glsentryprefix{#2}% + }% + {% + \glsentryprefixfirst{#2}% + }% + \@gls@{#1}{#2}[#3]% + }% +} +% \end{macrocode} +%\end{macro} +% +% Similarly for the plural version: +%\begin{macro}{\pglspl} +%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd{\pglspl}{\@gls@hyp@opt\@pglspl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \@spglspl} +%\begin{macro}{\@pglspl} +% Unstarred version. +% \begin{macrocode} +\newcommand*{\@pglspl}[2][]{% + \new@ifnextchar[% + {\@pglspl@{#1}{#2}}% + {\@pglspl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@pglspl@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@pglspl@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \ifglsused{#2}% + {% + \glsentryprefixplural{#2}% + }% + {% + \glsentryprefixfirstplural{#2}% + }% + \@glspl@{#1}{#2}[#3]% + }% +} +% \end{macrocode} +%\end{macro} +% +% Now for the first letter upper case versions: +%\begin{macro}{\Pgls} +%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd{\Pgls}{\@gls@hyp@opt\@Pgls} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \@sPgls} +%\begin{macro}{\@Pgls} +% Unstarred version. +% \begin{macrocode} +\newcommand*{\@Pgls}[2][]{% + \new@ifnextchar[% + {\@Pgls@{#1}{#2}}% + {\@Pgls@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Pgls@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Pgls@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \ifglsused{#2}% + {% + \ifglshasprefix{#2}% + {% + \Glsentryprefix{#2}% + \@gls@{#1}{#2}[#3]% + }% + {\@Gls@{#1}{#2}[#3]}% + }% + {% + \ifglshasprefixfirst{#2}% + {% + \Glsentryprefixfirst{#2}% + \@gls@{#1}{#2}[#3]% + }% + {\@Gls@{#1}{#2}[#3]}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% Similarly for the plural version: +%\begin{macro}{\Pglspl} +%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd{\Pglspl}{\@gls@hyp@opt\@Pglspl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \@sPglspl} +%\begin{macro}{\@Pglspl} +% Unstarred version. +% \begin{macrocode} +\newcommand*{\@Pglspl}[2][]{% + \new@ifnextchar[% + {\@Pglspl@{#1}{#2}}% + {\@Pglspl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Pglspl@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Pglspl@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \ifglsused{#2}% + {% + \ifglshasprefixplural{#2}% + {% + \Glsentryprefixplural{#2}% + \@glspl@{#1}{#2}[#3]% + }% + {\@Glspl@{#1}{#2}[#3]}% + }% + {% + \ifglshasprefixfirstplural{#2}% + {% + \Glsentryprefixfirstplural{#2}% + \@glspl@{#1}{#2}[#3]% + }% + {\@Glspl@{#1}{#2}[#3]}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% Finally the all upper case versions: +%\begin{macro}{\PGLS} +%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd{\PGLS}{\@gls@hyp@opt\@PGLS} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \@sPGLS} +%\begin{macro}{\@PGLS} +% Unstarred version. +% \begin{macrocode} +\newcommand*{\@PGLS}[2][]{% + \new@ifnextchar[% + {\@PGLS@{#1}{#2}}% + {\@PGLS@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@PGLS@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@PGLS@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \ifglsused{#2}% + {% + \mfirstucMakeUppercase{\glsentryprefix{#2}}% + }% + {% + \mfirstucMakeUppercase{\glsentryprefixfirst{#2}}% + }% + \@GLS@{#1}{#2}[#3]% + }% +} +% \end{macrocode} +%\end{macro} +% +% Plural version: +%\begin{macro}{\PGLSpl} +%\changes{4.08}{2014-07-30}{changed to use \cs{@gls@hyp@opt}} +% \begin{macrocode} +\newrobustcmd{\PGLSpl}{\@gls@hyp@opt\@PGLSpl} +% \end{macrocode} +%\end{macro} +%\changes{4.08}{2014-07-30}{removed \@sPGLSpl} +%\begin{macro}{\@PGLSpl} +% Unstarred version. +% \begin{macrocode} +\newcommand*{\@PGLSpl}[2][]{% + \new@ifnextchar[% + {\@PGLSpl@{#1}{#2}}% + {\@PGLSpl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@PGLSpl@} +% Read in the final optional argument: +% \begin{macrocode} +\def\@PGLSpl@#1#2[#3]{% + \glsdoifexists{#2}% + {% + \ifglsused{#2}% + {% + \mfirstucMakeUppercase{\glsentryprefixplural{#2}}% + }% + {% + \mfirstucMakeUppercase{\glsentryprefixfirstplural{#2}}% + }% + \@GLSpl@{#1}{#2}[#3]% + }% +} +% \end{macrocode} +%\end{macro} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-hypernav.sty> +% \end{macrocode} +%\fi +%\chapter{Glossary Styles} +% \section{Glossary hyper-navigation definitions (glossary-hypernav package)} +%\label{sec:code:hypernav} +% Package Definition: +% \begin{macrocode} +\ProvidesPackage{glossary-hypernav}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% +% The commands defined in this package are provided to +% help navigate around the groups within a glossary +% (see \autoref{sec:code:printglos}.) +% \ics{printglossary} (and \ics{printglossaries}) +% set \cs{@glo@type} to the label of the current +% glossary. This is used to create a unique hypertarget in +% the event of multiple glossaries. +%\\[10pt] +% \cs{glsnavhyperlink}\oarg{type}\marg{label}\marg{text}\\[10pt] +% This command makes \meta{text} a hyperlink to the glossary group +% whose label is given by \meta{label} for the glossary given +% by \meta{type}. +%\begin{macro}{\glsnavhyperlink} +%\changes{1.14}{2008-06-17}{changed \cs{edef} to \cs{protected@edef}} +%\changes{1.17}{2008-12-26}{replaced \cs{hyperlink} to +%\cs{@glslink}} +% \begin{macrocode} +\newcommand*{\glsnavhyperlink}[3][\@glo@type]{% + \edef\gls@grplabel{#2}\protected@edef\@gls@grptitle{#3}% + \@glslink{\glsnavhyperlinkname{#1}{#2}}{#3}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsnavhyperlinkname} +%\changes{4.29}{2017-01-19}{new} +%Expands to the hypertarget name. The first argument is the glossary +%type. The second argument is the group label. +% \begin{macrocode} +\newcommand*{\glsnavhyperlinkname}[2]{glsn:#1@#2} +% \end{macrocode} +%\end{macro} +%\vskip5pt +% \cs{glsnavhypertarget}\oarg{type}\marg{label}\marg{text}\\[10pt] +% This command makes \meta{text} a hypertarget for the glossary group +% whose label is given by \meta{label} in the glossary given +% by \meta{type}. If \meta{type} is omitted, \cs{@glo@type} is +% used which is set by \ics{printglossary} to the current +% glossary label. +%\begin{macro}{\glsnavhypertarget} +%\changes{1.14}{2008-06-17}{added write to aux file} +%\changes{1.15}{2008-08-15}{added check if rerun required} +%\changes{1.17}{2008-12-26}{replaced \cs{hypertarget} to +%\cs{@glstarget}} +% \begin{macrocode} +\newcommand*{\glsnavhypertarget}[3][\@glo@type]{% + \@glsnavhypertarget{#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +%The actual code is now in an internal command that doesn't have an +%optional argument, which makes it easier to save and restore the +%original behaviour. +%\begin{macro}{\@glsnavhypertarget} +%\changes{4.32}{2017-08-24}{new} +% \begin{macrocode} +\newcommand*{\@glsnavhypertarget}[3]{% +% \end{macrocode} +% Add this group to the aux file for re-run check. +% \begin{macrocode} + \protected@write\@auxout{}{\string\@gls@hypergroup{#1}{#2}}% +% \end{macrocode} +% Add the target. +% \begin{macrocode} + \@glstarget{\glsnavhyperlinkname{#1}{#2}}{#3}% +% \end{macrocode} +% Check list of known groups to determine if a re-run is required. +% \begin{macrocode} + \expandafter\let + \expandafter\@gls@list\csname @gls@hypergrouplist@#1\endcsname +% \end{macrocode} +% Iterate through list and terminate loop if this group is found. +% \begin{macrocode} + \@for\@gls@elem:=\@gls@list\do{% + \ifthenelse{\equal{\@gls@elem}{#2}}{\@endfortrue}{}}% +% \end{macrocode} +% Check if list terminated prematurely. +% \begin{macrocode} + \if@endfor + \else +% \end{macrocode} +% This group was not included in the list, so issue a warning. +% \begin{macrocode} + \GlossariesWarningNoLine{Navigation panel + for glossary type `#1'^^Jmissing group `#2'}% + \gdef\gls@hypergrouprerun{% + \GlossariesWarningNoLine{Navigation panel + has changed. Rerun LaTeX}}% + \fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@hypergrouprerun} +% Give a warning at the end if re-run required +%\changes{1.15}{2008-08-15}{new} +% \begin{macrocode} +\let\gls@hypergrouprerun\relax +\AtEndDocument{\gls@hypergrouprerun} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@hypergroup} +% This adds to (or creates) the command \cs{@gls@hypergrouplist@}\meta{glossary type} +% which lists all groups for a given glossary, so that +% the navigation bar only contains those groups that are present. +% However it requires at least 2 runs to ensure the information is +% up-to-date. +%\changes{1.14}{2008-06-17}{new} +% \begin{macrocode} +\newcommand*{\@gls@hypergroup}[2]{% +\@ifundefined{@gls@hypergrouplist@#1}{% + \expandafter\xdef\csname @gls@hypergrouplist@#1\endcsname{#2}% +}{% + \expandafter\let\expandafter\@gls@tmp + \csname @gls@hypergrouplist@#1\endcsname + \expandafter\xdef\csname @gls@hypergrouplist@#1\endcsname{% + \@gls@tmp,#2}% +}% +} +% \end{macrocode} +%\end{macro} +% +% The \cs{glsnavigation} command displays a simple glossary +% group navigation. +% The symbol and number elements are defined separately, +% so that they can be suppressed if need be. (In earlier verions this +% command will produce a link to all 28 groups, but some groups +% may not be defined if there are groups that do not contain any +% terms, in which case you will get an undefined hyperlink warning. +% Version 1.14 changed this to only use labels for groups that are +% present.) +% Now for the whole navigation bit: +%\begin{macro}{\glsnavigation} +% \changes{1.14}{2008-06-17}{changed to only use labels for +% groups that are present} +% \begin{macrocode} +\newcommand*{\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 +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{switched to using +%\cs{@gls@getgrouptitle}} +% \begin{macrocode} + \@gls@getgrouptitle{\@gls@tmp}{\@gls@grptitle}% + \glsnavhyperlink{\@gls@tmp}{\@gls@grptitle}% + \let\@gls@between\glshypernavsep + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glshypernavsep} +% Separator for the hyper navigation bar. +% \begin{macrocode} +\newcommand*{\glshypernavsep}{\space\textbar\space} +% \end{macrocode} +%\end{macro} +% The \cs{glssymbolnav} produces a simple navigation set of +% links for just the symbol and number groups. This used to be used at +% the start of \cs{glsnavigation}. This command is no longer needed. +%\begin{macro}{\glssymbolnav} +% \begin{macrocode} +\newcommand*{\glssymbolnav}{% + \glsnavhyperlink{glssymbols}{\glsgetgrouptitle{glssymbols}}% + \glshypernavsep + \glsnavhyperlink{glsnumbers}{\glsgetgrouptitle{glsnumbers}}% + \glshypernavsep +} +% \end{macrocode} +%\end{macro} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-inline.sty> +% \end{macrocode} +%\fi +% \section{In-line Style (glossary-inline.sty)} +% This defines an in-line style where the entries are +% comma-separated with just the name and description displayed. +% \begin{macrocode} +\ProvidesPackage{glossary-inline}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% +%\begin{style}{inline} +% Define the inline style. +% \begin{macrocode} +\newglossarystyle{inline}{% +% \end{macrocode} +% Start of glossary sets up first empty separator between entries. +% (This is then changed by \cs{glossentry}) +% \begin{macrocode} + \renewenvironment{theglossary}% + {% + \def\gls@inlinesep{}% + \def\gls@inlinesubsep{}% + \def\gls@inlinepostchild{}% + }% + {\glspostinline}% +% \end{macrocode} +% No header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings (if heading is required, add +% \ics{glsinlinedopostchild} to start definition in case heading +% follows a child entry): +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Just display separator followed by name and description: +%\changes{3.08a}{2013-08-30}{updated inline style to use +%\cs{glossentry} and \cs{subglossentry}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsinlinedopostchild + \gls@inlinesep + \glsentryitem{##1}% + \glsinlinenameformat{##1}{% + \glossentryname{##1}% + }% + \ifglsdescsuppressed{##1}% + {% + \glsinlineemptydescformat + {% + \glossentrysymbol{##1}% + }% + {% + ##2% + }% + }% + {% + \ifglshasdesc{##1}% + {\glsinlinedescformat{\glossentrydesc{##1}}{\glossentrysymbol{##1}}{##2}}% + {\glsinlineemptydescformat{\glossentrysymbol{##1}}{##2}}% + }% + \ifglshaschildren{##1}% + {% + \glsresetsubentrycounter + \glsinlineparentchildseparator + \def\gls@inlinesubsep{}% + \def\gls@inlinepostchild{\glsinlinepostchild}% + }% + {}% + \def\gls@inlinesep{\glsinlineseparator}% + }% +% \end{macrocode} +% Sub-entries display description: +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + \gls@inlinesubsep% + \glsinlinesubnameformat{##2}{% + \glossentryname{##2}}% + \glssubentryitem{##2}% + \glsinlinesubdescformat{\glossentrydesc{##2}}{\glossentrysymbol{##2}}{##3}% + \def\gls@inlinesubsep{\glsinlinesubseparator}% + }% +% \end{macrocode} +% Nothing special between groups: +% \begin{macrocode} + \renewcommand*{\glsgroupskip}{}% +} +% \end{macrocode} +%\end{style} +% +%\begin{macro}{\glsinlinedopostchild} +% \begin{macrocode} +\newcommand*{\glsinlinedopostchild}{% + \gls@inlinepostchild + \def\gls@inlinepostchild{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlineseparator} +% Separator to use between entries. +% \begin{macrocode} +\newcommand*{\glsinlineseparator}{;\space} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlinesubseparator} +% Separator to use between sub-entries. +% \begin{macrocode} +\newcommand*{\glsinlinesubseparator}{,\space} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlineparentchildseparator} +% Separator to use between parent and children. +% \begin{macrocode} +\newcommand*{\glsinlineparentchildseparator}{:\space} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlinepostchild} +%\changes{3.03}{2012/09/21}{new} +% Hook to use between child and next entry +% \begin{macrocode} +\newcommand*{\glsinlinepostchild}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspostinline} +% Terminator for inline glossary. +%\changes{3.03}{2012/09/21}{replaced ``.'' with \cs{glspostdescription}} +% \begin{macrocode} +\newcommand*{\glspostinline}{\glspostdescription\space} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlinenameformat} +%\changes{3.03}{2012/09/21}{new} +% Formats the name of the entry (first argument label, second +% argument name): +% \begin{macrocode} +\newcommand*{\glsinlinenameformat}[2]{\glstarget{#1}{#2}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlinedescformat} +%\changes{3.03}{2012/09/21}{new} +% Formats the entry's description, symbol and location list: +% \begin{macrocode} +\newcommand*{\glsinlinedescformat}[3]{\space#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlineemptydescformat} +%\changes{3.03}{2012/09/21}{new} +% Formats the entry's symbol and location list when the description +% is empty: +% \begin{macrocode} +\newcommand*{\glsinlineemptydescformat}[2]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlinesubnameformat} +%\changes{3.03}{2012/09/21}{new} +% Formats the name of the subentry (first argument label, second +% argument name): +% \begin{macrocode} +\newcommand*{\glsinlinesubnameformat}[2]{\glstarget{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsinlinesubdescformat} +%\changes{3.03}{2012/09/21}{new} +% Formats the subentry's description, symbol and location list: +% \begin{macrocode} +\newcommand*{\glsinlinesubdescformat}[3]{#1} +% \end{macrocode} +%\end{macro} +% +% +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-list.sty> +% \end{macrocode} +%\fi +% \section{List Style (glossary-list.sty)} +% The \isty{glossary-list} style file defines glossary styles +% that use the \env{description} environment. Note that since +% the entry name is placed in the optional argument to the +% \ics{item} command, it will appear in a bold font by +% default. +% \begin{macrocode} +\ProvidesPackage{glossary-list}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +%\begin{macro}{\indexspace} +%\changes{4.13}{2015-02-03}{new} +% There are a few classes that don't define \cs{indexspace}, so +% provide a definition if it hasn't been defined. +% \begin{macrocode} +\providecommand{\indexspace}{% + \par \vskip 10\p@ \@plus 5\p@ \@minus 3\p@ \relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslistgroupheaderfmt} +%\changes{4.22}{2016-04-19}{new} +% Provide a way of adjusting the format of the group headings. +% \begin{macrocode} +\newcommand*{\glslistgroupheaderfmt}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslistnavigationitem} +%\changes{4.22}{2016-04-19}{new} +% Provide a way of adjusting the format of the navigation header. +% This puts the navigation line inside the optional argument +% of item to prevent unwanted space occurring at the start, but +% this can cause a problem if the navigation line is too long. +% With this command, it makes it easier for the user to customise +% the style without having to remember to modify \cs{glossaryheader} +% after the style has been set. +% \begin{macrocode} +\newcommand*{\glslistnavigationitem}[1]{\item[#1]} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{list} +% The \glostyle{list} glossary style +% uses the \env{description} environment. The group separator +% \ics{glsgroupskip} is redefined as \cs{indexspace} +% which produces a gap between groups. The glossary heading +% and the group headings do nothing. Sub-entries immediately +% follow the main entry without the sub-entry name. This style +% does not use the entry's symbol. This is used as the default +% style for the \sty{glossaries} package. +% \begin{macrocode} +\newglossarystyle{list}{% +% \end{macrocode} +% Use \env{description} environment: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{description}}{\end{description}}% +% \end{macrocode} +% No header at the start of the environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries start a new item in the list: +%\changes{3.08a}{2013-08-30}{updated list style to use +%\cs{glossentry} and \cs{subglossentry}} +% \begin{macrocode} + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription\space ##2}% +% \end{macrocode} +% Sub-entries continue on the same line: +%\changes{4.22}{2016-04-19}{fixed missing space before description} +% \begin{macrocode} + \renewcommand*{\subglossentry}[3]{% + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\space + \glossentrydesc{##2}\glspostdescription\space ##3.}% +% \end{macrocode} +% Add vertical space between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +% \begin{macrocode} + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{listgroup} +% The \glostyle{listgroup} style is like the \glostyle{list} +% style, but the glossary groups have headings. +%\changes{1.08}{2007-10-13}{changed listgroup style to use \cs{glsgetgrouptitle}} +% \begin{macrocode} +\newglossarystyle{listgroup}{% +% \end{macrocode} +% Base it on the \glostyle{list} style: +% \begin{macrocode} + \setglossarystyle{list}% +% \end{macrocode} +% Each group has a heading: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]}} +% \end{macrocode} +%\end{style} +% +%\begin{style}{listhypergroup} +% The \glostyle{listhypergroup} style is like the \glostyle{listgroup} +% style, but has a set of links to the groups at the +% start of the glossary. +% \begin{macrocode} +\newglossarystyle{listhypergroup}{% +% \end{macrocode} +% Base it on the \glostyle{list} style: +% \begin{macrocode} + \setglossarystyle{list}% +% \end{macrocode} +% Add navigation links at the start of the environment. +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \glslistnavigationitem{\glsnavigation}}% +% \end{macrocode} +% Each group has a heading with a hypertarget: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]}} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlist} +% The \glostyle{altlist} glossary style is like the \glostyle{list} +% style, but places the description on a new line. Sub-entries +% follow in separate paragraphs without the sub-entry name. This +% style does not use the entry's symbol. +% \begin{macrocode} +\newglossarystyle{altlist}{% +% \end{macrocode} +% Base it on the \glostyle{list} style: +% \begin{macrocode} + \setglossarystyle{list}% +% \end{macrocode} +% Main (level 0) entries start a new item in the list with a +% line break after the entry name: +%\changes{3.08a}{2013-08-30}{updated altlist style to use +%\cs{glossentry} and \cs{subglossentry}} +% \begin{macrocode} + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}]% +% \end{macrocode} +%\changes{3.04}{2012-11-11}{replaced \cs{newline} with paragraph break} +% Version 3.04 changed \cs{newline} to the following paragraph break +% stuff (thanks to Daniel Gebhardt for supplying the fix) to prevent +% a page break occurring at this point. +% \begin{macrocode} + \mbox{}\par\nobreak\@afterheading + \glossentrydesc{##1}\glspostdescription\space ##2}% +% \end{macrocode} +% Sub-entries start a new paragraph: +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + \par + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space ##3}% +} +% \end{macrocode} +%\end{style} +%\begin{style}{altlistgroup} +% The \glostyle{altlistgroup} glossary style is like the +% \glostyle{altlist} style, but the glossary groups have headings. +%\changes{1.08}{2007-10-13}{changed altlistgroup style to use \cs{glsgetgrouptitle}} +% \begin{macrocode} +\newglossarystyle{altlistgroup}{% +% \end{macrocode} +% Base it on the \glostyle{altlist} style: +% \begin{macrocode} + \setglossarystyle{altlist}% +% \end{macrocode} +% Each group has a heading: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt{\glsgetgrouptitle{##1}}]}} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlisthypergroup} +% The \glostyle{altlisthypergroup} glossary style is like the +% \glostyle{altlistgroup} style, but has a +% set of links to the groups at the start of the glossary. +% \begin{macrocode} +\newglossarystyle{altlisthypergroup}{% +% \end{macrocode} +% Base it on the \glostyle{altlist} style: +% \begin{macrocode} + \setglossarystyle{altlist}% +% \end{macrocode} +% Add navigation links at the start of the environment. +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \glslistnavigationitem{\glsnavigation}}% +% \end{macrocode} +% Each group has a heading with a hypertarget: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item[\glslistgroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}]}} +% \end{macrocode} +%\end{style} +% +%\begin{style}{listdotted} +% The \glostyle{listdotted} glossary style was supplied by +% Axel~Menzel. I've modified it slightly so that the distance from +% the start of the name to the end of the dotted line is specified +% by \cs{glslistdottedwidth}. +% Note that this style ignores the page numbers as well as the +% symbol. Sub-entries are displayed in the same way as top-level +% entries. +% \begin{macrocode} +\newglossarystyle{listdotted}{% +% \end{macrocode} +% Base it on the \glostyle{list} style: +% \begin{macrocode} + \setglossarystyle{list}% +% \end{macrocode} +% Each main (level 0) entry starts a new item: +%\changes{3.08a}{2013-08-30}{updated listdotted style to use +%\cs{glossentry} and \cs{subglossentry}} +% \begin{macrocode} + \renewcommand*{\glossentry}[2]{% + \item[]\makebox[\glslistdottedwidth][l]{% + \glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}% + \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}\glossentrydesc{##1}}% +% \end{macrocode} +% Sub entries have the same format as main entries: +% \begin{macrocode} + \renewcommand*{\subglossentry}[3]{% + \item[]\makebox[\glslistdottedwidth][l]{% + \glssubentryitem{##2}% + \glstarget{##2}{\glossentryname{##2}}% + \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}\glossentrydesc{##2}}% +} +% \end{macrocode} +%\end{style} +%\begin{macro}{\glslistdottedwidth} +%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}} +% \begin{macrocode} +\newlength\glslistdottedwidth +\setlength{\glslistdottedwidth}{.5\hsize} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{sublistdotted} +% This style is similar to the glostyle{listdotted} style, except +% that the main entries just have the name displayed. +% \begin{macrocode} +\newglossarystyle{sublistdotted}{% +% \end{macrocode} +% Base it on the \glostyle{listdotted} style: +% \begin{macrocode} + \setglossarystyle{listdotted}% +% \end{macrocode} +% Main (level 0) entries just display the name: +% \begin{macrocode} + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}}]}% +} +% \end{macrocode} +%\end{style} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-long.sty> +% \end{macrocode} +%\fi +% \section{Glossary Styles using longtable (the glossary-long +% package)} +% The glossary styles defined in the \isty{glossary-long} package +% used the \env{longtable} environment in the glossary. +% \begin{macrocode} +\ProvidesPackage{glossary-long}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Requires the \isty{longtable} package: +% \begin{macrocode} +\RequirePackage{longtable} +% \end{macrocode} +%\begin{macro}{\glsdescwidth} +% This is a length that governs the width of the description column. +% (There's a chance that the user may specify \pkgopt{nolong} +% and then load \isty{glossary-long} later, in which case +% \cs{glsdescwidth} may have already been defined by +% \isty{glossary-super}. The same goes for \cs{glspagelistwidth}.) +%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}} +% \begin{macrocode} +\@ifundefined{glsdescwidth}{% + \newlength\glsdescwidth + \setlength{\glsdescwidth}{0.6\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspagelistwidth} +% This is a length that governs the width of the page list column. +%\changes{2.01}{2009 May 30}{changed \cs{linewidth} to \cs{hsize}} +% \begin{macrocode} +\@ifundefined{glspagelistwidth}{% + \newlength\glspagelistwidth + \setlength{\glspagelistwidth}{0.1\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{long} +% The \glostyle{long} glossary style command which +% uses the \env{longtable} environment: +% \begin{macrocode} +\newglossarystyle{long}{% +% \end{macrocode} +% Use \env{longtable} with two columns: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}}}% + {\end{longtable}}% +% \end{macrocode} +% Do nothing at the start of the environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No heading between groups: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries displayed in a row: +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries displayed on the following row without the name: +%\changes{4.22}{2016-04-19}{fixed typo in \cs{glossentrydesc}} +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space + ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longborder} +% The \glostyle{longborder} style is like the above, but with horizontal and +% vertical lines: +% \begin{macrocode} +\newglossarystyle{longborder}{% +% \end{macrocode} +% Base it on the glostyle{long} style: +% \begin{macrocode} + \setglossarystyle{long}% +% \end{macrocode} +% Use \env{longtable} with two columns with vertical lines +% between each column: +% \begin{macrocode} + \renewenvironment{theglossary}{% + \begin{longtable}{|l|p{\glsdescwidth}|}}{\end{longtable}}% +% \end{macrocode} +% Place horizontal lines at the head and foot of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longheader} +% The \glostyle{longheader} style is like the +% \glostyle{long} style but with a header: +% \begin{macrocode} +\newglossarystyle{longheader}{% +% \end{macrocode} +% Base it on the glostyle{long} style: +% \begin{macrocode} + \setglossarystyle{long}% +% \end{macrocode} +% Set the table's header: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \bfseries \entryname & \bfseries \descriptionname\tabularnewline\endhead}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longheaderborder} +% The \glostyle{longheaderborder} style is +% like the \glostyle{long} style but with a header and border: +% \begin{macrocode} +\newglossarystyle{longheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{longborder} style: +% \begin{macrocode} + \setglossarystyle{longborder}% +% \end{macrocode} +% Set the table's header and add horizontal line to table's foot: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \hline\bfseries \entryname & \bfseries + \descriptionname\tabularnewline\hline + \endhead + \hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long3col} +% The \glostyle{long3col} style is like \glostyle{long} but with 3 columns +% \begin{macrocode} +\newglossarystyle{long3col}{% +% \end{macrocode} +% Use a \env{longtable} with 3 columns: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}p{\glspagelistwidth}}}% + {\end{longtable}}% +% \end{macrocode} +% No table header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No headings between groups: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a row (name in first column, +% description in second column, page list in last column): +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & ##2\tabularnewline + }% +% \end{macrocode} +% Sub-entries on a separate row (no name, description in +% second column, page list in third column): +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long3colborder} +% The \glostyle{long3colborder} style is like the +% \glostyle{long3col} style but with a border: +% \begin{macrocode} +\newglossarystyle{long3colborder}{% +% \end{macrocode} +% Base it on the glostyle{long3col} style: +% \begin{macrocode} + \setglossarystyle{long3col}% +% \end{macrocode} +% Use a \env{longtable} with 3 columns with vertical lines +% around them: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}% + {\end{longtable}}% +% \end{macrocode} +% Place horizontal lines at the head and foot of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long3colheader} +% The \glostyle{long3colheader} style is like \glostyle{long3col} but with a header row: +% \begin{macrocode} +\newglossarystyle{long3colheader}{% +% \end{macrocode} +% Base it on the glostyle{long3col} style: +% \begin{macrocode} + \setglossarystyle{long3col}% +% \end{macrocode} +% Set the table's header: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline\endhead}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long3colheaderborder} +% The \glostyle{long3colheaderborder} style is like the above but with a border +% \begin{macrocode} +\newglossarystyle{long3colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{long3colborder} style: +% \begin{macrocode} + \setglossarystyle{long3colborder}% +% \end{macrocode} +% Set the table's header and add horizontal line at table's foot: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \hline + \bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline\hline\endhead + \hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long4col} +% The \glostyle{long4col} style has four columns where the third +% column contains the value of the associated \gloskey{symbol} key. +% \begin{macrocode} +\newglossarystyle{long4col}{% +% \end{macrocode} +% Use a \env{longtable} with 4 columns: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{llll}}% + {\end{longtable}}% +% \end{macrocode} +% No table header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a single row (name in first column, +% description in second column, symbol in third column, page list +% in last column): +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & + \glossentrysymbol{##1} & + ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries on a single row with no name (description in second +% column, symbol in third column, page list in last column): +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & & & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long4colheader} +% The \glostyle{long4colheader} style is like \glostyle{long4col} +% but with a header row. +% \begin{macrocode} +\newglossarystyle{long4colheader}{% +% \end{macrocode} +% Base it on the glostyle{long4col} style: +% \begin{macrocode} + \setglossarystyle{long4col}% +% \end{macrocode} +% Table has a header: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \bfseries\entryname&\bfseries\descriptionname& + \bfseries \symbolname& + \bfseries\pagelistname\tabularnewline\endhead}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long4colborder} +% The \glostyle{long4colborder} style is like \glostyle{long4col} +% but with a border. +% \begin{macrocode} +\newglossarystyle{long4colborder}{% +% \end{macrocode} +% Base it on the glostyle{long4col} style: +% \begin{macrocode} + \setglossarystyle{long4col}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns surrounded by vertical +% lines: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|l|l|l|}}% + {\end{longtable}}% +% \end{macrocode} +% Add horizontal lines to the head and foot of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long4colheaderborder} +% The \glostyle{long4colheaderborder} style is like the above but +% with a border. +% \begin{macrocode} +\newglossarystyle{long4colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{long4col} style: +% \begin{macrocode} + \setglossarystyle{long4col}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns surrounded by vertical +% lines: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|l|l|l|}}% + {\end{longtable}}% +% \end{macrocode} +% Add table header and horizontal line at the table's foot: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \hline\bfseries\entryname&\bfseries\descriptionname& + \bfseries \symbolname& + \bfseries\pagelistname\tabularnewline\hline\endhead + \hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlong4col} +% The \glostyle{altlong4col} style is like the \glostyle{long4col} +% style but can have multiline descriptions and page lists. +% \begin{macrocode} +\newglossarystyle{altlong4col}{% +% \end{macrocode} +% Base it on the glostyle{long4col} style: +% \begin{macrocode} + \setglossarystyle{long4col}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlong4colheader} +% The \glostyle{altlong4colheader} style is like +% \glostyle{altlong4col} but with a header row. +% \begin{macrocode} +\newglossarystyle{altlong4colheader}{% +% \end{macrocode} +% Base it on the glostyle{long4colheader} style: +% \begin{macrocode} + \setglossarystyle{long4colheader}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlong4colborder} +% The \glostyle{altlong4colborder} style is like +% \glostyle{altlong4col} but with a border. +% \begin{macrocode} +\newglossarystyle{altlong4colborder}{% +% \end{macrocode} +% Base it on the glostyle{long4colborder} style: +% \begin{macrocode} + \setglossarystyle{long4colborder}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlong4colheaderborder} +% The \glostyle{altlong4colheaderborder} style is like the above but +% with a header as well as a border. +% \begin{macrocode} +\newglossarystyle{altlong4colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{long4colheaderborder} style: +% \begin{macrocode} + \setglossarystyle{long4colheaderborder}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-longbooktabs.sty> +% \end{macrocode} +%\fi +%\section{Glossary Styles using longtable and booktabs (the +%glossary-longbooktabs) package} +% The styles here are based on David Carlisle's patch at +% \url{http://tex.stackexchange.com/a/56890} +% +% \begin{macrocode} +\ProvidesPackage{glossary-longbooktabs}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Requires \sty{booktabs} package: +% \begin{macrocode} +\RequirePackage{booktabs} +% \end{macrocode} +% and the base packages for long styles: +% \begin{macrocode} +\RequirePackage{glossary-long} +\RequirePackage{glossary-longragged} +% \end{macrocode} +%(\sty{longtable} and \sty{array} loaded by those packages). +% +%\begin{style}{long-booktabs} +%\changes{4.21}{2016-01-24}{new} +% The \glostyle{long-booktabs} style is similar to the +% \glostyle{longheader} +% style but uses the \sty{booktabs} rules and patches +% \env{longtable} to check for group skip occurring at a page break. +% \begin{macrocode} +\newglossarystyle{long-booktabs}{% +% \end{macrocode} +% If the style change is scoped, the patch will only have a local +% effect, which may be useful if it conflicts with other tables in +% the document. +% \begin{macrocode} + \glspatchLToutput +% \end{macrocode} +% As with the \glostyle{longheader} style, use the +% \glostyle{long} style as a base. +% \begin{macrocode} + \setglossarystyle{long}% +% \end{macrocode} +% Add a header with rules. +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \toprule \bfseries \entryname & \bfseries + \descriptionname\tabularnewline\midrule\endhead + \bottomrule\endfoot}% +% \end{macrocode} +% Check for the \pkgopt{nogroupskip} package option. If there should +% be a gap between groups, insert the penalty and the vertical +% space. +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} should occur outside +%\cs{glsgroupskip} to be on the safe side. +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long3col-booktabs} +%\changes{4.21}{2016-01-24}{new} +% The \glostyle{long3col-booktabs} style is similar to the +% \glostyle{long3colheader} +% style but uses the \sty{booktabs} rules and patches +% \env{longtable} to check for group skip occurring at a page break. +% \begin{macrocode} +\newglossarystyle{long3col-booktabs}{% +% \end{macrocode} +% If the style change is scoped, the patch will only have a local +% effect, which may be useful if it conflicts with other tables in +% the document. +% \begin{macrocode} + \glspatchLToutput +% \end{macrocode} +% Use the \glostyle{long3col} style as a base. +% \begin{macrocode} + \setglossarystyle{long3col}% +% \end{macrocode} +% Add a header with rules. +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \toprule \bfseries \entryname & + \bfseries \descriptionname & + \bfseries \pagelistname + \tabularnewline\midrule\endhead + \bottomrule\endfoot}% +% \end{macrocode} +% Check for the \pkgopt{nogroupskip} package option. If there should +% be a gap between groups, insert the penalty and the vertical +% space. +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} should occur outside +%\cs{glsgroupskip} to be on the safe side. +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{long4col-booktabs} +%\changes{4.21}{2016-01-24}{new} +% The \glostyle{long4col-booktabs} style is similar to the +% \glostyle{long4colheader} +% style but uses the \sty{booktabs} rules and patches +% \env{longtable} to check for group skip occurring at a page break. +% \begin{macrocode} +\newglossarystyle{long4col-booktabs}{% +% \end{macrocode} +% If the style change is scoped, the patch will only have a local +% effect, which may be useful if it conflicts with other tables in +% the document. +% \begin{macrocode} + \glspatchLToutput +% \end{macrocode} +% Use the \glostyle{long4col} style as a base. +% \begin{macrocode} + \setglossarystyle{long4col}% +% \end{macrocode} +% Add a header with rules. +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \toprule \bfseries \entryname & + \bfseries \descriptionname & + \bfseries \symbolname & + \bfseries \pagelistname + \tabularnewline\midrule\endhead + \bottomrule\endfoot}% +% \end{macrocode} +% Check for the \pkgopt{nogroupskip} package option. If there should +% be a gap between groups, insert the penalty and the vertical +% space. +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} should occur outside +%\cs{glsgroupskip} to be on the safe side. +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{\glspenaltygroupskip}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlong4col-booktabs} +%\changes{4.21}{2016-01-24}{new} +% The \glostyle{altlong4col-booktabs} style is similar to the +% \glostyle{altlong4colheader} +% style but uses the \sty{booktabs} rules and patches +% \env{longtable} to check for group skip occurring at a page break. +% \begin{macrocode} +\newglossarystyle{altlong4col-booktabs}{% +% \end{macrocode} +%The patch \cs{glspatchLToutput} is already applied in +%\glostyle{long4col-booktabs} and so doesn't need to be here. +%\changes{4.42}{??}{removed superfluous \cs{glspatchLToutput}} +% \begin{macrocode} + \glspatchLToutput +% \end{macrocode} +% Use the +% \glostyle{long4col-booktabs} style as a base. +% \begin{macrocode} + \setglossarystyle{long4col-booktabs}% +% \end{macrocode} +% Change the column specifications: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{lp{\glsdescwidth}lp{\glspagelistwidth}}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +% +% Ragged styles. +%\begin{style}{longragged-booktabs} +%\changes{4.21}{2016-01-24}{new} +% The \glostyle{longragged-booktabs} style is similar to the +% \glostyle{longragged} +% style but uses the \sty{booktabs} rules and patches +% \env{longtable} to check for group skip occurring at a page break. +% \begin{macrocode} +\newglossarystyle{longragged-booktabs}{% +% \end{macrocode} +% If the style change is scoped, the patch will only have a local +% effect, which may be useful if it conflicts with other tables in +% the document. +% \begin{macrocode} + \glspatchLToutput +% \end{macrocode} +% Use the \glostyle{long-booktabs} style as a base. +% \begin{macrocode} + \setglossarystyle{long-booktabs}% +% \end{macrocode} +% Adjust the column specification. +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longragged3col-booktabs} +%\changes{4.21}{2016-01-24}{new} +% The \glostyle{longragged3col-booktabs} style is similar to the +% \glostyle{longragged3col} +% style but uses the \sty{booktabs} rules and patches +% \env{longtable} to check for group skip occurring at a page break. +% \begin{macrocode} +\newglossarystyle{longragged3col-booktabs}{% +% \end{macrocode} +% If the style change is scoped, the patch will only have a local +% effect, which may be useful if it conflicts with other tables in +% the document. +% \begin{macrocode} + \glspatchLToutput +% \end{macrocode} +% Use the \glostyle{long3col-booktabs} style as a base. +% \begin{macrocode} + \setglossarystyle{long3col-booktabs}% +% \end{macrocode} +% Adjust the column specification. +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlongragged4col-booktabs} +%\changes{4.21}{2016-01-24}{new} +% The \glostyle{altlongragged4col-booktabs} style is similar to the +% \glostyle{altlongragged4col} +% style but uses the \sty{booktabs} rules and patches +% \env{longtable} to check for group skip occurring at a page break. +% \begin{macrocode} +\newglossarystyle{altlongragged4col-booktabs}{% +% \end{macrocode} +% If the style change is scoped, the patch will only have a local +% effect, which may be useful if it conflicts with other tables in +% the document. +% \begin{macrocode} + \glspatchLToutput +% \end{macrocode} +% Use the \glostyle{altlong4col-booktabs} style as a base. +% \begin{macrocode} + \setglossarystyle{altlong4col-booktabs}% +% \end{macrocode} +% Adjust the column specification. +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{longtable}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{macro}{\glsLTpenaltycheck} +%\changes{4.21}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\glsLTpenaltycheck}{% + \ifnum\outputpenalty=-50\vskip-\normalbaselineskip\relax\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspenaltygroupskip} +%\changes{4.21}{2016-01-24}{new} +% \begin{macrocode} +\newcommand{\glspenaltygroupskip}{% + \noalign{\penalty-50\vskip\normalbaselineskip}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsrestoreLToutput} +% Provide a way of restoring \cs{LT@output} for the user. +% \begin{macrocode} +\let\@gls@org@LT@output\LT@output +\newcommand*{\glsrestoreLToutput}{\let\LT@output\@gls@org@LT@output} +% \end{macrocode} +%\end{macro} +% +% This is David's patch, but I've replaced the hard-coded values +% with \cs{glsLTpenaltycheck} to make it easier to adjust. +%\begin{macro}{\glspatchLToutput} +%\changes{4.21}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\glspatchLToutput}{% + \renewcommand*{\LT@output}{% + \ifnum\outputpenalty <-\@Mi + \ifnum\outputpenalty > -\LT@end@pen + \LT@err{floats and marginpars not allowed in a longtable}\@ehc + \else + \setbox\z@\vbox{\unvbox\@cclv}% + \ifdim \ht\LT@lastfoot>\ht\LT@foot + \dimen@\pagegoal + \advance\dimen@-\ht\LT@lastfoot + \ifdim\dimen@<\ht\z@ + \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}% + \@makecol + \@outputpage + \setbox\z@\vbox{\box\LT@head\glsLTpenaltycheck}% + \fi + \fi + \global\@colroom\@colht + \global\vsize\@colht + {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}% + \fi + \else + \setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}% + \@makecol + \@outputpage + \global\vsize\@colroom + \copy\LT@head + \glsLTpenaltycheck + \nobreak + \fi + }% +} +% \end{macrocode} +%\end{macro} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-longragged.sty> +% \end{macrocode} +%\fi +% \section{Glossary Styles using longtable (the glossary-longragged +% package)} +% The glossary styles defined in the \isty{glossary-longragged} package +% used the \env{longtable} environment in the glossary and use +% ragged right formatting for the multiline columns. +% \begin{macrocode} +\ProvidesPackage{glossary-longragged}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Requires the \isty{array} package: +% \begin{macrocode} +\RequirePackage{array} +% \end{macrocode} +% Requires the \isty{longtable} package: +% \begin{macrocode} +\RequirePackage{longtable} +% \end{macrocode} +%\begin{macro}{\glsdescwidth} +% This is a length that governs the width of the description column. +% This may have already been defined. +% \begin{macrocode} +\@ifundefined{glsdescwidth}{% + \newlength\glsdescwidth + \setlength{\glsdescwidth}{0.6\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspagelistwidth} +% This is a length that governs the width of the page list column. +% This may already have been defined. +% \begin{macrocode} +\@ifundefined{glspagelistwidth}{% + \newlength\glspagelistwidth + \setlength{\glspagelistwidth}{0.1\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{longragged} +% The \glostyle{longragged} glossary style is like the +% \glostyle{long} but uses ragged right formatting for the +% description column. +% \begin{macrocode} +\newglossarystyle{longragged}{% +% \end{macrocode} +% Use \env{longtable} with two columns: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}}}% + {\end{longtable}}% +% \end{macrocode} +% Do nothing at the start of the environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No heading between groups: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries displayed in a row: +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription\space ##2% + \tabularnewline + }% +% \end{macrocode} +% Sub entries displayed on the following row without the name: +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}% + \glspostdescription\space ##3% + \tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longraggedborder} +% The \glostyle{longraggedborder} style is like the above, but with horizontal and +% vertical lines: +% \begin{macrocode} +\newglossarystyle{longraggedborder}{% +% \end{macrocode} +% Base it on the glostyle{longragged} style: +% \begin{macrocode} + \setglossarystyle{longragged}% +% \end{macrocode} +% Use \env{longtable} with two columns with vertical lines +% between each column: +% \begin{macrocode} + \renewenvironment{theglossary}{% + \begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|}}% + {\end{longtable}}% +% \end{macrocode} +% Place horizontal lines at the head and foot of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longraggedheader} +% The \glostyle{longraggedheader} style is like the +% \glostyle{longragged} style but with a header: +% \begin{macrocode} +\newglossarystyle{longraggedheader}{% +% \end{macrocode} +% Base it on the glostyle{longragged} style: +% \begin{macrocode} + \setglossarystyle{longragged}% +% \end{macrocode} +% Set the table's header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \bfseries \entryname & \bfseries \descriptionname + \tabularnewline\endhead}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longraggedheaderborder} +% The \glostyle{longraggedheaderborder} style is +% like the \glostyle{longragged} style but with a header and border: +% \begin{macrocode} +\newglossarystyle{longraggedheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{longraggedborder} style: +% \begin{macrocode} + \setglossarystyle{longraggedborder}% +% \end{macrocode} +% Set the table's header and add horizontal line to table's foot: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \hline\bfseries \entryname & \bfseries \descriptionname + \tabularnewline\hline + \endhead + \hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longragged3col} +% The \glostyle{longragged3col} style is like \glostyle{longragged} but with 3 columns +% \begin{macrocode} +\newglossarystyle{longragged3col}{% +% \end{macrocode} +% Use a \env{longtable} with 3 columns: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{longtable}}% +% \end{macrocode} +% No table header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No headings between groups: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a row (name in first column, +% description in second column, page list in last column): +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & ##2\tabularnewline + }% +% \end{macrocode} +% Sub-entries on a separate row (no name, description in +% second column, page list in third column): +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longragged3colborder} +% The \glostyle{longragged3colborder} style is like the +% \glostyle{longragged3col} style but with a border: +% \begin{macrocode} +\newglossarystyle{longragged3colborder}{% +% \end{macrocode} +% Base it on the glostyle{longragged3col} style: +% \begin{macrocode} + \setglossarystyle{longragged3col}% +% \end{macrocode} +% Use a \env{longtable} with 3 columns with vertical lines +% around them: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|% + >{\raggedright}p{\glspagelistwidth}|}}% + {\end{longtable}}% +% \end{macrocode} +% Place horizontal lines at the head and foot of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longragged3colheader} +% The \glostyle{longragged3colheader} style is like \glostyle{longragged3col} but with a header row: +% \begin{macrocode} +\newglossarystyle{longragged3colheader}{% +% \end{macrocode} +% Base it on the glostyle{longragged3col} style: +% \begin{macrocode} + \setglossarystyle{longragged3col}% +% \end{macrocode} +% Set the table's header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline\endhead}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{longragged3colheaderborder} +% The \glostyle{longragged3colheaderborder} style is like the above but with a border +% \begin{macrocode} +\newglossarystyle{longragged3colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{longragged3colborder} style: +% \begin{macrocode} + \setglossarystyle{longragged3colborder}% +% \end{macrocode} +% Set the table's header and add horizontal line at table's foot: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \hline + \bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline\hline\endhead + \hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlongragged4col} +% The \glostyle{altlongragged4col} style is like the \glostyle{altlong4col} +% style defined in the \isty{glossary-long} package, except that +% ragged right formatting is used for the description and page list +% columns. +% \begin{macrocode} +\newglossarystyle{altlongragged4col}{% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{longtable}}% +% \end{macrocode} +% No table header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a single row (name in first column, +% description in second column, symbol in third column, page list +% in last column): +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +%\changes{4.08}{2014-07-30}{fixed bug that displayed description instead of +%symbol} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & \glossentrysymbol{##1} & + ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries on a single row with no name (description in second +% column, symbol in third column, page list in last column): +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{ & & & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlongragged4colheader} +% The \glostyle{altlongragged4colheader} style is like +% \glostyle{altlongragged4col} but with a header row. +% \begin{macrocode} +\newglossarystyle{altlongragged4colheader}{% +% \end{macrocode} +% Base it on the glostyle{altlongragged4col} style: +% \begin{macrocode} + \setglossarystyle{altlongragged4col}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{l>{\raggedright}p{\glsdescwidth}l% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{longtable}}% +% \end{macrocode} +% Table has a header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \bfseries\entryname&\bfseries\descriptionname& + \bfseries \symbolname& + \bfseries\pagelistname\tabularnewline\endhead}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlongragged4colborder} +% The \glostyle{altlongragged4colborder} style is like +% \glostyle{altlongragged4col} but with a border. +% \begin{macrocode} +\newglossarystyle{altlongragged4colborder}{% +% \end{macrocode} +% Base it on the glostyle{altlongragged4col} style: +% \begin{macrocode} + \setglossarystyle{altlongragged4col}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|l|% + >{\raggedright}p{\glspagelistwidth}|}}% + {\end{longtable}}% +% \end{macrocode} +% Add horizontal lines to the head and foot of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{\hline\endhead\hline\endfoot}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altlongragged4colheaderborder} +% The \glostyle{altlongragged4colheaderborder} style is like the above but +% with a header as well as a border. +% \begin{macrocode} +\newglossarystyle{altlongragged4colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{altlongragged4col} style: +% \begin{macrocode} + \setglossarystyle{altlongragged4col}% +% \end{macrocode} +% Use a \env{longtable} with 4 columns where the second and +% last columns may have multiple lines in each row: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\begin{longtable}{|l|>{\raggedright}p{\glsdescwidth}|l|% + >{\raggedright}p{\glspagelistwidth}|}}% + {\end{longtable}}% +% \end{macrocode} +% Add table header and horizontal line at the table's foot: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \hline\bfseries\entryname&\bfseries\descriptionname& + \bfseries \symbolname& + \bfseries\pagelistname\tabularnewline\hline\endhead + \hline\endfoot}% +} +% \end{macrocode} +%\end{style} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-mcols.sty> +% \end{macrocode} +%\fi +%\section{Glossary Styles using \styfmt{multicol} +%(glossary-mcols.sty)} +%The \isty{glossary-mcols} style file defines glossary styles that +%use the \sty{multicol} package. These use the tree-like glossary +%styles in a multicol environment. +% \begin{macrocode} +\ProvidesPackage{glossary-mcols}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Required packages: +% \begin{macrocode} +\RequirePackage{multicol} +\RequirePackage{glossary-tree} +% \end{macrocode} +% +%\begin{macro}{\indexspace} +%\changes{4.13}{2015-02-03}{new} +% The are a few classes that don't define \cs{indexspace}, so +% provide a definition if it hasn't been defined. +% \begin{macrocode} +\providecommand{\indexspace}{% + \par \vskip 10\p@ \@plus 5\p@ \@minus 3\p@ \relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsmcols} +% Define macro in which to store the number of columns. (Defaults to +% 2.) +% \begin{macrocode} +\newcommand*{\glsmcols}{2} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{mcolindex} +% Multi-column index style. Same as the \glostyle{index}, but puts the +% glossary in multiple columns. (Ideally the glossary title should go in the +% optional argument of \env{multicols}, but the title isn't part of +% the glossary style.) +% \begin{macrocode} +\newglossarystyle{mcolindex}{% + \setglossarystyle{index}% + \renewenvironment{theglossary}% + {% +% \end{macrocode} +%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}} +% \begin{macrocode} + \begin{multicols}{\glsmcols} + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% +% \end{macrocode} +%\changes{4.26}{2016-10-12}{replaced \cs{@idxitem} with +%\cs{glstreeitem}} +% \begin{macrocode} + \let\item\glstreeitem + \let\subitem\glstreesubitem + \let\subsubitem\glstreesubsubitem + }% + {\end{multicols}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcolindexgroup} +% As \glostyle{mcolindex} but has headings: +% \begin{macrocode} +\newglossarystyle{mcolindexgroup}{% + \setglossarystyle{mcolindex}% + \renewcommand*{\glsgroupheading}[1]{% + \item\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcolindexhypergroup} +% The \glostyle{mcolindexhypergroup} style is like the +% \glostyle{mcolindexgroup} style but has hyper navigation. +% \begin{macrocode} +\newglossarystyle{mcolindexhypergroup}{% +% \end{macrocode} +% Base it on the glostyle{mcolindex} style: +% \begin{macrocode} + \setglossarystyle{mcolindex}% +% \end{macrocode} +% Put navigation links to the groups at the start of the glossary: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \item\glstreenavigationfmt{\glsnavigation}\indexspace}% +% \end{macrocode} +% Add a heading for each group (with a target). The group's title is +% in bold followed by a vertical gap. +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item\glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}% + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcolindexspannav} +%\changes{4.22}{2016-04-19}{new} +% Similar to \glostyle{mcolindexhypergroup}, but puts the navigation +% line +% in the optional argument of \env{multicols}. +% \begin{macrocode} +\newglossarystyle{mcolindexspannav}{% + \setglossarystyle{index}% + \renewenvironment{theglossary}% + {% +% \end{macrocode} +%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}} +% \begin{macrocode} + \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}] + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% +% \end{macrocode} +%\changes{4.26}{2016-10-12}{replaced \cs{@idxitem} with +%\cs{glstreeitem}} +% \begin{macrocode} + \let\item\glstreeitem}% + {\end{multicols}}% +% \end{macrocode} +% Add a heading for each group (with a target). The group's title is +% in bold followed by a vertical gap. +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item\glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}% + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltree} +% Multi-column index style. Same as the \glostyle{tree}, but puts the +% glossary in multiple columns. +% \begin{macrocode} +\newglossarystyle{mcoltree}{% + \setglossarystyle{tree}% + \renewenvironment{theglossary}% + {% +% \end{macrocode} +%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}} +% \begin{macrocode} + \begin{multicols}{\glsmcols} + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + }% + {\end{multicols}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltreegroup} +% Like the \glostyle{mcoltree} style but the glossary groups have +% headings. +% \begin{macrocode} +\newglossarystyle{mcoltreegroup}{% +% \end{macrocode} +% Base it on the glostyle{mcoltree} style: +% \begin{macrocode} + \setglossarystyle{mcoltree}% +% \end{macrocode} +% Each group has a heading (in bold) followed by a vertical gap): +% \begin{macrocode} + \renewcommand{\glsgroupheading}[1]{\par + \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par\indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltreehypergroup} +% The \glostyle{mcoltreehypergroup} style is like the +% \glostyle{treegroup} +% style, but has a set of links to the groups at the +% start of the glossary. +% \begin{macrocode} +\newglossarystyle{mcoltreehypergroup}{% +% \end{macrocode} +% Base it on the glostyle{mcoltree} style: +% \begin{macrocode} + \setglossarystyle{mcoltree}% +% \end{macrocode} +% Put navigation links to the groups at the start of the +% \env{theglossary} environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}% +% \end{macrocode} +% Each group has a heading (in bold with a target) followed by a +% vertical gap): +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltreespannav} +%\changes{4.22}{2016-04-19}{new} +% Similar to the \glostyle{mcoltreehypergroup} style but the +% navigation line is put in the optional argument of the +% \env{multicols} environment. +% \begin{macrocode} +\newglossarystyle{mcoltreespannav}{% + \setglossarystyle{tree}% + \renewenvironment{theglossary}% + {% +% \end{macrocode} +%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}} +% \begin{macrocode} + \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}] + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + }% + {\end{multicols}}% +% \end{macrocode} +% Each group has a heading (in bold with a target) followed by a +% vertical gap): +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltreenoname} +% Multi-column index style. Same as the \glostyle{treenoname}, but puts the +% glossary in multiple columns. +% \begin{macrocode} +\newglossarystyle{mcoltreenoname}{% + \setglossarystyle{treenoname}% + \renewenvironment{theglossary}% + {% +% \end{macrocode} +%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}} +% \begin{macrocode} + \begin{multicols}{\glsmcols} + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + }% + {\end{multicols}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltreenonamegroup} +% Like the \glostyle{mcoltreenoname} style but the glossary groups have +% headings. +% \begin{macrocode} +\newglossarystyle{mcoltreenonamegroup}{% +% \end{macrocode} +% Base it on the glostyle{mcoltreenoname} style: +% \begin{macrocode} + \setglossarystyle{mcoltreenoname}% +% \end{macrocode} +% Give each group a heading: +% \begin{macrocode} + \renewcommand{\glsgroupheading}[1]{\par + \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par\indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltreenonamehypergroup} +% The \glostyle{mcoltreenonamehypergroup} style is like the +% \glostyle{mcoltreenonamegroup} +% style, but has a set of links to the groups at the +% start of the glossary. +% \begin{macrocode} +\newglossarystyle{mcoltreenonamehypergroup}{% +% \end{macrocode} +% Base it on the glostyle{mcoltreenoname} style: +% \begin{macrocode} + \setglossarystyle{mcoltreenoname}% +% \end{macrocode} +% Put navigation links to the groups at the start of the +% \env{theglossary} environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}% +% \end{macrocode} +% Each group has a heading (in bold with a target) followed by a +% vertical gap): +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcoltreenonamespannav} +%\changes{4.22}{2016-04-19}{new} +% Similar to the \glostyle{mcoltreenonamehypergroup} style but the +% navigation line is put in the optional argument of the +% \env{multicols} environment. +% \begin{macrocode} +\newglossarystyle{mcoltreenonamespannav}{% + \setglossarystyle{treenoname}% + \renewenvironment{theglossary}% + {% + \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}] + \setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + }% + {\end{multicols}}% +% \end{macrocode} +% Each group has a heading (in bold with a target) followed by a +% vertical gap): +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par\noindent + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcolalttree} +% Multi-column index style. Same as the \glostyle{alttree}, but puts the +% glossary in multiple columns. +% \begin{macrocode} +\newglossarystyle{mcolalttree}{% + \setglossarystyle{alttree}% + \renewenvironment{theglossary}% + {% +% \end{macrocode} +%\changes{3.05}{2013-04-21}{replaced `2' with \cs{glsmcols}} +% \begin{macrocode} + \begin{multicols}{\glsmcols} + \def\@gls@prevlevel{-1}% + \mbox{}\par + }% + {\par\end{multicols}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcolalttreegroup} +% Like the \glostyle{mcolalttree} style but the glossary groups have +% headings. +% \begin{macrocode} +\newglossarystyle{mcolalttreegroup}{% +% \end{macrocode} +% Base it on the glostyle{mcolalttree} style: +% \begin{macrocode} + \setglossarystyle{mcolalttree}% +% \end{macrocode} +% Give each group a heading. +% \begin{macrocode} + \renewcommand{\glsgroupheading}[1]{\par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par\indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcolalttreehypergroup} +% The \glostyle{mcolalttreehypergroup} style is like the +% \glostyle{mcolalttreegroup} style, but has a set of links to the +% groups at the start of the glossary. +% \begin{macrocode} +\newglossarystyle{mcolalttreehypergroup}{% +% \end{macrocode} +% Base it on the glostyle{mcolalttree} style: +% \begin{macrocode} + \setglossarystyle{mcolalttree}% +% \end{macrocode} +% Put the navigation links in the header +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreenavigationfmt{\glsnavigation}\par\indexspace}% +% \end{macrocode} +% Put a hypertarget at the start of each group +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{mcolalttreespannav} +%\changes{4.22}{2016-04-19}{new} +% Similar to the \glostyle{mcolalttreehypergroup} style but the +% navigation line is put in the optional argument of the +% \env{multicols} environment. +% \begin{macrocode} +\newglossarystyle{mcolalttreespannav}{% + \setglossarystyle{alttree}% + \renewenvironment{theglossary}% + {% + \begin{multicols}{\glsmcols}[\noindent\glstreenavigationfmt{\glsnavigation}] + \def\@gls@prevlevel{-1}% + \mbox{}\par + }% + {\par\end{multicols}}% +% \end{macrocode} +% Put a hypertarget at the start of each group +%\changes{4.34}{2017-11-03}{removed spurious space} +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% + +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-super.sty> +% \end{macrocode} +%\fi +% \section{Glossary Styles using supertabular environment (glossary-super package)} +% The glossary styles defined in the \isty{glossary-super} package +% use the \env{supertabular} environment. +% \begin{macrocode} +\ProvidesPackage{glossary-super}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Requires the \isty{supertabular} package: +% \begin{macrocode} +\RequirePackage{supertabular} +% \end{macrocode} +%\begin{macro}{\glsdescwidth} +% This is a length that governs the width of the description column. +% This may already have been defined if \isty{glossary-long} +% has been loaded.\changes{2.01}{2009 May 30}{changed \cs{linewidth} +% to \cs{hsize}} +% \begin{macrocode} +\@ifundefined{glsdescwidth}{% + \newlength\glsdescwidth + \setlength{\glsdescwidth}{0.6\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspagelistwidth} +% This is a length that governs the width of the page list column. +% This may already have been defined if \isty{glossary-long} +% has been loaded.\changes{2.01}{2009 May 30}{changed \cs{linewidth} +% to \cs{hsize}} +% \begin{macrocode} +\@ifundefined{glspagelistwidth}{% + \newlength\glspagelistwidth + \setlength{\glspagelistwidth}{0.1\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{super} +% The \glostyle{super} glossary style uses the +% \env{supertabular} environment +% (it uses lengths defined in the \isty{glossary-long} package.) +% \begin{macrocode} +\newglossarystyle{super}{% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns and no head or tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}}}% + {\end{supertabular}}% +% \end{macrocode} +% Do nothing at the start of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries put in a row (name in first column, +% description and page list in second column): +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries put in a row (no name, description and page list +% in second column): +%\changes{4.0}{2013-11-14}{fixed typo in \cs{subglossentry} (\cs{glossentrydesc})} +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space + ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superborder} +% The \glostyle{superborder} style is like the above, but with +% horizontal and vertical lines: +% \begin{macrocode} +\newglossarystyle{superborder}{% +% \end{macrocode} +% Base it on the glostyle{super} style: +% \begin{macrocode} + \setglossarystyle{super}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns and a horizontal line in the head and tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline}\tabletail{\hline}% + \begin{supertabular}{|l|p{\glsdescwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superheader} +% The \glostyle{superheader} style is like the +% \glostyle{super} style, but with a header: +% \begin{macrocode} +\newglossarystyle{superheader}{% +% \end{macrocode} +% Base it on the glostyle{super} style: +% \begin{macrocode} + \setglossarystyle{super}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns, a header and no tail: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} +\renewenvironment{theglossary}% + {\tablehead{\bfseries \entryname & + \bfseries\descriptionname\tabularnewline}% + \tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superheaderborder} +% The \glostyle{superheaderborder} style is like +% the \glostyle{super} style but with a header and border: +% \begin{macrocode} +\newglossarystyle{superheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{super} style: +% \begin{macrocode} + \setglossarystyle{super}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns, a header and horizontal lines above and below the +% table: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline\bfseries \entryname & + \bfseries \descriptionname\tabularnewline\hline}% + \tabletail{\hline} + \begin{supertabular}{|l|p{\glsdescwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super3col} +% The \glostyle{super3col} style is like the \glostyle{super} +% style, but with 3 columns: +% \begin{macrocode} +\newglossarystyle{super3col}{% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns and no head or tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}% + {\end{supertabular}}% +% \end{macrocode} +% Do nothing at the start of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a row (name in first column, +% description in second column, page list in last column): +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries on a row (no name, description in second column, +% page list in last column): +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super3colborder} +% The \glostyle{super3colborder} style is like the +% \glostyle{super3col} style, but with a border: +% \begin{macrocode} +\newglossarystyle{super3colborder}{% +% \end{macrocode} +% Base it on the glostyle{super3col} style: +% \begin{macrocode} + \setglossarystyle{super3col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns and a horizontal line in the head and tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline}\tabletail{\hline}% + \begin{supertabular}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super3colheader} +% The \glostyle{super3colheader} style is like +% the \glostyle{super3col} style but with a header row: +% \begin{macrocode} +\newglossarystyle{super3colheader}{% +% \end{macrocode} +% Base it on the glostyle{super3col} style: +% \begin{macrocode} + \setglossarystyle{super3col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns, a header and no tail: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline}\tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}p{\glspagelistwidth}}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super3colheaderborder} +% The \glostyle{super3colheaderborder} style is like +% the \glostyle{super3col} style but with a header and border: +% \begin{macrocode} +\newglossarystyle{super3colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{super3colborder} style: +% \begin{macrocode} + \setglossarystyle{super3colborder}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns, a header with horizontal lines and a horizontal +% line in the tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline + \bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline\hline}% + \tabletail{\hline}% + \begin{supertabular}{|l|p{\glsdescwidth}|p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super4col} +% The \glostyle{super4col} glossary style has four columns, +% where the third column contains the value of the +% corresponding \gloskey{symbol} key used when that entry +% was defined. +% \begin{macrocode} +\newglossarystyle{super4col}{% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and no head or tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{llll}}{% + \end{supertabular}}% +% \end{macrocode} +% Do nothing at the start of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a row with the name in the first +% column, description in second column, symbol in third column +% and page list in last column: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +%\changes{4.22}{2016-04-19}{fixed bug in \cs{glossentry}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & + \glossentrysymbol{##1} & ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries on a row with no name, the description in the second +% column, symbol in third column and page list in last column: +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super4colheader} +% The \glostyle{super4colheader} style is like +% the \glostyle{super4col} but with a header row. +% \begin{macrocode} +\newglossarystyle{super4colheader}{% +% \end{macrocode} +% Base it on the glostyle{super4col} style: +% \begin{macrocode} + \setglossarystyle{super4col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns, a header and no tail: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\bfseries\entryname&\bfseries\descriptionname& + \bfseries\symbolname & + \bfseries\pagelistname\tabularnewline}% + \tabletail{}% + \begin{supertabular}{llll}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super4colborder} +% The \glostyle{super4colborder} style is like +% the \glostyle{super4col} but with a border. +% \begin{macrocode} +\newglossarystyle{super4colborder}{% +% \end{macrocode} +% Base it on the glostyle{super4col} style: +% \begin{macrocode} + \setglossarystyle{super4col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and a horizontal line in the head and tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline}\tabletail{\hline}% + \begin{supertabular}{|l|l|l|l|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{super4colheaderborder} +% The \glostyle{super4colheaderborder} style is like +% the \glostyle{super4col} but with a header and border. +% \begin{macrocode} +\newglossarystyle{super4colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{super4col} style: +% \begin{macrocode} + \setglossarystyle{super4col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and a header bordered by horizontal lines and +% a horizontal line in the tail: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline\bfseries\entryname&\bfseries\descriptionname& + \bfseries\symbolname & + \bfseries\pagelistname\tabularnewline\hline}% + \tabletail{\hline}% + \begin{supertabular}{|l|l|l|l|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuper4col} +% The \glostyle{altsuper4col} glossary style is like +% \glostyle{super4col} but has provision for multiline descriptions. +% \begin{macrocode} +\newglossarystyle{altsuper4col}{% +% \end{macrocode} +% Base it on the glostyle{super4col} style: +% \begin{macrocode} + \setglossarystyle{super4col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and no head or tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}lp{\glspagelistwidth}}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuper4colheader} +% The \glostyle{altsuper4colheader} style is like +% the \glostyle{altsuper4col} but with a header row. +% \begin{macrocode} +\newglossarystyle{altsuper4colheader}{% +% \end{macrocode} +% Base it on the glostyle{super4colheader} style: +% \begin{macrocode} + \setglossarystyle{super4colheader}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns, a header and no tail: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\bfseries\entryname&\bfseries\descriptionname& + \bfseries\symbolname & + \bfseries\pagelistname\tabularnewline}\tabletail{}% + \begin{supertabular}{lp{\glsdescwidth}lp{\glspagelistwidth}}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuper4colborder} +% The \glostyle{altsuper4colborder} style is like +% the \glostyle{altsuper4col} but with a border. +% \begin{macrocode} +\newglossarystyle{altsuper4colborder}{% +% \end{macrocode} +% Base it on the glostyle{super4colborder} style: +% \begin{macrocode} + \setglossarystyle{super4colborder}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and a horizontal line in the head and tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline}\tabletail{\hline}% + \begin{supertabular}% + {|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuper4colheaderborder} +% The \glostyle{altsuper4colheaderborder} style is like +% the \glostyle{altsuper4col} but with a header and border. +% \begin{macrocode} +\newglossarystyle{altsuper4colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{super4colheaderborder} style: +% \begin{macrocode} + \setglossarystyle{super4colheaderborder}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and a header bordered by horizontal lines and +% a horizontal line in the tail: +%\changes{3.13a}{2013-11-05}{switched to \cs{tabularnewline}} +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline + \bfseries\entryname & + \bfseries\descriptionname & + \bfseries\symbolname & + \bfseries\pagelistname\tabularnewline\hline}% + \tabletail{\hline}% + \begin{supertabular}% + {|l|p{\glsdescwidth}|l|p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-superragged.sty> +% \end{macrocode} +%\fi +% \section{Glossary Styles using supertabular environment (glossary-superragged package)} +% The glossary styles defined in the \isty{glossary-superragged} +% package use the \env{supertabular} environment. These styles +% are like those provided by the \isty{glossary-super} package, +% except that the multiline columns have ragged right justification. +% \begin{macrocode} +\ProvidesPackage{glossary-superragged}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Requires the \isty{array} package: +% \begin{macrocode} +\RequirePackage{array} +% \end{macrocode} +% Requires the \isty{supertabular} package: +% \begin{macrocode} +\RequirePackage{supertabular} +% \end{macrocode} +%\begin{macro}{\glsdescwidth} +% This is a length that governs the width of the description column. +% This may already have been defined. +% \begin{macrocode} +\@ifundefined{glsdescwidth}{% + \newlength\glsdescwidth + \setlength{\glsdescwidth}{0.6\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspagelistwidth} +% This is a length that governs the width of the page list column. +% This may already have been defined. +% \begin{macrocode} +\@ifundefined{glspagelistwidth}{% + \newlength\glspagelistwidth + \setlength{\glspagelistwidth}{0.1\hsize} +}{} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{superragged} +% The \glostyle{superragged} glossary style uses the +% \env{supertabular} environment. +% \begin{macrocode} +\newglossarystyle{superragged}{% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns and no head or tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}% + {\end{supertabular}}% +% \end{macrocode} +% Do nothing at the start of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries put in a row (name in first column, +% description and page list in second column): +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription\space ##2% + \tabularnewline + }% +% \end{macrocode} +% Sub entries put in a row (no name, description and page list +% in second column): +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2}\glspostdescription\space + ##3% + \tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superraggedborder} +% The \glostyle{superraggedborder} style is like the above, but with +% horizontal and vertical lines: +% \begin{macrocode} +\newglossarystyle{superraggedborder}{% +% \end{macrocode} +% Base it on the glostyle{superragged} style: +% \begin{macrocode} + \setglossarystyle{superragged}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns and a horizontal line in the head and tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline}\tabletail{\hline}% + \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superraggedheader} +% The \glostyle{superraggedheader} style is like the +% \glostyle{super} style, but with a header: +% \begin{macrocode} +\newglossarystyle{superraggedheader}{% +% \end{macrocode} +% Base it on the glostyle{superragged} style: +% \begin{macrocode} + \setglossarystyle{superragged}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns, a header and no tail: +% \begin{macrocode} +\renewenvironment{theglossary}% + {\tablehead{\bfseries \entryname & \bfseries \descriptionname + \tabularnewline}% + \tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superraggedheaderborder} +% The \glostyle{superraggedheaderborder} style is like +% the \glostyle{superragged} style but with a header and border: +% \begin{macrocode} +\newglossarystyle{superraggedheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{super} style: +% \begin{macrocode} + \setglossarystyle{superragged}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% two columns, a header and horizontal lines above and below the +% table: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline\bfseries \entryname & + \bfseries \descriptionname\tabularnewline\hline}% + \tabletail{\hline} + \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superragged3col} +% The \glostyle{superragged3col} style is like the \glostyle{superragged} +% style, but with 3 columns: +% \begin{macrocode} +\newglossarystyle{superragged3col}{% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns and no head or tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{supertabular}}% +% \end{macrocode} +% Do nothing at the start of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a row (name in first column, +% description in second column, page list in last column): +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & + ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries on a row (no name, description in second column, +% page list in last column): +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superragged3colborder} +% The \glostyle{superragged3colborder} style is like the +% \glostyle{superragged3col} style, but with a border: +% \begin{macrocode} +\newglossarystyle{superragged3colborder}{% +% \end{macrocode} +% Base it on the glostyle{superragged3col} style: +% \begin{macrocode} + \setglossarystyle{superragged3col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns and a horizontal line in the head and tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline}\tabletail{\hline}% + \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|% + >{\raggedright}p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superragged3colheader} +% The \glostyle{superragged3colheader} style is like +% the \glostyle{superragged3col} style but with a header row: +% \begin{macrocode} +\newglossarystyle{superragged3colheader}{% +% \end{macrocode} +% Base it on the glostyle{superragged3col} style: +% \begin{macrocode} + \setglossarystyle{superragged3col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns, a header and no tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{superraggedright3colheaderborder} +% The \glostyle{superragged3colheaderborder} style is like +% the \glostyle{superragged3col} style but with a header and border: +% \begin{macrocode} +\newglossarystyle{superragged3colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{superragged3colborder} style: +% \begin{macrocode} + \setglossarystyle{superragged3colborder}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% three columns, a header with horizontal lines and a horizontal +% line in the tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline + \bfseries\entryname&\bfseries\descriptionname& + \bfseries\pagelistname\tabularnewline\hline}% + \tabletail{\hline}% + \begin{supertabular}{|l|>{\raggedright}p{\glsdescwidth}|% + >{\raggedright}p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuperragged4col} +% The \glostyle{altsuperragged4col} glossary style is like +% \glostyle{altsuper4col} style in the \isty{glossary-super} +% package but uses ragged right formatting in the description +% and page list columns. +% \begin{macrocode} +\newglossarystyle{altsuperragged4col}{% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and no head or tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{supertabular}}% +% \end{macrocode} +% Do nothing at the start of the table: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries on a row with the name in the first +% column, description in second column, symbol in third column +% and page list in last column: +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1} & + \glossentrysymbol{##1} & ##2\tabularnewline + }% +% \end{macrocode} +% Sub entries on a row with no name, the description in the second +% column, symbol in third column and page list in last column: +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}\glossentrydesc{##2} & + \glossentrysymbol{##2} & ##3\tabularnewline + }% +% \end{macrocode} +% Blank row between groups: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +%\changes{4.23}{2016-04-30}{check for nogroupskip changed} +%The check for \pkgopt{nogroupskip} must occur outside +%\cs{glsgroupskip} +%(\url{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=108}) +% \begin{macrocode} + \ifglsnogroupskip + \renewcommand*{\glsgroupskip}{}% + \else + \renewcommand*{\glsgroupskip}{& & & \tabularnewline}% + \fi +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuperragged4colheader} +% The \glostyle{altsuperragged4colheader} style is like +% the \glostyle{altsuperragged4col} style but with a header row. +% \begin{macrocode} +\newglossarystyle{altsuperragged4colheader}{% +% \end{macrocode} +% Base it on the glostyle{altsuperragged4col} style: +% \begin{macrocode} + \setglossarystyle{altsuperragged4col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns, a header and no tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\bfseries\entryname&\bfseries\descriptionname& + \bfseries\symbolname & + \bfseries\pagelistname\tabularnewline}\tabletail{}% + \begin{supertabular}{l>{\raggedright}p{\glsdescwidth}l% + >{\raggedright}p{\glspagelistwidth}}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuperragged4colborder} +% The \glostyle{altsuperragged4colborder} style is like +% the \glostyle{altsuperragged4col} style but with a border. +% \begin{macrocode} +\newglossarystyle{altsuperragged4colborder}{% +% \end{macrocode} +% Base it on the glostyle{altsuperragged4col} style: +% \begin{macrocode} + \setglossarystyle{altsuper4col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and a horizontal line in the head and tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline}\tabletail{\hline}% + \begin{supertabular}% + {|l|>{\raggedright}p{\glsdescwidth}|l|% + >{\raggedright}p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{altsuperragged4colheaderborder} +% The \glostyle{altsuperragged4colheaderborder} style is like +% the \glostyle{altsuperragged4col} style but with a header and border. +% \begin{macrocode} +\newglossarystyle{altsuperragged4colheaderborder}{% +% \end{macrocode} +% Base it on the glostyle{altsuperragged4col} style: +% \begin{macrocode} + \setglossarystyle{altsuperragged4col}% +% \end{macrocode} +% Put the glossary in a \env{supertabular} environment with +% four columns and a header bordered by horizontal lines and +% a horizontal line in the tail: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\tablehead{\hline + \bfseries\entryname & + \bfseries\descriptionname & + \bfseries\symbolname & + \bfseries\pagelistname\tabularnewline\hline}% + \tabletail{\hline}% + \begin{supertabular}% + {|l|>{\raggedright}p{\glsdescwidth}|l|% + >{\raggedright}p{\glspagelistwidth}|}}% + {\end{supertabular}}% +} +% \end{macrocode} +%\end{style} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-tree.sty> +% \end{macrocode} +%\fi +%\section{Tree Styles (glossary-tree.sty)} +% The \isty{glossary-tree} style file defines glossary styles +% that have a tree-like structure. These are designed for +% hierarchical glossaries. +% \begin{macrocode} +\ProvidesPackage{glossary-tree}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% +%\begin{macro}{\indexspace} +%\changes{4.13}{2015-02-03}{new} +% There are a few classes that don't define \cs{indexspace}, so +% provide a definition if it hasn't been defined. +% \begin{macrocode} +\providecommand{\indexspace}{% + \par \vskip 10\p@ \@plus 5\p@ \@minus 3\p@ \relax +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstreenamefmt} +%\changes{4.08}{2014-07-30}{new} +% Format used to display the name in the tree styles. (This may be +% counteracted by \ics{glsnamefont}.) This command was previously also used to +% format the group headings. +% \begin{macrocode} +\newcommand*{\glstreenamefmt}[1]{\textbf{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstreegroupheaderfmt} +%\changes{4.22}{2016-04-19}{new} +% Format used to display the group header in the tree styles. +% Before v4.22, \cs{glstreenamefmt} was used for the group header, +% so the default definition uses that to help maintain +% backward-compatibility, since in previous versions redefining +% \cs{glstreenamefmt} would've also affected the group headings. +% \begin{macrocode} +\newcommand*{\glstreegroupheaderfmt}[1]{\glstreenamefmt{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstreenavigationfmt} +%\changes{4.22}{2016-04-19}{new} +% Format used to display the navigation header in the tree styles. +% \begin{macrocode} +\newcommand*{\glstreenavigationfmt}[1]{\glstreenamefmt{#1}} +% \end{macrocode} +%\end{macro} +% +%Allow the user to adjust the \glostyle{index} style without disturbing the index. +%\begin{macro}{\glstreeitem} +%Top level item used in \glostyle{index} style. +%\changes{4.26}{2016-10-12}{new} +% \begin{macrocode} +\ifdef\@idxitem +{\newcommand{\glstreeitem}{\@idxitem}} +{\newcommand{\glstreeitem}{\par\hangindent40\p@}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstreesubitem} +%\changes{4.26}{2016-10-12}{new} +%Level~1 item used in \glostyle{index} style. +% \begin{macrocode} +\ifdef\subitem +{\let\glstreesubitem\subitem} +{\newcommand\glstreesubitem{\glstreeitem\hspace*{20\p@}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstreesubsubitem} +%\changes{4.26}{2016-10-12}{new} +%Level~1 item used in \glostyle{index} style. +% \begin{macrocode} +\ifdef\subsubitem +{\let\glstreesubsubitem\subsubitem} +{\newcommand\glstreesubsubitem{\glstreeitem\hspace*{30\p@}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstreepredesc} +%Allow the user to adjust the space before the description (except +%for the \glostyle{alttree} style). +%\changes{4.26}{2016-10-12}{new} +% \begin{macrocode} +\newcommand{\glstreepredesc}{\space} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstreechildpredesc} +%Allow the user to adjust the space before the description for +%sub-entries (except for the \glostyle{treenoname} and +%\glostyle{alttree} style). +%\changes{4.26}{2016-10-12}{new} +% \begin{macrocode} +\newcommand{\glstreechildpredesc}{\space} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{index} +% The \glostyle{index} glossary style +% is similar in style to the way indices are usually typeset +% using \cs{item}, \cs{subitem} and \cs{subsubitem}. +% The entry name is +% set in bold. If an entry has a symbol, it is placed in +% brackets after the name. Then the description is displayed, +% followed by the number list. This style allows up to three +% levels. +% \begin{macrocode} +\newglossarystyle{index}{% +% \end{macrocode} +% Set the paragraph indentation and skip and define \ics{item} +% to be the same as that used by \env{theindex}: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}% + \let\item\glstreeitem + \let\subitem\glstreesubitem + \let\subsubitem\glstreesubsubitem + }% +% \end{macrocode} +%\changes{3.08a}{2013-09-28}{added paragraph break at end of environment} +% \begin{macrocode} + {\par}% +% \end{macrocode} +% Do nothing at the start of the environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headers: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entry starts a new item with the name in bold +% followed by the symbol in brackets (if it exists), the description +% and the page list. +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +% \begin{macrocode} + \renewcommand*{\glossentry}[2]{% + \item\glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% + \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}% + \glstreepredesc \glossentrydesc{##1}\glspostdescription\space ##2% + }% +% \end{macrocode} +% Sub entries: level 1 entries use \ics{subitem}, levels greater +% than~1 use \ics{subsubitem}. The level ("##1") shouldn't be 0, +% as that's catered by \cs{glossentry}, but for completeness, +% if the level is 0, \ics{item} is used. The name is put in bold, +% followed by the symbol in brackets (if it exists), the description +% and the page list. +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + \ifcase##1\relax + % level 0 + \item + \or + % level 1 + \subitem + \glssubentryitem{##2}% + \else + % all other levels + \subsubitem + \fi + \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}% + \ifglshassymbol{##2}{\space(\glossentrysymbol{##2})}{}% + \glstreechildpredesc\glossentrydesc{##2}\glspostdescription\space ##3% + }% +% \end{macrocode} +% Vertical gap between groups is the same as that used by indices: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +% \begin{macrocode} + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}} +% \end{macrocode} +%\end{style} +% +%\begin{style}{indexgroup} +% The \glostyle{indexgroup} style is like the \glostyle{index} +% style but has headings. +% \begin{macrocode} +\newglossarystyle{indexgroup}{% +% \end{macrocode} +% Base it on the glostyle{index} style: +% \begin{macrocode} + \setglossarystyle{index}% +% \end{macrocode} +% Add a heading for each group. This puts the group's title in +% bold followed by a vertical gap. +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}% + \indexspace + }% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{indexhypergroup} +% The \glostyle{indexhypergroup} style is like the +% \glostyle{indexgroup} style but has hyper navigation. +% \begin{macrocode} +\newglossarystyle{indexhypergroup}{% +% \end{macrocode} +% Base it on the glostyle{index} style: +% \begin{macrocode} + \setglossarystyle{index}% +% \end{macrocode} +% Put navigation links to the groups at the start of the glossary: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \item\glstreenavigationfmt{\glsnavigation}\indexspace}% +% \end{macrocode} +% Add a heading for each group (with a target). The group's title is +% in bold followed by a vertical gap. +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \item\glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}% + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{tree} +% The \glostyle{tree} glossary style +% is similar in style to the \glostyle{index} style, but +% can have arbitrary levels. +% \begin{macrocode} +\newglossarystyle{tree}{% +% \end{macrocode} +% Set the paragraph indentation and skip: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}}% + {}% +% \end{macrocode} +% Do nothing at the start of the \env{theglossary} environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries: name in bold, followed by symbol in +% brackets (if it exists), the description and the page list: +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \hangindent0pt\relax + \parindent0pt\relax + \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% + \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}% + \glstreepredesc\glossentrydesc{##1}\glspostdescription\space##2\par + }% +% \end{macrocode} +% Sub entries: level \meta{n} is indented by \meta{n} times +% \ics{glstreeindent}. The name is in bold, followed by the +% symbol in brackets (if it exists), the description and the +% page list. +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + \hangindent##1\glstreeindent\relax + \parindent##1\glstreeindent\relax + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi + \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}% + \ifglshassymbol{##2}{\space(\glossentrysymbol{##2})}{}% + \glstreechildpredesc\glossentrydesc{##2}\glspostdescription\space ##3\par + }% +% \end{macrocode} +% Vertical gap between groups is the same as that used by +% indices: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +% \begin{macrocode} + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}} +% \end{macrocode} +%\end{style} +% +%\begin{style}{treegroup} +% Like the \glostyle{tree} style but the glossary groups have +% headings. +% \begin{macrocode} +\newglossarystyle{treegroup}{% +% \end{macrocode} +% Base it on the glostyle{tree} style: +% \begin{macrocode} + \setglossarystyle{tree}% +% \end{macrocode} +% Each group has a heading (in bold) followed by a vertical gap): +% \begin{macrocode} + \renewcommand{\glsgroupheading}[1]{\par + \noindent\glstreegroupheaderfmt{\glsgetgrouptitle{##1}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{treehypergroup} +% The \glostyle{treehypergroup} style is like the \glostyle{treegroup} +% style, but has a set of links to the groups at the +% start of the glossary. +% \begin{macrocode} +\newglossarystyle{treehypergroup}{% +% \end{macrocode} +% Base it on the glostyle{tree} style: +% \begin{macrocode} + \setglossarystyle{tree}% +% \end{macrocode} +% Put navigation links to the groups at the start of the +% \env{theglossary} environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}% +% \end{macrocode} +% Each group has a heading (in bold with a target) followed by a +% vertical gap): +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par\noindent + \glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{macro}{\glstreeindent} +% Length governing left indent for each level of the \glostyle{tree} +% style. +% \begin{macrocode} +\newlength\glstreeindent +\setlength{\glstreeindent}{10pt} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{treenoname} +% The \glostyle{treenoname} glossary style +% is like the \glostyle{tree} style, but +% doesn't print the name or symbol for sub-levels. +% \begin{macrocode} +\newglossarystyle{treenoname}{% +% \end{macrocode} +% Set the paragraph indentation and skip: +% \begin{macrocode} + \renewenvironment{theglossary}% + {\setlength{\parindent}{0pt}% + \setlength{\parskip}{0pt plus 0.3pt}}% + {}% +% \end{macrocode} +% No header: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% +% \end{macrocode} +% No group headings: +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Main (level 0) entries: the name is in bold, followed by the +% symbol in brackets (if it exists), the description and the +% page list. +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \hangindent0pt\relax + \parindent0pt\relax + \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}% + \ifglshassymbol{##1}{\space(\glossentrysymbol{##1})}{}% + \glstreepredesc\glossentrydesc{##1}\glspostdescription\space##2\par + }% +% \end{macrocode} +% Sub entries: level \meta{n} is indented by \meta{n} times +% \ics{glstreeindent}. The name and symbol are omitted. The +% description followed by the page list are displayed. +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% + \hangindent##1\glstreeindent\relax + \parindent##1\glstreeindent\relax + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi + \glstarget{##2}{\strut}% + \glossentrydesc{##2}\glspostdescription\space##3\par + }% +% \end{macrocode} +% Vertical gap between groups is the same as that used by indices: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +% \begin{macrocode} + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{treenonamegroup} +% Like the \glostyle{treenoname} style but the glossary groups have +% headings. +% \begin{macrocode} +\newglossarystyle{treenonamegroup}{% +% \end{macrocode} +% Base it on the glostyle{treenoname} style: +% \begin{macrocode} + \setglossarystyle{treenoname}% +% \end{macrocode} +% Give each group a heading: +% \begin{macrocode} + \renewcommand{\glsgroupheading}[1]{\par + \noindent\glstreegroupheaderfmt + {\glsgetgrouptitle{##1}}\par\indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{treenonamehypergroup} +% The \glostyle{treenonamehypergroup} style is like the \glostyle{treenonamegroup} +% style, but has a set of links to the groups at the +% start of the glossary. +% \begin{macrocode} +\newglossarystyle{treenonamehypergroup}{% +% \end{macrocode} +% Base it on the glostyle{treenoname} style: +% \begin{macrocode} + \setglossarystyle{treenoname}% +% \end{macrocode} +% Put navigation links to the groups at the start of the +% \env{theglossary} environment: +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \par\noindent\glstreenavigationfmt{\glsnavigation}\par\indexspace}% +% \end{macrocode} +% Each group has a heading (in bold with a target) followed by a +% vertical gap): +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par\noindent + \glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{macro}{\glsfindwidesttoplevelname} +%\changes{4.22}{2016-04-19}{new} +% Find the widest name over all parentless entries in the +% given glossary or glossaries. +% \begin{macrocode} +\newrobustcmd*{\glsfindwidesttoplevelname}[1][\@glo@types]{% + \dimen@=0pt\relax + \gls@tmplen=0pt\relax + \forallglossaries[#1]{\@gls@type}% + {% + \forglsentries[\@gls@type]{\@glo@label}% + {% + \ifglshasparent{\@glo@label}% + {}% + {% + \settowidth{\dimen@}% + {\glstreenamefmt{\glsentryname{\@glo@label}}}% + \ifdim\dimen@>\gls@tmplen + \gls@tmplen=\dimen@ + \letcs{\@glswidestname}{glo@\glsdetoklabel{\@glo@label}@name}% + \fi + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssetwidest} +% \cs{glssetwidest}\oarg{level}\marg{text} sets the widest +% text for the given level. It is used by the +% \glostyle{alttree} glossary styles to determine the +% indentation of each level. +% \begin{macrocode} +\newcommand*{\glssetwidest}[2][0]{% + \expandafter\def\csname @glswidestname\romannumeral#1\endcsname{% + #2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glswidestname} +% Initialise \cs{@glswidestname}. +% \begin{macrocode} +\newcommand*{\@glswidestname}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glstreenamebox} +% Used by the \glostyle{alttree} style to create the box for the +% name and associated information. +%\changes{4.19}{2015-10-31}{new} +% \begin{macrocode} +\newcommand*{\glstreenamebox}[2]{% + \makebox[#1][l]{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{style}{alttree} +% The \glostyle{alttree} glossary style +% is similar in style to the \glostyle{tree} style, but +% the indentation is obtained from the width of +% \cs{@glswidestname} which is set using \cs{glssetwidest}. +% \begin{macrocode} +\newglossarystyle{alttree}{% +% \end{macrocode} +% Redefine \env{theglossary} environment. +% \begin{macrocode} + \renewenvironment{theglossary}% + {\def\@gls@prevlevel{-1}% + \mbox{}\par}% + {\par}% +% \end{macrocode} +% Set the header and group headers to nothing. +% \begin{macrocode} + \renewcommand*{\glossaryheader}{}% + \renewcommand*{\glsgroupheading}[1]{}% +% \end{macrocode} +% Redefine the way that the level~0 entries are displayed. +%\changes{3.08a}{2013-09-28}{updated to use \cs{glossentry} and +%\cs{subglossentry}} +% \begin{macrocode} + \renewcommand{\glossentry}[2]{% + \ifnum\@gls@prevlevel=0\relax + \else +% \end{macrocode} +% Find out how big the indentation should be by measuring the +% widest entry. +% \begin{macrocode} + \settowidth{\glstreeindent}{\glstreenamefmt{\@glswidestname\space}}% + \fi +% \end{macrocode} +% Set the hangindent and paragraph indent. +%\changes{4.04}{2014-03-06}{moved hangindent and parindent assignments +%outside level test} +% \begin{macrocode} + \hangindent\glstreeindent + \parindent\glstreeindent +% \end{macrocode} +% Put the name to the left of the paragraph block. +% \begin{macrocode} + \makebox[0pt][r]{\glstreenamebox{\glstreeindent}{% + \glsentryitem{##1}\glstreenamefmt{\glstarget{##1}{\glossentryname{##1}}}}}% +% \end{macrocode} +% If the symbol is missing, ignore it, otherwise put it in +% brackets. +%\changes{4.10}{2014-08-27}{moved space after symbol} +% \begin{macrocode} + \ifglshassymbol{##1}{(\glossentrysymbol{##1})\space}{}% +% \end{macrocode} +% Do the description followed by the description terminator and +% location list. +% \begin{macrocode} + \glossentrydesc{##1}\glspostdescription \space ##2\par +% \end{macrocode} +% Set the previous level to 0. +% \begin{macrocode} + \def\@gls@prevlevel{0}% + }% +% \end{macrocode} +% Redefine the way sub-entries are displayed. +% \begin{macrocode} + \renewcommand{\subglossentry}[3]{% +% \end{macrocode} +% Increment and display the sub-entry counter if this is a level~1 +% entry and the sub-entry counter is in use. +% \begin{macrocode} + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi +% \end{macrocode} +% If the level hasn't changed, keep the same settings, otherwise +% adjust \cs{glstreeindent} accordingly. +% \begin{macrocode} + \ifnum\@gls@prevlevel=##1\relax + \else +% \end{macrocode} +% Compute the widest entry for this level, or for level~0 if not +% defined for this level. Store in \cs{gls@tmplen} +% \begin{macrocode} + \@ifundefined{@glswidestname\romannumeral##1}{% + \settowidth{\gls@tmplen}{\glstreenamefmt{\@glswidestname\space}}}{% + \settowidth{\gls@tmplen}{\glstreenamefmt{% + \csname @glswidestname\romannumeral##1\endcsname\space}}}% +% \end{macrocode} +% Determine if going up or down a level +% \begin{macrocode} + \ifnum\@gls@prevlevel<##1\relax +% \end{macrocode} +% Depth has increased, so add the width of the widest entry to +% \cs{glstreeindent}. +% \begin{macrocode} + \setlength\glstreeindent\gls@tmplen + \addtolength\glstreeindent\parindent + \parindent\glstreeindent + \else +% \end{macrocode} +% Depth has decreased, so subtract width of the widest entry +% from the previous level to \cs{glstreeindent}. First +% determine the width of the widest entry for the previous level +% and store in \cs{glstreeindent}. +% \begin{macrocode} + \@ifundefined{@glswidestname\romannumeral\@gls@prevlevel}{% + \settowidth{\glstreeindent}{\glstreenamefmt{% + \@glswidestname\space}}}{% + \settowidth{\glstreeindent}{\glstreenamefmt{% + \csname @glswidestname\romannumeral\@gls@prevlevel + \endcsname\space}}}% +% \end{macrocode} +% Subtract this length from the previous level's paragraph indent +% and set to \cs{glstreeindent}. +% \begin{macrocode} + \addtolength\parindent{-\glstreeindent}% + \setlength\glstreeindent\parindent + \fi + \fi +% \end{macrocode} +% Set the hanging indentation. +% \begin{macrocode} + \hangindent\glstreeindent +% \end{macrocode} +% Put the name to the left of the paragraph block +% \begin{macrocode} + \makebox[0pt][r]{\glstreenamebox{\gls@tmplen}{% + \glstreenamefmt{\glstarget{##2}{\glossentryname{##2}}}}}% +% \end{macrocode} +% If the symbol is missing, ignore it, otherwise put it in +% brackets. +%\changes{4.10}{2014-08-27}{moved space after symbol} +% \begin{macrocode} + \ifglshassymbol{##2}{(\glossentrysymbol{##2})\space}{}% +% \end{macrocode} +% Do the description followed by the description terminator and +% location list. +% \begin{macrocode} + \glossentrydesc{##2}\glspostdescription\space ##3\par +% \end{macrocode} +% Set the previous level macro to the current level. +% \begin{macrocode} + \def\@gls@prevlevel{##1}% + }% +% \end{macrocode} +% Vertical gap between groups is the same as that used by indices: +%\changes{3.03}{2012/09/21}{added check for glsnogroupskip} +% \begin{macrocode} + \renewcommand*{\glsgroupskip}{\ifglsnogroupskip\else\indexspace\fi}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{alttreegroup} +% Like the \glostyle{alttree} style but the glossary groups have +% headings. +% \begin{macrocode} +\newglossarystyle{alttreegroup}{% +% \end{macrocode} +% Base it on the glostyle{alttree} style: +% \begin{macrocode} + \setglossarystyle{alttree}% +% \end{macrocode} +% Give each group a heading. +% \begin{macrocode} + \renewcommand{\glsgroupheading}[1]{\par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt{\glsgetgrouptitle{##1}}% + \par\indexspace}% +} +% \end{macrocode} +%\end{style} +% +%\begin{style}{alttreehypergroup} +% The \glostyle{alttreehypergroup} style is like the +% \glostyle{alttreegroup} style, but has a set of links to the +% groups at the start of the glossary. +% \begin{macrocode} +\newglossarystyle{alttreehypergroup}{% +% \end{macrocode} +% Base it on the glostyle{alttree} style: +% \begin{macrocode} + \setglossarystyle{alttree}% +% \end{macrocode} +% Put the navigation links in the header +% \begin{macrocode} + \renewcommand*{\glossaryheader}{% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreenavigationfmt{\glsnavigation}\par\indexspace}% +% \end{macrocode} +% Put a hypertarget at the start of each group +% \begin{macrocode} + \renewcommand*{\glsgroupheading}[1]{% + \par + \def\@gls@prevlevel{-1}% + \hangindent0pt\relax + \parindent0pt\relax + \glstreegroupheaderfmt + {\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}}\par + \indexspace}} +% \end{macrocode} +%\end{style} +% +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-compatible-207.sty> +% \end{macrocode} +%\fi +%\chapter{Backwards Compatibility} +%\section{glossaries-compatible-207} +% Provides compatibility with version 2.07 and below. This uses +% original \sty{glossaries} xindy and makeindex formatting, so can +% be used with old documents that had customized style files, but +% hyperlinks may not work properly. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-compatible-207}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +%\begin{macro}{\GlsAddXdyAttribute} +% Adds an attribute in old format. +% \begin{macrocode} +\ifglsxindy + \renewcommand*\GlsAddXdyAttribute[1]{% + \edef\@xdyattributes{\@xdyattributes ^^J \string"#1\string"}% + \expandafter\toks@\expandafter{\@xdylocref}% + \edef\@xdylocref{\the\toks@ ^^J% + (markup-locref + :open \string"\string~n\string\setentrycounter + {\noexpand\glscounter}% + \expandafter\string\csname#1\endcsname + \expandafter\@gobble\string\{\string" ^^J + :close \string"\expandafter\@gobble\string\}\string" ^^J + :attr \string"#1\string")}} +% \end{macrocode} +% Only has an effect before \ics{writeist}: +% \begin{macrocode} +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\GlsAddXdyCounters} +% \begin{macrocode} +\renewcommand*\GlsAddXdyCounters[1]{% + \GlossariesWarning{\string\GlsAddXdyCounters\space not available + in compatibility mode.}% +} +% \end{macrocode} +%\end{macro} +% Add predefined attributes +% \begin{macrocode} + \GlsAddXdyAttribute{glsnumberformat} + \GlsAddXdyAttribute{textrm} + \GlsAddXdyAttribute{textsf} + \GlsAddXdyAttribute{texttt} + \GlsAddXdyAttribute{textbf} + \GlsAddXdyAttribute{textmd} + \GlsAddXdyAttribute{textit} + \GlsAddXdyAttribute{textup} + \GlsAddXdyAttribute{textsl} + \GlsAddXdyAttribute{textsc} + \GlsAddXdyAttribute{emph} + \GlsAddXdyAttribute{glshypernumber} + \GlsAddXdyAttribute{hyperrm} + \GlsAddXdyAttribute{hypersf} + \GlsAddXdyAttribute{hypertt} + \GlsAddXdyAttribute{hyperbf} + \GlsAddXdyAttribute{hypermd} + \GlsAddXdyAttribute{hyperit} + \GlsAddXdyAttribute{hyperup} + \GlsAddXdyAttribute{hypersl} + \GlsAddXdyAttribute{hypersc} + \GlsAddXdyAttribute{hyperemph} +% \end{macrocode} +% +%\begin{macro}{\GlsAddXdyLocation} +% Restore v2.07 definition: +% \begin{macrocode} +\ifglsxindy + \renewcommand*{\GlsAddXdyLocation}[2]{% + \edef\@xdyuserlocationdefs{% + \@xdyuserlocationdefs ^^J% + (define-location-class \string"#1\string"^^J\space\space + \space(#2)) + }% + \edef\@xdyuserlocationnames{% + \@xdyuserlocationnames^^J\space\space\space + \string"#1\string"}% + } +\fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@do@wrglossary} +% \begin{macrocode} +\renewcommand{\@do@wrglossary}[1]{% +% \end{macrocode} +% Determine whether to use \app{xindy} or \app{makeindex} +% syntax +% \begin{macrocode} +\ifglsxindy +% \end{macrocode} +% Need to determine if the formatting information starts with +% a ( or ) indicating a range. +% \begin{macrocode} + \expandafter\@glo@check@mkidxrangechar\@glsnumberformat\@nil + \def\@glo@range{}% + \expandafter\if\@glo@prefix(\relax + \def\@glo@range{:open-range}% + \else + \expandafter\if\@glo@prefix)\relax + \def\@glo@range{:close-range}% + \fi + \fi +% \end{macrocode} +% Get the location and escape any special characters +% \begin{macrocode} + \protected@edef\@glslocref{\theglsentrycounter}% + \@gls@checkmkidxchars\@glslocref +% \end{macrocode} +% Write to the glossary file using \app{xindy} syntax. +% \begin{macrocode} + \glossary[\csname glo@#1@type\endcsname]{% + (indexentry :tkey (\csname glo@#1@index\endcsname) + :locref \string"\@glslocref\string" % + :attr \string"\@glo@suffix\string" \@glo@range + ) + }% +\else +% \end{macrocode} +% Convert the format information into the format required for +% \app{makeindex} +% \begin{macrocode} + \@set@glo@numformat\@glo@numfmt\@gls@counter\@glsnumberformat +% \end{macrocode} +% Write to the glossary file using \app{makeindex} syntax. +% \begin{macrocode} + \glossary[\csname glo@#1@type\endcsname]{% + \string\glossaryentry{\csname glo@#1@index\endcsname + \@gls@encapchar\@glo@numfmt}{\theglsentrycounter}}% +\fi +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@set@glo@numformat} +% Only had 3 arguments in v2.07 +% \begin{macrocode} +\def\@set@glo@numformat#1#2#3{% + \expandafter\@glo@check@mkidxrangechar#3\@nil + \protected@edef#1{% + \@glo@prefix setentrycounter[]{#2}% + \expandafter\string\csname\@glo@suffix\endcsname + }% + \@gls@checkmkidxchars#1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\writeist} +% Redefine \cs{writeist} back to the way it was in v2.07, but change +% \cs{istfile} to \cs{glswrite}. +% \begin{macrocode} +\ifglsxindy + \def\writeist{% + \openout\glswrite=\istfilename + \write\glswrite{;; xindy style file created by the glossaries + package in compatible-2.07 mode}% + \write\glswrite{;; for document '\jobname' on + \the\year-\the\month-\the\day}% + \write\glswrite{^^J; required styles^^J} + \@for\@xdystyle:=\@xdyrequiredstyles\do{% + \ifx\@xdystyle\@empty + \else + \protected@write\glswrite{}{(require + \string"\@xdystyle.xdy\string")}% + \fi + }% + \write\glswrite{^^J% + ; list of allowed attributes (number formats)^^J}% + \write\glswrite{(define-attributes ((\@xdyattributes)))}% + \write\glswrite{^^J; user defined alphabets^^J}% + \write\glswrite{\@xdyuseralphabets}% + \write\glswrite{^^J; location class definitions^^J}% + \protected@edef\@gls@roman{\@roman{0\string" + \string"roman-numbers-lowercase\string" :sep \string"}}% + \@onelevel@sanitize\@gls@roman + \edef\@tmp{\string" \string"roman-numbers-lowercase\string" + :sep \string"}% + \@onelevel@sanitize\@tmp + \ifx\@tmp\@gls@roman + \write\glswrite{(define-location-class + \string"roman-page-numbers\string"^^J\space\space\space + (\string"roman-numbers-lowercase\string") + :min-range-length \@glsminrange)}% + \else + \write\glswrite{(define-location-class + \string"roman-page-numbers\string"^^J\space\space\space + (:sep "\@gls@roman") + :min-range-length \@glsminrange)}% + \fi + \write\glswrite{(define-location-class + \string"Roman-page-numbers\string"^^J\space\space\space + (\string"roman-numbers-uppercase\string") + :min-range-length \@glsminrange)}% + \write\glswrite{(define-location-class + \string"arabic-page-numbers\string"^^J\space\space\space + (\string"arabic-numbers\string") + :min-range-length \@glsminrange)}% + \write\glswrite{(define-location-class + \string"alpha-page-numbers\string"^^J\space\space\space + (\string"alpha\string") + :min-range-length \@glsminrange)}% + \write\glswrite{(define-location-class + \string"Alpha-page-numbers\string"^^J\space\space\space + (\string"ALPHA\string") + :min-range-length \@glsminrange)}% + \write\glswrite{(define-location-class + \string"Appendix-page-numbers\string"^^J\space\space\space + (\string"ALPHA\string" + :sep \string"\@glsAlphacompositor\string" + \string"arabic-numbers\string") + :min-range-length \@glsminrange)}% + \write\glswrite{(define-location-class + \string"arabic-section-numbers\string"^^J\space\space\space + (\string"arabic-numbers\string" + :sep \string"\glscompositor\string" + \string"arabic-numbers\string") + :min-range-length \@glsminrange)}% + \write\glswrite{^^J; user defined location classes}% + \write\glswrite{\@xdyuserlocationdefs}% + \write\glswrite{^^J; define cross-reference class^^J}% + \write\glswrite{(define-crossref-class \string"see\string" + :unverified )}% + \write\glswrite{(markup-crossref-list + :class \string"see\string"^^J\space\space\space + :open \string"\string\glsseeformat\string" + :close \string"{}\string")}% + \write\glswrite{^^J; define the order of the location classes}% + \write\glswrite{(define-location-class-order + (\@xdylocationclassorder))}% + \write\glswrite{^^J; define the glossary markup^^J}% + \write\glswrite{(markup-index^^J\space\space\space + :open \string"\string + \glossarysection[\string\glossarytoctitle]{\string + \glossarytitle}\string\glossarypreamble\string~n\string\begin + {theglossary}\string\glossaryheader\string~n\string" ^^J\space + \space\space:close \string"\expandafter\@gobble + \string\%\string~n\string + \end{theglossary}\string\glossarypostamble + \string~n\string" ^^J\space\space\space + :tree)}% + \write\glswrite{(markup-letter-group-list + :sep \string"\string\glsgroupskip\string~n\string")}% + \write\glswrite{(markup-indexentry + :open \string"\string\relax \string\glsresetentrylist + \string~n\string")}% + \write\glswrite{(markup-locclass-list :open + \string"\glsopenbrace\string\glossaryentrynumbers + \glsopenbrace\string\relax\space \string"^^J\space\space\space + :sep \string", \string" + :close \string"\glsclosebrace\glsclosebrace\string")}% + \write\glswrite{(markup-locref-list + :sep \string"\string\delimN\space\string")}% + \write\glswrite{(markup-range + :sep \string"\string\delimR\space\string")}% + \@onelevel@sanitize\gls@suffixF + \@onelevel@sanitize\gls@suffixFF + \ifx\gls@suffixF\@empty + \else + \write\glswrite{(markup-range + :close "\gls@suffixF" :length 1 :ignore-end)}% + \fi + \ifx\gls@suffixFF\@empty + \else + \write\glswrite{(markup-range + :close "\gls@suffixFF" :length 2 :ignore-end)}% + \fi + \write\glswrite{^^J; define format to use for locations^^J}% + \write\glswrite{\@xdylocref}% + \write\glswrite{^^J; define letter group list format^^J}% + \write\glswrite{(markup-letter-group-list + :sep \string"\string\glsgroupskip\string~n\string")}% + \write\glswrite{^^J; letter group headings^^J}% + \write\glswrite{(markup-letter-group + :open-head \string"\string\glsgroupheading + \glsopenbrace\string"^^J\space\space\space + :close-head \string"\glsclosebrace\string")}% + \write\glswrite{^^J; additional letter groups^^J}% + \write\glswrite{\@xdylettergroups}% + \write\glswrite{^^J; additional sort rules^^J} + \write\glswrite{\@xdysortrules}% + \noist} +\else + \edef\@gls@actualchar{\string?} + \edef\@gls@encapchar{\string|} + \edef\@gls@levelchar{\string!} + \edef\@gls@quotechar{\string"} + \def\writeist{\relax + \openout\glswrite=\istfilename + \write\glswrite{\expandafter\@gobble\string\% makeindex style file + created by the glossaries package} + \write\glswrite{\expandafter\@gobble\string\% for document + '\jobname' on \the\year-\the\month-\the\day} + \write\glswrite{actual '\@gls@actualchar'} + \write\glswrite{encap '\@gls@encapchar'} + \write\glswrite{level '\@gls@levelchar'} + \write\glswrite{quote '\@gls@quotechar'} + \write\glswrite{keyword \string"\string\\glossaryentry\string"} + \write\glswrite{preamble \string"\string\\glossarysection[\string + \\glossarytoctitle]{\string\\glossarytitle}\string + \\glossarypreamble\string\n\string\\begin{theglossary}\string + \\glossaryheader\string\n\string"} + \write\glswrite{postamble \string"\string\%\string\n\string + \\end{theglossary}\string\\glossarypostamble\string\n + \string"} + \write\glswrite{group_skip \string"\string\\glsgroupskip\string\n + \string"} + \write\glswrite{item_0 \string"\string\%\string\n\string"} + \write\glswrite{item_1 \string"\string\%\string\n\string"} + \write\glswrite{item_2 \string"\string\%\string\n\string"} + \write\glswrite{item_01 \string"\string\%\string\n\string"} + \write\glswrite{item_x1 + \string"\string\\relax \string\\glsresetentrylist\string\n + \string"} + \write\glswrite{item_12 \string"\string\%\string\n\string"} + \write\glswrite{item_x2 + \string"\string\\relax \string\\glsresetentrylist\string\n + \string"} + \write\glswrite{delim_0 \string"\string\{\string + \\glossaryentrynumbers\string\{\string\\relax \string"} + \write\glswrite{delim_1 \string"\string\{\string + \\glossaryentrynumbers\string\{\string\\relax \string"} + \write\glswrite{delim_2 \string"\string\{\string + \\glossaryentrynumbers\string\{\string\\relax \string"} + \write\glswrite{delim_t \string"\string\}\string\}\string"} + \write\glswrite{delim_n \string"\string\\delimN \string"} + \write\glswrite{delim_r \string"\string\\delimR \string"} + \write\glswrite{headings_flag 1} + \write\glswrite{heading_prefix + \string"\string\\glsgroupheading\string\{\string"} + \write\glswrite{heading_suffix + \string"\string\}\string\\relax + \string\\glsresetentrylist \string"} + \write\glswrite{symhead_positive \string"glssymbols\string"} + \write\glswrite{numhead_positive \string"glsnumbers\string"} + \write\glswrite{page_compositor \string"\glscompositor\string"} + \@gls@escbsdq\gls@suffixF + \@gls@escbsdq\gls@suffixFF + \ifx\gls@suffixF\@empty + \else + \write\glswrite{suffix_2p \string"\gls@suffixF\string"} + \fi + \ifx\gls@suffixFF\@empty + \else + \write\glswrite{suffix_3p \string"\gls@suffixFF\string"} + \fi + \noist + } +\fi +% \end{macrocode} +%\end{macro} +%\begin{macro}{\noist} +% \begin{macrocode} +\renewcommand*{\noist}{\let\writeist\relax} +% \end{macrocode} +%\end{macro} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-compatible-307.sty> +% \end{macrocode} +%\fi +%\section{glossaries-compatible-307} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-compatible-307}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% +% Compatibility macros for predefined glossary styles: +%\begin{macro}{\compatglossarystyle} +% Defines a compatibility glossary style. +% \begin{macrocode} +\newcommand{\compatglossarystyle}[2]{% + \ifcsundef{@glscompstyle@#1}% + {% + \csdef{@glscompstyle@#1}{#2}% + }% + {% + \PackageError{glossaries}{Glossary compatibility style `#1' is already defined}{}% + }% +} +% \end{macrocode} +%\end{macro} +% Backward compatible \glostyle{inline} style. +% \begin{macrocode} +\compatglossarystyle{inline}{% + \renewcommand{\glossaryentryfield}[5]{% + \glsinlinedopostchild + \gls@inlinesep + \def\glo@desc{##3}% + \def\@no@post@desc{\nopostdesc}% + \glsentryitem{##1}\glsinlinenameformat{##1}{##2}% + \ifx\glo@desc\@no@post@desc + \glsinlineemptydescformat{##4}{##5}% + \else + \ifstrempty{##3}% + {\glsinlineemptydescformat{##4}{##5}}% + {\glsinlinedescformat{##3}{##4}{##5}}% + \fi + \ifglshaschildren{##1}% + {% + \glsresetsubentrycounter + \glsinlineparentchildseparator + \def\gls@inlinesubsep{}% + \def\gls@inlinepostchild{\glsinlinepostchild}% + }% + {}% + \def\gls@inlinesep{\glsinlineseparator}% + }% +% \end{macrocode} +% Sub-entries display description: +% \begin{macrocode} + \renewcommand{\glossarysubentryfield}[6]{% + \gls@inlinesubsep% + \glsinlinesubnameformat{##2}{##3}% + \glssubentryitem{##2}\glsinlinesubdescformat{##4}{##5}{##6}% + \def\gls@inlinesubsep{\glsinlinesubseparator}% + }% +} +% \end{macrocode} +% Backward compatible \glostyle{list} style. +% \begin{macrocode} +\compatglossarystyle{list}{% + \renewcommand*{\glossaryentryfield}[5]{% + \item[\glsentryitem{##1}\glstarget{##1}{##2}] + ##3\glspostdescription\space ##5}% +% \end{macrocode} +% Sub-entries continue on the same line: +% \begin{macrocode} + \renewcommand*{\glossarysubentryfield}[6]{% + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4\glspostdescription\space ##6.}% +} +% \end{macrocode} +% Backward compatible \glostyle{listgroup} style. +% \begin{macrocode} +\compatglossarystyle{listgroup}{% + \csuse{@glscompstyle@list}% +}% +% \end{macrocode} +% Backward compatible \glostyle{listhypergroup} style. +% \begin{macrocode} +\compatglossarystyle{listhypergroup}{% + \csuse{@glscompstyle@list}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlist} style. +% \begin{macrocode} +\compatglossarystyle{altlist}{% + \renewcommand*{\glossaryentryfield}[5]{% + \item[\glsentryitem{##1}\glstarget{##1}{##2}]% + \mbox{}\par\nobreak\@afterheading + ##3\glspostdescription\space ##5}% + \renewcommand{\glossarysubentryfield}[6]{% + \par + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4\glspostdescription\space ##6}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlistgroup} style. +% \begin{macrocode} +\compatglossarystyle{altlistgroup}{% + \csuse{@glscompstyle@altlist}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlisthypergroup} style. +% \begin{macrocode} +\compatglossarystyle{altlisthypergroup}{% + \csuse{@glscompstyle@altlist}% +}% +% \end{macrocode} +% Backward compatible \glostyle{listdotted} style. +% \begin{macrocode} +\compatglossarystyle{listdotted}{% + \renewcommand*{\glossaryentryfield}[5]{% + \item[]\makebox[\glslistdottedwidth][l]{% + \glsentryitem{##1}\glstarget{##1}{##2}% + \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}##3}% + \renewcommand*{\glossarysubentryfield}[6]{% + \item[]\makebox[\glslistdottedwidth][l]{% + \glssubentryitem{##2}% + \glstarget{##2}{##3}% + \unskip\leaders\hbox to 2.9mm{\hss.}\hfill\strut}##4}% +}% +% \end{macrocode} +% Backward compatible \glostyle{sublistdotted} style. +% \begin{macrocode} +\compatglossarystyle{sublistdotted}{% + \csuse{@glscompstyle@listdotted}% + \renewcommand*{\glossaryentryfield}[5]{% + \item[\glsentryitem{##1}\glstarget{##1}{##2}]}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long} style. +% \begin{macrocode} +\compatglossarystyle{long}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4\glspostdescription\space ##6\\}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longborder} style. +% \begin{macrocode} +\compatglossarystyle{longborder}{% + \csuse{@glscompstyle@long}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longheader} style. +% \begin{macrocode} +\compatglossarystyle{longheader}{% + \csuse{@glscompstyle@long}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{longheaderborder}{% + \csuse{@glscompstyle@long}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long3col} style. +% \begin{macrocode} +\compatglossarystyle{long3col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\\}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##6\\}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long3colborder} style. +% \begin{macrocode} +\compatglossarystyle{long3colborder}{% + \csuse{@glscompstyle@long3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long3colheader} style. +% \begin{macrocode} +\compatglossarystyle{long3colheader}{% + \csuse{@glscompstyle@long3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long3colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{long3colheaderborder}{% + \csuse{@glscompstyle@long3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long4col} style. +% \begin{macrocode} +\compatglossarystyle{long4col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\\}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##5 & ##6\\}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long4colheader} style. +% \begin{macrocode} +\compatglossarystyle{long4colheader}{% + \csuse{@glscompstyle@long4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long4colborder} style. +% \begin{macrocode} +\compatglossarystyle{long4colborder}{% + \csuse{@glscompstyle@long4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{long4colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{long4colheaderborder}{% + \csuse{@glscompstyle@long4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlong4col} style. +% \begin{macrocode} +\compatglossarystyle{altlong4col}{% + \csuse{@glscompstyle@long4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlong4colheader} style. +% \begin{macrocode} +\compatglossarystyle{altlong4colheader}{% + \csuse{@glscompstyle@long4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlong4colborder} style. +% \begin{macrocode} +\compatglossarystyle{altlong4colborder}{% + \csuse{@glscompstyle@long4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlong4colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{altlong4colheaderborder}{% + \csuse{@glscompstyle@long4col}% +}% +% \end{macrocode} +% +% Backward compatible \glostyle{long} style. +% \begin{macrocode} +\compatglossarystyle{longragged}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5% + \tabularnewline}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4\glspostdescription\space ##6% + \tabularnewline}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longraggedborder} style. +% \begin{macrocode} +\compatglossarystyle{longraggedborder}{% + \csuse{@glscompstyle@longragged}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longraggedheader} style. +% \begin{macrocode} +\compatglossarystyle{longraggedheader}{% + \csuse{@glscompstyle@longragged}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longraggedheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{longraggedheaderborder}{% + \csuse{@glscompstyle@longragged}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longragged3col} style. +% \begin{macrocode} +\compatglossarystyle{longragged3col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\tabularnewline}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##6\tabularnewline}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longragged3colborder} style. +% \begin{macrocode} +\compatglossarystyle{longragged3colborder}{% + \csuse{@glscompstyle@longragged3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longragged3colheader} style. +% \begin{macrocode} +\compatglossarystyle{longragged3colheader}{% + \csuse{@glscompstyle@longragged3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{longragged3colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{longragged3colheaderborder}{% + \csuse{@glscompstyle@longragged3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlongragged4col} style. +% \begin{macrocode} +\compatglossarystyle{altlongragged4col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\tabularnewline}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##5 & ##6\tabularnewline}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlongragged4colheader} style. +% \begin{macrocode} +\compatglossarystyle{altlongragged4colheader}{% + \csuse{@glscompstyle@altlong4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlongragged4colborder} style. +% \begin{macrocode} +\compatglossarystyle{altlongragged4colborder}{% + \csuse{@glscompstyle@altlong4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altlongragged4colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{altlongragged4colheaderborder}{% + \csuse{@glscompstyle@altlong4col}% +}% +% \end{macrocode} +% +% Backward compatible \glostyle{index} style. +% \begin{macrocode} +\compatglossarystyle{index}{% + \renewcommand*{\glossaryentryfield}[5]{% + \item\glsentryitem{##1}\textbf{\glstarget{##1}{##2}}% + \ifx\relax##4\relax + \else + \space(##4)% + \fi + \space ##3\glspostdescription \space ##5}% + \renewcommand*{\glossarysubentryfield}[6]{% + \ifcase##1\relax + % level 0 + \item + \or + % level 1 + \subitem + \glssubentryitem{##2}% + \else + % all other levels + \subsubitem + \fi + \textbf{\glstarget{##2}{##3}}% + \ifx\relax##5\relax + \else + \space(##5)% + \fi + \space##4\glspostdescription\space ##6}% +}% +% \end{macrocode} +% Backward compatible \glostyle{indexgroup} style. +% \begin{macrocode} +\compatglossarystyle{indexgroup}{% + \csuse{@glscompstyle@index}% +}% +% \end{macrocode} +% Backward compatible \glostyle{indexhypergroup} style. +% \begin{macrocode} +\compatglossarystyle{indexhypergroup}{% + \csuse{@glscompstyle@index}% +}% +% \end{macrocode} +% Backward compatible \glostyle{tree} style. +% \begin{macrocode} +\compatglossarystyle{tree}{% + \renewcommand{\glossaryentryfield}[5]{% + \hangindent0pt\relax + \parindent0pt\relax + \glsentryitem{##1}\textbf{\glstarget{##1}{##2}}% + \ifx\relax##4\relax + \else + \space(##4)% + \fi + \space ##3\glspostdescription \space ##5\par}% + \renewcommand{\glossarysubentryfield}[6]{% + \hangindent##1\glstreeindent\relax + \parindent##1\glstreeindent\relax + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi + \textbf{\glstarget{##2}{##3}}% + \ifx\relax##5\relax + \else + \space(##5)% + \fi + \space##4\glspostdescription\space ##6\par}% +}% +% \end{macrocode} +% Backward compatible \glostyle{treegroup} style. +% \begin{macrocode} +\compatglossarystyle{treegroup}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{treehypergroup} style. +% \begin{macrocode} +\compatglossarystyle{treehypergroup}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{treenoname} style. +% \begin{macrocode} +\compatglossarystyle{treenoname}{% + \renewcommand{\glossaryentryfield}[5]{% + \hangindent0pt\relax + \parindent0pt\relax + \glsentryitem{##1}\textbf{\glstarget{##1}{##2}}% + \ifx\relax##4\relax + \else + \space(##4)% + \fi + \space ##3\glspostdescription \space ##5\par}% + \renewcommand{\glossarysubentryfield}[6]{% + \hangindent##1\glstreeindent\relax + \parindent##1\glstreeindent\relax + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi + \glstarget{##2}{\strut}% + ##4\glspostdescription\space ##6\par}% +}% +% \end{macrocode} +% Backward compatible \glostyle{treenonamegroup} style. +% \begin{macrocode} +\compatglossarystyle{treenonamegroup}{% + \csuse{@glscompstyle@treenoname}% +}% +% \end{macrocode} +% Backward compatible \glostyle{treenonamehypergroup} style. +% \begin{macrocode} +\compatglossarystyle{treenonamehypergroup}{% + \csuse{@glscompstyle@treenoname}% +}% +% \end{macrocode} +% Backward compatible \glostyle{alttree} style. +% \begin{macrocode} +\compatglossarystyle{alttree}{% + \renewcommand{\glossaryentryfield}[5]{% + \ifnum\@gls@prevlevel=0\relax + \else + \settowidth{\glstreeindent}{\textbf{\@glswidestname\space}}% + \hangindent\glstreeindent + \parindent\glstreeindent + \fi + \makebox[0pt][r]{\makebox[\glstreeindent][l]{% + \glsentryitem{##1}\textbf{\glstarget{##1}{##2}}}}% + \ifx\relax##4\relax + \else + (##4)\space + \fi + ##3\glspostdescription \space ##5\par + \def\@gls@prevlevel{0}% + }% + \renewcommand{\glossarysubentryfield}[6]{% + \ifnum##1=1\relax + \glssubentryitem{##2}% + \fi + \ifnum\@gls@prevlevel=##1\relax + \else + \@ifundefined{@glswidestname\romannumeral##1}{% + \settowidth{\gls@tmplen}{\textbf{\@glswidestname\space}}}{% + \settowidth{\gls@tmplen}{\textbf{% + \csname @glswidestname\romannumeral##1\endcsname\space}}}% + \ifnum\@gls@prevlevel<##1\relax + \setlength\glstreeindent\gls@tmplen + \addtolength\glstreeindent\parindent + \parindent\glstreeindent + \else + \@ifundefined{@glswidestname\romannumeral\@gls@prevlevel}{% + \settowidth{\glstreeindent}{\textbf{% + \@glswidestname\space}}}{% + \settowidth{\glstreeindent}{\textbf{% + \csname @glswidestname\romannumeral\@gls@prevlevel + \endcsname\space}}}% + \addtolength\parindent{-\glstreeindent}% + \setlength\glstreeindent\parindent + \fi + \fi + \hangindent\glstreeindent + \makebox[0pt][r]{\makebox[\gls@tmplen][l]{% + \textbf{\glstarget{##2}{##3}}}}% + \ifx##5\relax\relax + \else + (##5)\space + \fi + ##4\glspostdescription\space ##6\par + \def\@gls@prevlevel{##1}% + }% +}% +% \end{macrocode} +% Backward compatible \glostyle{alttreegroup} style. +% \begin{macrocode} +\compatglossarystyle{alttreegroup}{% + \csuse{@glscompstyle@alttree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{alttreehypergroup} style. +% \begin{macrocode} +\compatglossarystyle{alttreehypergroup}{% + \csuse{@glscompstyle@alttree}% +}% +% \end{macrocode} +% +% Backward compatible \glostyle{mcolindex} style. +% \begin{macrocode} +\compatglossarystyle{mcolindex}{% + \csuse{@glscompstyle@index}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcolindexgroup} style. +% \begin{macrocode} +\compatglossarystyle{mcolindexgroup}{% + \csuse{@glscompstyle@index}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcolindexhypergroup} style. +% \begin{macrocode} +\compatglossarystyle{mcolindexhypergroup}{% + \csuse{@glscompstyle@index}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcoltree} style. +% \begin{macrocode} +\compatglossarystyle{mcoltree}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcoltreegroup} style. +% \begin{macrocode} +\compatglossarystyle{mcolindextreegroup}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcoltreehypergroup} style. +% \begin{macrocode} +\compatglossarystyle{mcolindextreehypergroup}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcoltreenoname} style. +% \begin{macrocode} +\compatglossarystyle{mcoltreenoname}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcoltreenonamegroup} style. +% \begin{macrocode} +\compatglossarystyle{mcoltreenonamegroup}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcoltreenonamehypergroup} style. +% \begin{macrocode} +\compatglossarystyle{mcoltreenonamehypergroup}{% + \csuse{@glscompstyle@tree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcolalttree} style. +% \begin{macrocode} +\compatglossarystyle{mcolalttree}{% + \csuse{@glscompstyle@alttree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcolalttreegroup} style. +% \begin{macrocode} +\compatglossarystyle{mcolalttreegroup}{% + \csuse{@glscompstyle@alttree}% +}% +% \end{macrocode} +% Backward compatible \glostyle{mcolalttreehypergroup} style. +% \begin{macrocode} +\compatglossarystyle{mcolalttreehypergroup}{% + \csuse{@glscompstyle@alttree}% +}% +% \end{macrocode} + +% Backward compatible \glostyle{superragged} style. +% \begin{macrocode} +\compatglossarystyle{superragged}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5% + \tabularnewline}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4\glspostdescription\space ##6% + \tabularnewline}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superraggedborder} style. +% \begin{macrocode} +\compatglossarystyle{superraggedborder}{% + \csuse{@glscompstyle@superragged}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superraggedheader} style. +% \begin{macrocode} +\compatglossarystyle{superraggedheader}{% + \csuse{@glscompstyle@superragged}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superraggedheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{superraggedheaderborder}{% + \csuse{@glscompstyle@superragged}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superragged3col} style. +% \begin{macrocode} +\compatglossarystyle{superragged3col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\tabularnewline}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##6\tabularnewline}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superragged3colborder} style. +% \begin{macrocode} +\compatglossarystyle{superragged3colborder}{% + \csuse{@glscompstyle@superragged3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superragged3colheader} style. +% \begin{macrocode} +\compatglossarystyle{superragged3colheader}{% + \csuse{@glscompstyle@superragged3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superragged3colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{superragged3colheaderborder}{% + \csuse{@glscompstyle@superragged3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuperragged4col} style. +% \begin{macrocode} +\compatglossarystyle{altsuperragged4col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\tabularnewline}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##5 & ##6\tabularnewline}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuperragged4colheader} style. +% \begin{macrocode} +\compatglossarystyle{altsuperragged4colheader}{% + \csuse{@glscompstyle@altsuperragged4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuperragged4colborder} style. +% \begin{macrocode} +\compatglossarystyle{altsuperragged4colborder}{% + \csuse{@glscompstyle@altsuperragged4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuperragged4colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{altsuperragged4colheaderborder}{% + \csuse{@glscompstyle@altsuperragged4col}% +}% +% \end{macrocode} +% +% Backward compatible \glostyle{super} style. +% \begin{macrocode} +\compatglossarystyle{super}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3\glspostdescription\space ##5\\}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4\glspostdescription\space ##6\\}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superborder} style. +% \begin{macrocode} +\compatglossarystyle{superborder}{% + \csuse{@glscompstyle@super}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superheader} style. +% \begin{macrocode} +\compatglossarystyle{superheader}{% + \csuse{@glscompstyle@super}% +}% +% \end{macrocode} +% Backward compatible \glostyle{superheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{superheaderborder}{% + \csuse{@glscompstyle@super}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super3col} style. +% \begin{macrocode} +\compatglossarystyle{super3col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##5\\}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##6\\}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super3colborder} style. +% \begin{macrocode} +\compatglossarystyle{super3colborder}{% + \csuse{@glscompstyle@super3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super3colheader} style. +% \begin{macrocode} +\compatglossarystyle{super3colheader}{% + \csuse{@glscompstyle@super3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super3colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{super3colheaderborder}{% + \csuse{@glscompstyle@super3col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super4col} style. +% \begin{macrocode} +\compatglossarystyle{super4col}{% + \renewcommand*{\glossaryentryfield}[5]{% + \glsentryitem{##1}\glstarget{##1}{##2} & ##3 & ##4 & ##5\\}% + \renewcommand*{\glossarysubentryfield}[6]{% + & + \glssubentryitem{##2}% + \glstarget{##2}{\strut}##4 & ##5 & ##6\\}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super4colheader} style. +% \begin{macrocode} +\compatglossarystyle{super4colheader}{% + \csuse{@glscompstyle@super4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super4colborder} style. +% \begin{macrocode} +\compatglossarystyle{super4colborder}{% + \csuse{@glscompstyle@super4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{super4colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{super4colheaderborder}{% + \csuse{@glscompstyle@super4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuper4col} style. +% \begin{macrocode} +\compatglossarystyle{altsuper4col}{% + \csuse{@glscompstyle@super4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuper4colheader} style. +% \begin{macrocode} +\compatglossarystyle{altsuper4colheader}{% + \csuse{@glscompstyle@super4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuper4colborder} style. +% \begin{macrocode} +\compatglossarystyle{altsuper4colborder}{% + \csuse{@glscompstyle@super4col}% +}% +% \end{macrocode} +% Backward compatible \glostyle{altsuper4colheaderborder} style. +% \begin{macrocode} +\compatglossarystyle{altsuper4colheaderborder}{% + \csuse{@glscompstyle@super4col}% +}% +% \end{macrocode} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-accsupp.sty> +% \end{macrocode} +%\fi +%\chapter{Accessibility Support (glossaries-accsupp Code)} +%\label{sec:code:accsupp} +% The \isty{glossaries-accsupp} package is experimental. It is +% intended to provide a means of using the PDF accessibilty support +% in glossary entries. See the \isty{accsupp} documentation for +% further details about accessibility support. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +% \end{macrocode} +% Package version number now in line with main glossaries package number. +% \begin{macrocode} +\ProvidesPackage{glossaries-accsupp}[2019/01/06 v4.42 (NLCT) + Experimental glossaries accessibility] +% \end{macrocode} +% Pass all options to \sty{glossaries}: +% \begin{macrocode} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{glossaries}} +% \end{macrocode} +% Process options: +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% This package should be loaded before \sty{glossaries-extra}, so +% complain if that has already been loaded. +% \begin{macrocode} +\@ifpackageloaded{glossaries-extra} +{% +% \end{macrocode} +%If the \pkgoptfmt{accsupp} option was used, \cs{@glsxtr@doaccsupp} +%will have been set, otherwise it will be empty. +%\changes{4.29}{2017-01-19}{added check for \cs{@glsxtr@doaccsupp}} +% \begin{macrocode} + \ifx\@glsxtr@doaccsupp\empty + \GlossariesWarning{The `glossaries-accsupp' + package has been loaded\MessageBreak + after the `glossaries-extra' package. This\MessageBreak + can cause a failure to integrate both packages. \MessageBreak + Either use the `accsupp' option when you load\MessageBreak + `glossaries-extra' or load `glossaries-accsupp'\MessageBreak + before loading `glossaries-extra'}% + \fi +} +{} +% \end{macrocode} +% +%\begin{macro}{\compatibleglossentry} +% Override style compatibility macros: +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.04}{2014-03-06}{changed \cs{newcommand} to \cs{def} as is may or +%may not be defined} +% \begin{macrocode} +\def\compatibleglossentry#1#2{% + \toks@{#2}% + \protected@edef\@do@glossentry{% + \noexpand\accsuppglossaryentryfield{#1}% + {\noexpand\glsnamefont + {\expandafter\expandonce\csname glo@\glsdetoklabel{#1}@name\endcsname}}% + {\expandafter\expandonce\csname glo@\glsdetoklabel{#1}@desc\endcsname}% + {\expandafter\expandonce\csname glo@\glsdetoklabel{#1}@symbol\endcsname}% + {\the\toks@}% + }% + \@do@glossentry +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\compatiblesubglossentry} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.04}{2014-03-06}{changed \cs{newcommand} to \cs{def} as is may or +%may not be defined} +% \begin{macrocode} +\def\compatiblesubglossentry#1#2#3{% + \toks@{#3}% + \protected@edef\@do@subglossentry{% + \noexpand\accsuppglossarysubentryfield{\number#1}% + {#2}% + {\noexpand\glsnamefont + {\expandafter\expandonce\csname glo@\glsdetoklabel{#2}@name\endcsname}}% + {\expandafter\expandonce\csname glo@\glsdetoklabel{#2}@desc\endcsname}% + {\expandafter\expandonce\csname glo@\glsdetoklabel{#2}@symbol\endcsname}% + {\the\toks@}% + }% + \@do@subglossentry +} +% \end{macrocode} +%\end{macro} +% Required packages: +% \begin{macrocode} +\RequirePackage{glossaries} +\RequirePackage{accsupp} +% \end{macrocode} +% +%\section{Defining Replacement Text} +% The version 0.1 stored the replacement text in the +% \gloskey{symbol} key. This has been changed to use the +% new keys defined here. Example of use: +%\begin{verbatim} +%\newglossaryentry{dr}{name=Dr,description={},access={Doctor}} +%\end{verbatim} +%\begin{key}{access} +% The replacement text corresponding to the \gloskey{name} key: +% \begin{macrocode} +\define@key{glossentry}{access}{% + \def\@glo@access{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{textaccess} +% The replacement text corresponding to the \gloskey{text} key: +% \begin{macrocode} +\define@key{glossentry}{textaccess}{% + \def\@glo@textaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{firstaccess} +% The replacement text corresponding to the \gloskey{first} key: +% \begin{macrocode} +\define@key{glossentry}{firstaccess}{% + \def\@glo@firstaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{pluralaccess} +% The replacement text corresponding to the \gloskey{plural} key: +% \begin{macrocode} +\define@key{glossentry}{pluralaccess}{% + \def\@glo@pluralaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{firstpluralaccess} +% The replacement text corresponding to the \gloskey{firstplural} key: +% \begin{macrocode} +\define@key{glossentry}{firstpluralaccess}{% + \def\@glo@firstpluralaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{symbolaccess} +% The replacement text corresponding to the \gloskey{symbol} key: +% \begin{macrocode} +\define@key{glossentry}{symbolaccess}{% + \def\@glo@symbolaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{symbolpluralaccess} +% The replacement text corresponding to the \gloskey{symbolplural} key: +% \begin{macrocode} +\define@key{glossentry}{symbolpluralaccess}{% + \def\@glo@symbolpluralaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{descriptionaccess} +% The replacement text corresponding to the \gloskey{description} key: +% \begin{macrocode} +\define@key{glossentry}{descriptionaccess}{% + \def\@glo@descaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{descriptionpluralaccess} +% The replacement text corresponding to the \gloskey{descriptionplural} key: +% \begin{macrocode} +\define@key{glossentry}{descriptionpluralaccess}{% + \def\@glo@descpluralaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{shortaccess} +% The replacement text corresponding to the \gloskey{short} key: +% \begin{macrocode} +\define@key{glossentry}{shortaccess}{% + \def\@glo@shortaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{shortpluralaccess} +% The replacement text corresponding to the \gloskey{shortplural} key: +% \begin{macrocode} +\define@key{glossentry}{shortpluralaccess}{% + \def\@glo@shortpluralaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{longaccess} +% The replacement text corresponding to the \gloskey{long} key: +% \begin{macrocode} +\define@key{glossentry}{longaccess}{% + \def\@glo@longaccess{#1}% +} +% \end{macrocode} +%\end{key} +%\begin{key}{longpluralaccess} +% The replacement text corresponding to the \gloskey{longplural} key: +% \begin{macrocode} +\define@key{glossentry}{longpluralaccess}{% + \def\@glo@longpluralaccess{#1}% +} +% \end{macrocode} +%\end{key} +% There are no equivalent keys for the \gloskey{user1}\ldots +%\gloskey{user6} keys. The replacement text would have to be +% explicitly put in the value, e.g., +% "user1={\glsaccsupp{inches}{in}}". +% +% Append these new keys to \cs{@gls@keymap}: +% \begin{macrocode} +\appto\@gls@keymap{,% + {access}{access},% + {textaccess}{textaccess},% + {firstaccess}{firstaccess},% + {pluralaccess}{pluralaccess},% + {firstpluralaccess}{firstpluralaccess},% + {symbolaccess}{symbolaccess},% + {symbolpluralaccess}{symbolpluralaccess},% + {descaccess}{descaccess},% + {descpluralaccess}{descpluralaccess},% + {shortaccess}{shortaccess},% + {shortpluralaccess}{shortpluralaccess},% + {longaccess}{longaccess},% + {longpluralaccess}{longpluralaccess}% +} +% \end{macrocode} +% +%\begin{macro}{\@gls@noaccess} +% Indicates that no replacement text has been provided. +% \begin{macrocode} +\def\@gls@noaccess{\relax} +% \end{macrocode} +%\end{macro} +% +% Add to the start hook (the \gloskey{access} key is initialised to +% the value of the \gloskey{symbol} key at the start for backwards +% compatibility): +% \begin{macrocode} +\let\@gls@oldnewglossaryentryprehook\@newglossaryentryprehook +\renewcommand*{\@newglossaryentryprehook}{% + \@gls@oldnewglossaryentryprehook + \def\@glo@access{\@glo@symbol}% +% \end{macrocode} +% Initialise the other keys: +% \begin{macrocode} + \def\@glo@textaccess{\@glo@access}% + \def\@glo@firstaccess{\@glo@access}% + \def\@glo@pluralaccess{\@glo@textaccess}% + \def\@glo@firstpluralaccess{\@glo@pluralaccess}% + \def\@glo@symbolaccess{\relax}% + \def\@glo@symbolpluralaccess{\@glo@symbolaccess}% + \def\@glo@descaccess{\relax}% + \def\@glo@descpluralaccess{\@glo@descaccess}% + \def\@glo@shortaccess{\relax}% + \def\@glo@shortpluralaccess{\@glo@shortaccess}% + \def\@glo@longaccess{\relax}% + \def\@glo@longpluralaccess{\@glo@longaccess}% +} +% \end{macrocode} +% Add to the end hook: +% \begin{macrocode} +\let\@gls@oldnewglossaryentryposthook\@newglossaryentryposthook +\renewcommand*{\@newglossaryentryposthook}{% + \@gls@oldnewglossaryentryposthook +% \end{macrocode} +% Store the access information: +% \begin{macrocode} + \expandafter + \protected@xdef\csname glo@\@glo@label @access\endcsname{% + \@glo@access}% + \expandafter + \protected@xdef\csname glo@\@glo@label @textaccess\endcsname{% + \@glo@textaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @firstaccess\endcsname{% + \@glo@firstaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @pluralaccess\endcsname{% + \@glo@pluralaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @firstpluralaccess\endcsname{% + \@glo@firstpluralaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @symbolaccess\endcsname{% + \@glo@symbolaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @symbolpluralaccess\endcsname{% + \@glo@symbolpluralaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @descaccess\endcsname{% + \@glo@descaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @descpluralaccess\endcsname{% + \@glo@descpluralaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @shortaccess\endcsname{% + \@glo@shortaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @shortpluralaccess\endcsname{% + \@glo@shortpluralaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @longaccess\endcsname{% + \@glo@longaccess}% + \expandafter + \protected@xdef\csname glo@\@glo@label @longpluralaccess\endcsname{% + \@glo@longpluralaccess}% +} +% \end{macrocode} +% +%\section{Accessing Replacement Text} +%\begin{macro}{\glsentryaccess} +% Get the value of the \gloskey{access} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentryaccess}[1]{% + \@gls@entry@field{#1}{access}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrytextaccess} +% Get the value of the \gloskey{textaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrytextaccess}[1]{% + \@gls@entry@field{#1}{textaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentryfirstaccess} +% Get the value of the \gloskey{firstaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentryfirstaccess}[1]{% + \@gls@entry@field{#1}{firstaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrypluralaccess} +% Get the value of the \gloskey{pluralaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrypluralaccess}[1]{% + \@gls@entry@field{#1}{pluralaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentryfirstpluralaccess} +% Get the value of the \gloskey{firstpluralaccess} key for the entry with +% the given label: +% \begin{macrocode} +\newcommand*{\glsentryfirstpluralaccess}[1]{% + \csname glo@#1@firstpluralaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrysymbolaccess} +% Get the value of the \gloskey{symbolaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrysymbolaccess}[1]{% + \@gls@entry@field{#1}{symbolaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrysymbolpluralaccess} +% Get the value of the \gloskey{symbolpluralaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrysymbolpluralaccess}[1]{% + \@gls@entry@field{#1}{symbolpluralaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrydescaccess} +% Get the value of the \gloskey{descriptionaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrydescaccess}[1]{% + \@gls@entry@field{#1}{descaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrydescpluralaccess} +% Get the value of the \gloskey{descriptionpluralaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrydescpluralaccess}[1]{% + \@gls@entry@field{#1}{descaccess}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryshortaccess} +% Get the value of the \gloskey{shortaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentryshortaccess}[1]{% + \@gls@entry@field{#1}{shortaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentryshortpluralaccess} +% Get the value of the \gloskey{shortpluralaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentryshortpluralaccess}[1]{% + \@gls@entry@field{#1}{shortpluralaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrylongaccess} +% Get the value of the \gloskey{longaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrylongaccess}[1]{% + \@gls@entry@field{#1}{longaccess}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsentrylongpluralaccess} +% Get the value of the \gloskey{longpluralaccess} key for the entry with +% the given label: +%\changes{4.03}{2014-01-20}{switched to using \cs{@gls@entry@field}} +% \begin{macrocode} +\newcommand*{\glsentrylongpluralaccess}[1]{% + \@gls@entry@field{#1}{longpluralaccess}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccsupp} +%\changes{4.38}{2018-05-10}{added braces around actual text argument} +%\begin{definition} +%\cs{glsaccsupp}\marg{replacement text}\marg{text} +%\end{definition} +% This can be redefined to use "E" or "Alt" instead of +% "ActualText". (I don't have the software to test the "E" or +% "Alt" options.) +% \begin{macrocode} +\newcommand*{\glsaccsupp}[2]{% + \BeginAccSupp{ActualText={#1}}#2\EndAccSupp{}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\xglsaccsupp} +% Fully expands replacement text before calling \cs{glsaccsupp} +% \begin{macrocode} +\newcommand*{\xglsaccsupp}[2]{% + \protected@edef\@gls@replacementtext{#1}% + \expandafter\glsaccsupp\expandafter{\@gls@replacementtext}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@access@display} +%\changes{4.03}{2014-01-20}{new} +% \begin{macrocode} +\newcommand*{\@gls@access@display}[2]{% + \protected@edef\@glo@access{#2}% + \ifx\@glo@access\@gls@noaccess + #1% + \else + \xglsaccsupp{\@glo@access}{#1}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsnameaccessdisplay} +% Displays the first argument with the accessibility text for +% the entry with the label given by the second argument (if set). +% \begin{macrocode} +\DeclareRobustCommand*{\glsnameaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentryaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glstextaccessdisplay} +% As above but for the \gloskey{textaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glstextaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrytextaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glspluralaccessdisplay} +% As above but for the \gloskey{pluralaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glspluralaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrypluralaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstaccessdisplay} +% As above but for the \gloskey{firstaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glsfirstaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentryfirstaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsfirstpluralaccessdisplay} +% As above but for the \gloskey{firstpluralaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glsfirstpluralaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentryfirstpluralaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glssymbolaccessdisplay} +% As above but for the \gloskey{symbolaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glssymbolaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrysymbolaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glssymbolpluralaccessdisplay} +% As above but for the \gloskey{symbolpluralaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glssymbolpluralaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrysymbolpluralaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsdescriptionaccessdisplay} +% As above but for the \gloskey{descriptionaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glsdescriptionaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrydescaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsdescriptionpluralaccessdisplay} +% As above but for the \gloskey{descriptionpluralaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glsdescriptionpluralaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrydescpluralaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsshortaccessdisplay} +% As above but for the \gloskey{shortaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glsshortaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentryshortaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsshortpluralaccessdisplay} +% As above but for the \gloskey{shortpluralaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glsshortpluralaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentryshortpluralaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongaccessdisplay} +% As above but for the \gloskey{longaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glslongaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrylongaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glslongpluralaccessdisplay} +% As above but for the \gloskey{longpluralaccess} replacement text. +% \begin{macrocode} +\DeclareRobustCommand*{\glslongpluralaccessdisplay}[2]{% + \@gls@access@display{#1}{\glsentrylongpluralaccess{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdisplay} +% Gets the replacement text corresponding to the named key given +% by the first argument and calls the appropriate command +% defined above. +% \begin{macrocode} +\DeclareRobustCommand*{\glsaccessdisplay}[3]{% + \@ifundefined{gls#1accessdisplay}% + {% + \PackageError{glossaries-accsupp}{No accessibility support + for key `#1'}{}% + }% + {% + \csname gls#1accessdisplay\endcsname{#2}{#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@gls@default@entryfmt} +% Redefine the default entry format to use accessibility information +% \begin{macrocode} +\renewcommand*{\@@gls@default@entryfmt}[2]{% + \ifdefempty\glscustomtext + {% + \glsifplural + {% +% \end{macrocode} +% Plural form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + #2{\glspluralaccessdisplay + {\glsentryplural{\glslabel}}{\glslabel}}% + {\glsdescriptionpluralaccessdisplay + {\glsentrydescplural{\glslabel}}{\glslabel}}% + {\glssymbolpluralaccessdisplay + {\glsentrysymbolplural{\glslabel}}{\glslabel}} + {\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glsfirstpluralaccessdisplay + {\glsentryfirstplural{\glslabel}}{\glslabel}}% + {\glsdescriptionpluralaccessdisplay + {\glsentrydescplural{\glslabel}}{\glslabel}}% + {\glssymbolpluralaccessdisplay + {\glsentrysymbolplural{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use. +% \begin{macrocode} + #2{\glspluralaccessdisplay + {\Glsentryplural{\glslabel}}{\glslabel}}% + {\glsdescriptionpluralaccessdisplay + {\glsentrydescplural{\glslabel}}{\glslabel}}% + {\glssymbolpluralaccessdisplay + {\glsentrysymbolplural{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glsfirstpluralaccessdisplay + {\Glsentryfirstplural{\glslabel}}{\glslabel}}% + {\glsdescriptionpluralaccessdisplay + {\glsentrydescplural{\glslabel}}{\glslabel}}% + {\glssymbolpluralaccessdisplay + {\glsentrysymbolplural{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \MakeUppercase{% + #2{\glspluralaccessdisplay + {\glsentryplural{\glslabel}}{\glslabel}}% + {\glsdescriptionpluralaccessdisplay + {\glsentrydescplural{\glslabel}}{\glslabel}}% + {\glssymbolpluralaccessdisplay + {\glsentrysymbolplural{\glslabel}}{\glslabel}}% + {\glsinsert}}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \MakeUppercase{% + #1{\glsfirstpluralaccessdisplay + {\glsentryfirstplural{\glslabel}}{\glslabel}}% + {\glsdescriptionpluralaccessdisplay + {\glsentrydescplural{\glslabel}}{\glslabel}}% + {\glssymbolpluralaccessdisplay + {\glsentrysymbolplural{\glslabel}}{\glslabel}}% + {\glsinsert}}% + }% + }% + }% + {% +% \end{macrocode} +% Singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + #2{\glstextaccessdisplay + {\glsentrytext{\glslabel}}{\glslabel}}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glsfirstaccessdisplay + {\glsentryfirst{\glslabel}}{\glslabel}}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + #2{\glstextaccessdisplay + {\Glsentrytext{\glslabel}}{\glslabel}}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glsfirstaccessdisplay + {\Glsentryfirst{\glslabel}}{\glslabel}}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \MakeUppercase{% + #2{\glstextaccessdisplay + {\glsentrytext{\glslabel}}{\glslabel}}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \MakeUppercase{% + #1{\glsfirstaccessdisplay + {\glsentryfirst{\glslabel}}{\glslabel}}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}}% + }% + }% + }% + }% + {% +% \end{macrocode} +% Custom text provided in \cs{glsdisp} +% \begin{macrocode} + \ifglsused{\glslabel}% + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + #2{\glscustomtext}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + #1{\glscustomtext}% + {\glsdescriptionaccessdisplay + {\glsentrydesc{\glslabel}}{\glslabel}}% + {\glssymbolaccessdisplay + {\glsentrysymbol{\glslabel}}{\glslabel}}% + {\glsinsert}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgenentryfmt} +% Redefine to use accessibility information. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewcommand*{\glsgenentryfmt}{% + \ifdefempty\glscustomtext + {% + \glsifplural + {% +% \end{macrocode} +% Plural form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \glspluralaccessdisplay + {\glsentryplural{\glslabel}}{\glslabel}% + \glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsfirstpluralaccessdisplay + {\glsentryfirstplural{\glslabel}}{\glslabel}% + \glsinsert + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use. +% \begin{macrocode} + \glspluralaccessdisplay + {\Glsentryplural{\glslabel}}{\glslabel}% + \glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsfirstpluralaccessdisplay + {\Glsentryfirstplural{\glslabel}}{\glslabel}% + \glsinsert + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \glspluralaccessdisplay + {\mfirstucMakeUppercase{\glsentryplural{\glslabel}}}% + {\glslabel}% + \mfirstucMakeUppercase{\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsfirstpluralacessdisplay + {\mfirstucMakeUppercase{\glsentryfirstplural{\glslabel}}}% + {\glslabel}% + \mfirstucMakeUppercase{\glsinsert}% + }% + }% + }% + {% +% \end{macrocode} +% Singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Don't adjust case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \glstextaccessdisplay{\glsentrytext{\glslabel}}{\glslabel}% + \glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsfirstaccessdisplay{\glsentryfirst{\glslabel}}{\glslabel}% + \glsinsert + }% + }% + {% +% \end{macrocode} +% Make first letter upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \glstextaccessdisplay{\Glsentrytext{\glslabel}}{\glslabel}% + \glsinsert + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsfirstaccessdisplay{\Glsentryfirst{\glslabel}}{\glslabel}% + \glsinsert + }% + }% + {% +% \end{macrocode} +% Make all upper case +% \begin{macrocode} + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use +% \begin{macrocode} + \glstextaccessdisplay + {\mfirstucMakeUppercase{\glsentrytext{\glslabel}}}{\glslabel}% + \mfirstucMakeUppercase{\glsinsert}% + }% + {% +% \end{macrocode} +% First use +% \begin{macrocode} + \glsfirstaccessdisplay + {\mfirstucMakeUppercase{\glsentryfirst{\glslabel}}}{\glslabel}% + \mfirstucMakeUppercase{\glsinsert}% + }% + }% + }% + }% + {% +% \end{macrocode} +% Custom text provided in \cs{glsdisp}. (The insert should +% be empty at this point.) The accessibility information, if +% required, will have to be explicitly included in the custom text. +% \begin{macrocode} + \glscustomtext\glsinsert + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgenacfmt} +% Redefine to include accessibility information. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewcommand*{\glsgenacfmt}{% + \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} + \acronymfont + {\glsshortpluralaccessdisplay + {\glsentryshortpl{\glslabel}}{\glslabel}}% + \glsinsert + }% + {% +% \end{macrocode} +% Subsequent plural form, make first letter upper case: +% \begin{macrocode} + \acronymfont + {\glsshortpluralaccessdisplay + {\Glsentryshortpl{\glslabel}}{\glslabel}}% + \glsinsert + }% + {% +% \end{macrocode} +% Subsequent plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\acronymfont + {\glsshortpluralaccessdisplay + {\glsentryshortpl{\glslabel}}{\glslabel}}% + \glsinsert}% + }% + }% + {% +% \end{macrocode} +% Subsequent singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Subsequent singular form, don't adjust case: +% \begin{macrocode} + \acronymfont + {\glsshortaccessdisplay{\glsentryshort{\glslabel}}{\glslabel}}% + \glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, make first letter upper case: +% \begin{macrocode} + \acronymfont + {\glsshortaccessdisplay{\Glsentryshort{\glslabel}}{\glslabel}}% + \glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\acronymfont{% + \glsshortaccessdisplay{\glsentryshort{\glslabel}}{\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} + \genplacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, make first letter upper case: +% \begin{macrocode} + \Genplacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\genplacrfullformat{\glslabel}{\glsinsert}}% + }% + }% + {% +% \end{macrocode} +% First use singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% First use singular form, don't adjust case: +% \begin{macrocode} + \genacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, make first letter upper case: +% \begin{macrocode} + \Genacrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\genacrfullformat{\glslabel}{\glsinsert}}% + }% + }% + }% + }% + {% +% \end{macrocode} +% User supplied text. (The insert should be empty at this point.) +% The accessibility information, if +% required, will have to be explicitly included in the custom text. +% \begin{macrocode} + \glscustomtext + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\genacrfullformat} +% Redefine to include accessibility information. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewcommand*{\genacrfullformat}[2]{% + \glslongaccessdisplay{\glsentrylong{#1}}{#1}#2\space + (\glsshortaccessdisplay{\protect\firstacronymfont{\glsentryshort{#1}}}{#1})% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Genacrfullformat} +% Redefine to include accessibility information. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewcommand*{\Genacrfullformat}[2]{% + \glslongaccessdisplay{\Glsentrylong{#1}}{#1}#2\space + (\glsshortaccessdisplay{\protect\firstacronymfont{\Glsentryshort{#1}}}{#1})% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\genplacrfullformat} +% Redefine to include accessibility information. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewcommand*{\genplacrfullformat}[2]{% + \glslongpluralaccessdisplay{\glsentrylongpl{#1}}{#1}#2\space + (\glsshortpluralaccessdisplay + {\protect\firstacronymfont{\glsentryshortpl{#1}}}{#1})% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Genplacrfullformat} +% Redefine to include accessibility information. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewcommand*{\Genplacrfullformat}[2]{% + \glslongpluralaccessdisplay{\Glsentrylongpl{#1}}{#1}#2\space + (\glsshortpluralaccessdisplay + {\protect\firstacronymfont{\glsentryshortpl{#1}}}{#1})% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrshort} +%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}} +% \begin{macrocode} +\def\@acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsshortaccessdisplay{\glsentryshort{#2}}{#2}}#3% + }% +% \end{macrocode} +% Call \cs{@gls@link} +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrshort} +%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}} +% \begin{macrocode} +\def\@Acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsshortaccessdisplay{\Glsentryshort{#2}}{#2}}#3% + }% +% \end{macrocode} +% Call \cs{@gls@link} +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRshort} +%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}} +% \begin{macrocode} +\def\@ACRshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsshortaccessdisplay + {\MakeUppercase{\glsentryshort{#2}}}{#2}}#3% + }% +% \end{macrocode} +% Call \cs{@gls@link} +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrlong} +%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}} +% \begin{macrocode} +\def\@acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glslongaccessdisplay{\glsentrylong{#2}}{#2}}#3% + }% +% \end{macrocode} +% Call \cs{@gls@link} +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrlong} +%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}} +% \begin{macrocode} +\def\@Acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glslongaccessdisplay{\Glsentrylong{#2}}{#2}}#3% + }% +% \end{macrocode} +% Call \cs{@gls@link} +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRlong} +%\changes{4.08}{2014-07-30}{added \cs{do@gls@link@checkfirsthyper}} +% \begin{macrocode} +\def\@ACRlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\relax +% \end{macrocode} +%\changes{3.11a}{2013-10-15}{added \cs{glslabel}, \cs{glsifplural}, +% \cs{glscapscase}, \cs{glsinsert} and \cs{glscustomtext}} +%\changes{4.03}{2014-01-20}{removed \cs{glslabel} (defined in +%\cs{@gls@link})} +% \begin{macrocode} + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glslongaccessdisplay{% + \MakeUppercase{\glsentrylong{#2}}}{#2}#3}% + }% +% \end{macrocode} +% Call \cs{@gls@link} +% \begin{macrocode} + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\section{Displaying the Glossary} +%\changes{3.08a}{2013-09-28}{removed definition of \cs{@glossaryentryfield}} +%\changes{3.08a}{2013-09-28}{removed definition of \cs{@glossarysubentryfield}} +% +% We need to redefine the way the glossary entries are formatted to +% include the accessibility support. The predefined glossary styles +% use \ics{glossentryname}, \ics{glossentrydesc} and +% \ics{glossentrysymbol}, but we need to provide compatibility with +% earlier versions in case users have defined their own styles using +% \cs{accsuppglossaryentryfield} and +% \cs{accsuppglossarysubentryfield}. +% +% Now redefine \cs{glossentryname}, \cs{glossentrydesc} and +% \cs{glossentrysymbol} etc so they use the accessibility stuff. +% \begin{macrocode} +\renewcommand*{\glossentryname}[1]{% + \glsdoifexists{#1}% + {% + \glsnamefont{\glsnameaccessdisplay{\glsentryname{#1}}{#1}}% + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\renewcommand*{\glossentryname}[1]{% + \glsdoifexists{#1}% + {% + \glsnamefont{\glsnameaccessdisplay{\Glsentryname{#1}}{#1}}% + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\renewcommand*{\glossentrydesc}[1]{% + \glsdoifexists{#1}% + {% + \glsdescriptionaccessdisplay{\glsentrydesc{#1}}{#1}% + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\renewcommand*{\Glossentrydesc}[1]{% + \glsdoifexists{#1}% + {% + \glsdescriptionaccessdisplay{\Glsentrydesc{#1}}{#1}% + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\renewcommand*{\glossentrysymbol}[1]{% + \glsdoifexists{#1}% + {% + \glssymbolaccessdisplay{\glsentrysymbol{#1}}{#1}% + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\renewcommand*{\Glossentrysymbol}[1]{% + \glsdoifexists{#1}% + {% + \glssymbolaccessdisplay{\Glsentrysymbol{#1}}{#1}% + }% +} +% \end{macrocode} +% +%\begin{macro}{\accsuppglossaryentryfield} +% \begin{macrocode} +\newcommand*{\accsuppglossaryentryfield}[5]{% + \glossaryentryfield{#1}% + {\glsnameaccessdisplay{#2}{#1}}% + {\glsdescriptionaccessdisplay{#3}{#1}}% + {\glssymbolaccessdisplay{#4}{#1}}{#5}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\accsuppglossarysubentryfield} +% \begin{macrocode} +\newcommand*{\accsuppglossarysubentryfield}[6]{% + \glossarysubentryfield{#1}{#2}% + {\glsnameaccessdisplay{#3}{#2}}% + {\glsdescriptionaccessdisplay{#4}{#2}}% + {\glssymbolaccessdisplay{#5}{#2}}{#6}% +} +% \end{macrocode} +%\end{macro} +% +%\section{Acronyms} +% Redefine acronym styles provided by \styfmt{glossaries}: +% +%\begin{acrstyle}{long-short} +% \meta{long} (\meta{short}) acronym style. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{long-short}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + \renewcommand*{\genacrfullformat}[2]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}##2\space + (\glsshortaccessdisplay + {\protect\firstacronymfont{\glsentryshort{##1}}}{##1})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \glslongaccessdisplay{\Glsentrylong{##1}}{##1}##2\space + (\glsshortaccessdisplay + {\protect\firstacronymfont{\glsentryshort{##1}}}{##1})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}##2\space + (\glsshortpluralaccessdisplay + {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \glslongpluralaccessdisplay{\Glsentrylongpl{##1}}{##1}##2\space + (\glsshortpluralaccessdisplay + {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1})% + }% + \renewcommand*{\acronymentry}[1]{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}} + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{short-long} +% \meta{short} (\meta{long}) acronym style. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{short-long}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + \renewcommand*{\genacrfullformat}[2]{% + \glsshortaccessdisplay + {\protect\firstacronymfont{\glsentryshort{##1}}}{##1}##2\space + (\glslongaccessdisplay{\glsentrylong{##1}}{##1})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \glsshortaccessdisplay + {\protect\firstacronymfont{\Glsentryshort{##1}}}{##1}##2\space + (\glslongaccessdisplay{\glsentrylong{##1}}{##1})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsshortpluralaccessdisplay + {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1}##2\space + (\glslongpluralaccessdisplay + {\glsentrylongpl{##1}}{##1})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \glsshortpluralaccessdisplay + {\protect\firstacronymfont{\Glsentryshortpl{##1}}}{##1}##2\space + (\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1})% + }% + \renewcommand*{\acronymentry}[1]{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-short-desc} +% \meta{long} (\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{long-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-short}% +}% +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sc-short-desc} +% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{long-sc-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-sc-short}% +}% +{% + \GlsUseAcrStyleDefs{long-sc-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{long-sm-short-desc} +% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{long-sm-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-sm-short}% +}% +{% + \GlsUseAcrStyleDefs{long-sm-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{short-long-desc} +% \meta{short} (\marg{long}) acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{short-long-desc}% +{% + \GlsUseAcrEntryDispStyle{short-long}% +}% +{% + \GlsUseAcrStyleDefs{short-long}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{sc-short-long-desc} +% \meta{long} (\cs{textsc}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{sc-short-long-desc}% +{% + \GlsUseAcrEntryDispStyle{sc-short-long}% +}% +{% + \GlsUseAcrStyleDefs{sc-short-long}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{sm-short-long-desc} +% \meta{long} (\cs{textsmaller}\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{sm-short-long-desc}% +{% + \GlsUseAcrEntryDispStyle{sm-short-long}% +}% +{% + \GlsUseAcrStyleDefs{sm-short-long}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{dua} +% \meta{long} only acronym style. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{dua}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifdefempty\glscustomtext + {% + \ifglshaslong{\glslabel}% + {% + \glsifplural + {% +% \end{macrocode} +% Plural form: +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Plural form, don't adjust case: +% \begin{macrocode} + \glslongpluralaccessdisplay{\glsentrylongpl{\glslabel}}{\glslabel}% + \glsinsert + }% + {% +% \end{macrocode} +% Plural form, make first letter upper case: +% \begin{macrocode} + \glslongpluralaccessdisplay{\Glsentrylongpl{\glslabel}}{\glslabel}% + \glsinsert + }% + {% +% \end{macrocode} +% Plural form, all caps: +% \begin{macrocode} + \glslongpluralaccessdisplay + {\mfirstucMakeUppercase{\glsentrylongpl{\glslabel}}}{\glslabel}% + \mfirstucMakeUppercase{\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Singular form, don't adjust case: +% \begin{macrocode} + \glslongaccessdisplay{\glsentrylong{\glslabel}}{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, make first letter upper case: +% \begin{macrocode} + \glslongaccessdisplay{\Glsentrylong{\glslabel}}{\glslabel}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, all caps: +% \begin{macrocode} + \glslongaccessdisplay + {\mfirstucMakeUppercase + {\glsentrylong{\glslabel}\glsinsert}}{\glslabel}% + \mfirstucMakeUppercase{\glsinsert}% + }% + }% + }% + {% +% \end{macrocode} +% Not an acronym: +% \begin{macrocode} + \glsgenentryfmt + }% + }% + {\glscustomtext\glsinsert}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glslongaccessdisplay{\glsentrylong{##2}}{##2}##3\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2})}}% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glslongaccessdisplay{\Glsentrylong{##2}}{##2}##3\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2})}}% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \glslongaccessdisplay + {\mfirstucMakeUppercase{\glsentrylong{##2}}{##2}##3\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2})}}}% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glslongpluralaccessdisplay + {\glsentrylongpl{##2}}{##2}##3\space + (\glsshortpluralaccessdisplay + {\acronymfont{\glsentryshortpl{##2}}}{##2})}}% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glslongpluralaccessdisplay + {\Glsentrylongpl{##2}}{##2}##3\space + (\glsshortpluralaccessdisplay + {\acronymfont{\glsentryshortpl{##2}}}{##2})}}% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glslongpluralaccessdisplay + {\mfirstucMakeUppercase{\glsentrylongpl{##2}}{##2}##3\space + (\glsshortpluralaccessdisplay + {\acronymfont{\glsentryshortpl{##2}}}{##2})}}}% + \renewcommand*{\glsentryfull}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})% + }% + \renewcommand*{\Glsentryfull}[1]{% + \glslongaccessdisplay{\Glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})% + }% + \renewcommand*{\glsentryfullpl}[1]{% + \glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}\space + (\glsshortpluralaccessdisplay{\acronymfont{\glsentryshortpl{##1}}}{##1})% + }% + \renewcommand*{\Glsentryfullpl}[1]{% + \glslongpluralaccessdisplay{\Glsentrylongpl{##1}}{##1}\space + (\glsshortpluralaccessdisplay{\acronymfont{\glsentryshortpl{##1}}}{##1})% + }% + \renewcommand*{\acronymentry}[1]{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{dua-desc} +% \meta{long} only acronym style with user-supplied description. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{dua-desc}% +{% + \GlsUseAcrEntryDispStyle{dua}% +}% +{% + \GlsUseAcrStyleDefs{dua}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\acronymfont{\glsentrylong{##1}}}{##1}}% + \renewcommand*{\acronymsort}[2]{##2}% +}% +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote} +% \meta{short}\cs{footnote}\marg{long} acronym style. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{footnote}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% +% \end{macrocode} +% Need to ensure hyperlinks are switched off on first use: +% \begin{macrocode} + \glshyperfirstfalse + \renewcommand*{\genacrfullformat}[2]{% + \glsshortaccessdisplay + {\protect\firstacronymfont{\glsentryshort{##1}}}{##1}##2% + \protect\footnote{\glslongaccessdisplay{\glsentrylong{##1}}{##1}}% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \glsshortaccessdisplay + {\firstacronymfont{\Glsentryshort{##1}}}{##1}##2% + \protect\footnote{\glslongaccessdisplay{\glsentrylong{##1}}{##1}}% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsshortpluralaccessdisplay + {\protect\firstacronymfont{\glsentryshortpl{##1}}}{##1}##2% + \protect\footnote{\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}}% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \glsshortpluralaccessdisplay + {\protect\firstacronymfont{\Glsentryshortpl{##1}}}{##1}##2% + \protect\footnote{\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1}}% + }% + \renewcommand*{\acronymentry}[1]{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +% \end{macrocode} +% Don't use footnotes for \ics{acrfull}: +% \begin{macrocode} + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##2}}}{##2}##3\space + (\glslongaccessdisplay{\glsentrylong{##2}}{##2})}}% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glsshortaccessdisplay{\acronymfont{\Glsentryshort{##2}}}{##2}##3\space + (\glslongaccessdisplay{\glsentrylong{##2}}{##2})}}% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \glsshortaccessdisplay + {\mfirstucMakeUppercase + {\acronymfont{\glsentryshort{##2}}}{##2}##3\space + (\glslongaccessdisplay{\glsentrylong{##2}}{##2})}}}% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glsshortpluralaccessdisplay + {\acronymfont{\glsentryshortpl{##2}}}{##2}##3\space + (\glslongpluralaccessdisplay{\glsentrylongpl{##2}}{##2})}}% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glsshortpluralaccessdisplay + {\acronymfont{\Glsentryshortpl{##2}}}{##2}##3\space + (\glslongpluralaccessdisplay{\glsentrylongpl{##2}})}}% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glsshortpluralaccessdisplay + {\mfirstucMakeUppercase + {\acronymfont{\glsentryshortpl{##2}}}{##2}##3\space + (\glslongpluralaccessdisplay{\glsentrylongpl{##2}}{##2})}}}% +% \end{macrocode} +% Similarly for \ics{glsentryfull} etc: +% \begin{macrocode} + \renewcommand*{\glsentryfull}[1]{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}\space + (\glslongaccessdisplay{\glsentrylong{##1}}{##1})}% + \renewcommand*{\Glsentryfull}[1]{% + \glsshortaccessdisplay{\acronymfont{\Glsentryshort{##1}}}{##1}\space + (\glslongaccessdisplay{\glsentrylong{##1}}{##1})}% + \renewcommand*{\glsentryfullpl}[1]{% + \glsshortpluralaccessdisplay + {\acronymfont{\glsentryshortpl{##1}}}{##1}\space + (\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1})}% + \renewcommand*{\Glsentryfullpl}[1]{% + \glsshortpluralaccessdisplay + {\acronymfont{\Glsentryshortpl{##1}}}{##1}\space + (\glslongpluralaccessdisplay{\glsentrylongpl{##1}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sc} +% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{footnote-sc}% +{% + \GlsUseAcrEntryDispStyle{footnote}% +}% +{% + \GlsUseAcrStyleDefs{footnote}% + \renewcommand{\acronymentry}[1]{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}} + \renewcommand{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% +}% +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sm} +% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style. +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{footnote-sm}% +{% + \GlsUseAcrEntryDispStyle{footnote}% +}% +{% + \GlsUseAcrStyleDefs{footnote}% + \renewcommand{\acronymentry}[1]{% + \glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1}} + \renewcommand{\acronymfont}[1]{\textsmaller{##1}}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +}% +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-desc} +% \meta{short}\cs{footnote}\marg{long} acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{footnote-desc}% +{% + \GlsUseAcrEntryDispStyle{footnote}% +}% +{% + \GlsUseAcrStyleDefs{footnote}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sc-desc} +% \cs{textsc}\marg{short}\cs{footnote}\marg{long} acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{footnote-sc-desc}% +{% + \GlsUseAcrEntryDispStyle{footnote-sc}% +}% +{% + \GlsUseAcrStyleDefs{footnote-sc}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{acrstyle}{footnote-sm-desc} +% \cs{textsmaller}\marg{short}\cs{footnote}\marg{long} acronym style that has an +% accompanying description (which the user needs to supply). +%\changes{4.03}{2014-01-20}{redefined to use accessibility +%information} +% \begin{macrocode} +\renewacronymstyle{footnote-sm-desc}% +{% + \GlsUseAcrEntryDispStyle{footnote-sm}% +}% +{% + \GlsUseAcrStyleDefs{footnote-sm}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glslongaccessdisplay{\glsentrylong{##1}}{##1}\space + (\glsshortaccessdisplay{\acronymfont{\glsentryshort{##1}}}{##1})}% +} +% \end{macrocode} +%\end{acrstyle} +% +% Use \cs{newacronymhook} to modify the key list to set +% the access text to the long version by default. +% \begin{macrocode} +\renewcommand*{\newacronymhook}{% + \edef\@gls@keylist{shortaccess=\the\glslongtok,% + \the\glskeylisttok}% + \expandafter\glskeylisttok\expandafter{\@gls@keylist}% +} +% \end{macrocode} +%\begin{macro}{\DefaultNewAcronymDef} +% Modify default style to use access text: +% \begin{macrocode} +\renewcommand*{\DefaultNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\the\glsshorttok},% + description={\the\glslongtok},% + descriptionaccess=\relax, + text={\the\glsshorttok},% + access={\noexpand\@glo@textaccess},% + sort={\the\glsshorttok},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + shortaccess={\the\glslongtok},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},% + first={\noexpand\glslongaccessdisplay + {\the\glslongtok}{\the\glslabeltok}\space + (\noexpand\glsshortaccessdisplay + {\the\glsshorttok}{\the\glslabeltok})},% + plural={\the\glsshorttok\acrpluralsuffix},% + firstplural={\noexpand\glslongpluralaccessdisplay + {\noexpand\@glo@longpl}{\the\glslabeltok}\space + (\noexpand\glsshortpluralaccessdisplay + {\noexpand\@glo@shortpl}{\the\glslabeltok})},% + firstaccess=\relax, + firstpluralaccess=\relax, + textaccess={\noexpand\@glo@shortaccess},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@descplural\gls@assign@descplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@descplural##1##2{% + \@@gls@expand@field{##1}{descplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DescriptionFootnoteNewAcronymDef} +% \begin{macrocode} +\renewcommand*{\DescriptionFootnoteNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand\acronymfont{\the\glsshorttok}},% + sort={\the\glsshorttok},% + text={\the\glsshorttok},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + shortaccess={\the\glslongtok},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + access={\noexpand\@glo@textaccess},% + plural={\the\glsshorttok\noexpand\acrpluralsuffix},% + symbol={\the\glslongtok},% + symbolplural={\the\glslongtok\noexpand\acrpluralsuffix},% + firstpluralaccess=\relax, + textaccess={\noexpand\@glo@shortaccess},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\DescriptionNewAcronymDef} +% \begin{macrocode} +\renewcommand*{\DescriptionNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand + \acrnameformat{\the\glsshorttok}{\the\glslongtok}},% + access={\noexpand\@glo@textaccess},% + sort={\the\glsshorttok},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + shortaccess={\the\glslongtok},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + first={\the\glslongtok},% + firstaccess=\relax, + firstplural={\the\glslongtok\noexpand\acrpluralsuffix},% + text={\the\glsshorttok},% + textaccess={\the\glslongtok},% + plural={\the\glsshorttok\noexpand\acrpluralsuffix},% + symbol={\noexpand\@glo@text},% + symbolaccess={\noexpand\@glo@textaccess},% + symbolplural={\noexpand\@glo@plural},% + firstpluralaccess=\relax, + textaccess={\noexpand\@glo@shortaccess},% + \the\glskeylisttok}% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\FootnoteNewAcronymDef} +% \begin{macrocode} +\renewcommand*{\FootnoteNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand\acronymfont{\the\glsshorttok}},% + sort={\the\glsshorttok},% + text={\the\glsshorttok},% + textaccess={\the\glslongtok},% + access={\noexpand\@glo@textaccess},% + plural={\the\glsshorttok\noexpand\acrpluralsuffix},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + description={\the\glslongtok},% + descriptionplural={\the\glslongtok\noexpand\acrpluralsuffix},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@descplural\gls@assign@descplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@descplural##1##2{% + \@@gls@expand@field{##1}{descplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@descplural\@org@gls@assign@descplural +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\SmallNewAcronymDef} +% \begin{macrocode} +\renewcommand*{\SmallNewAcronymDef}{% + \edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\noexpand\acronymfont{\the\glsshorttok}},% + access={\noexpand\@glo@symbolaccess},% + sort={\the\glsshorttok},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + shortaccess={\the\glslongtok},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + text={\noexpand\@glo@short},% + textaccess={\noexpand\@glo@shortaccess},% + plural={\noexpand\@glo@shortpl},% + first={\the\glslongtok},% + firstaccess=\relax, + firstplural={\the\glslongtok\noexpand\acrpluralsuffix},% + description={\noexpand\@glo@first},% + descriptionplural={\noexpand\@glo@firstplural},% + symbol={\the\glsshorttok},% + symbolaccess={\the\glslongtok},% + symbolplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + \the\glskeylisttok + }% + }% + \let\@org@gls@assign@firstpl\gls@assign@firstpl + \let\@org@gls@assign@plural\gls@assign@plural + \let\@org@gls@assign@descplural\gls@assign@descplural + \let\@org@gls@assign@symbolplural\gls@assign@symbolplural + \def\gls@assign@firstpl##1##2{% + \@@gls@expand@field{##1}{firstpl}{##2}% + }% + \def\gls@assign@plural##1##2{% + \@@gls@expand@field{##1}{plural}{##2}% + }% + \def\gls@assign@descplural##1##2{% + \@@gls@expand@field{##1}{descplural}{##2}% + }% + \def\gls@assign@symbolplural##1##2{% + \@@gls@expand@field{##1}{symbolplural}{##2}% + }% + \@do@newglossaryentry + \let\gls@assign@firstpl\@org@gls@assign@firstpl + \let\gls@assign@plural\@org@gls@assign@plural + \let\gls@assign@descplural\@org@gls@assign@descplural + \let\gls@assign@symbolplural\@org@gls@assign@symbolplural +} +% \end{macrocode} +%\end{macro} +% +% The following are kept for compatibility with versions before +% 3.0: +%\begin{macro}{\glsshortaccesskey} +% \begin{macrocode} + \newcommand*{\glsshortaccesskey}{\glsshortkey access}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsshortpluralaccesskey} +% \begin{macrocode} + \newcommand*{\glsshortpluralaccesskey}{\glsshortpluralkey access}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongaccesskey} +% \begin{macrocode} + \newcommand*{\glslongaccesskey}{\glslongkey access}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongpluralaccesskey} +% \begin{macrocode} + \newcommand*{\glslongpluralaccesskey}{\glslongpluralkey access}% +% \end{macrocode} +%\end{macro} +%\section{Debugging Commands} +% +%\begin{macro}{\showglonameaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +%\changes{4.38}{2018-05-10}{bug fix: corrected field (was showing text access field)} +% \begin{macrocode} +\newcommand*{\showglonameaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@access\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglotextaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglotextaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@textaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglopluralaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglopluralaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@pluralaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglofirstaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglofirstaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@firstaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglofirstpluralaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglofirstpluralaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@firstpluralaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglosymbolaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglosymbolaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@symbolaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglosymbolpluralaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglosymbolpluralaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@symbolpluralaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglodescaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglodescaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@descaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglodescpluralaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglodescpluralaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@descpluralaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showgloshortaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloshortaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@shortaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showgloshortpluralaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showgloshortpluralaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@shortpluralaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglolongaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglolongaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@longaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\showglolongpluralaccess} +%\changes{4.03}{2014-01-20}{added \cs{glsdetoklabel}} +% \begin{macrocode} +\newcommand*{\showglolongpluralaccess}[1]{% + \expandafter\show\csname glo@\glsdetoklabel{#1}@longpluralaccess\endcsname +} +% \end{macrocode} +%\end{macro} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-babel.sty> +% \end{macrocode} +%\fi +%\chapter{Multi-Lingual Support} +% Many thanks to everyone who contributed to the translations both +% via email and on comp.text.tex. +% Language support has now been split off into independent language +% modules. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-babel}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Load \sty{tracklang} to obtain language settings. +% \begin{macrocode} +\RequirePackage{tracklang} +\let\glsifusetranslator\@secondoftwo +% \end{macrocode} +% Check for tracked languages: +% \begin{macrocode} + \AnyTrackedLanguages + {% + \ForEachTrackedDialect{\this@dialect}{% + \IfTrackedLanguageFileExists{\this@dialect}% + {glossaries-}% prefix + {.ldf}% + {% + \RequireGlossariesLang{\CurrentTrackedTag}% + }% + {% + \PackageWarningNoLine{glossaries}% + {No language module detected for `\this@dialect'.\MessageBreak + Language modules need to be installed separately.\MessageBreak + Please check on CTAN for a bundle called\MessageBreak + `glossaries-\CurrentTrackedLanguage' or similar}% + }% + }% + }% + {}% +% \end{macrocode} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries-polyglossia.sty> +% \end{macrocode} +%\fi +%\section{Polyglossia Captions} +% Language support has now been split off into independent language +% modules. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-polyglossia}[2019/01/06 v4.42 (NLCT)] +% \end{macrocode} +% Load \sty{tracklang} to obtain language settings. +% \begin{macrocode} +\RequirePackage{tracklang} +\let\glsifusetranslator\@secondoftwo +% \end{macrocode} +% Check for tracked languages: +% \begin{macrocode} + \AnyTrackedLanguages + {% + \ForEachTrackedDialect{\this@dialect}{% + \IfTrackedLanguageFileExists{\this@dialect}% + {glossaries-}% prefix + {.ldf}% + {% + \RequireGlossariesLang{\CurrentTrackedTag}% + }% + {% + \PackageWarningNoLine{glossaries}% + {No language module detected for `\this@dialect'.\MessageBreak + Language modules need to be installed separately.\MessageBreak + Please check on CTAN for a bundle called\MessageBreak + `glossaries-\CurrentTrackedLanguage' or similar}% + }% + }% + }% + {}% +% \end{macrocode} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*minimalgls.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain. + % + % This is a minimal file for testing and debugging + % the glossaries package. Change the class file as + % desired, and add the relevant package options to + % both the class file and the glossaries package. + % Change the sample glossary entry and acronym if + % required. If the problem occurs with an additional + % glossary, add in the relevant \newglossary command + % and a sample entry. + % + % Only add extra packages or commands if they + % contribute to whatever problem you are trying to + % test. + % + % Remember that the document will not be complete + % until you have successfully completed all of the + % following steps: + % 1. latex minimalgls + % 2. makeglossaries minimalgls (note no extension) + % 3. latex minimalgls + % A further run through LaTeX will be required to ensure that + % the table of contents is up to date if the toc option + % is used. + % Alternatively, if you use arara, you can add the following + % directives in your document: + % + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + + % If you require multilingual support you must also install + % the appropriate glossaries language module. The language + % modules are distributed separately. + +\documentclass{article} +\listfiles + +\usepackage[colorlinks]{hyperref} + %\usepackage{glossaries} % abbreviation will go in main glossary + \usepackage[acronym]{glossaries} % make a separate list of acronyms + +\makeglossaries + +\longnewglossaryentry{par}{name={par}}% +{% + A long description with a paragraph break. + + This is the next paragraph. +} + +\newglossaryentry{sample}{name={sample}, +description={a sample entry}} + + % set the acronym style: +\setacronymstyle{long-short} + + % This contrived acronym has non-standard plural forms. + % These are specified in the optional argument. + % Remove the optional argument to revert to the default + % plurals. +\newacronym[\glsshortpluralkey=cas,\glslongpluralkey=contrived +acronyms]{aca}{aca}{a contrived acronym} + + % Keep all definitions in the preamble! + +\begin{document} + +A \gls{sample} entry and \gls{aca}. Second use: \gls{aca}. + +Plurals: \glspl{sample}. Reset acronym\glsreset{aca}. +First use: \glspl{aca}. Second use: \glspl{aca}. + +\glsresetall +First letter upper case: \Gls{sample}. First use: \Gls{aca}. +Subsequent use: \Gls{aca}. +\glsresetall +Plurals: \Glspl{sample}. First use: \Glspl{aca}. Next: \Glspl{aca}. + +If you want paragraph breaks in the description use +\verb|\longnewglossaryentry|, as with entry \gls{par}. + +Title case a particular field: +\glslink{sample}{\glsentrytitlecase{sample}{desc}}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossary-lipsum-examples.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex + % arara: bibtex + % arara: pdflatex + % arara: pdflatex +\documentclass{report} + +\usepackage{graphicx} + +\usepackage[colorlinks]{hyperref} +\usepackage[savewrites,nopostdot,toc,acronym,symbols]{glossaries} +\usepackage{glossary-mcols} +\usepackage{glossary-longragged} + +\newglossary*{symbolname}{Entries with Symbols in the Name} +\newglossary*{long}{Long Descriptions} +\newglossary*{multipar}{Multi-Paragraph Descriptions} +\newglossary*{acronymdesc}{Acronyms with Descriptions} +\newglossary*{images}{Descriptions with Images} +\newglossary*{acronymslang}{Acronyms with Translations} + +\newglossary*{parent}{Hierarchical Entries} +\newglossary*{homographs}{Homographs} +\newglossary*{cites}{Entries with Citations} +\newglossary*{urls}{Entries with URLs} + +\DeclareAcronymList{acronymdesc,acronymslang} + +\makeglossaries + +\loadglsentries{example-glossaries-brief} +\loadglsentries[long]{example-glossaries-long} +\loadglsentries[multipar]{example-glossaries-multipar} +\loadglsentries[symbols]{example-glossaries-symbols} +\loadglsentries[symbolname]{example-glossaries-symbolnames} +\loadglsentries[images]{example-glossaries-images} +\loadglsentries[parent]{example-glossaries-parent} +\loadglsentries[homographs]{example-glossaries-childnoname} +\loadglsentries[cites]{example-glossaries-cite} +\loadglsentries[urls]{example-glossaries-url} + +\setacronymstyle{long-short} + +\loadglsentries[acronym]{example-glossaries-acronym} + +\setacronymstyle{long-short-desc} + +\loadglsentries[acronymdesc]{example-glossaries-acronym-desc} + + % define an acronym style for the acronyms with a translation: + +\newacronymstyle{acronymslang}% +{% + \GlsUseAcrEntryDispStyle{long-short}% +} +{% + \GlsUseAcrStyleDefs{short-long}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% +} + +\setacronymstyle{acronymslang} + +\loadglsentries[acronymslang]{example-glossaries-acronyms-lang} + + % Define a style for the "images" glossary. The image names are + % stored in the user1 key. + % (The image insertion can probably be done more neatly using an + % appropriate package, but this is just a sample file.) + +\newsavebox\glsimagebox +\newlength\glswidth + +\newglossarystyle{images}% +{% + \setglossarystyle{tree}% + \renewenvironment{theglossary}{}{}% + \renewcommand{\glossentry}[2]{% + \ifglshasfield{useri}{##1}% + {\savebox + {\glsimagebox}% + {\includegraphics[height=4\baselineskip]{\glsentryuseri{##1}}}% + \settowidth{\glswidth}{\usebox\glsimagebox}% + \glswidth=\dimexpr\linewidth-\glswidth-1em\relax + \parshape=5 + 0pt \glswidth + 0pt \glswidth + 0pt \glswidth + 0pt \glswidth + 0pt \linewidth\relax + }% + {% + \savebox{\glsimagebox}{}% + }% + \noindent + \makebox[0pt][l]{% + \smash{\makebox[\linewidth][r]{\raisebox{-3\baselineskip}{\usebox\glsimagebox}}}}% + \glsentryitem{##1}\textbf{\glstarget{##1}{\glossentryname{##1}}}% + \space\glossentrydesc{##1}\par + \indexspace + }% + \renewcommand*{\glsgroupskip}{}% +} + + % glossary style for acronyms with a translation + +\newglossarystyle{acronymslang} +{% + \setglossarystyle{long}% + \renewcommand*{\glsgroupskip}{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription + \ifglshasfield{useri}{##1}{ (English: \glsentryuseri{##1})}{}% + \space ##2\tabularnewline + }% +} + + % glossary style for the cites glossary + +\newglossarystyle{cites} +{% based on list style + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription + \ifglshasfield{useri}{##1}{\space + % in the event of multiple cites (as in the vestibulum2 + % sample entry), \glsentryuseri{##1} needs to be expanded + % before being passed to \cite. + \glsletentryfield{\thiscite}{##1}{useri}% + (See \expandafter\cite\expandafter{\thiscite})}{}% + \space ##2}% +} + + % glossary style for the urls glossary + +\newglossarystyle{urls} +{% based on list style + \setglossarystyle{list}% + \renewcommand{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription\space##2% + \ifglshasfield{useri}{##1}{\glspar + \glsletentryfield{\thisurl}{##1}{useri}% + \expandafter\url\expandafter{\thisurl}}{}}% +} + +\begin{document} +\tableofcontents + +\chapter{Sample} + +This is a sample document that uses the dummy glossary entries +supplied with the glossaries bundle for testing. + +Here are all the entries (including acronyms): + +\forallglossaries{\thistype}{\section{Glossary `\thistype'} +\forglsentries[\thistype]{\thislabel}{\gls{\thislabel}. }} + +\section{Acronyms Revisited} + +Here are just the acronyms again: +\forallacronyms{\thistype}{\forglsentries[\thistype]{\thislabel}{\gls{\thislabel}. }} + +\printglossary[style=mcolindex,title={Brief Descriptions}] + +\printglossary[type=long,style=list] + +\printglossary[type=multipar,style=altlist] + +\printglossary[type=symbols,style=altlongragged4col,nogroupskip] + +\printglossary[type=symbolname,style=list,nogroupskip] + +\printglossary[type=acronym,style=long] + +\printglossary[type=acronymdesc,style=altlist] + +\printglossary[type=images,style=images] + +\printglossary[type=acronymslang,style=acronymslang] + +\printglossary[type=homographs,style=mcoltreenoname,subentrycounter] + +\printglossary[type=parent,style=tree] + +\printglossary[type=cites,style=cites,nopostdot=false,nogroupskip] + +\printglossary[type=urls,style=urls,nopostdot=false,nogroupskip] + +\bibliographystyle{plain} +\bibliography{xampl} + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-acronym-desc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test acronym entries with descriptions. + +\newacronym[type=\glsdefaulttype,description={fringilla a, euismod sodales, + sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula} + +\newacronym[type=\glsdefaulttype,description={non justo}]{mal}{MAL}{morbi auctor lorem} + +\newacronym[type=\glsdefaulttype,description={pretium at, lobortis vitae, ultricies et, +tellus}]{nll}{NLL}{name lacus libero} + +\newacronym[type=\glsdefaulttype,description={tortor sed accumsan bibendum, erat ligula +aliquet magna, vitae ornare odio metus a mi}]{da}{DA}{donec aliquet} + +\newacronym[type=\glsdefaulttype,description={et nisl hendrerit mollis}]{mao}{MAO}{morbi ac orci} + +\newacronym[type=\glsdefaulttype,description={cras nec ante}]{sum}{SUM}{suspendisse ut massa} + +\newacronym[type=\glsdefaulttype,description={cum sociis natoque penatibus et magnis dis +parturient montes, nascetur ridiculus mus}]{pan}{PAN}{pellentesque a nulla} + +\newacronym[type=\glsdefaulttype,description={nulla ullamcorper vestibulum +turpis}]{atu}{ATU}{aliquam tincidunt urna} + +\newacronym[type=\glsdefaulttype,description={nulla malesuada porttitor diam}]% + {pclm}{PCLM}{pellentesque cursus luctus mauris} + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-acronym.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test acronym entries + +\newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum dolor} + +\newacronym[type=\glsdefaulttype]{stc}{STC}{sit amet consectetuer} + +\newacronym[type=\glsdefaulttype]{aeu}{AEU}{adipiscing elit ut} + +\newacronym[type=\glsdefaulttype]{pev}{PEV}{purus elit vestibulum} + +\newacronym[type=\glsdefaulttype]{upa}{UPA}{ut placerat ac} + +\newacronym[type=\glsdefaulttype]{avf}{AVF}{adipiscing vitae felis} + +\newacronym[type=\glsdefaulttype]{cdg}{CDG}{curabitur dictum gravida} + +\newacronym[type=\glsdefaulttype]{mna}{MNA}{mauris nam arcu} + +\newacronym[type=\glsdefaulttype]{lne}{LNE}{libero nonummy eget} + +\newacronym[type=\glsdefaulttype]{civ}{CIV}{consectetuer id vulputate} + +\newacronym[type=\glsdefaulttype]{amd}{AMD}{a magna donec} + +\newacronym[type=\glsdefaulttype]{vae}{VAE}{vehicula augue eu} + +\newacronym[type=\glsdefaulttype]{nph}{NPH}{neque pellentesque habitant} + +\newacronym[type=\glsdefaulttype]{mts}{MTS}{morbi tristique senectus} + +\newacronym[type=\glsdefaulttype]{ene}{ENE}{et netus et} + +\newacronym[type=\glsdefaulttype]{mfa}{MFA}{malesuada fames ac} + +\newacronym[type=\glsdefaulttype]{tem}{TEM}{turpis egestas mauris} + +\newacronym[type=\glsdefaulttype]{ulc}{ULC}{ut leo cras} + +\newacronym[type=\glsdefaulttype]{vmr}{VMR}{viverra metus rhoncus} + +\newacronym[type=\glsdefaulttype]{sne}{SNE}{sem nulla et} + +\newacronym[type=\glsdefaulttype]{lvu}{LVU}{lectus vestibulum urna} + +\newacronym[type=\glsdefaulttype]{fup}{FUP}{fringilla ultrices phasellus} + +\newacronym[type=\glsdefaulttype]{ets}{ETS}{eu tellus sit} + +\newacronym[type=\glsdefaulttype]{atg}{ATG}{amet tortor gravida} + +\newacronym[type=\glsdefaulttype]{pis}{PIS}{placerat integer sapien} + +\newacronym[type=\glsdefaulttype]{eii}{EII}{est iaculis in} + +\newacronym[type=\glsdefaulttype]{pqv}{PQV}{pretium quis viverra} + +\newacronym[type=\glsdefaulttype]{anp}{ANP}{ac nunc praesent} + +\newacronym[type=\glsdefaulttype]{esv}{ESV}{eget sem vel} + +\newacronym[type=\glsdefaulttype]{lub}{LUB}{leo ultrices bibendum} + +\newacronym[type=\glsdefaulttype]{afm}{AFM}{aenean faucibus morbi} + +\newacronym[type=\glsdefaulttype]{dnm}{DNM}{dolor nulla malesuada} + +\newacronym[type=\glsdefaulttype]{epa}{EPA}{eu pulvinar at} + +\newacronym[type=\glsdefaulttype]{man}{MAC}{mollis ac nulla} + +\newacronym[type=\glsdefaulttype]{cas}{CAS}{curabitur auctor semper} + +\newacronym[type=\glsdefaulttype]{ndv}{NDV}{nulla donec varius} + +\newacronym[type=\glsdefaulttype]{oer}{OER}{orci eget risus} + +\newacronym[type=\glsdefaulttype]{dnmc}{DNMC}{duis nibh mi congue} + +\newacronym[type=\glsdefaulttype]{cea}{CEA}{congue eu accumsan} + +\newacronym[type=\glsdefaulttype]{esq}{ESQ}{eleifend sagittis quis} + +\newacronym[type=\glsdefaulttype]{dia}{DIA}{duis eget orci} + +\newacronym[type=\glsdefaulttype]{sao}{SAO}{sit amet orci} + +\newacronym[type=\glsdefaulttype]{drn}{DRN}{dignissim rutrum nam} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-acronyms-lang.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test acronym entries where some are provided with + % "translations", which are stored in the user1 key. + +\newacronym[type=\glsdefaulttype,user1={love itself}]{li}{LI}{lorem ipsum} + +\newacronym[type=\glsdefaulttype,user1={produces none}]{np}{NP}{nulla pariatur} + +\newacronym[type=\glsdefaulttype,user1={blame belongs}]{sic}{SIC}{sunt in culpa} + +\newacronym[type=\glsdefaulttype,user1={blinded by +desire}]{esoc}{ESOC}{excepturi sint obcaecati cupiditat} + +\newacronym[type=\glsdefaulttype]{nmruu}{NMRUU}{nulla malesuada +risus ut urna} + +\newacronym[type=\glsdefaulttype]{di}{DI}{duis iaculi} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-brief.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with brief descriptions. + +\newglossaryentry{lorem}{name={lorem},description={ipsum}} + +\newglossaryentry{dolor}{name={dolor},description={sit}} + +\newglossaryentry{amet}{name={amet},description={consectetuer}} + +\newglossaryentry{adipiscing}{name={adipiscing},description={elit}} + +\newglossaryentry{ut}{name={ut},description={purus}} + +\newglossaryentry{elit}{name={elit},description={vestibulum}} + +\newglossaryentry{placerat}{name={placerat},description={ac}} + +\newglossaryentry{vitae}{name={vitae},description={felis}} + +\newglossaryentry{curabitur}{name={curabitur},description={gravida}} + +\newglossaryentry{mauris}{name={mauris},description={nam}} + +\newglossaryentry{arcu}{name={arcu},description={libero}} + +\newglossaryentry{nonummy}{name={nonummy},description={eget}} + +\newglossaryentry{consectetuer}{name={consectetuer},description={id}} + +\newglossaryentry{vulputate}{name={vulputate},description={a magna}} + +\newglossaryentry{donec}{name={donec},description={vehicula}} + +\newglossaryentry{augue}{name={augue},description={eu neque}} + +\newglossaryentry{pellentesque}{name={pellentesque},description={habitant}} + +\newglossaryentry{morbi}{name={morbi},description={tristique}} + +\newglossaryentry{senectus}{name={senectus},description={et netus}} + +\newglossaryentry{et}{name={et},description={malesuada}} + +\newglossaryentry{fames}{name={fames},description={ac}} + +\newglossaryentry{turpis}{name={turpis},description={egestas}} + +\newglossaryentry{leo}{name={leo},description={cras}} + +\newglossaryentry{viverra}{name={viverra},description={metus}} + +\newglossaryentry{rhoncus}{name={rhoncus},description={sem}} + +\newglossaryentry{nulla}{name={nulla},description={et}} + +\newglossaryentry{lectus}{name={lectus},description={vestibulum}} + +\newglossaryentry{urna}{name={urna},description={fringilla}} + +\newglossaryentry{ultrices}{name={ultrices},description={phasellus}} + +\newglossaryentry{eu}{name={eu},description={tellus}} + +\newglossaryentry{sit}{name={sit},description={amet}} + +\newglossaryentry{tortor}{name={tortor},description={gravida}} + +\newglossaryentry{integer}{name={integer},description={sapien}} + +\newglossaryentry{est}{name={est},description={iaculis}} + +\newglossaryentry{in}{name={in},description={pretium}} + +\newglossaryentry{quis}{name={quis},description={viverra}} + +\newglossaryentry{ac}{name={ac},description={nunc}} + +\newglossaryentry{praesent}{name={praesent},description={eget}} + +\newglossaryentry{sem}{name={sem},description={vel leo}} + +\newglossaryentry{bibendum}{name={bibendum},description={ultrices}} + +\newglossaryentry{aenean}{name={aenean},description={faucibus}} + +\newglossaryentry{malesuada}{name={malesuada},description={eu}} + +\newglossaryentry{pulvinar}{name={pulvinar},description={at}} + +\newglossaryentry{mollis}{name={mollis},description={ac nulla}} + +\newglossaryentry{auctor}{name={auctor},description={semper}} + +\newglossaryentry{varius}{name={varius},description={orci}} + +\newglossaryentry{eget}{name={eget},description={risus}} + +\newglossaryentry{duis}{name={duis},description={nibh}} + +\newglossaryentry{mi}{name={mi},description={congue}} + +\newglossaryentry{accumsan}{name={accumsan},description={eleifend}} + +\newglossaryentry{sagittis}{name={sagittis},description={quis}} + +\newglossaryentry{diam}{name={diam},description={duis}} + +\newglossaryentry{orci}{name={orci},description={dignissim}} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-childnoname.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with child entries that don't have + % a name supplied. (The name is the same as the parent name.) + +\newglossaryentry{scelerisque}{name={scelerisque},description={at}} + +\newglossaryentry{vestibulum}{parent={scelerisque},description={eu, nulla}} + +\newglossaryentry{utodionisl}{parent={scelerisque},description={facilisis id}} + +\newglossaryentry{molliset}{parent={scelerisque},description={nec, enim}} + +\newglossaryentry{aeneansem}{parent={scelerisque},description={sem leo}} + +\newglossaryentry{pellentesquesit}{parent={scelerisque},description={sit amet}} + +\newglossaryentry{sapien}{parent={scelerisque},description={vehicula +pellentesque}} + +\newglossaryentry{consequat}{parent={scelerisque},description={tellus +et tortor}} + +\newglossaryentry{uttempor}{name={ut tempor},description={laoreet +quam}} + +\newglossaryentry{nullamid}{parent={uttempor},description={wisi a +libero}} + +\newglossaryentry{tristique}{parent={uttempor},description={semper}} + +\newglossaryentry{nullamnislmassa}{parent={uttempor},description={rutrum +ut}} + +\newglossaryentry{eleifend}{name={eleifend},description={sit amet +faucibus}} + +\newglossaryentry{elementum}{parent={eleifend},description={elementum}} + +\newglossaryentry{urnasapien}{parent={eleifend},description={urna sapien}} + +\newglossaryentry{consectetuermauris}{name={consectetuer},description={mauris}} + +\newglossaryentry{quisegestas}{parent={consectetuermauris},description={quis egestas}} + +\newglossaryentry{leojusto}{parent={consectetuermauris},description={leo +justo}} + +\newglossaryentry{nonrisus}{name={non risus},description={morbi non +felis}} + +\newglossaryentry{aclibero}{parent={nonrisus},description={ac libero}} + +\newglossaryentry{vulputatefringilla}{parent={nonrisus},description={vulputate +fringilla}} + +\newglossaryentry{maurislibero}{name={mauris},description={libero eros}} + +\newglossaryentry{lacinia}{parent={maurislibero},description={lacinia +non}} + +\newglossaryentry{sodales}{parent={maurislibero},description={sodales +quis}} + +\newglossaryentry{dapibus}{parent={maurislibero},description={dapibus +porttitor, pede}} + +\newglossaryentry{class}{name={class},description={aptent taciti}} + +\newglossaryentry{sociosqu}{parent={class},description={sociosqu}} + +\newglossaryentry{adlitora}{parent={class},description={ad litora}} + +\newglossaryentry{torquent}{parent={class},description={torquent per +conubia}} + +\newglossaryentry{nostra}{name={nostra},description={per inceptos +hymenaeos}} + +\newglossaryentry{morbidapibus}{parent={nostra},description={morbi +dapibus}} + +\newglossaryentry{mauriscondimentum}{parent={nostra},description={mauris +condimentum nulla}} + +\newglossaryentry{cumsociis}{name={cum sociis},description={natoque +penatibus}} + +\newglossaryentry{etmagnis}{parent={cumsociis},description={et +magnis}} + +\newglossaryentry{disparturient}{parent={cumsociis},description={dis +parturient montes}} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-cite.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with citation labels stored in + % the user1 field. (The citations are defined in the xampl.bib file + % that should be available on modern TeX distributions.) + +\newglossaryentry{fusce}{name={fusce}, +description={suscipit cursus sem},user1={article-minimal}} + +\newglossaryentry{vivamus}{name={vivamus}, +description={risus mi, egestas ac},user1={article-full}} + +\newglossaryentry{imperdiet}{name={imperdiet}, +description={varius, faucibus quis, leo},user1={whole-journal}} + +\newglossaryentry{aenean2}{name={aenean}, +description={tincidunt},user1={inbook-minimal}} + +\newglossaryentry{crasid}{name={cras id}, +description={justo quis nibh scelerisque dignissim}, +user1={inbook-full}} + +\newglossaryentry{aliquam2}{name={aliquam}, +description={sagittis elementum dolor}, +user1={book-minimal}} + +\newglossaryentry{aeneanconsectetuer}{name={aenean consectetuer}, +description={justo in pede}, +user1={book-full}} + +\newglossaryentry{curabiturullamcorper}{name={curabitur ullamcorper}, +description={ligula nec orci}, +user1={booklet-minimal}} + +\newglossaryentry{aliquampurus}{name={aliquam purus}, +description={turpis, aliquam id}, +user1={booklet-full}} + +\newglossaryentry{ornarevitae}{name={ornare vitae}, +description={porttitor non, wisi}, +user1={incollection-minimal}} + +\newglossaryentry{maecenasluctus}{name={maecenas luctus}, +description={porta lorem}, +user1={incollection-full}} + +\newglossaryentry{donecvitae}{name={donec vitae}, +description={ligula eu ante pretium varius}, +user1={manual-minimal}} + +\newglossaryentry{proin}{name={proin}, +description={tortor metus, convallis et}, +user1={manual-full}} + +\newglossaryentry{hendrerit}{name={hendrerit}, +description={non, scelerisque in, urna}, +user1={mastersthesis-minimal}} + +\newglossaryentry{crasquis}{name={cras qui}, +description={libero eu ligula bibendum tempor}, +user1={mastersthesis-full}} + +\newglossaryentry{vivamustellus}{name={vivamus tellus}, +description={quam, malesuada eu, tempus sed, tempor sed, velit}, +user1={misc-minimal}} + +\newglossaryentry{doneclacinia}{name={donec lacinia}, +description={auctor libero}, +user1={misc-full}} + +\newglossaryentry{praesent2}{name={praesent}, +description={sed neque id pede mollis rutrum}, +user1={inproceedings-minimal}} + + % Here's one with multiple cites: +\newglossaryentry{vestibulum2}{name={vestibulum}, +description={iaculis risus}, +user1={inproceedings-minimal,phdthesis-minimal}} + + % Here's one without a user1 key for comparison: +\newglossaryentry{pellentesque2}{name={pellentesque}, +description={lacus}} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-images.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with multi-paragraph descriptions + % that have an associated image file (stored in user1). + % The referenced image files are provided by the mwe package. + +\longnewglossaryentry{sedfeugiat}{name={sed feugiat},user1={example-image}}% +{% +Cum sociis natoque penatibus et magnis dis parturient montes, +nascetur ridiculus mus. Ut pellentesque augue sed urna. Vestibulum +diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam +at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit +amet massa. Fusce blandit. Aliquam erat volutpat. Aliquam euismod. +Aenean vel lectus. Nunc imperdiet justo nec dolor. + +Etiam euismod. Fusce facilisis lacinia dui. Suspendisse potenti. In +mi erat, cursus id, nonummy sed, ullamcorper eget, sapien. Praesent +pretium, magna in eleifend egestas, pede pede pretium lorem, quis +consectetuer tortor sapien facilisis magna. Mauris quis magna +varius nulla scelerisque imperdiet. Aliquam non quam. Aliquam +porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat. +In vitae pede quis diam bibendum placerat. Fusce elementum convallis +neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut, +mi. Duis nec dui quis leo sagittis commodo. +} + +\longnewglossaryentry{aliquamlectus}% +{name={aliquam lectus},user1={example-image-a}}% +{% +Vivamus leo. Quisque ornare tellus ullamcorper nulla. Mauris +porttitor pharetra tortor. Sed fringilla justo sed mauris. Mauris +tellus. Sed non leo. Nullam elementum, magna in cursus sodales, +augue est scelerisque sapien, venenatis congue nulla arcu et pede. +Ut suscipit enim vel sapien. Donec congue. Maecenas urna mi, +suscipit in, placerat ut, vestibulum ut, massa. Fusce ultrices nulla +et nisl. + +Etiam ac leo a risus tristique nonummy. Donec dignissim tincidunt +nulla. Vestibulum rhoncus molestie odio. Sed lobortis, justo et +pretium lobortis, mauris turpis condimentum augue, nec ultricies +nibh arcu pretium enim. Nunc purus neque, placerat id, imperdiet +sed, pellentesque nec, nisl. Vestibulum imperdiet neque non sem +accumsan laoreet. In hac habitasse platea dictumst. Etiam +condimentum facilisis libero. Suspendisse in elit quis nisl aliquam +dapibus. Pellentesque auctor sapien. Sed egestas sapien nec lectus. +Pellentesque vel dui vel neque bibendum viverra. Aliquam porttitor +nisl nec pede. Proin mattis libero vel turpis. Donec rutrum mauris +et libero. Proin euismod porta felis. Nam lobortis, metus quis +elementum commodo, nunc lectus elementum mauris, eget vulputate +ligula tellus eu neque. Vivamus eu dolor. +} + +\longnewglossaryentry{nullainipsum}% +{name={nulla in ipsum},user1={example-image-b}}% +{% + Praesent eros nulla, congue vitae, euismod ut, commodo a, wisi. +Pellentesque habitant morbi tristique senectus et netus et malesuada +fames ac turpis egestas. Aenean nonummy magna non leo. Sed felis +erat, ullamcorper in, dictum non, ultricies ut, lectus. Proin vel +arcu a odio lobortis euismod. Vestibulum ante ipsum primis in +faucibus orci luctus et ultrices posuere cubilia Curae; Proin ut +est. Aliquam odio. Pellentesque massa turpis, cursus eu, euismod +nec, tempor congue, nulla. Duis viverra gravida mauris. Cras +tincidunt. Curabitur eros ligula, varius ut, pulvinar in, cursus +faucibus, augue. + +Nulla mattis luctus nulla. Duis commodo velit at leo. Aliquam +vulputate magna et leo. Nam vestibulum ullamcorper leo. Vestibulum +condimentum rutrum mauris. Donec id mauris. Morbi molestie justo et +pede. Vivamus eget turpis sed nisl cursus tempor. Curabitur mollis +sapien condimentum nunc. In wisi nisl, malesuada at, dignissim sit +amet, lobortis in, odio. Aenean consequat arcu a ante. Pellentesque +porta elit sit amet orci. Etiam at turpis nec elit ultricies +imperdiet. Nulla facilisi. In hac habitasse platea dictumst. +Suspendisse viverra aliquam risus. Nullam pede justo, molestie +nonummy, scelerisque eu, facilisis vel, arcu. +} + +\longnewglossaryentry{curabiturtellusmagna}% +{name={curabitur tellus magna},user1={example-image-c}}% +{% +Donec interdum. Praesent scelerisque. Maecenas posuere sodales +odio. Vivamus metus lacus, varius quis, imperdiet quis, rhoncus a, +turpis. Etiam ligula arcu, elementum a, venenatis quis, sollicitudin +sed, metus. Donec nunc pede, tincidunt in, venenatis vitae, faucibus +vel, nibh. Pellentesque wisi. Nullam malesuada. Morbi ut tellus ut +pede tincidunt porta. Lorem ipsum dolor sit amet, consectetuer +adipiscing elit. Etiam congue neque id dolor. + +Donec et nisl at wisi luctus bibendum. Nam interdum tellus ac +libero. Sed sem justo, laoreet vitae, fringilla at, adipiscing ut, +nibh. Maecenas non sem quis tortor eleifend fermentum. Etiam id +tortor ac mauris porta vulputate. Integer porta neque vitae massa. +Maecenas tempus libero a libero posuere dictum. Vestibulum ante +ipsum primis in faucibus orci luctus et ultrices posuere cubilia +Curae; Aenean quis mauris sed elit commodo placerat. Class aptent +taciti sociosqu ad litora torquent per conubia nostra, per inceptos +hymenaeos. Vivamus rhoncus tincidunt libero. Etiam elementum pretium +justo. Vivamus est. Morbi a tellus eget pede tristique commodo. +Nulla nisl. Vestibulum sed nisl eu sapien cursus rutrum. +} + +\longnewglossaryentry{nullanonmauris}% +{name={nulla non mauris},user1={example-image-16x10}}% +{% +Nullam varius. Etiam dignissim elementum metus. Vestibulum faucibus, +metus sit amet mattis rhoncus, sapien dui laoreet odio, nec +ultricies nibh augue a enim. Fusce in ligula. Quisque at magna et +nulla commodo consequat. Proin accumsan imperdiet sem. Nunc porta. +Donec feugiat mi at justo. Phasellus facilisis ipsum quis ante. In +ac elit eget ipsum pharetra faucibus. Maecenas viverra nulla in +massa. + +Nulla ac nisl. Nullam urna nulla, ullamcorper in, interdum sit amet, +gravida ut, risus. Aenean ac enim. In luctus. Phasellus eu quam +vitae turpis viverra pellentesque. Duis feugiat felis ut enim. +Phasellus pharetra, sem id porttitor sodales, magna nunc aliquet +nibh, nec blandit nisl mauris at pede. Suspendisse risus risus, +lobortis eget, semper at, imperdiet sit amet, quam. Quisque +scelerisque dapibus nibh. Nam enim. Lorem ipsum dolor sit amet, +consectetuer adipiscing elit. Nunc ut metus. Ut metus justo, auctor +at, ultrices eu, sagittis ut, purus. Aliquam aliquam. +} + +\longnewglossaryentry{etiampedemassa}% +{name={etiam pede massa},user1={example-image-10x16}}% +{% +Vestibulum luctus commodo lacus. Morbi lacus dui, tempor sed, +euismod eget, condimentum at, tortor. Phasellus aliquet odio ac +lacus tempor faucibus. Praesent sed sem. Praesent iaculis. Cras +rhoncus tellus sed justo ullamcorper sagittis. Donec quis orci. +Sed ut tortor quis tellus euismod tincidunt. Suspendisse congue nisl +eu elit. Aliquam tortor diam, tempus id, tristique eget, sodales +vel, nulla. Praesent tellus mi, condimentum sed, viverra at, +consectetuer quis, lectus. In auctor vehicula orci. Sed pede sapien, +euismod in, suscipit in, pharetra placerat, metus. Vivamus commodo +dui non odio. Donec et felis. + +Etiam suscipit aliquam arcu. Aliquam sit amet est ac purus bibendum +congue. Sed in eros. Morbi non orci. Pellentesque mattis lacinia +elit. Fusce molestie velit in ligula. Nullam et orci vitae nibh +vulputate auctor. Aliquam eget purus. Nulla auctor wisi sed ipsum. +Morbi porttitor tellus ac enim. Fusce ornare. Proin ipsum enim, +tincidunt in, ornare venenatis, molestie a, augue. Donec vel pede in +lacus sagittis porta. Sed hendrerit ipsum quis nisl. Suspendisse +quis massa ac nibh pretium cursus. Sed sodales. Nam eu neque quis +pede dignissim ornare. Maecenas eu purus ac urna tincidunt congue. +} + +\longnewglossaryentry{donecetnisl}% +{name={donec et nisl},user1={example-image-16x9}}% +{% +Aenean dictum odio sit amet risus. Morbi purus. Nulla a est sit amet +purus venenatis iaculis. Vivamus viverra purus vel magna. Donec in +justo sed odio malesuada dapibus. Nunc ultrices aliquam nunc. +Vivamus facilisis pellentesque velit. Nulla nunc velit, vulputate +dapibus, vulputate id, mattis ac, justo. Nam mattis elit dapibus +purus. Quisque enim risus, congue non, elementum ut, mattis quis, +sem. Quisque elit. + +Maecenas non massa. Vestibulum pharetra nulla at lorem. Duis quis +quam id lacus dapibus interdum. Nulla lorem. Donec ut ante quis +dolor bibendum condimentum. Etiam egestas tortor vitae lacus. +Praesent cursus. Mauris bibendum pede at elit. Morbi et felis a +lectus interdum facilisis. Sed suscipit gravida turpis. Nulla at +lectus. Vestibulum ante ipsum primis in faucibus orci luctus et +ultrices posuere cubilia Curae; Praesent nonummy luctus nibh. Proin +turpis nunc, congue eu, egestas ut, fringilla at, tellus. In hac +habitasse platea dictumst. +} + +\longnewglossaryentry{vivamuseutellus}% +{name={vivamus eu tellus},user1={example-image-9x16}}% +{% + Nam orci orci, malesuada id, gravida nec, ultricies vitae, erat. +Donec risus turpis, luctus sit amet, interdum quis, porta sed, +ipsum. Suspendisse condimentum, tortor at egestas posuere, neque +metus tempor orci, et tincidunt urna nunc a purus. Sed facilisis +blandit tellus. Nunc risus sem, suscipit nec, eleifend quis, cursus +quis, libero. Curabitur et dolor. Sed vitae sem. Cum sociis natoque +penatibus et magnis dis parturient montes, nascetur ridiculus mus. +Maecenas ante. Duis ullamcorper enim. Donec tristique enim eu leo. +Nullam molestie elit eu dolor. Nullam bibendum, turpis vitae +tristique gravida, quam sapien tempor lectus, quis pretium tellus +purus ac quam. Nulla facilisi. + +Duis aliquet dui in est. Donec eget est. Nunc lectus odio, varius +at, fermentum in, accumsan non, enim. Aliquam erat volutpat. Proin +sit amet nulla ut eros consectetuer cursus. Phasellus dapibus +aliquam justo. Nunc laoreet. Donec consequat placerat magna. Duis +pretium tincidunt justo. Sed sollicitudin vestibulum quam. Nam quis +ligula. Vivamus at metus. Etiam imperdiet imperdiet pede. Aenean +turpis. Fusce augue velit, scelerisque sollicitudin, dictum vitae, +tempor et, pede. Donec wisi sapien, feugiat in, fermentum ut, +sollicitudin adipiscing, metus. +} + +\longnewglossaryentry{donecvelnibh}% +{name={donec vel nibh},user1={example-image-golden}}% +{% + Donec pede. Sed id quam id wisi laoreet suscipit. Nulla lectus +dolor, aliquam ac, fringilla eget, mollis ut, orci. In pellentesque +justo in ligula. Maecenas turpis. Donec eleifend leo at felis +tincidunt consequat. Aenean turpis metus, malesuada sed, condimentum +sit amet, auctor a, wisi. Pellentesque sapien elit, bibendum ac, +posuere et, congue eu, felis. Vestibulum mattis libero quis metus +scelerisque ultrices. Sed purus. + +Donec molestie, magna ut luctus ultrices, tellus arcu nonummy velit, +sit amet pulvinar elit justo et mauris. In pede. Maecenas euismod +elit eu erat. Aliquam augue wisi, facilisis congue, suscipit in, +adipiscing et, ante. In justo. Cras lobortis neque ac ipsum. Nunc +fermentum massa at ante. Donec orci tortor, egestas sit amet, +ultrices eget, venenatis eget, mi. Maecenas vehicula leo semper +est. Mauris vel metus. Aliquam erat volutpat. In rhoncus sapien ac +tellus. Pellentesque ligula. +} + +\longnewglossaryentry{crasdapibus}% +{name={cras dapibus},user1={example-image-golden-upright}}% +{% +Aenean interdum nibh sed wisi. Praesent sollicitudin vulputate dui. +Praesent iaculis viverra augue. Quisque in libero. Aenean gravida +lorem vitae sem ullamcorper cursus. Nunc adipiscing rutrum ante. +Nunc ipsum massa, faucibus sit amet, viverra vel, elementum semper, +orci. Cras eros sem, vulputate et, tincidunt id, ultrices eget, +magna. Nulla varius ornare odio. Donec accumsan mauris sit amet +augue. Sed ligula lacus, laoreet non, aliquam sit amet, iaculis +tempor, lorem. Suspendisse eros. Nam porta, leo sed congue tempor, +felis est ultrices eros, id mattis velit felis non metus. Curabitur +vitae elit non mauris varius pretium. Aenean lacus sem, tincidunt +ut, consequat quis, porta vitae, turpis. Nullam laoreet fermentum +urna. Proin iaculis lectus. + +Sed mattis, erat sit amet gravida malesuada, elit augue egestas +diam, tempus scelerisque nunc nisl vitae libero. Sed consequat +feugiat massa. Nunc porta, eros in eleifend varius, erat leo rutrum +dui, non convallis lectus orci ut nibh. Sed lorem massa, nonummy +quis, egestas id, condimentum at, nisl. Maecenas at nibh. Aliquam +et augue at nunc pellentesque ullamcorper. Duis nisl nibh, laoreet +suscipit, convallis ut, rutrum id, enim. Phasellus odio. Nulla +nulla elit, molestie non, scelerisque at, vestibulum eu, nulla. Ut +odio nisl, facilisis id, mollis et, scelerisque nec, enim. Aenean +sem leo, pellentesque sit amet, scelerisque sit amet, vehicula +pellentesque, sapien. +} + +\longnewglossaryentry{sedconsequat}% +{name={sed consequat},user1={example-image-1x1}}% +{% +Ut tempor laoreet quam. Nullam id wisi a libero tristique semper. +Nullam nisl massa, rutrum ut, egestas semper, mollis id, leo. Nulla +ac massa eu risus blandit mattis. Mauris ut nunc. In hac habitasse +platea dictumst. Aliquam eget tortor. Quisque dapibus pede in erat. +Nunc enim. In dui nulla, commodo at, consectetuer nec, malesuada +nec, elit. Aliquam ornare tellus eu urna. Sed nec metus. Cum sociis +natoque penatibus et magnis dis parturient montes, nascetur +ridiculus mus. Pellentesque habitant morbi tristique senectus et +netus et malesuada fames ac turpis egestas. + +Phasellus id magna. Duis malesuada interdum arcu. Integer metus. +Morbi pulvinar pellentesque mi. Suspendisse sed est eu magna +molestie egestas. Quisque mi lorem, pulvinar eget, egestas quis, +luctus at, ante. Proin auctor vehicula purus. Fusce ac nisl aliquam +ante hendrerit pellentesque. Class aptent taciti sociosqu ad litora +torquent per conubia nostra, per inceptos hymenaeos. Morbi wisi. +Etiam arcu mauris, facilisis sed, eleifend non, nonummy ut, pede. +Cras ut lacus tempor metus mollis placerat. Vivamus eu tortor vel +metus interdum malesuada. +} + + % This one doesn't have an image. The style can test whether an + % image has been supplied using \ifglshasfield + +\longnewglossaryentry{sedeleifend}% +{name={sed eleifend}}% +{% +Morbi non felis ac libero vulputate fringilla. Mauris libero eros, +lacinia non, sodales quis, dapibus porttitor, pede. Class aptent +taciti sociosqu ad litora torquent per conubia nostra, per inceptos +hymenaeos. Morbi dapibus mauris condimentum nulla. Cum sociis +natoque penatibus et magnis dis parturient montes, nascetur +ridiculus mus. Etiam sit amet erat. Nulla varius. Etiam tincidunt +dui vitae turpis. Donec leo. Morbi vulputate convallis est. Integer +aliquet. Pellentesque aliquet sodales urna. +} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-long.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with long descriptions. + +\newglossaryentry{loremipsum}{name={lorem ipsum}, +description={dolor sit amet, consectetuer adipiscing elit. Ut purus +elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur +dictum gravida mauris.}} + +\newglossaryentry{namearcu}{name={name arcu}, +description={libero, nonummy eget, consectetuer id, vulputate a, magna. Donec +vehicula augue eu neque. Pellentesque habitant morbi tristique +senectus et netus et malesuada fames ac turpis egestas. Mauris ut +leo.}} + +\newglossaryentry{crasviverra}{name={cras viverra}, +description={metus rhoncus sem. Nulla et lectus vestibulum +urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida +placerat.}} + +\newglossaryentry{integersapien}{name={integer sapien}, +description={est, iaculis in, pretium quis, viverra ac, +nunc. Praesent eget sem vel leo ultrices bibendum. Aenean +faucibus.}} + +\newglossaryentry{morbidolor}{name={morbi dolor}, +description={nulla, malesuada eu, pulvinar at, mollis ac, nulla. +Curabitur auctor semper nulla. Donec varius orci eget risus. Duis +nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis +eget orci sit amet orci dignissim rutrum.}} + +\newglossaryentry{namdui}{name={nam dui}, +description={ligula, fringilla a, euismod sodales, +sollicitudin vel, wisi. Morbi auctor lorem non justo.}} + +\newglossaryentry{namlacus}{name={nam lacus}, +description={libero, pretium at, lobortis vitae, ultricies et, +tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, +vitae ornare odio metus a mi.}} + +\newglossaryentry{morbiac}{name={morbi ac}, +description={orci et nisl hendrerit mollis. Suspendisse ut massa. +Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus +et magnis dis parturient montes, nascetur ridiculus mus.}} + +\newglossaryentry{aliquam}{name={aliquam}, +description={tincidunt urna. Nulla ullamcorper +vestibulum turpis. Pellentesque cursus luctus mauris.}} + +\newglossaryentry{nullamalesuada}{name={nulla malesuada}, +description={porttitor diam. Donec felis erat, congue non, volutpat at, +tincidunt tristique, libero. Vivamus viverra fermentum felis.}} + +\newglossaryentry{donecnonummy}{name={donec nonummy}, +description={pellentesque ante. Phasellus +adipiscing semper elit. Proin fermentum massa ac quam. Sed diam +turpis, molestie vitae, placerat a, molestie nec, leo.}} + +\newglossaryentry{maecenaslacinia}{name={maecenas lacinia}, +description={nam ipsum ligula, eleifend at, accumsan nec, suscipit +a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat +lorem.}} + +\newglossaryentry{sedlacinia}{name={sed lacinia}, +description={nulla vitae enim. Pellentesque tincidunt purus +vel magna. Integer non enim. Praesent euismod nunc eu purus. Donec +bibendum quam in tellus.}} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-multipar.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with multi-paragraph descriptions. + +\longnewglossaryentry{loremi-ii}{name={lorem 1--2}}% +{% +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, +vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur +dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer +id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque +habitant morbi tristique senectus et netus et malesuada fames ac +turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla +et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus +sit amet tortor gravida placerat. Integer sapien est, iaculis in, +pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices +bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar +at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius +orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, +sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. + +Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, +wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, +lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed +accumsan bibendum, erat ligula aliquet magna, vitae ornare odio +metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut +massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque +penatibus et magnis dis parturient montes, nascetur ridiculus mus. +Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. +Pellentesque cursus luctus mauris.% +} + +\longnewglossaryentry{loremiii-iv}{name={lorem 3--4}}% +{% +Nulla malesuada porttitor diam. Donec felis erat, congue non, +volutpat at, tincidunt tristique, libero. Vivamus viverra fermentum +felis. Donec nonummy pellentesque ante. Phasellus adipiscing semper +elit. Proin fermentum massa ac quam. Sed diam turpis, molestie +vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum +ligula, eleifend at, accumsan nec, suscipit a, ipsum. Morbi blandit +ligula feugiat magna. Nunc eleifend consequat lorem. Sed lacinia +nulla vitae enim. Pellentesque tincidunt purus vel magna. Integer +non enim. Praesent euismod nunc eu purus. Donec bibendum quam in +tellus. Nullam cursus pulvinar lectus. Donec et mi. Nam vulputate +metus eu enim. Vestibulum pellentesque felis eu massa. + +Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo +vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet, +consectetuer adipiscing elit. In hac habitasse platea dictumst. +Integer tempus convallis augue. Etiam facilisis. Nunc elementum +fermentum wisi. Aenean placerat. Ut imperdiet, enim sed gravida +sollicitudin, felis odio placerat quam, ac pulvinar elit purus eget +enim. Nunc vitae tortor. Proin tempus nibh sit amet nisl. Vivamus +quis tortor vitae risus porta vehicula.% +} + +\longnewglossaryentry{loremv-vi}{name={lorem 5--6}}% +{% +Fusce mauris. Vestibulum luctus nibh at lectus. Sed bibendum, nulla +a faucibus semper, leo velit ultricies tellus, ac venenatis arcu +wisi vel nisl. Vestibulum diam. Aliquam pellentesque, augue quis +sagittis posuere, turpis lacus congue quam, in hendrerit risus eros +eget felis. Maecenas eget erat in sapien mattis porttitor. +Vestibulum porttitor. Nulla facilisi. Sed a turpis eu lacus commodo +facilisis. Morbi fringilla, wisi in dignissim interdum, justo lectus +sagittis dui, et vehicula libero dui cursus dui. Mauris tempor +ligula sed lacus. Duis cursus enim ut augue. Cras ac magna. Cras +nulla. Nulla egestas. Curabitur a leo. Quisque egestas wisi eget +nunc. Nam feugiat lacus vel est. Curabitur consectetuer.% + +Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit +amet, laoreet vitae, arcu. Aenean faucibus pede eu ante. Praesent +enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus +eros, malesuada sit amet, fermentum eu, sodales cursus, magna. Donec +eu purus. Quisque vehicula, urna sed ultricies auctor, pede lorem +egestas dui, et convallis elit erat sed nulla. Donec luctus. +Curabitur et nunc. Aliquam dolor odio, commodo pretium, ultricies +non, pharetra in, velit. Integer arcu est, nonummy in, fermentum +faucibus, egestas vel, odio.% +} + +\longnewglossaryentry{loremvii-viii}{name={lorem 7--8}}% +{% +Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. +Sed vehicula hendrerit sem. Duis non odio. Morbi ut dui. Sed +accumsan risus eget odio. In hac habitasse platea dictumst. +Pellentesque non elit. Fusce sed justo eu urna porta tincidunt. +Mauris felis odio, sollicitudin sed, volutpat a, ornare ac, erat. +Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc +dui lobortis purus, quis congue purus metus ultricies tellus. Proin +et quam. Class aptent taciti sociosqu ad litora torquent per conubia +nostra, per inceptos hymenaeos. Praesent sapien turpis, fermentum +vel, eleifend faucibus, vehicula eu, lacus. + +Pellentesque habitant morbi tristique senectus et netus et malesuada +fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit +amet, egestas sed, leo. Praesent feugiat sapien aliquet odio. +Integer vitae justo. Aliquam vestibulum fringilla lorem. Sed neque +lectus, consectetuer at, consectetuer sed, eleifend ac, lectus. +Nulla facilisi. Pellentesque eget lectus. Proin eu metus. Sed +porttitor. In hac habitasse platea dictumst. Suspendisse eu lectus. +Ut mi mi, lacinia sit amet, placerat et, mollis vitae, dui. Sed ante +tellus, tristique ut, iaculis eu, malesuada ac, dui. Mauris nibh +leo, facilisis non, adipiscing quis, ultrices a, dui.% +} + +\longnewglossaryentry{loremix-x}{name={lorem 9--10}}% +{% +Morbi luctus, wisi viverra faucibus pretium, nibh est placerat odio, +nec commodo wisi enim eget quam. Quisque libero justo, consectetuer +a, feugiat vitae, porttitor eu, libero. Suspendisse sed mauris +vitae elit sollicitudin malesuada. Maecenas ultricies eros sit amet +ante. Ut venenatis velit. Maecenas sed mi eget dui varius euismod. +Phasellus aliquet volutpat odio. Vestibulum ante ipsum primis in +faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque +sit amet pede ac sem eleifend consectetuer. Nullam elementum, urna +vel imperdiet sodales, elit ipsum pharetra ligula, ac pretium ante +justo a nulla. Curabitur tristique arcu eu metus. Vestibulum lectus. +Proin mauris. Proin eu nunc eu urna hendrerit faucibus. Aliquam +auctor, pede consequat laoreet varius, eros tellus scelerisque quam, +pellentesque hendrerit ipsum dolor sed augue. Nulla nec lacus. + +Suspendisse vitae elit. Aliquam arcu neque, ornare in, ullamcorper +quis, commodo eu, libero. Fusce sagittis erat at erat tristique +mollis. Maecenas sapien libero, molestie et, lobortis in, sodales +eget, dui. Morbi ultrices rutrum lorem. Nam elementum ullamcorper +leo. Morbi dui. Aliquam sagittis. Nunc placerat. Pellentesque +tristique sodales est. Maecenas imperdiet lacinia velit. Cras non +urna. Morbi eros pede, suscipit ac, varius vel, egestas non, eros. +Praesent malesuada, diam id pretium elementum, eros sem dictum +tortor, vel consectetuer odio sem sed wisi.% +} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-parent.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with child entries. + +\newglossaryentry{sedmattis}{name={sed mattis},description={erat sit amet}} + +\newglossaryentry{gravida}{parent={sedmattis},name={gravida},description={malesuada}} + +\newglossaryentry{elitaugue}{parent={sedmattis},name={elit augue}, +description={egestas diam}} + +\newglossaryentry{tempus}{parent={sedmattis},name={tempus}, +description={scelerisque}} + +\newglossaryentry{nunc}{name={nunc},description={nisl vitae}} + +\newglossaryentry{libero}{parent={nunc},name={libero},description={sed +consequat}} + +\newglossaryentry{feugiat}{parent={nunc},name={feugiat},description={massa}} + +\newglossaryentry{porta}{parent={nunc},name={porta},description={eros +in eleifend}} + +\newglossaryentry{variuserat}{parent={nunc},name={varius erat}, +description={leo rutrum dui}} + +\newglossaryentry{nonconvallis}{name={non +convallis},description={lectus orci ut nibh}} + +\newglossaryentry{sedlorem}{parent={nonconvallis},name={sedlorem},description={massa}} + +\newglossaryentry{nonummyquis}{parent={nonconvallis},name={nonummy +quis}, description={egestas id}} + +\newglossaryentry{condimentum}{name={condimentum},description={at +nisl}} + +\newglossaryentry{maecenas}{parent={condimentum},name={maecenas}, +description={at nibh}} + +\newglossaryentry{aliquamet}{name={aliquam et},description={augue}} + +\newglossaryentry{atnunc}{parent={aliquamet},name={at nunc},description={pellentesque +ullamcorper}} + +\newglossaryentry{duisnisl}{parent={atnunc},name={duisnisl},description={laoreet +suscipit}} + +\newglossaryentry{duisnibh}{parent={atnunc},name={duisnibh}, +description={convallis ut}} + +\newglossaryentry{rutrum}{name={rutrum},description={id, enim}} + +\newglossaryentry{phasellus}{parent={rutrum},name={phasellus}, +description={odio}} + +\newglossaryentry{nullanulla}{parent={rutrum},name={nulla nulla}, +description={elit, molestie non}} + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-symbolnames.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with associated symbols. + +\newglossaryentry{sym.alpha}{sort={alpha},name={\ensuremath{\alpha}}, +description={Quisque ullamcorper placerat ipsum.}} + +\newglossaryentry{sym.beta}{sort={beta},name={\ensuremath{\beta}}, +description={Cras nibh.}} + +\newglossaryentry{sym.gamma}{sort={gamma},name={\ensuremath{\gamma}}, +description={Morbi vel justo vitae lacus tincidunt ultrices.}} + +\newglossaryentry{sym.delta}{sort={delta},name={\ensuremath{\delta}}, +description={Lorem ipsum dolor sit amet, consectetuer adipiscing +elit.}} + +\newglossaryentry{sym.epsilon}{sort={epsilon},name={\ensuremath{\epsilon}}, +description={In hac habitasse platea dictumst.}} + +\newglossaryentry{sym.zeta}{sort={zeta},name={\ensuremath{\zeta}}, +description={Integer tempus convallis augue.}} + +\newglossaryentry{sym.eta}{sort={eta},name={\ensuremath{\eta}}, +description={Etiam facilisis.}} + +\newglossaryentry{sym.theta}{sort={theta},name={\ensuremath{\theta}}, +description={Nunc elementum fermentum wisi.}} + +\newglossaryentry{sym.iota}{sort={iota},name={\ensuremath{i}}, +description={Aenean placerat.}} + +\newglossaryentry{sym.kappa}{sort={kappa},name={\ensuremath{\kappa}}, +description={Ut imperdiet, enim sed gravida sollicitudin, felis odio +placerat quam, ac pulvinar elit purus eget enim.}} + +\newglossaryentry{sym.lambda}{sort={lambda},name={\ensuremath{\lambda}}, +description={Nunc vitae tortor.}} + +\newglossaryentry{sym.mu}{sort={mu},name={\ensuremath{\mu}}, +description={Proin tempus nibh sit amet nisl.}} + +\newglossaryentry{sym.nu}{sort={nu},name={\ensuremath{\nu}}, +description={Vivamus quis tortor vitae risus porta vehicula.}} + +\newglossaryentry{sym.xi}{sort={xi},name={\ensuremath{\xi}}, +description={Fusce mauris.}} + +\newglossaryentry{sym.pi}{sort={pi},name={\ensuremath{\pi}}, +description={Vestibulum luctus nibh at lectus.}} + +\newglossaryentry{sym.rho}{sort={rho},name={\ensuremath{\rho}}, +description={Sed bibendum, nulla a faucibus semper, leo velit +ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam.}} + +\newglossaryentry{sym.sigma}{sort={sigma},name={\ensuremath{\sigma}}, +description={Aliquam pellentesque, augue quis sagittis posuere, +turpis lacus congue quam, in hendrerit risus eros eget felis.}} + +\newglossaryentry{sym.tau}{sort={tau},name={\ensuremath{\tau}}, +description={Maecenas eget erat in sapien mattis porttitor.}} + +\newglossaryentry{sym.upsilon}{sort={upsilon},name={\ensuremath{\upsilon}}, +description={Vestibulum porttitor.}} + +\newglossaryentry{sym.phi}{sort={phi},name={\ensuremath{\phi}}, +description={Nulla facilisi.}} + +\newglossaryentry{sym.chi}{sort={chi},name={\ensuremath{\chi}}, +description={Sed a turpis eu lacus commodo facilisis.}} + +\newglossaryentry{sym.psi}{sort={psi},name={\ensuremath{\psi}}, +description={Morbi fringilla, wisi in dignissim interdum, justo +lectus sagittis dui, et vehicula libero dui cursus dui.}} + +\newglossaryentry{sym.omega}{sort={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.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with associated symbols. + +\newglossaryentry{alpha}{name={alpha},symbol={\ensuremath{\alpha}}, +description={Quisque ullamcorper placerat ipsum.}} + +\newglossaryentry{beta}{name={beta},symbol={\ensuremath{\beta}}, +description={Cras nibh.}} + +\newglossaryentry{gamma}{name={gamma},symbol={\ensuremath{\gamma}}, +description={Morbi vel justo vitae lacus tincidunt ultrices.}} + +\newglossaryentry{delta}{name={delta},symbol={\ensuremath{\delta}}, +description={Lorem ipsum dolor sit amet, consectetuer adipiscing +elit.}} + +\newglossaryentry{epsilon}{name={epsilon},symbol={\ensuremath{\epsilon}}, +description={In hac habitasse platea dictumst.}} + +\newglossaryentry{zeta}{name={zeta},symbol={\ensuremath{\zeta}}, +description={Integer tempus convallis augue.}} + +\newglossaryentry{eta}{name={eta},symbol={\ensuremath{\eta}}, +description={Etiam facilisis.}} + +\newglossaryentry{theta}{name={theta},symbol={\ensuremath{\theta}}, +description={Nunc elementum fermentum wisi.}} + +\newglossaryentry{iota}{name={iota},symbol={\ensuremath{i}}, +description={Aenean placerat.}} + +\newglossaryentry{kappa}{name={kappa},symbol={\ensuremath{\kappa}}, +description={Ut imperdiet, enim sed gravida sollicitudin, felis odio +placerat quam, ac pulvinar elit purus eget enim.}} + +\newglossaryentry{lambda}{name={lambda},symbol={\ensuremath{\lambda}}, +description={Nunc vitae tortor.}} + +\newglossaryentry{mu}{name={mu},symbol={\ensuremath{\mu}}, +description={Proin tempus nibh sit amet nisl.}} + +\newglossaryentry{nu}{name={nu},symbol={\ensuremath{\nu}}, +description={Vivamus quis tortor vitae risus porta vehicula.}} + +\newglossaryentry{xi}{name={xi},symbol={\ensuremath{\xi}}, +description={Fusce mauris.}} + +\newglossaryentry{pi}{name={pi},symbol={\ensuremath{\pi}}, +description={Vestibulum luctus nibh at lectus.}} + +\newglossaryentry{rho}{name={rho},symbol={\ensuremath{\rho}}, +description={Sed bibendum, nulla a faucibus semper, leo velit +ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam.}} + +\newglossaryentry{sigma}{name={sigma},symbol={\ensuremath{\sigma}}, +description={Aliquam pellentesque, augue quis sagittis posuere, +turpis lacus congue quam, in hendrerit risus eros eget felis.}} + +\newglossaryentry{tau}{name={tau},symbol={\ensuremath{\tau}}, +description={Maecenas eget erat in sapien mattis porttitor.}} + +\newglossaryentry{upsilon}{name={upsilon},symbol={\ensuremath{\upsilon}}, +description={Vestibulum porttitor.}} + +\newglossaryentry{phi}{name={phi},symbol={\ensuremath{\phi}}, +description={Nulla facilisi.}} + +\newglossaryentry{chi}{name={chi},symbol={\ensuremath{\chi}}, +description={Sed a turpis eu lacus commodo facilisis.}} + +\newglossaryentry{psi}{name={psi},symbol={\ensuremath{\psi}}, +description={Morbi fringilla, wisi in dignissim interdum, justo +lectus sagittis dui, et vehicula libero dui cursus dui.}} + +\newglossaryentry{omega}{name={omega},symbol={\ensuremath{\omega}}, +description={Mauris tempor ligula sed lacus.}} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*example-glossaries-url.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is part of the glossaries bundle + % These are test glossary entries with URLs stored in + % the user1 field. + +\newglossaryentry{aenean-url}{name={aenean}, + description={adipiscing auctor est}, + user1={http://uk.tug.org/}} + +\newglossaryentry{morbi-url}{name={morbi}, + description={quam arcu, malesuada sed, volutpat et, elementum sit +amet, libero}, + user1={http://www.ctan.org/}} + +\newglossaryentry{duis-url}{name={duis}, + description={mattis}, + user1={http://www.tug.org/}} + + % Now try an active character +\newglossaryentry{sed-url}{name={sed}, + description={cursus lectus quis odio (uses +\texttt{\string\protect\string~})}, + user1={http://theoval.cmp.uea.ac.uk/\protect~nlct/}} + +\newglossaryentry{sed2-url}{name={sed}, + description={cursus lectus quis odio (uses +\texttt{\string\string\string~})}, + user1={http://theoval.cmp.uea.ac.uk/\string~nlct/}} + +\newglossaryentry{sed3-url}{name={sed}, + description={cursus lectus quis odio (uses +\texttt{\string\glstildechar})}, + user1={http://theoval.cmp.uea.ac.uk/\glstildechar nlct/}} + + % How do we deal with a percent character? + + % Temporarily change the category code + +\catcode`\%=12 +\newglossaryentry{phasellus-url}{name={phasellus}, + description={arcu (catcode change)}, + user1=http://theoval.cmp.uea.ac.uk/%7Enlct +} +\catcode`\%=14 + + % Use \% + +\newglossaryentry{phasellus2-url}{name={phasellus}, + description={arcu (uses \texttt{\string\%})}, + user1=http://theoval.cmp.uea.ac.uk/\%7Enlct +} + + % Use \glspercentchar + +\newglossaryentry{phasellus3-url}{name={phasellus}, + description={arcu (uses + \texttt{\string\glspercentchar})}, + user1=http://theoval.cmp.uea.ac.uk/\glspercentchar 7Enlct +} + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-chap-hyperfirst.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{chapter}{0}{\glschapnum} + +\loadglsentries{example-glossaries-brief} + +\renewcommand*{\glslinkpostsetkeys}{% + \edef\currentchap{\arabic{chapter}}% + \ifnum\currentchap=\glschapnum{\glslabel}\relax + % Already used this entry in the current chapter, so switch + % off the hyperlink. + \setkeys{glslink}{hyper=false}% + \else + % Hasn't been used in the current chapter. Update the value + % of the "chapter" field unless the hyperlink has been switched + % off. + \glsifhyperon + {% + \glsfieldxdef{\glslabel}{chapter}{\currentchap}% + }% + {}% + \fi +} + +\begin{document} +\chapter{Sample} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Another} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Start with a Star} + +Use all entries but suppress hyperlink: +\forglsentries{\thislabel}{\gls*{\thislabel}. } + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-crossref.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\makeglossaries + +\renewcommand{\glsseeitemformat}[1]{\textsc{\glsentryname{#1}}} + +\newglossaryentry{pear}{name=pear, +description={an oddly shaped fruit}} + +\newglossaryentry{apple}{name=apple, +description={firm, round fruit}, +see=[see also]{pear}} + +\newglossaryentry{banana}{name=banana, +description={a yellow fruit with an even odder shape than +a \gls{pear}}} + +\newglossaryentry{fruit}{name=fruit, +description={sweet, fleshy product of plant containing seed}} + +\glssee{fruit}{pear,apple,banana} + +\begin{document} +\gls{pear}, \gls{apple} and \gls{banana}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-custom-acronym.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[acronym,% create list of acronyms + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain + ]{glossaries} + +\makeglossaries + + % This is a sample file to illustrate how to define a custom + % acronym style. This example defines the acronyms so that on first use + % they display the short form in the text and with the long form + % and description in a footnote. In the main body of the + % document the short form will be displayed in small caps, but in + % the list of acronyms the short form is displayed in normal + % capitals. To ensure this, the short form should be written in + % lower case when the acronym is defined, and \MakeTextUppercase is + % used when it's displayed in the list of acronyms. + +\newacronymstyle{custom-fn}% new style name +{% Check for long form in case of a mixed glossary + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% Style definitions: + % User needs to supply the description: + \renewcommand*{\GenericAcronymFields}{}% + % Need to ensure hyperlinks are switched off on first use: + \glshyperfirstfalse + % Redefine the commands used by \glsgenacfmt on first use: + \renewcommand*{\genacrfullformat}[2]{% + \firstacronymfont{\glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \firstacronymfont{\Glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \firstacronymfont{\glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \firstacronymfont{\Glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + % Redefine the no-link full forms: + \renewcommand*{\glsentryfull}[1]{% + \glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Glsentryfull}[1]{% + \Glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\glsentryfullpl}[1]{% + \glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Glsentryfullpl}[1]{% + \Glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})% + }% + % Redefine the link full forms: + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylong{##2}##3\space(\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylong{##2}##3\space(\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + }% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + }% + % Use smallcaps for the acronym in the document text: + \renewcommand*{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + % Sort acronyms according to the long form: + \renewcommand*{\acronymsort}[2]{##2}% + % Set the name in the list of acronyms to the long form followed by + % the short form (in upper case) in parentheses: + \renewcommand*{\acronymentry}[1]{% + \Glsentrylong{##1}\space(\MakeTextUppercase{\glsentryshort{##1}})}% +} + + % Now set the new acronym style (to override the default style) +\setacronymstyle{custom-fn} + + % Set an appropriate glossary style: +\setglossarystyle{altlist} + + % Now define the acronyms (must be done after setting the custom + % style) + +\newacronym[description={set of tags for use in developing hypertext +documents}]{html}{html}{hyper text markup language} + +\newacronym[description={language used to describe the layout of a +document written in a markup language}]{css}{css}{cascading style +sheet} + +\begin{document} + +\gls{css}. \gls{html}. + +\gls{css}. \gls{html}. + +No-link full forms: \glsentryfull{css}, \Glsentryfull{css}. +Linking full forms: \acrfull{css}, \Acrfull{css}, \ACRfull{css}. +Linking with insert: \acrfull{css}['s], \Acrfull{css}['s], +\ACRfull{css}['s]. + +Now test plurals. + +No-link full forms: \glsentryfullpl{html}, \Glsentryfullpl{html}. +Linking full forms: \acrfullpl{html}, \Acrfullpl{html}, \ACRfullpl{html}. +Linking with insert: \acrfullpl{html}['s], \Acrfullpl{html}['s], +\ACRfullpl{html}['s]. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-dot-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{abbrtype}{word}{\abbrtype} + +\setacronymstyle{long-short} + +\newcommand*{\newabbr}[1][]{% + \newacronym[abbrtype=initials,#1]} + +\newabbr{eg}{e.g.}{exempli gratia} +\newabbr{ie}{i.e.}{id est} +\newabbr{bsc}{B.Sc.}{Bachelor of Science} +\newabbr{ba}{B.A.}{Bachelor of Arts} +\newabbr{agm}{A.G.M.}{annual general meeting} + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + + % See the sample-initialisms.tex example file provided with + % glossaries-extra.sty for a better way of doing this. + +\makeatletter +\renewcommand{\glspostlinkhook}{% + \ifglsfieldeq{\glslabel}{abbrtype}{initials}% + {\new@ifnextchar.\doendsentence\doendword} + {}% +} +\makeatother + +\newcommand{\doendsentence}[1]{\spacefactor=10000{}} +\newcommand{\doendword}{\spacefactor=1000{}} + +\begin{document} +This is a sample document that illustrates abbreviations with +full stops (periods) and abbreviations that are words (i.e.\ +acronyms). The examples switch to a typewriter font to make it +easier to see the inter-word and inter-sentence spaces. + +The extension package glossaries-extra.sty provides a better way of +doing this. + +First use: \gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} end of +sentence. + +End of sentence use: + +\ttfamily + +\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}. +Done. + +laser. e.g. i.e. B.Sc. B.A\@. A.G.M\@. Done. + +\rmfamily + +Mid-sentence use: + +\ttfamily + +\gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} Done. + +laser e.g.\ i.e.\ B.Sc.\ B.A. A.G.M. Done. + +\rmfamily + +Check other sentence terminators: + +\ttfamily + +\gls{laser}? \gls{eg}? \gls{ie}? \gls{bsc}! \gls{ba}! \gls{agm}? Done. + +laser? e.g.? i.e.? B.Sc.! B.A.! A.G.M.? Done. + +\rmfamily + +\glsresetall Reset. End of sentence use: + +\ttfamily + +\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}. +Done. + +\rmfamily +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-dual.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[acronym]{glossaries} + + % \newdualentry[main options]{label}{short}{long}{description} + +\newcommand*{\newdualentry}[5][]{% + \newglossaryentry{main-#2}{name={#4},% + text={#3\glsadd{#2}},% + description={#5},% + #1 + }% + \newacronym{#2}{#3\glsadd{main-#2}}{#4} +} + +\newdualentry{svm}% label + {SVM}% abbreviation + {support vector machine}% long form + {Statistical pattern recognition technique}% description + +\makeglossaries + +\begin{document} + +\gls{svm}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-entrycount.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage + [nomain,% 'nomain' is used to suppress the main glossary + acronym% 'acronym' is used to create the 'acronym' glossary + ] + {glossaries} +\makeglossaries + +\glsenableentrycount + +\setacronymstyle{long-short} + +\newacronym{html}{HTML}{hypertext markup language} +\newacronym{css}{CSS}{cascading style sheets} +\newacronym{xml}{XML}{extensible markup language} +\newacronym{sql}{SQL}{structured query language} +\newacronym{rdbms}{RDBMS}{relational database management system} +\newacronym{rdsms}{RDSMS}{relational data stream management system} + +\begin{document} +These entries are only used once: \cgls{sql}, \cgls{rdbms}, +\cgls{xml}. These entries are used multiple times: +\cgls{html}, \cgls{html}, \cgls{css}, \cgls{css}, \cgls{css}, +\cgls{rdsms}, \cgls{rdsms}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-entryfmt.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[style=tree]{glossaries} + +\makeglossaries + +\renewcommand*{\glsentryfmt}{% + \glsgenentryfmt + \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}% +} + +\newglossaryentry{distance}{name=distance, +description={The length between two points}, +symbol={km}} + +\begin{document} + +First use: \gls{distance}. Next use: \gls{distance}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-FnDesc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you are using arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[hyperfirst=false]{glossaries} + +\makeglossaries + +\renewcommand*{\glsentryfmt}{% + \glsgenentryfmt + \ifglsused{\glslabel}{}{\footnote{\glsentrydesc{\glslabel}}}% +} + +\newglossaryentry{sample}{name={sample},description={an example +description}} + +\begin{document} +\chapter{Sample Chapter} + +First use: \gls{sample}. + +Next use: \gls{sample}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-font-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{font}{}{\entryfont} + +\newacronymstyle{long-font-short} +{% + \GlsUseAcrEntryDispStyle{long-short}% +} +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}% + \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}% +} + +\setacronymstyle{long-font-short} + +\newcommand*{\newitabbr}[1][]{\newacronym[font=\em,#1]} +\newcommand*{\newupabbr}[1][]{\newacronym[#1]} + +\newitabbr{eg}{e.g.}{exempli gratia} +\newitabbr{ie}{i.e.}{id est} + +\newupabbr{bsc}{BSc}{Bachelor of Science} +\newupabbr{ba}{BA}{Bachelor of Arts} +\newupabbr{agm}{AGM}{annual general meeting} + +\begin{document} + +First use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}. + +Next use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}. + +Short: \acrshort{eg} \acrshort{ie} \acrshort{bsc} \acrshort{ba} +\acrshort{agm}. + +Full: \acrfull{eg} \acrfull{ie} \acrfull{bsc} \acrfull{ba} +\acrfull{agm}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-ignored.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\newignoredglossary{common} + +\makeglossaries + +\newglossaryentry{sample}{name={sample},description={an example}} + +\newglossaryentry{commonex}{type=common,name={common term}} + +\begin{document} + +\gls{sample}. \gls{commonex}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-index.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[toc,index,nohypertypes={index}]{glossaries} +\usepackage{glossary-mcols} + +\makeglossaries + + % define terms for the index + +\newterm[plural={stegosauruses}]{stegosaurus} +\newterm[plural={triceratopses}]{triceratops} +\newterm[plural={apatosauruses}]{apatosaurus} + + % To avoid labels conflicting with the same name in the main glossary + % prefix the index label with "ind-". (This means that the name must + % be set independently.) +\newterm[name={dinosaur}]{ind-dinosaur} +\newterm[name={Triassic}]{ind-triassic} + + % define terms for the main glossary + +\newglossaryentry{dinosaur}% +{% + name={dinosaur\glsadd{ind-dinosaur}},% + description={One of a group of dinosauria}% +} + +\newglossaryentry{Triassic}% +{% + name={Triassic\glsadd{ind-triassic}},% + description={The first period of the Mesozoic Era} +} + +\begin{document} +\tableofcontents + +\chapter{Dinosaurs} + +\Glspl{dinosaur} are now extinct. They first appeared during the +\gls{Triassic} period. Examples of \glspl{dinosaur} include the +\gls{triceratops}, the \gls{apatosaurus} and the \gls{stegosaurus}. + +Indexed term: \gls{ind-dinosaur}. + +\renewcommand*{\glsnamefont}[1]{\textbf{\makefirstuc{#1}}} + +\printglossary[style=long,nogroupskip] + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\printindex[style=mcolindexgroup] + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-inline.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[toc,order=word,subentrycounter]{glossaries} + +\usepackage{glossary-inline} + +\renewcommand*{\glossarysection}[2][]{\textbf{#1}: } +\renewcommand{\glsnamefont}[1]{\textsc{#1}} +\setglossarystyle{inline} + +\makeglossaries + +\newglossaryentry{Perl}{name=\texttt{Perl}, +sort=Perl, % need a sort key because name contains a command +description=A scripting language} + +\newglossaryentry{glossary}{name=glossary, +description={\nopostdesc}, +plural={glossaries}} + +\newglossaryentry{glossarycol}{ +description={collection of glosses}, +sort={2}, +parent={glossary}} + +\newglossaryentry{glossarylist}{ +description={list of technical words}, +sort={1}, +parent={glossary}} + +\newglossaryentry{pagelist}{name=page list, + % description value has to be enclosed in braces + % because it contains commas +description={a list of individual pages or page ranges +(e.g.\ 1,2,4,7-9)}} + +\newglossaryentry{mtrx}{name=matrix, +description={rectangular array of quantities}, + % plural is not simply obtained by appending an s, so specify +plural=matrices} + + % entry with a paragraph break in the description + +\newglossaryentry{par}{name=paragraph, +description={distinct section of piece of +writing. Beginning on new, usually indented, line}} + + % entry with two types of plural. Set the plural form to the + % form most likely to be used. If you want to use a different + % plural, you will need to explicity specify it in \glslink +\newglossaryentry{cow}{name=cow, + % this isn't necessary, as this form (appending an s) is + % the default +plural=cows, + % description: +description={(\emph{pl.}\ cows, \emph{archaic} kine) an adult +female of any bovine animal}} + +\newglossaryentry{bravo}{name={bravo}, +description={\nopostdesc}} + +\newglossaryentry{bravo1}{description={cry of approval (pl.\ bravos)}, +sort={1}, +plural={bravos}, +parent=bravo} + +\newglossaryentry{bravo2}{description={hired ruffian or killer (pl.\ bravoes)}, +sort={2}, +plural={bravoes}, +parent=bravo} + +\newglossaryentry{seal}{name=seal,description={sea mammal with +flippers that eats fish}} + +\newglossaryentry{sealion}{name={sea lion}, +description={large seal}} + +\begin{document} + +\title{Sample Document Using glossary Package} +\author{Nicola Talbot} +\pagenumbering{alph}% prevent duplicate page link names if using PDF +\maketitle + +\pagenumbering{roman} +\tableofcontents + +\chapter{Introduction} +\pagenumbering{arabic} + +This document has a glossary in a footnote\footnote{\printglossaries}. + +A \gls{glossarylist} (definition~\glsrefentry{glossarylist}) is a +very useful addition to any technical document, although a +\gls{glossarycol} (definition~\glsrefentry{glossarycol}) can also +simply be a collection of glosses, which is another thing entirely. +Some documents have multiple \glspl{glossarylist}. + +Once you have run your document through \LaTeX, you +will then need to run the \texttt{.glo} file through +\texttt{makeindex}. You will need to set the output +file so that it creates a \texttt{.gls} file instead +of an \texttt{.ind} file, and change the name of +the log file so that it doesn't overwrite the index +log file (if you have an index for your document). +Rather than having to remember all the command line +switches, you can call the \gls{Perl} script +\texttt{makeglossaries} which provides a convenient +wrapper. + +If a comma appears within the name or description, grouping +must be used, e.g.\ in the description of \gls{pagelist}. + +\chapter{Plurals and Paragraphs} + +Plurals are assumed to have the letter s appended, but if this is +not the case, as in \glspl{mtrx}, then you need to specify the +plural when you define the entry. If a term may have multiple +plurals (for example \glspl{cow}/\glslink{cow}{kine}) then +define the entry with the plural form most likely to be used and +explicitly specify the alternative form using \verb|\glslink|. +\Glspl{seal} and \glspl{sealion} have regular plural forms. + +\Gls{bravo} is a homograph, but the plural forms are spelt +differently. The plural of \gls{bravo1}, a cry of approval +(definition~\glsrefentry{bravo1}), is \glspl{bravo1}, whereas the +plural of \gls{bravo2}, a hired ruffian or killer +(definition~\glsrefentry{bravo2}), is \glspl{bravo2}. + +\Glspl{par} can cause a problem in commands, so care is needed +when having a paragraph break in a \gls{glossarylist} entry. + +\chapter{Ordering} + +There are two types of ordering: word ordering (which places +``\gls{sealion}'' before ``\gls{seal}'') and letter ordering +(which places ``\gls{seal}'' before ``\gls{sealion}''). + + + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-langdict.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + + % This file also requires the glossaries-english + % and glossaries-french language modules. These must + % be installed in addition to installing the glossaries package. +\documentclass[english,french]{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{babel} + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. +\usepackage[nomain]{glossaries} + +\newglossary[glg]{english}{gls}{glo}{English to French} +\newglossary[flg]{french}{flx}{flo}{French to English} + +\makeglossaries + + % \newword{label}{english}{determiner}{french} +\newcommand*{\newword}[4]{% + \newglossaryentry{en-#1}{type=english,name={#2},description={#3 #4}}% + \newglossaryentry{fr-#1}{type=french,name={#3 #4},text={#4},sort={#4},description={#2}}% +} + +\newword{cat}{cat}{le}{chat} +\newword{mat}{mat}{la}{natte} + +\begin{document} +\selectlanguage{english} +The \gls{en-cat} sat on the \gls{en-mat}. + +\selectlanguage{french} +Le \gls{fr-cat} s'est repos\'e sur la \gls{fr-mat}. + +\selectlanguage{english} +\printglossary[type=english] + +\selectlanguage{french} +\printglossary[type=french] +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-newkeys.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you are using arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[nopostdot,nogroupskip]{glossaries} + +\glsaddkey*% star version needed as default value needs expanding + {ed}% key + {\glsentrytext{\glslabel}ed}% default value + {\glsentryed}% command analogous to \glsentrytext + {\Glsentryed}% command analogous to \Glsentrytext + {\glsed}% command analogous to \glstext + {\Glsed}% command analogous to \Glstext + {\GLSed}% command analogous to \GLStext + +\glsaddkey* + {ing}% key + {\glsentrytext{\glslabel}ing}% default value + {\glsentrying}% command analogous to \glsentrytext + {\Glsentrying}% command analogous to \Glsentrytext + {\glsing}% command analogous to \glstext + {\Glsing}% command analogous to \Glstext + {\GLSing}% command analogous to \GLStext + + +\makeglossaries + +\newglossaryentry{jump}{name={jump},description={}} + +\newglossaryentry{run}{name={run},% + ed={ran},% + ing={running}, + description={}} + +\newglossaryentry{waddle}{name={waddle},% + ed={waddled},% + ing={waddling},% + description={}} + +\begin{document} + +This is a sample document illustrating how to add new glossary entry +keys. + +The dog \glsed{jump} over the duck. + +The duck was \glsing{waddle} round the dog. + +The dog \glsed{run} away from the duck. + +First letter uppercase: \Glsed{jump}, \Glsing{jump}, +\Glsed{waddle}, \Glsing{waddle}, +\Glsed{run}, \Glsing{run}. + +All uppercase: \GLSed{jump}, \GLSing{jump}, +\GLSed{waddle}, \GLSing{waddle}, +\GLSed{run}, \GLSing{run}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-noidxapp-utf8.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: pdflatex +\documentclass{report} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} + +\usepackage[colorlinks]{hyperref} +\usepackage[index,symbols,nohypertypes={index}]{glossaries} +\usepackage{glossary-mcols} + +\makenoidxglossaries + +\renewcommand{\theHequation}{\theequation} + + % main entries + +\newglossaryentry{elite}{% + name={{é}lite}, + description={select group of people} +} + +\newglossaryentry{elephant}{% + name={elephant}, + description={very large mammal with tusks} +} + +\newglossaryentry{elk}{% + name={elk}, + description={large northern deer} +} + +\newglossaryentry{emigre}{% + name={{é}migré}, + description={person who has emigrated to another country, + especially for political reasons} +} + + % Symbols + +\newglossaryentry{set}{% + type=symbols, + name={$\mathcal{S}$}, + text={\mathcal{S}}, + sort={S}, + description={A set}} + +\newglossaryentry{U}{% + type=symbols, + name={$\mathcal{U}$}, + text={\mathcal{U}}, + sort={U}, + description={The universal set}} + +\newglossaryentry{card}{% + type=symbols, + name={$|\glsentrytext{set}|$}, + text={|\glsentrytext{set}|}, + sort={|}, + description={cardinality of $\gls{set}$}} + +\newglossaryentry{factorial}{% + type=symbols, + name={$!$}, + text={!}, + sort={!}, + description={factorial}} + + % index entries + +\newterm{seal} + +\newterm{dinosaur} + +\newterm[parent=dinosaur]{ceratopsidae} + +\newterm[parent=dinosaur,plural={stegosauruses}]{stegosaurus} +\newterm[parent=ceratopsidae,plural={triceratopses}]{triceratops} +\newterm[parent=ceratopsidae,plural={styracosauruses}]{styracosaurus} +\newterm[parent=dinosaur,plural={apatosauruses}]{apatosaurus} + +\newterm{Triassic} + +\newterm{Devonian} + +\newterm[see={[see also]seal}]{sea lion} + +\begin{document} + +\chapter{Mathematical Notation} + +The cardinality of a set $\gls{set}$ is denoted $\gls{card}$ +The $\gls{factorial}$ symbol indicates factorial. +$\gls{U}$ is the universal set. + +\glsaddall[types=main] + +\chapter{Dinosaurs} + +\Glspl{dinosaur} are now extinct. They first appeared during the +\gls{Triassic} period. Examples of \glspl{dinosaur} include the +\gls{triceratops}, the \gls{styracosaurus}, the \gls{apatosaurus} and the \gls{stegosaurus}. + +\Glspl{seal} and \glspl{sea lion} are marine mammals. +The \gls{Devonian} period was the age of fish. + +\glsaddall[types=main] + +\chapter{Location Lists} + +Dinosaur: \glsdisplaynumberlist{dinosaur}. + +Set: \glsdisplaynumberlist{set}. + +\Gls{elite}: \glsdisplaynumberlist{elite}. + +\begin{equation} +3\gls[counter=equation]{factorial} = 3 \times 2 \times 1 +\end{equation} + +\newcommand{\myhandler}[4]{% + Prefix: #1. + Counter: #2. + Format: #3. + Value: #4. + Link: \setentrycounter[#1]{#2}% + \csuse{#3}{#4}. + \par +} +\newcommand{\myxrhandler}[2][]{XR (#1): #2. } + +Factorial locations: +\glsnumberlistloop{factorial}{\myhandler}{\myxrhandler} + +Sea lion locations: +\glsnumberlistloop{sea lion}{\myhandler}{\myxrhandler} + +\printnoidxglossary[type=main,sort=word] + +\printnoidxglossary[type=symbols,sort=use] + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\printnoidxglossary[type=index,style=mcolindexgroup,sort=word] + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-noidxapp.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[index,symbols,nohypertypes={index}]{glossaries} +\usepackage{glossary-mcols} + +\makenoidxglossaries + +\renewcommand{\theHequation}{\theequation} + + % main entries + +\newglossaryentry{elite}{% + name={{\'e}lite}, + description={select group of people} +} + +\newglossaryentry{elephant}{% + name={elephant}, + description={very large mammal with tusks} +} + +\newglossaryentry{elk}{% + name={elk}, + description={large northern deer} +} + +\newglossaryentry{emigre}{% + name={{\'e}migr\'e}, + description={person who has emigrated to another country, + especially for political reasons} +} + + % Symbols + +\newglossaryentry{set}{% + type=symbols, + name={$\mathcal{S}$}, + text={\mathcal{S}}, + sort={S}, + description={A set}} + +\newglossaryentry{U}{% + type=symbols, + name={$\mathcal{U}$}, + text={\mathcal{U}}, + sort={U}, + description={The universal set}} + +\newglossaryentry{card}{% + type=symbols, + name={$|\glsentrytext{set}|$}, + text={|\glsentrytext{set}|}, + sort={|}, + description={cardinality of $\gls{set}$}} + +\newglossaryentry{factorial}{% + type=symbols, + name={$!$}, + text={!}, + sort={!}, + description={factorial}} + + % index entries + +\newterm{seal} + +\newterm{dinosaur} + +\newterm[parent=dinosaur]{ceratopsidae} + +\newterm[parent=dinosaur,plural={stegosauruses}]{stegosaurus} +\newterm[parent=ceratopsidae,plural={triceratopses}]{triceratops} +\newterm[parent=ceratopsidae,plural={styracosauruses}]{styracosaurus} +\newterm[parent=dinosaur,plural={apatosauruses}]{apatosaurus} + +\newterm{Triassic} + +\newterm{Devonian} + +\newterm[see={[see also]seal}]{sea lion} + +\begin{document} + +\chapter{Mathematical Notation} + +The cardinality of a set $\gls{set}$ is denoted $\gls{card}$ +The $\gls{factorial}$ symbol indicates factorial. +$\gls{U}$ is the universal set. + +\glsaddall[types=main] + +\chapter{Dinosaurs} + +\Glspl{dinosaur} are now extinct. They first appeared during the +\gls{Triassic} period. Examples of \glspl{dinosaur} include the +\gls{triceratops}, the \gls{styracosaurus}, the \gls{apatosaurus} and the \gls{stegosaurus}. + +\Glspl{seal} and \glspl{sea lion} are marine mammals. +The \gls{Devonian} period was the age of fish. + +\glsaddall[types=main] + +\chapter{Location Lists} + +Dinosaur: \glsdisplaynumberlist{dinosaur}. + +Set: \glsdisplaynumberlist{set}. + +\Gls{elite}: \glsdisplaynumberlist{elite}. + +\begin{equation} +3\gls[counter=equation]{factorial} = 3 \times 2 \times 1 +\end{equation} + +\newcommand{\myhandler}[4]{% + Prefix: #1. + Counter: #2. + Format: #3. + Value: #4. + Link: \setentrycounter[#1]{#2}% + \csuse{#3}{#4}. + \par +} +\newcommand{\myxrhandler}[2][]{XR (#1): #2. } + +Factorial locations: +\glsnumberlistloop{factorial}{\myhandler}{\myxrhandler} + +Sea lion locations: +\glsnumberlistloop{sea lion}{\myhandler}{\myxrhandler} + +\printnoidxglossary[type=main,sort=word] + +\printnoidxglossary[type=symbols,sort=use] + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\printnoidxglossary[type=index,style=mcolindexgroup,sort=letter] + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-nomathhyper.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\GlsDeclareNoHyperList{main} + +\makeglossaries + + % redefine \glsentryfmt so that it adds a hyperlink + % if not in math mode and the hyperlinks haven't been forced on +\renewcommand*{\glsentryfmt}{% + \ifmmode + \glsgenentryfmt + \else + \glsifhyperon + {\glsgenentryfmt}% hyperlink already on + {\glshyperlink[\glsgenentryfmt]{\glslabel}}% + \fi +} + + % define a sample entry: +\newglossaryentry{x}{name={x},description={sample entry}} + +\begin{document} +\chapter{Sample} +In text mode: \gls{x}. Inline maths: $\gls{x}$. Displayed +maths: +\[ + \gls{x} +\] + +Back to text mode again: \gls{x}. Don't check the first use flag: +\glstext{x}. Force on the hyperlink: \glstext+{x}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-numberlist.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[savenumberlist,counter=chapter]{glossaries} + +\makeglossaries + +\newglossaryentry{sample}{name=sample,description=an example} + +\begin{document} +\chapter{Introduction} + +This is a \glsentryname{sample} document. \Glsentryplural{sample} +are discussed in chapters~\glsdisplaynumberlist{sample}. + +\chapter{Sample Documents} + +\Gls{sample} documents are provided for testing and illustration +purposes. + +\chapter{More About Samples} + +Here's more information about \glspl{sample}. + +\chapter{Another chapter} + +A chapter about something else. + +\chapter{Another About Samples} + +Here's some more information about \glspl{sample}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-prefix.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } + +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[toc,acronym]{glossaries-prefix} + +\makeglossaries + +\newglossaryentry{sample}{name={sample}, + description={an example}, + prefix={a~}, + prefixplural={the\space}% +} + +\newglossaryentry{oeil}{name={oeil}, + plural={yeux}, + description={eye}, + prefix={l'}, + prefixplural={les\space}} + +\newacronym + [% + prefix={an\space},prefixfirst={a~}% + ]{svm}{SVM}{support vector machine} + +\newglossarystyle{plist}{% + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \Glsentryprefix{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription\space ##2}% +} + +\begin{document} + +\tableofcontents + +\section{Sample} + +First use: \pgls{sample}, \pgls{svm}, \pgls{oeil}. Next use: \pgls{sample}, \pgls{svm}, \pgls{oeil}. + +Reset. \glsresetall + +First use: \pglspl{sample}, \pglspl{svm}, \pglspl{oeil}. Next use: +\pglspl{sample}, \pglspl{svm}, \pglspl{oeil}. + +Reset. \glsresetall + +First use: \Pgls{sample}, \Pgls{svm}. Next use: \Pgls{sample}, \Pgls{svm}. + +Reset. \glsresetall + +First use: \Pglspl{sample}, \Pglspl{svm}. Next use: \Pglspl{sample}, \Pglspl{svm}. + +Reset. \glsresetall + +First use: \PGLS{sample}, \PGLS{svm}. Next use: \PGLS{sample}, \PGLS{svm}. + +Reset. \glsresetall + +First use: \PGLSpl{sample}, \PGLSpl{svm}. Next use: \PGLSpl{sample}, \PGLSpl{svm}. + +\printglossary[style=plist] + +\printacronyms +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-si.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} +\usepackage{siunitx} +\usepackage[style=long4col]{glossaries} + +\makeglossaries + +\newglossaryentry{ohm}{% + name=ohm, + symbol={\si{\ohm}}, + description=unit of electrical resistance% +} + +\begin{document} +\glsaddallunused + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-storage-abbr-desc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey + {abbrtype}% key/field name + {acronym}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required + +\newacronymstyle + {mystyle}% style name + {% Use the generic display + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + } + {% User needs to explicitly set the description + \renewcommand*{\GenericAcronymFields}{}% + % For the full format, test the value of the "abbrtype" key. + % If it's set to "acronym" put the short form first with + % the long form in brackets. + \renewcommand*{\genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % first letter upper case version: + \renewcommand*{\Genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % plural + \renewcommand*{\genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % plural and first letter upper case + \renewcommand*{\Genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % Just use the short form as the name part in the glossary: + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + % Sort by the short form: + \renewcommand*{\acronymsort}[2]{##1}% + % Just use the surrounding font for the short form: + \renewcommand*{\acronymfont}[1]{##1}% + % Same for first use: + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + % Default plural suffix if the plural isn't explicitly set + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + } + +\setacronymstyle{mystyle} + + % The default for "abbrtype" is "acronym" so we don't need + % this new key for acronyms: +\newacronym[description={system for detecting the position and +speed of aircraft, ships, etc}]{radar}{radar}{radio detecting +and ranging} + +\newacronym[description={device that creates a narrow beam +of intense light}]{laser}{laser}{light amplification by +stimulated emission of radiation} + +\newacronym[description={portable breathing device for +divers}]{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\newcommand*{\newinitialism}[4][]{% + \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% +} + +\newinitialism[description={mathematical manipulation of an +information signal}]{dsp}{DSP}{digital signal processing} +\newinitialism[description={device that allows customers of +financial institutions to perform transactions, such as +cash withdrawal, without the need for a teller}]{atm}{ATM} +{automated teller machine} + +\newcommand*{\newcontraction}[4][]{% + \newacronym[abbrtype=contraction,#1]{#2}{#3}{#4}% +} + +\newcontraction[description={front part of a ship below the +deck}]{focsle}{fo'c's'le}{forecastle} + +\newglossaryentry{apple}{name={apple},description={a fruit}} + +\newglossarystyle + {mystyle}% style name + {% base it on the "list" style + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \ifglshaslong{##1}% + { (\abbrtype{##1}: \glsentrylong{##1})\space}{}% + \glossentrydesc{##1}\glspostdescription\space ##2}% + } + +\setglossarystyle{mystyle} + +\begin{document} + +First use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}, \gls{focsle}. + +Next use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}, \gls{focsle}. + +Regular term: \gls{apple}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-storage-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey + {abbrtype}% key/field name + {word}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required + +\newacronymstyle + {mystyle}% style name + {% Use the generic display + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + } + {% Put the long form in the description + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + % For the full format, test the value of the "abbrtype" key. + % If it's set to "word" put the short form first with + % the long form in brackets. + \renewcommand*{\genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % first letter upper case version: + \renewcommand*{\Genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % plural + \renewcommand*{\genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % plural and first letter upper case + \renewcommand*{\Genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % Just use the short form as the name part in the glossary: + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + % Sort by the short form: + \renewcommand*{\acronymsort}[2]{##1}% + % Just use the surrounding font for the short form: + \renewcommand*{\acronymfont}[1]{##1}% + % Same for first use: + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + % Default plural suffix if the plural isn't explicitly set + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + } + +\setacronymstyle{mystyle} + + % The default for "abbrtype" is "acronym" so we don't need + % this new key for acronyms: +\newacronym{radar}{radar}{radio detecting and ranging} +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} +\newacronym{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\newcommand*{\newinitialism}[4][]{% + \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% +} + +\newinitialism{dsp}{DSP}{digital signal processing} +\newinitialism{atm}{ATM}{automated teller machine} + +\begin{document} + +First use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}. + +Next use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[toc,style=treenoname,order=word,subentrycounter]{glossaries} + +\makeglossaries + +\newglossaryentry{Perl}{name=\texttt{Perl}, +sort=Perl, % need a sort key because name contains a command +description=A scripting language} + +\newglossaryentry{glossary}{name=glossary, +description={\nopostdesc}, +plural={glossaries}} + +\newglossaryentry{glossarycol}{ +description={collection of glosses}, +sort={2}, +parent={glossary}} + +\newglossaryentry{glossarylist}{ +description={list of technical words}, +sort={1}, +parent={glossary}} + +\newglossaryentry{pagelist}{name=page list, + % description value has to be enclosed in braces + % because it contains commas +description={a list of individual pages or page ranges +(e.g.\ 1,2,4,7-9)}} + +\newglossaryentry{mtrx}{name=matrix, +description={rectangular array of quantities}, + % plural is not simply obtained by appending an s, so specify +plural=matrices} + + % Entry with a paragraph break in the description: + % (If you use \newglossaryentry, the paragraph break + % must be identified with \glspar not with \par or a blank line. + % It's easier to use \longnewglossaryentry.) + +\longnewglossaryentry{par}% label +{name=paragraph}% options +{% multi-paragraph description +distinct section of a piece of writing. + +Beginning on new, usually indented, line} + + % entry with two types of plural. Set the plural form to the + % form most likely to be used. If you want to use a different + % plural, you will need to explicity specify it in \glslink +\newglossaryentry{cow}{name=cow, + % this isn't necessary, as this form (appending an s) is + % the default +plural=cows, + % description: +description={(\emph{pl.}\ cows, \emph{archaic} kine) an adult +female of any bovine animal}} + +\newglossaryentry{bravo}{name={bravo}, +description={\nopostdesc}} + +\newglossaryentry{bravo1}{description={cry of approval (pl.\ bravos)}, +sort={1}, +plural={bravos}, +parent=bravo} + +\newglossaryentry{bravo2}{description={hired ruffian or killer (pl.\ bravoes)}, +sort={2}, +plural={bravoes}, +parent=bravo} + +\newglossaryentry{seal}{% + name=seal,% + description={sea mammal with flippers that eats fish} +} + +\newglossaryentry{sealion}{% + name={sea lion},% + description={large seal}% +} + + % If a value contains a comma, you must use braces to hide + % it from the key=value list parser. Take care to avoid + % accidentally introducing unwanted space as leading and trailing + % spaces within the braces aren't stripped. For example, + % text={ spurious space } will result in extra space appearing + % when the entry is referenced. +\newglossaryentry{spuriousspace}{% + name={space, spurious}, + text={spurious space}, + description={unwanted spaces accidentally introduced by +uncommented line breaks or attempts to pretty-print the \LaTeX\ code} +} + +\begin{document} + +\title{Sample Document Using the glossaries Package} +\author{Nicola Talbot} +\pagenumbering{alph}% prevent duplicate page link names if using PDF +\maketitle + +\pagenumbering{roman} +\tableofcontents + +\chapter{Introduction} +\pagenumbering{arabic} + +A \gls{glossarylist} (definition~\glsrefentry{glossarylist}) is a +very useful addition to any technical document, although a +\gls{glossarycol} (definition~\glsrefentry{glossarycol}) can also +simply be a collection of glosses, which is another thing entirely. +Some documents have multiple \glspl{glossarylist}. + +Once you have run your document through \LaTeX, you will then need +to run the \texttt{.glo} file through \texttt{makeindex} (default) +or \texttt{xindy}. You will need to set the output file so that the +indexing application +creates a \texttt{.gls} file instead of an \texttt{.ind} file, and +change the name of the log file so that it doesn't overwrite the +index log file (if you have an index for your document). Rather +than having to remember all the command line switches, you can call +the \gls{Perl} script \texttt{makeglossaries} which provides a +convenient wrapper. See +\href{https://www.dickimaw-books.com/latex/buildglossaries}{Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build} for help. + +If a comma appears within the name or description, grouping +must be used, e.g.\ in the description of \gls{pagelist}. +Be careful about \glspl{spuriousspace} appearing in your code. + +\chapter{Plurals and Paragraphs} + +Plurals are assumed to have the letter s appended, but if this is +not the case, as in \glspl{mtrx}, then you need to specify the +plural when you define the entry. If a term may have multiple +plurals (for example \glspl{cow}/\glslink{cow}{kine}) then +define the entry with the plural form most likely to be used and +explicitly specify the alternative form using \verb|\glslink| +(e.g.\ \glslink{cow}{kine}) +or \verb|\glsdisp| (e.g.\ \glsdisp{cow}{kine}). +\Glspl{seal} and \glspl{sealion} have regular plural forms. + +\Gls{bravo} is a homograph, but the plural forms are spelt +differently. The plural of \gls{bravo1}, a cry of approval +(definition~\glsrefentry{bravo1}), is \glspl{bravo1}, whereas the +plural of \gls{bravo2}, a hired ruffian or killer +(definition~\glsrefentry{bravo2}), is \glspl{bravo2}. + +\Glspl{par} can cause a problem in commands, so care is needed +when having a paragraph break in a \gls{glossarylist} entry. + +\chapter{Ordering} + +There are two types of ordering: word ordering (which places +``\gls{sealion}'' before ``\gls{seal}'') and letter ordering +(which places ``\gls{seal}'' before ``\gls{sealion}''). + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample4col.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{article} + +\usepackage[style=long4colheaderborder]{glossaries} + +\makeglossaries + +\newglossaryentry{w}{name={$w$}, +sort=w, +description={width}, +symbol=m} + +\newglossaryentry{M}{name={$M$}, +sort=M, +description={mass}, +symbol=kg} + +\begin{document} + +\printglossaries + +The width, \gls{w}, is measured in meters. The mass, \gls{M} is +measured in kilograms. + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleaccsupp.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{article} + +\usepackage[margin=0.5in]{geometry} +\usepackage{booktabs} +\usepackage[acronym]{glossaries-accsupp} + +\makeglossaries + +\newglossaryentry{dr}{name=Dr,description={Doctor},access={Doctor}} + +\newacronym[shortaccess=S V M]{svm}{svm}{support vector machine} + +\newacronym{eg}{e.g.}{for example} + +\newcommand*{\samplerow}[1]{% + \gls{#1} & \gls{#1} & \acrshort{#1} & \acrlong{#1}\\ + \glsreset{#1}\Gls{#1} & \Gls{#1} & \Acrshort{#1} & \Acrlong{#1}\\ + \glsreset{#1}\GLS{#1} & \GLS{#1} & \ACRshort{#1} & \ACRlong{#1}\\ +} + +\begin{document} + +\begin{center} +\begin{tabular}{lllll} +\toprule +\bfseries First & \bfseries Next & \bfseries Short & \bfseries Long +\\\midrule +\samplerow{dr} +\midrule +\samplerow{eg} +\midrule +\samplerow{svm} +\bottomrule +\end{tabular} +\end{center} + + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleAcr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[style=long,% use 'long' style for the glossary + toc,% add glossary to table of contents + ]{glossaries} + +\makeglossaries + + % Set the acronym style +\setacronymstyle{long-sc-short} + +\newacronym{svm}% label +{svm}% abbreviation +{support vector machine}% long form + +\newacronym{ksvm}{ksvm}{kernel support vector machine} + +\newacronym{rna}{rna}{ribonukleins\"aure} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +\Glspl{svm} are used widely in the area of pattern recognition. +Subsequent use: \gls{svm}. + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. Plural: \glspl{ksvm}. Resetting +acronyms. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{ksvm}. + +\chapter{Short, Long and Full Forms} + +These commands don't affect the first use flag: + +\begin{center} +\begin{tabular}{lll} + & Unstarred & Starred\\ +acrshort & \acrshort{svm} & \acrshort*{svm}\\ +Acrshort & \Acrshort{svm} & \Acrshort*{svm}\\ +ACRshort & \ACRshort{svm} & \ACRshort*{svm}\\ +acrlong & \acrlong{svm} & \acrlong*{svm}\\ +Acrlong & \Acrlong{svm} & \Acrlong*{svm}\\ +ACRlong & \ACRlong{svm} & \ACRlong*{svm}\\ +acrfull & \acrfull{svm} & \acrfull*{svm}\\ +Acrfull & \Acrfull{svm} & \Acrfull*{svm}\\ +ACRfull & \ACRfull{svm} & \ACRfull*{svm}\\ +\\ +& Insert Unstarred & Insert Starred\\ +acrshort & \acrshort{svm}['s] & \acrshort*{svm}['s]\\ +Acrshort & \Acrshort{svm}['s] & \Acrshort*{svm}['s]\\ +ACRshort & \ACRshort{svm}['s] & \ACRshort*{svm}['s]\\ +acrlong & \acrlong{svm}['s] & \acrlong*{svm}['s]\\ +Acrlong & \Acrlong{svm}['s] & \Acrlong*{svm}['s]\\ +ACRlong & \ACRlong{svm}['s] & \ACRlong*{svm}['s]\\ +acrfull & \acrfull{svm}['s] & \acrfull*{svm}['s]\\ +Acrfull & \Acrfull{svm}['s] & \Acrfull*{svm}['s]\\ +ACRfull & \ACRfull{svm}['s] & \ACRfull*{svm}['s] +\end{tabular} +\end{center} + +\chapter{Another chapter} + +You don't need to worry about makeindex's special characters: +\gls{rna}. + +\printglossary[title={List of Acronyms}] + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleAcrDesc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[acronym,% create 'acronym' glossary type + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain,% + style=altlist, % use altlist style + toc, % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + + % Change the acronym style to long-sc-short-desc: +\setacronymstyle{long-sc-short-desc} + + % Change the "see" items so that they use \acronymfont: +\renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} + + % Not using a font that supports bold smallcaps so change the way + % the name is formatted in the glossary: + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\newacronym[description={Statistical pattern recognition +technique~\protect\cite{svm}}, % acronym's description +]{svm}{svm}{support vector machine} + +\newacronym + [description={Statistical pattern recognition technique + using the ``kernel trick''},% acronym's description + see={[see also]{svm}}, +] +{ksvm}{ksvm}{kernel support vector machine} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots\ (but beware, converting the initial letter to +upper case for a small caps acronym is sometimes considered +poor style). + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. This is the entry's description without +a link: \glsentrydesc{ksvm}. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleacronyms.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[acronym,acronymlists={main,acronym2}]{glossaries} + +\newglossary[alg2]{acronym2}{acr2}{acn2}{Statistical Acronyms} + +\makeglossaries + + % Use long (short) acronym style: +\setacronymstyle{long-short} + + % Main glossary is a list of calculus acronyms + +\renewcommand{\glossaryname}{Calculus Acronyms} + +\newacronym[type=main]{vc}{VC}{Vector Calculus} +\newacronym[type=main]{ftoc}{FTOC}{Fundamental Theorem of Calculus} + + % "acronym" glossary is a list of computer related acronyms + +\renewcommand{\acronymname}{Computer Acronyms} + +\newacronym{kb}{kb}{KiloBit} +\newacronym{kB}{kB}{KiloByte} + + % "acronym2" glossary is a list of statistical acronyms + +\newacronym[type=acronym2]{svm}{SVM}{Support Vector Machine} + +\begin{document} +\section{Sample Section} +\gls{kb}. \gls{kB}. \gls{vc}. \gls{ftoc}. \gls{svm}. + +\gls{kb}. \gls{kB}. \gls{vc}. \gls{ftoc}. \gls{svm}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleCustomAcr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[acronym,% create 'acronym' glossary type + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain, + style=altlist, % use altlist style + toc, % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + + % Define a new acronym style called "altfn" that's based on the + % footnote-sc-desc style + +\newacronymstyle + {altfn}% style name + {% Inherit display style from "footnote-sc-desc" + \GlsUseAcrEntryDispStyle{footnote-sc-desc}% + }% + {% Inherit definitions from "footnote-sc-desc" + \GlsUseAcrStyleDefs{footnote-sc-desc}% + % Modify the first use display styles so they put the long form + % followed by the description in the footnote: + % + % First use of \gls: + \renewcommand*{\genacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshort{##1}}##2% + \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + % First use of \Gls: + \renewcommand*{\Genacrfullformat}[2]{% + \firstacronymfont{\Glsentryshort{##1}}##2% + \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + % First use of \glspl: + \renewcommand*{\genplacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshortpl{##1}}##2% + \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + % First use of \Glspl: + \renewcommand*{\Genplacrfullformat}[2]{% + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2% + \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + % Sort according to long form: + \renewcommand*{\acronymsort}[2]{##2}% + % Set the name (as displayed in the glossary) to long (short) + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1} (\acronymfont{\glsentryshort{##1}})}% + % Since bold small caps isn't supported with this document's + % fonts, adjust \acronymfont so that it switches to medium + % small caps: + \renewcommand{\acronymfont}[1]{\textmd{\scshape ##1}}% + } + + % Now use this new style: +\setacronymstyle{altfn} + + % Change the "see" items so that they use \acronymfont: +\renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} + +\newacronym[description={Statistical pattern recognition +technique~\protect\cite{svm}}, % acronym's description +]{svm}{svm}{support vector machine} + +\newacronym[description={Statistical pattern recognition technique +using the ``kernel trick''},% acronym's description +see={[see also]{svm}}, +]{ksvm}{ksvm}{kernel +support vector machine} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots\ (but beware, converting the initial letter to +upper case for a small caps acronym is sometimes considered +poor style). + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. This is the entry's description without +a link: \glsentrydesc{ksvm}. + +\glsresetall +(Reset all.) +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleDB.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[nonumberlist]{glossaries} + +\newglossary[nlg]{symbols}{not}{ntn}{Symbols} + +\makeglossaries + +\loadglsentries{database1} +\loadglsentries[symbols]{database2} + +\begin{document} + +\glsaddall + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleDesc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % + % See also sampleAcrDesc.tex + % + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} + +\usepackage[style=altlist, % use altlist style + toc % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + +\newglossaryentry{svm}{ + % how the entry name should appear in the glossary +name={Support vector machine (SVM)}, + % how the description should appear in the glossary +description={Statistical pattern recognition +technique~\cite{svm}}, + % how the entry should appear in the document text +text={svm}, + % how the entry should appear the first time it is + % used in the document text +first={support vector machine (svm)}} + +\newglossaryentry{ksvm}{ +name={Kernel support vector machine (KSVM)}, +description={Statistical pattern recognition technique +using the ``kernel trick'' (see also SVM)}, +text={ksvm}, +first={kernel support vector machine}} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots + +This is the text produced without a link: \glsentrytext{svm}. +This is the text produced on first use without a link: +\glsentryfirst{svm}. This is the entry's description without +a link: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary[title={Acronyms}] + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleEq.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain +\documentclass[a4paper,12pt]{report} + +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[xindy,toc,ucmark,style=long3colheader,counter=equation]{glossaries} + +\makeglossaries + +\newcommand{\erf}{\operatorname{erf}} +\newcommand{\erfc}{\operatorname{erfc}} + +\pagestyle{headings} + + % redefine the way hyperref creates the target for equations + % so that the glossary links to equation numbers work + + \renewcommand*\theHequation{\theHchapter.\arabic{equation}} + + % Change the glossary headings + +\renewcommand{\entryname}{Notation} +\renewcommand{\descriptionname}{Function Name} +\renewcommand{\pagelistname}{Number of Formula} + + % define glossary entries + +\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)}, +description=Gamma function, +sort=Gamma} + +\newglossaryentry{gamma}{name={\ensuremath{\gamma(\alpha,x)}}, +description=Incomplete gamma function, +sort=gamma1} + +\newglossaryentry{iGamma}{name={\ensuremath{\Gamma(\alpha,x)}}, +description=Incomplete gamma function, +sort=Gamma2} + +\newglossaryentry{psi}{name=\ensuremath{\psi(x)}, +description=Psi function,sort=psi} + +\newglossaryentry{erf}{name=\ensuremath{\erf(x)}, +description=Error function,sort=erf} + +\newglossaryentry{erfc}{name=\ensuremath{\erfc}, +description=Complementary error function,sort=erfc} + +\newglossaryentry{B}{name={\ensuremath{B(x,y)}}, +description=Beta function,sort=B} + +\newglossaryentry{Bx}{name={\ensuremath{B_x(p,q)}}, +description=Incomplete beta function,sort=Bx} + +\newglossaryentry{Tn}{name=\ensuremath{T_n(x)}, +description=Chebyshev's polynomials of the first kind,sort=Tn} + +\newglossaryentry{Un}{name=\ensuremath{U_n(x)}, +description=Chebyshev's polynomials of the second kind,sort=Un} + +\newglossaryentry{Hn}{name=\ensuremath{H_n(x)}, +description=Hermite polynomials,sort=Hn} + +\newglossaryentry{Ln}{name=\ensuremath{L_n^\alpha(x)}, +description=Laguerre polynomials,sort=Lna} + +\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)}, +description=Bessel functions,sort=Z} + +\newglossaryentry{Phi}{name={\ensuremath{\Phi(\alpha,\gamma;z)}}, +description=confluent hypergeometric function,sort=Pagz} + +\newglossaryentry{knu}{name=\ensuremath{k_\nu(x)}, +description=Bateman's function,sort=kv} + +\newglossaryentry{Dp}{name=\ensuremath{D_p(z)}, +description=Parabolic cylinder functions,sort=Dp} + +\newglossaryentry{F}{name={\ensuremath{F(\phi,k)}}, +description=Elliptical integral of the first kind,sort=Fpk} + +\newglossaryentry{C}{name=\ensuremath{C}, +description=Euler's constant,sort=C} + +\newglossaryentry{G}{name=\ensuremath{G}, +description=Catalan's constant,sort=G} + +\begin{document} +\title{A Sample Document Using glossaries.sty} +\author{Nicola Talbot} +\maketitle + +\begin{abstract} +This is a sample document illustrating the use of the \textsf{glossaries} +package. The functions here have been taken from ``Tables of +Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. +The glossary is a list of special functions, so +the equation number has been used rather than the page number. This +can be done using the \texttt{counter=equation} package +option. +\end{abstract} + +\printglossary[title={Index of Special Functions and Notations}] + +\chapter{Gamma Functions} + +\begin{equation} +\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt +\end{equation} + +\verb|\ensuremath| is only required here if using +hyperlinks. +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x) +\end{equation} + +\begin{equation} +\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\begin{equation} +\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\newpage + +\begin{equation} +\gls{Gamma} = \Gamma(\alpha, x) + \gamma(\alpha, x) +\end{equation} + +\begin{equation} +\gls{psi} = \frac{d}{dx}\ln\Gamma(x) +\end{equation} + +\chapter{Error Functions} + +\begin{equation} +\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt +\end{equation} + +\begin{equation} +\gls{erfc} = 1 - \erf(x) +\end{equation} + +\chapter{Beta Function} + +\begin{equation} +\gls{B} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt +\end{equation} +Alternatively: +\begin{equation} +\gls{B} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi +\end{equation} + +\begin{equation} +\gls{B} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) +\end{equation} + +\begin{equation} +\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt +\end{equation} + +\chapter{Polynomials} + +\section{Chebyshev's polynomials} + +\begin{equation} +\gls{Tn} = \cos(n\arccos x) +\end{equation} + +\begin{equation} +\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} +\end{equation} + +\section{Hermite polynomials} + +\begin{equation} +\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) +\end{equation} + +\section{Laguerre polynomials} + +\begin{equation} +L_n^{\alpha} (x) = \frac{1}{n!}e^x x^{-\alpha} +\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) +\end{equation} + +\chapter{Bessel Functions} + +Bessel functions $Z_\nu$ are solutions of +\begin{equation} +\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} ++ \frac{1}{z}\,\frac{dZ_\nu}{dz} + +\left( 1-\frac{\nu^2}{z^2}Z_\nu = 0 \right) +\end{equation} + +\chapter{Confluent hypergeometric function} + +\begin{equation} +\gls{Phi} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} ++ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} ++\frac{\alpha(\alpha+1)(\alpha+2)}{\gamma(\gamma+1)(\gamma+2)}\, +\frac{z^3}{3!} + \cdots +\end{equation} + +\begin{equation} +\gls{knu} = \frac{2}{\pi}\int_0^{\pi/2} +\cos(x \tan\theta - \nu\theta)\,d\theta +\end{equation} + +\chapter{Parabolic cylinder functions} + +\begin{equation} +\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} +\left\{ +\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} +\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) +-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} +\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) +\right\} +\end{equation} + +\chapter{Elliptical Integral of the First Kind} + +\begin{equation} +\gls{F} = \int_0^\phi \frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} +\end{equation} + +\chapter{Constants} + +\begin{equation} +\gls{C} = 0.577\,215\,664\,901\ldots +\end{equation} + +\begin{equation} +\gls{G} = 0.915\,965\,594\ldots +\end{equation} + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleEqPg.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % + % To ensure that the page numbers are up-to-date: + % + % latex sampleEqPg + % makeglossaries sampleEqPg + % latex sampleEqPg + % makeglossaries sampleEqPg + % latex sampleEqPg + % + % The extra makeglossaries run is required because adding the + % glossary in the second LaTeX run shifts the page numbers on + % which means that the glossary needs to be updated again. + % (Note that this problem is avoided if the page numbering is + % reset after the glossary. For example, if the glossary has + % roman numbering and the subsequent pages have arabic numbering) + % + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass[a4paper,12pt]{report} + +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[style=long3colheader,toc, + counter=equation]{glossaries} + +\newcommand{\erf}{\operatorname{erf}} +\newcommand{\erfc}{\operatorname{erfc}} + + % redefine the way hyperref creates the target for equations + % so that the glossary links to equation numbers work + +\renewcommand*\theHequation{\thechapter.\arabic{equation}} + +\renewcommand{\glossaryname}{Index of Special Functions and Notations} + +\renewcommand{\glossarypreamble}{Numbers in italic indicate the equation number, +numbers in bold indicate page numbers where the main definition occurs.\par} + + % set the glossary number style to italic + % hyperit is used instead of textit because + % the hyperref package is being used. +\renewcommand{\glsnumberformat}[1]{\hyperit{#1}} + + % 1st column heading +\renewcommand{\entryname}{Notation} + + % 2nd column heading +\renewcommand{\descriptionname}{Function Name} + + % 3rd column heading +\renewcommand{\pagelistname}{} + + % Redefine header row so that it + % adds a blank row after the title row +\renewcommand{\glossaryheader}{\bfseries\entryname & +\bfseries\descriptionname&\bfseries\pagelistname\\ +& & \\\endhead} + + % Define glossary entries + +\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)}, +description=Gamma function,sort=Gamma} + +\newglossaryentry{gamma}{name=\ensuremath{\gamma(\alpha,x)}, +description=Incomplete gamma function,sort=gamma} + +\newglossaryentry{iGamma}{name=\ensuremath{\Gamma(\alpha,x)}, +description=Incomplete gamma function,sort=Gamma} + +\newglossaryentry{psi}{name=\ensuremath{\psi(x)}, +description=Psi function,sort=psi} + +\newglossaryentry{erf}{name=\ensuremath{\erf(x)}, +description=Error function,sort=erf} + +\newglossaryentry{erfc}{name=\ensuremath{\erfc(x)}, +description=Complementary error function,sort=erfc} + +\newglossaryentry{beta}{name=\ensuremath{B(x,y)}, +description=Beta function,sort=B} + +\newglossaryentry{Bx}{name=\ensuremath{B_x(p,q)}, +description=Incomplete beta function,sort=Bx} + +\newglossaryentry{Tn}{name=\ensuremath{T_n(x)}, +description=Chebyshev's polynomials of the first kind, +sort=Tn} + +\newglossaryentry{Un}{name=\ensuremath{U_n(x)}, +description=Chebyshev's polynomials of the second kind, +sort=Un} + +\newglossaryentry{Hn}{name=\ensuremath{H_n(x)}, +description=Hermite polynomials,sort=Hn} + +\newglossaryentry{Lna}{name=\ensuremath{L_n^\alpha(x)}, +description=Laguerre polynomials,sort=Lna} + +\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)}, +description=Bessel functions,sort=Z} + +\newglossaryentry{Pagz}{name=\ensuremath{\Phi(\alpha,\gamma;z)}, +description=confluent hypergeometric function,sort=Pagz} + +\newglossaryentry{kv}{name=\ensuremath{k_\nu(x)}, +description=Bateman's function,sort=kv} + +\newglossaryentry{Dp}{name=\ensuremath{D_p(z)}, +description=Parabolic cylinder functions,sort=Dp} + +\newglossaryentry{Fpk}{name=\ensuremath{F(\phi,k)}, +description=Elliptical integral of the first kind,sort=Fpk} + +\newglossaryentry{C}{name=\ensuremath{C}, +description=Euler's constant,sort=C} + +\newglossaryentry{G}{name=\ensuremath{G}, +description=Catalan's constant,sort=G} + +\makeglossaries + +\pagestyle{headings} + +\begin{document} + +\title{Sample Document Using Interchangable Numbering} +\author{Nicola Talbot} +\maketitle + +\begin{abstract} +This is a sample document illustrating the use of the \textsf{glossaries} +package. The functions here have been taken from ``Tables of +Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. + +The glossary lists both page numbers and equation numbers. +Since the majority of the entries use the equation number, +\texttt{counter=equation} was used as a package option. +Note that this example will only work where the +page number and equation number compositor is the same. So +it won't work if, say, the page numbers are of the form +2-4 and the equation numbers are of the form 4.6. +As most of the glossary entries should have an italic +format, it is easiest to set the default format to +italic. + +\end{abstract} + +\tableofcontents + +\printglossary[toctitle={Special Functions}] + +\chapter{Gamma Functions} + +The \glslink[format=hyperbf,counter=page]{Gamma}{gamma function} is +defined as +\begin{equation} +\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt +\end{equation} + +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x) +\end{equation} + +\begin{equation} +\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\begin{equation} +\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\newpage + +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(\alpha)}} = +\Gamma(\alpha, x) + \gamma(\alpha, x) +\end{equation} + +\begin{equation} +\gls{psi} = \frac{d}{dx}\ln\Gamma(x) +\end{equation} + +\chapter{Error Functions} + +The \glslink[format=hyperbf,counter=page]{erf}{error function} is defined as: +\begin{equation} +\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt +\end{equation} + +\begin{equation} +\gls{erfc} = 1 - \erf(x) +\end{equation} + +\chapter{Beta Function} + +\begin{equation} +\gls{beta} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt +\end{equation} +Alternatively: +\begin{equation} +\gls{beta} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi +\end{equation} + +\begin{equation} +\gls{beta} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) +\end{equation} + +\begin{equation} +\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt +\end{equation} + +\chapter{Chebyshev's polynomials} + +\begin{equation} +\gls{Tn} = \cos(n\arccos x) +\end{equation} + +\begin{equation} +\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} +\end{equation} + +\chapter{Hermite polynomials} + +\begin{equation} +\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) +\end{equation} + +\chapter{Laguerre polynomials} + +\begin{equation} +\gls{Lna} = \frac{1}{n!}e^x x^{-\alpha} +\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) +\end{equation} + +\chapter{Bessel Functions} + +Bessel functions $Z_\nu(z)$ are solutions of +\begin{equation} +\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} + \frac{1}{z}\,\frac{dZ_\nu}{dz} + +\left( +1-\frac{\nu^2}{z^2}Z_\nu = 0 +\right) +\end{equation} + +\chapter{Confluent hypergeometric function} + +\begin{equation} +\gls{Pagz} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} ++ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} ++\frac{\alpha(\alpha+1)(\alpha+2)} + {\gamma(\gamma+1)(\gamma+2)} +\,\frac{z^3}{3!} ++ \cdots +\end{equation} + +\begin{equation} +\gls{kv} = \frac{2}{\pi}\int_0^{\pi/2} +\cos(x \tan\theta - \nu\theta)\,d\theta +\end{equation} + +\chapter{Parabolic cylinder functions} + +\begin{equation} +\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} +\left\{ +\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} +\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) +-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} +\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) +\right\} +\end{equation} + +\chapter{Elliptical Integral of the First Kind} + +\begin{equation} +\gls{Fpk} = \int_0^\phi +\frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} +\end{equation} + +\chapter{Constants} + +\begin{equation} +\gls{C} = 0.577\,215\,664\,901\ldots +\end{equation} + +\begin{equation} +\gls{G} = 0.915\,965\,594\ldots +\end{equation} + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleFnAcrDesc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[acronym,% create 'acronym' glossary type + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain, + style=altlist, % use altlist style + toc, % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + + % Change the acronym style to a small-caps footnote style: +\setacronymstyle{footnote-sc-desc} + + % Make some minor adjustments to the style: +\renewcommand*{\acronymsort}[2]{#1}% sort by short form +\renewcommand*{\acronymentry}[1]{% + \acronymfont{\glsentryshort{#1}}\space (\glsentrylong{#1})} + + % Not using a font that supports bold smallcaps so ensure + % the acronym is always in medium weight. +\renewcommand*{\acronymfont}[1]{\textmd{\scshape #1}} + + % Change the "see" items so that they use \acronymfont: +\renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} + + +\newacronym[description={Statistical pattern recognition +technique~\protect\cite{svm}}, % acronym's description +]{svm}{svm}{support vector machine} + +\newacronym[description={Statistical pattern recognition technique +using the ``kernel trick''},% acronym's description +see={[see also]{svm}}, +]{ksvm}{ksvm}{kernel +support vector machine} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots\ (but beware, converting the initial letter to +upper case for a small caps acronym is sometimes considered +poor style). + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. This is the entry's description without +a link: \glsentrydesc{ksvm}. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleNtn.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + + % If you want to add babel to this document, you may have to + % replace the : character in the labels if you are using a + % language setting (e.g. french) that makes : active. + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage{html} +\usepackage[toc,xindy]{glossaries} + + % Define a new glossary type called notation +\newglossary[nlg]{notation}{not}{ntn}{Notation} + +\makeglossaries + + % Notation definitions + +\newglossaryentry{not:set}{type=notation, % glossary type +name={$\mathcal{S}$}, +description={A set}, +sort={S}} + +\newglossaryentry{not:U}{type=notation, +name={$\mathcal{U}$}, +description={The universal set}, +sort=U} + +\newglossaryentry{not:card}{type=notation, +name={$|\mathcal{S}|$}, +description={cardinality of $\mathcal{S}$}, +sort=cardinality} + +\newglossaryentry{not:fact}{type=notation, +name={$!$}, +description={factorial}, +sort=factorial} + + % Main glossary definitions + +\newglossaryentry{gls:set}{name=set, +description={A collection of distinct objects}} + +\newglossaryentry{gls:card}{name=cardinality, +description={The number of elements in the specified set}} + +\begin{document} +\title{Sample Document using the glossaries Package} +\author{Nicola Talbot} +\pagenumbering{alph} +\maketitle + +\begin{abstract} + %stop hyperref complaining about duplicate page identifiers: +\pagenumbering{Alph} +This is a sample document illustrating the use of the +\textsf{glossaries} package. In this example, a new glossary type +called \texttt{notation} is defined, so that the document can have a +separate glossary of terms and index of notation. The index of notation +doesn't have associated numbers. +\end{abstract} + + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} + +\Glspl{gls:set} are denoted by a calligraphic font +e.g.\ \gls{not:set}. + +Let \gls[format=hyperit]{not:U} denote the universal set. + +The \gls{gls:card} of a set $\mathcal{S}$ is denoted +\gls{not:card}. + +\chapter{Another Chapter} + +Another mention of the universal set \gls{not:U}. + +The factorial symbol: \gls{not:fact}. + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*samplePeople.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you are using arara, you need the following directives: + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[toc,style=listgroup]{glossaries} + +\makeglossaries + +\newcommand{\sortname}[2]{#2, #1} +\newcommand{\textname}[2]{#1 #2} + + % Syntax: \name{first name}{surname} + \let\name\textname + +\renewcommand{\glsprestandardsort}[3]{% + \let\name\sortname + \edef#1{\expandafter\expandonce\expandafter{#1}}% + \let\name\textname + \glsdosanitizesort +} + +\newglossaryentry{joebloggs}{name={\name{Joe}{Bloggs}},description={\nopostdesc}} + +\newglossaryentry{johnsmith}{name={\name{John}{Smith}},description={\nopostdesc}} + +\newglossaryentry{zoeadams}{name={\name{Zo\'e}{Adams}},description={\nopostdesc}} + +\newglossaryentry{maryadams}{name={\name{Mary}{Adams}},description={\nopostdesc}} + +\begin{document} +\tableofcontents + +\chapter{\glsentrytext{joebloggs}} + +\gls{joebloggs} was a fairly ordinary person. + +\chapter{\glsentrytext{johnsmith}} + +\gls{johnsmith} was great friends with \gls{joebloggs}. + +\chapter{\glsentrytext{maryadams}} + +\gls{maryadams} worked with \gls{johnsmith} but never met +\gls{joebloggs}. + +\chapter{\glsentrytext{zoeadams}} + +\gls{zoeadams} was \gls{maryadams}['s] sister. +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleSec.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[style=altlist,toc,counter=section]{glossaries} + +\makeglossaries + +\newglossaryentry{ident}{name=identity matrix, +description=diagonal matrix with 1s along the leading diagonal, +plural=identity matrices} + +\newglossaryentry{diag}{name=diagonal matrix, +description=matrix whose only non-zero entries are along +the leading diagonal, +plural=diagonal matrices} + +\newglossaryentry{sing}{name=singular matrix, +description=matrix with zero determinant, +plural=singular matrices} + +\begin{document} + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} +This is a sample document illustrating the use of the +\textsf{glossaries} package. + +\chapter{Diagonal matrices} + +A \gls[format=hyperit]{diag} is a matrix where all elements not on the +leading diagonal are zero. This is the +primary definition, so an italic font is used for the page number. + +\newpage +\section{Identity matrix} +The \gls[format=hyperit]{ident} is a \gls{diag} whose leading +diagonal elements are all equal to 1. + +Here is another entry for a \gls{diag}. And this is the +plural: \glspl{ident}. + +This adds an entry into the glossary with a bold number, but +it doesn't create a hyperlink: \gls*[format=hyperbf]{ident}. + +\chapter{Singular Matrices} + +A \gls{sing} is a matrix with zero determinant. +\Glspl{sing} are non-invertible. Possessive: +a \gls{sing}['s] dimensions are not necessarily equal. + +Another \gls{ident} entry. + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleSort.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + + % If you want to add babel to this document, you may have to + % replace the : character in the labels if you are using a + % language setting (e.g. french) that makes : active. + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[toc,acronym]{glossaries} + + % Define a new glossary type called notation +\newglossary[nlg]{notation}{not}{ntn}{Notation} + +\makeglossaries + +\newcounter{sortcount} + +\renewcommand{\glsprestandardsort}[3]{% + \ifdefstring{#2}{notation}% + {% + \stepcounter{sortcount}% + \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% + }% + {% + \glsdosanitizesort + }% +} + + % Notation definitions + +\newglossaryentry{not:set}{type=notation, % glossary type +name={$\mathcal{S}$}, +text={\mathcal{S}}, +description={A set}} + +\newglossaryentry{not:emptyset}{type=notation, +name={$\emptyset$}, +text={\emptyset}, +description={The empty set}} + +\newglossaryentry{not:card}{type=notation, +name={$|\mathcal{S}|$}, +text={|\mathcal{S}|}, +description={cardinality of $\mathcal{S}$}} + + % Main glossary definitions + +\newglossaryentry{gls:set}{name=set, +description={A collection of distinct objects}} + +\newglossaryentry{gls:card}{name=cardinality, +description={The number of elements in the specified set}} + + % Acronym definitions + +\newacronym{zfc}{ZFC}{Zermelo-Fraenkel set theory} + +\newacronym{ad}{AD}{axiom of determinacy} + +\newacronym{nf}{NF}{new foundations} + +\begin{document} +\title{Sample Document using the glossaries Package} +\author{Nicola Talbot} +\pagenumbering{alph} +\maketitle + +\begin{abstract} + %stop hyperref complaining about duplicate page identifiers: +\pagenumbering{Alph} +This is a sample document illustrating the use of the +\textsf{glossaries} package. In this example, a new glossary type +called \texttt{notation} is defined, so that the document can have a +separate glossary of terms, list of acronyms and index of notation. +\end{abstract} + + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} + +\Glspl{gls:set} are denoted by a calligraphic font +e.g.\ $\gls{not:set}$. + +The \gls{gls:card} of a set $\mathcal{S}$ is denoted +$\gls{not:card}$. The empty set is denoted +$\gls{not:emptyset}$. + +Here are some acronyms: \gls{nf}, \gls{zfc} and \gls{ad}. + +\chapter{Another Chapter} + +Another mention of the empty set $\gls{not:emptyset}$. + +Here are the acronyms again: \gls{nf}, \gls{zfc} and \gls{ad}. + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampletree.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[style=alttreehypergroup,nolong,nosuper]{glossaries} + + % The alttree type of glossary styles need to know the + % widest entry name for each level +\glssetwidest{Roman letters} % level 0 widest name +\glssetwidest[1]{Sigma} % level 1 widest name + +\makeglossaries + +\newglossaryentry{greekletter}{name={Greek letters}, +text={Greek letter}, +description={\nopostdesc}} + +\newglossaryentry{sigma}{name={Sigma}, +text={\ensuremath{\Sigma}}, +first={\ensuremath{\Sigma} (uppercase sigma)}, +symbol={\ensuremath{\Sigma}}, +description={Used to indicate summation}, +parent=greekletter} + +\newglossaryentry{pi}{name={pi}, +text={\ensuremath{\pi}}, +first={\ensuremath{\pi} (lowercase pi)}, +symbol={\ensuremath{\pi}}, +description={Transcendental number}, +parent=greekletter} + +\newglossaryentry{romanletter}{name={Roman letters}, +text={Roman letter}, +description={\nopostdesc}} + +\newglossaryentry{e}{name={e}, +description={Unique real number such that the derivative of +the function $e^x$ is the function itself}, +parent=romanletter} + +\newglossaryentry{C}{name={C}, +description={Euler's constant}, +parent=romanletter} + +\begin{document} +This is a sample document illustrating hierarchical glossary +entries. + +\chapter{Greek Letters Used in Mathematics} + +Some information about \glspl{greekletter}. +The letter \gls{pi} is used to represent the ratio of a circle's +circumference to its diameter. +The letter \gls{sigma} is used to represent summation. + +\chapter{Roman Letters Used in Mathematics} + +Some information about \glspl{romanletter}. +The letter \gls{e} is the unique real number such that +the derivative of the function $e^x$ is the function itself. +The letter \gls{C} represents Euler's constant. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sampleutf8.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[xindy,nonumberlist,style=listgroup]{glossaries} + +\makeglossaries + + % Note that because the é is the first letter of the + % name, it needs to be grouped or it will cause a + % problem for \makefirstuc due to expansion issues. +\newglossaryentry{elite}{name={{é}lite}, +description={select group or class}} + +\newglossaryentry{elephant}{name=elephant, +description={large animal with trunk and tusks}} + +\newglossaryentry{elk}{name=elk, +description=large deer} + +\newglossaryentry{mannerly}{name=mannerly, +description=polite} + + % The œ is not the first letter, so it doesn't need to + % be grouped. +\newglossaryentry{manoeuvre}{name={manœuvre}, +description=planned and controlled movement} + +\newglossaryentry{manor}{name=manor, +description=large landed estate or its house} + +\newglossaryentry{odometer}{name=odometer, +description=instrument for measuring distance travelled by +a wheeled vehicle} + +\newglossaryentry{oesophagus}{name={{œ}sophagus}, +plural={{œ}sophagi}, +description={canal from mouth to stomach}} + +\newglossaryentry{ogre}{name=ogre, +description=man-eating giant} + +\begin{document} +\glsaddall + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*samplexdy.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%< \tallynum { + "arabic-numbers" % -> arabic number (0, 1, 2, etc) + :sep "\glsclosebrace" % -> } +} + +% If the definition of \tally changes so that it expands to +% something slightly different then the above will have to be +% changed accordingly. + +% (Need to redefine \glsXpageXhyperbfit and +% \glsXpageXglsnumberformat after \makeglossaries to get the +% hyperlinks working correctly.) + +% To have Mc as a separate group uncomment the following three +% lines: + +%\setStyleFile{samplexdy-mc} % note no extension +%\noist +%\GlsSetXdyLanguage{} + +% The above three lines specify to use samplexdy-mc.xdy (supplied +% with this file) and don't overwrite it. The language is +% unset using \GlsSetXdyLanguage{} as all the language +% dependent information is contained in samplexdy-mc.xdy +% Note that using \noist means that commands like +% \GlsAddXdyAttribute and \GlsAddXdyLocation will no longer have +% an effect. + +% Write the style file (if \noist isn't used) +% and activate glossary entries + +\makeglossaries + +% Each page location will be specified in the form: +% +% "\glsXpageXglsnumberformat{}{\tallynum {" number "}}" +% or +% "\glsXpageXhyperbfit{}{\tallynum {" number "}}" +% +% Knowing this, we can redefine \glsXpageXglsnumberformat +% and \glsXpageXhyperbfit to grab the number part to work out the +% location's numeric value. If the definition of \tally changes +% so that it expands to something slightly different then this +% code will no longer work. +% +% Redefine to allow hyperlinks: + +\renewcommand{\glsXpageXglsnumberformat}[2]{% + % remember that #2 is in the form \tallynum {n} + % so this does \linkpagenumber\tallynum{n} + \linkpagenumber#2% +} + +\renewcommand{\glsXpageXhyperbfit}[2]{% + \textbf{\em\linkpagenumber#2}% +} + +% Syntax: \linkpagenumber\tallynum{page number} +% This creates hyperlink to the given page. +\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} + +% Define glossary entries +% \glshyperlink is used instead of \gls to prevent the glossary +% page numbers also appear in the locations, however I need +% to ensure that the referenced entries are added to the +% glossary via commands that use \glslink, \glsadd or \glssee + +\newglossaryentry{mcadam}{name={McAdam, John Loudon}, +first={John Loudon McAdam},text={McAdam}, +description={Scottish engineer}} + +\newglossaryentry{maclaurin}{name={Maclaurin, Colin}, +first={Colin Maclaurin},text={Maclaurin}, +description={Scottish mathematician best known for the +\gls{maclaurinseries}}} + +\newglossaryentry{maclaurinseries}{name={Maclaurin series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylorstheorem}{name={Taylor's theorem}, +description={Theorem expressing a function $f(x)$ as the sum of +a polynomial and a remainder: +\[f(x) = f(a)+f'(a)(x-a)+f''(a)(x-a^2)/2!+\cdots+R_n\] +If $n\to\infty$ the expansion is a \glshyperlink{taylorseries} +and if $a=0$, the series is called a +\gls{maclaurinseries}}} + +\newglossaryentry{taylorseries}{name={Taylor series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylor}{name={Taylor, Brook}, +first={Brook Taylor},text={Taylor}, +description={English mathematician}} + +\newglossaryentry{mcnemar}{name={McNemar, Quinn}, +first={Quinn McNemar},text={McNemar}, +description={Mathematician who introduced +\gls{mcnemarstest}. This entry has the number list +suppressed},nonumberlist} + +\newglossaryentry{mcnemarstest}{name={McNemar's test}, +description={A nonparametric test introduced by +\gls{mcnemar} in 1947}} + +\newglossaryentry{mach}{name={Mach, Ernst}, +first={Ernst Mach},text={Mach}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach, Ernst}, +description={Czech/Austrian physicist and philosopher}} + +\newglossaryentry{machnumber}{name={Mach number}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach number}, +description={Ratio of the speed of a body in a fluid to the +speed of sound in that fluid named after \gls{mach}}} + +\newglossaryentry{malthus}{name={Malthus, Thomas Robert}, +first={Thomas Robert Malthus},text={Malthus}, +description={English mathematician, sociologist and classicist}} + +\newglossaryentry{ampereandre}{name={Ampère, André-Marie}, +first={André-Marie Ampère},text={Ampère}, +description={French mathematician and physicist}} + +\newglossaryentry{ampere}{name={ampere}, +description={SI unit of electric current named after +\gls{ampereandre}}} + +\newglossaryentry{archimedes}{name={Archimedes of Syracuse}, +first={Archimedes of Syracuse},text={Archimedes}, +description={Greek mathematician}} + +\newglossaryentry{archimedesprinciple}{name={Archimedes' principle}, +description={Principle that if a body is submerged in a fluid +it experiences upthrust equal to the weight of the displaced +fluid. Named after \gls{archimedes}}} + +\newglossaryentry{galton}{name={Galton, Sir Francis}, +first={Sir Francis Galton},text={Galton}, +description={English anthropologist}} + +\newglossaryentry{gauss}{name={Gauss, Karl Friedrich}, +first={Karl Friedrich Gauss},text={Gauss}, +description={German mathematician}} + +\newglossaryentry{gaussianint}{name={Gaussian integer}, +description={Complex number where both real and imaginary +parts are integers}} + +\newglossaryentry{gaussianfn}{name={Gaussian function}, + description={A function of the form: + \[f(x) = a \exp\left(-\frac{(x-b)^2}{2c^2}\right)\] + for some constants $a$, $b$ and $c$}} + +\newglossaryentry{peano}{name={Peano, Giuseppe}, +first={Giuseppe Peano},text={Peano}, +description={Italian mathematician}} + +\newglossaryentry{peanoscurve}{name={Peano's curve}, +description={A space-filling curve discovered by +\gls{peano}}} + +\newglossaryentry{pearson}{name={Pearson, Karl}, +first={Karl Pearson},text={Pearson}, +description={English mathematician}} + +\newglossaryentry{pearspmcc}{name={Pearson's product moment +correlation coefficient},description={Product moment correlation +coefficient named after \gls{pearson}}} + +\begin{document} +\title{Sample Document Using the Glossaries Package With Xindy} +\author{Nicola Talbot} +\maketitle + +\section{\glsentryfirst{gauss}} + +This is a section on \gls[format=(]{gauss}. This section spans +several pages. + +\rule{1pt}{0.6\textheight} + +This paragraph has been shoved to the bottom of the page using a rule. +This paragraph spans a page break for testing purposes to ensure the +glossary entry in this paragraph has the correct location. Here's +the glossary entry: \gls{gaussianfn}. Check that the location is +correct. + +This page talks about \glspl[format=hyperbfit]{gaussianint}. Since +it's the principle definition, the user-defined hyperbfit format is +used. + +\newpage + +The section on \gls[format=)]{gauss} ends here. + +\section{Series Expansions} + +This section is about series expansions. It mentions +\gls{maclaurin} and \gls{taylor}. It also discusses +\gls{taylorstheorem} which is related to the \gls{taylorseries}. +The \gls{maclaurinseries} is a special case of the +\gls{taylorseries}. + +\section{\glsentryname{archimedesprinciple}} + +This section discusses \gls{archimedesprinciple} which was +introduced by \gls{archimedes}. + +\section{Another section} + +This section covers \gls{mach} who introduced the \gls{machnumber}. +It also mentions \gls{ampereandre} after whom the +SI unit \gls{ampere} is named. It then discusses \gls{galton} +and \gls{malthus}. Finally it mentions \gls{mcadam}. + +\newpage +This page discusses \gls{mcnemar} who introduced +\gls{mcnemarstest} and \gls{peano} who discovered \gls{peanoscurve}. + +\printglossaries +\end{document} +%COMMENT +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*samplexdy2.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % + % This is a sample document illustrating how to use the + % glossaries package with xindy. To create the document: + % + % pdflatex samplexdy2 + % makeglossaries samplexdy2 + % pdflatex samplexdy2 + % + % This sample file won't work with makeindex + % + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[colorlinks]{hyperref} +\usepackage[xindy,counter=section]{glossaries} + + % Set up somewhat eccentric section numbering system: + +\renewcommand*{\thesection}{[\thechapter]\arabic{section}} + +\renewcommand*{\theHsection}{\thepart.\thesection} +\renewcommand*{\thepart}{\Roman{part}} + +\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "[" + "arabic-numbers" :sep "]" "arabic-numbers" +} + + % If part is 0, then \thepart will be empty, so add an extra + % case to catch this: + +\GlsAddXdyLocation{zero.section}{:sep "[" + "arabic-numbers" :sep "]" "arabic-numbers" +} + + % (Note that the above will stop xindy giving a warning, but the + % location hyper links will be invalid if no \part is used.) + +\makeglossaries + +\newglossaryentry{sample}{name=sample,description={an example}} +\newglossaryentry{sample2}{name=sample2,description={another example}} + +\begin{document} +This is a sample document illustrating Xindy specific commands in +the glossaries package. + +\part{First Part} + +\chapter{Sample Chapter} +This example document has an eccentric section numbering system +where the section number is prefixed by the chapter number in square +brackets. + +\section{First Section} + +\gls{sample}. \gls{sample2}. + +\section{Second Section} + +\gls{sample2}. + +\section{Third Section} + +\gls{sample}. \gls{sample2}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*samplexdy3.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<} (where is the page number) +% so need to define the location in that format: +% (This command will have no effect if \noist is used) + +\GlsAddXdyLocation{customfmt}{:sep "\string\customfmtnum\space\glsopenbrace" + "arabic-numbers" :sep "\glsclosebrace"} + +% (Need to redefine \glsXpageXhyperbfit and +% \glsXpageXglsnumberformat after \makeglossaries to get the +% hyperlinks working correctly.) + +% To have Mc as a separate group uncomment the following three +% lines: + +%\setStyleFile{samplexdy-mc} % note no extension +%\noist +%\GlsSetXdyLanguage{} + +% The above three lines specify to use samplexdy-mc.xdy (supplied +% with this file) and don't overwrite it. The language is +% unset using \GlsSetXdyLanguage{} as all the language +% dependent information is contained in samplexdy-mc.xdy +% Note that using \noist means that commands like +% \GlsAddXdyAttribute and \GlsAddXdyLocation will no longer have +% an effect. + +% Write the style file (if \noist isn't used) +% and activate glossary entries + +\makeglossaries + +% Each page location will be specified in the form: +% +% "\glsXpageXglsnumberformat{}{\customfmtnum "\marg{n}"}" +% or +% "\glsXpageXhyperbfit{}{\customfmtnum "\marg{n}"}" +% +% Redefine to allow hyperlinks: + +\renewcommand{\glsXpageXglsnumberformat}[2]{% + \linkpagenumber#2% +} + +\renewcommand{\glsXpageXhyperbfit}[2]{% + \textbf{\em\linkpagenumber#2}% +} + +% The arguments of \linkpagenumber will be +% #1 -> \customfmtnum +% #2 -> n +% This means that the page number (n) can be used to +% form the hyperlink target. +\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} + +% Define glossary entries +% \glshyperlink is used instead of \gls to prevent the glossary +% page numbers also appear in the locations, however I need +% to ensure that the referenced entries are added to the +% glossary via commands that use \glslink, \glsadd or \glssee + +\newglossaryentry{mcadam}{name={McAdam, John Loudon}, +first={John Loudon McAdam},text={McAdam}, +description={Scottish engineer}} + +\newglossaryentry{maclaurin}{name={Maclaurin, Colin}, +first={Colin Maclaurin},text={Maclaurin}, +description={Scottish mathematician best known for the +\gls{maclaurinseries}}} + +\newglossaryentry{maclaurinseries}{name={Maclaurin series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylorstheorem}{name={Taylor's theorem}, +description={Theorem expressing a function $f(x)$ as the sum of +a polynomial and a remainder: +\[f(x) = f(a)+f'(a)(x-a)+f''(a)(x-a^2)/2!+\cdots+R_n\] +If $n\to\infty$ the expansion is a \glshyperlink{taylorseries} +and if $a=0$, the series is called a +\gls{maclaurinseries}}} + +\newglossaryentry{taylorseries}{name={Taylor series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylor}{name={Taylor, Brook}, +first={Brook Taylor},text={Taylor}, +description={English mathematician}} + +\newglossaryentry{mcnemar}{name={McNemar, Quinn}, +first={Quinn McNemar},text={McNemar}, +description={Mathematician who introduced +\gls{mcnemarstest}. This entry has the number list +suppressed},nonumberlist} + +\newglossaryentry{mcnemarstest}{name={McNemar's test}, +description={A nonparametric test introduced by +\gls{mcnemar} in 1947}} + +\newglossaryentry{mach}{name={Mach, Ernst}, +first={Ernst Mach},text={Mach}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach, Ernst}, +description={Czech/Austrian physicist and philosopher}} + +\newglossaryentry{machnumber}{name={Mach number}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach number}, +description={Ratio of the speed of a body in a fluid to the +speed of sound in that fluid named after \gls{mach}}} + +\newglossaryentry{malthus}{name={Malthus, Thomas Robert}, +first={Thomas Robert Malthus},text={Malthus}, +description={English mathematician, sociologist and classicist}} + +\newglossaryentry{ampereandre}{name={Ampère, André-Marie}, +first={André-Marie Ampère},text={Ampère}, +description={French mathematician and physicist}} + +\newglossaryentry{ampere}{name={ampere}, +description={SI unit of electric current named after +\gls{ampereandre}}} + +\newglossaryentry{archimedes}{name={Archimedes of Syracuse}, +first={Archimedes of Syracuse},text={Archimedes}, +description={Greek mathematician}} + +\newglossaryentry{archimedesprinciple}{name={Archimedes' principle}, +description={Principle that if a body is submerged in a fluid +it experiences upthrust equal to the weight of the displaced +fluid. Named after \gls{archimedes}}} + +\newglossaryentry{galton}{name={Galton, Sir Francis}, +first={Sir Francis Galton},text={Galton}, +description={English anthropologist}} + +\newglossaryentry{gauss}{name={Gauss, Karl Friedrich}, +first={Karl Friedrich Gauss},text={Gauss}, +description={German mathematician}} + +\newglossaryentry{gaussianint}{name={Gaussian integer}, +description={Complex number where both real and imaginary +parts are integers}} + +\newglossaryentry{gaussianfn}{name={Gaussian function}, + description={A function of the form: + \[f(x) = a \exp\left(-\frac{(x-b)^2}{2c^2}\right)\] + for some constants $a$, $b$ and $c$}} + +\newglossaryentry{peano}{name={Peano, Giuseppe}, +first={Giuseppe Peano},text={Peano}, +description={Italian mathematician}} + +\newglossaryentry{peanoscurve}{name={Peano's curve}, +description={A space-filling curve discovered by +\gls{peano}}} + +\newglossaryentry{pearson}{name={Pearson, Karl}, +first={Karl Pearson},text={Pearson}, +description={English mathematician}} + +\newglossaryentry{pearspmcc}{name={Pearson's product moment +correlation coefficient},description={Product moment correlation +coefficient named after \gls{pearson}}} + +\begin{document} +\title{Sample Document Using the Glossaries Package With Xindy} +\author{Nicola Talbot} +\maketitle + +\section{\glsentryfirst{gauss}} + +This is a section on +\gls[format=(]{gauss}. This section spans +several pages. + +\rule{1pt}{0.6\textheight} + +This paragraph has been shoved to the bottom of the page using a rule. +This paragraph spans a page break for testing purposes to ensure the +glossary entry in this paragraph has the correct location. Here's +the glossary entry: \gls{gaussianfn}. + +This page talks about \glspl[format=hyperbfit]{gaussianint}. Since +it's the principle definition, the user-defined hyperbfit format is +used. + +\newpage + +The section on \gls[format=)]{gauss} ends here. + +\section{Series Expansions} + +This section is about series expansions. It mentions +\gls{maclaurin} and \gls{taylor}. It also discusses +\gls{taylorstheorem} which is related to the \gls{taylorseries}. +The \gls{maclaurinseries} is a special case of the +\gls{taylorseries}. + +\section{\glsentryname{archimedesprinciple}} + +This section discusses \gls{archimedesprinciple} which was +introduced by \gls{archimedes}. + +\section{Another section} + +This section covers \gls{mach} who introduced the \gls{machnumber}. +It also mentions \gls{ampereandre} after whom the +SI unit \gls{ampere} is named. It then discusses \gls{galton} +and \gls{malthus}. Finally it mentions \gls{mcadam}. + +\newpage +This page discusses \gls{mcnemar} who introduced +\gls{mcnemarstest} and \gls{peano} who discovered \gls{peanoscurve}. + +\printglossaries +\end{document} +%COMMENT +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*mwe-acr-desc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\setacronymstyle{short-long-desc} + +\newacronym[description={a device that emits a narrow beam of +light}]{laser}{laser}{light amplification by stimulated +emission of radiation} + +\begin{document} + +First use: \gls{laser}. + +Next use: \gls{laser} or \glspl{laser}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*mwe-acr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\setacronymstyle{long-short} + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + +\begin{document} + +First use: \gls{laser}. + +Next use: \gls{laser} or \glspl{laser}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*mwe-gls.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\newglossaryentry{apple}{name={apple},description={a fruit}} + +\begin{document} + +\Gls{apple} or \gls{apple} or \glspl{apple}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*samplexdy-mc.xdy> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +;; xindy style file for samplexdy.tex that has Mc letter group + +(define-letter-group "A" :prefixes ("€")) +(define-letter-group "B" :after "A" :prefixes ("„")) +(define-letter-group "C" :after "B" :prefixes ("†")) +(define-letter-group "D" :after "C" :prefixes ("")) +(define-letter-group "E" :after "D" :prefixes ("—")) +(define-letter-group "F" :after "E" :prefixes ("œ")) +(define-letter-group "G" :after "F" :prefixes ("")) +(define-letter-group "H" :after "G" :prefixes ("¤")) +(define-letter-group "I" :after "H" :prefixes ("¨")) +(define-letter-group "J" :after "I" :prefixes ("¬")) +(define-letter-group "K" :after "J" :prefixes ("®")) +(define-letter-group "L" :after "K" :prefixes ("´")) +(define-letter-group "Mc" :after "L" :prefixes ("»†")) +(define-letter-group "M" :after "Mc" :prefixes ("»")) +(define-letter-group "N" :after "M" :prefixes ("¼")) +(define-letter-group "O" :after "N" :prefixes ("Ã")) +(define-letter-group "P" :after "O" :prefixes ("È")) +(define-letter-group "Q" :after "P" :prefixes ("Ê")) +(define-letter-group "R" :after "Q" :prefixes ("Ë")) +(define-letter-group "S" :after "R" :prefixes ("Ð")) +(define-letter-group "T" :after "S" :prefixes ("Ú")) +(define-letter-group "U" :after "T" :prefixes ("à")) +(define-letter-group "V" :after "U" :prefixes ("å")) +(define-letter-group "W" :after "V" :prefixes ("æ")) +(define-letter-group "X" :after "W" :prefixes ("ë")) +(define-letter-group "Y" :after "X" :prefixes ("í")) +(define-letter-group "Ȝ" :after "Y" :prefixes ("ï")) +(define-letter-group "Z" :after "Ȝ" :prefixes ("ð")) +(define-letter-group "Þ" :after "Z" :prefixes ("ö")) +(define-letter-group "Æ¿" :after "Þ" :prefixes ("÷")) + +(define-rule-set "en-alphabetize" + + :rules (("à" "€" :string) + ("À" "€" :string) + ("Æ" "€—" :string) + ("æ" "€—" :string) + ("Ç" "†" :string) + ("ç" "†" :string) + ("ð" "" :string) + ("Ð" "" :string) + ("É" "—" :string) + ("Ê" "—" :string) + ("È" "—" :string) + ("Ë" "—" :string) + ("è" "—" :string) + ("ë" "—" :string) + ("ê" "—" :string) + ("é" "—" :string) + ("Ï" "¨" :string) + ("ï" "¨" :string) + ("Ñ" "¼" :string) + ("ñ" "¼" :string) + ("Ö" "Ã" :string) + ("Ô" "Ã" :string) + ("ô" "Ã" :string) + ("ö" "Ã" :string) + ("œ" "×" :string) + ("Œ" "×" :string) + ("ȝ" "ï" :string) + ("Ȝ" "ï" :string) + ("þ" "ö" :string) + ("Þ" "ö" :string) + ("Ç·" "÷" :string) + ("Æ¿" "÷" :string) + ("a" "€" :string) + ("A" "€" :string) + ("b" "„" :string) + ("B" "„" :string) + ("C" "†" :string) + ("c" "†" :string) + ("d" "" :string) + ("D" "" :string) + ("E" "—" :string) + ("e" "—" :string) + ("F" "œ" :string) + ("f" "œ" :string) + ("g" "" :string) + ("G" "" :string) + ("H" "¤" :string) + ("h" "¤" :string) + ("I" "¨" :string) + ("i" "¨" :string) + ("J" "¬" :string) + ("j" "¬" :string) + ("K" "®" :string) + ("k" "®" :string) + ("L" "´" :string) + ("l" "´" :string) + ("Mc" "»†" :string) + ("Mac" "»†" :string) + ("M" "»" :string) + ("m" "»" :string) + ("N" "¼" :string) + ("n" "¼" :string) + ("O" "Ã" :string) + ("o" "Ã" :string) + ("P" "È" :string) + ("p" "È" :string) + ("q" "Ê" :string) + ("Q" "Ê" :string) + ("r" "Ë" :string) + ("R" "Ë" :string) + ("S" "Ð" :string) + ("s" "Ð" :string) + ("T" "Ú" :string) + ("t" "Ú" :string) + ("u" "à" :string) + ("U" "à" :string) + ("v" "å" :string) + ("V" "å" :string) + ("w" "æ" :string) + ("W" "æ" :string) + ("X" "ë" :string) + ("x" "ë" :string) + ("Y" "í" :string) + ("y" "í" :string) + ("z" "ð" :string) + ("Z" "ð" :string) + )) + +(define-rule-set "en-resolve-diacritics" + + :rules (("ȝ" "¢" :string) + ("þ" "¢" :string) + ("Ç·" "¢" :string) + ("Þ" "¢" :string) + ("Ȝ" "¢" :string) + ("Æ¿" "¢" :string) + ("Ö" "£" :string) + ("Ñ" "£" :string) + ("ð" "£" :string) + ("Ç" "£" :string) + ("É" "£" :string) + ("Ï" "£" :string) + ("ï" "£" :string) + ("ö" "£" :string) + ("ñ" "£" :string) + ("ç" "£" :string) + ("à" "£" :string) + ("À" "£" :string) + ("é" "£" :string) + ("Ð" "£" :string) + ("Ô" "¤" :string) + ("ô" "¤" :string) + ("È" "¤" :string) + ("è" "¤" :string) + ("Ë" "¥" :string) + ("ë" "¥" :string) + ("Ê" "¦" :string) + ("ê" "¦" :string) + ("œ" "ÿ" :string) + ("Æ" "ÿ" :string) + ("Œ" "ÿ" :string) + ("æ" "ÿ" :string) + ("S" "¢" :string) + ("K" "¢" :string) + ("d" "¢" :string) + ("Y" "¢" :string) + ("E" "¢" :string) + ("y" "¢" :string) + ("g" "¢" :string) + ("e" "¢" :string) + ("J" "¢" :string) + ("q" "¢" :string) + ("D" "¢" :string) + ("b" "¢" :string) + ("z" "¢" :string) + ("w" "¢" :string) + ("Q" "¢" :string) + ("M" "¢" :string) + ("C" "¢" :string) + ("L" "¢" :string) + ("X" "¢" :string) + ("P" "¢" :string) + ("T" "¢" :string) + ("a" "¢" :string) + ("N" "¢" :string) + ("j" "¢" :string) + ("Z" "¢" :string) + ("u" "¢" :string) + ("k" "¢" :string) + ("t" "¢" :string) + ("W" "¢" :string) + ("v" "¢" :string) + ("s" "¢" :string) + ("B" "¢" :string) + ("H" "¢" :string) + ("c" "¢" :string) + ("I" "¢" :string) + ("G" "¢" :string) + ("U" "¢" :string) + ("F" "¢" :string) + ("r" "¢" :string) + ("x" "¢" :string) + ("V" "¢" :string) + ("h" "¢" :string) + ("f" "¢" :string) + ("i" "¢" :string) + ("A" "¢" :string) + ("O" "¢" :string) + ("n" "¢" :string) + ("m" "¢" :string) + ("l" "¢" :string) + ("p" "¢" :string) + ("R" "¢" :string) + ("o" "¢" :string) + )) + +(define-rule-set "en-resolve-case" + + :rules (("Ö" "8" :string) + ("Ñ" "8" :string) + ("Ô" "8" :string) + ("Ç" "8" :string) + ("É" "8" :string) + ("Ï" "8" :string) + ("Ê" "8" :string) + ("È" "8" :string) + ("Ë" "8" :string) + ("Ç·" "8" :string) + ("À" "8" :string) + ("Þ" "8" :string) + ("Ȝ" "8" :string) + ("Ð" "8" :string) + ("Æ" "89" :string) + ("Œ" "89" :string) + ("ð" "9" :string) + ("ô" "9" :string) + ("ȝ" "9" :string) + ("ï" "9" :string) + ("ö" "9" :string) + ("ñ" "9" :string) + ("ç" "9" :string) + ("à" "9" :string) + ("þ" "9" :string) + ("è" "9" :string) + ("ë" "9" :string) + ("ê" "9" :string) + ("é" "9" :string) + ("Æ¿" "9" :string) + ("œ" "99" :string) + ("æ" "99" :string) + ("S" "8" :string) + ("K" "8" :string) + ("Y" "8" :string) + ("E" "8" :string) + ("J" "8" :string) + ("D" "8" :string) + ("Q" "8" :string) + ("M" "8" :string) + ("C" "8" :string) + ("L" "8" :string) + ("X" "8" :string) + ("P" "8" :string) + ("T" "8" :string) + ("N" "8" :string) + ("Z" "8" :string) + ("W" "8" :string) + ("B" "8" :string) + ("H" "8" :string) + ("I" "8" :string) + ("G" "8" :string) + ("U" "8" :string) + ("F" "8" :string) + ("V" "8" :string) + ("A" "8" :string) + ("O" "8" :string) + ("R" "8" :string) + ("d" "9" :string) + ("y" "9" :string) + ("g" "9" :string) + ("e" "9" :string) + ("q" "9" :string) + ("b" "9" :string) + ("z" "9" :string) + ("w" "9" :string) + ("a" "9" :string) + ("j" "9" :string) + ("u" "9" :string) + ("k" "9" :string) + ("t" "9" :string) + ("v" "9" :string) + ("s" "9" :string) + ("c" "9" :string) + ("r" "9" :string) + ("x" "9" :string) + ("h" "9" :string) + ("f" "9" :string) + ("i" "9" :string) + ("n" "9" :string) + ("m" "9" :string) + ("l" "9" :string) + ("p" "9" :string) + ("o" "9" :string) + )) + +(define-rule-set "en-ignore-special" + + :rules (("-" "" :string) + ("!" "" :string) + ("{" "" :string) + ("'" "" :string) + ("}" "" :string) + ("?" "" :string) + ("." "" :string) + )) + +(define-rule-set "en-resolve-special" + + :rules (("Ö" "¤" :string) + ("Ñ" "¤" :string) + ("ð" "¤" :string) + ("Ô" "¤" :string) + ("Ç" "¤" :string) + ("É" "¤" :string) + ("ô" "¤" :string) + ("Ï" "¤" :string) + ("ȝ" "¤" :string) + ("ï" "¤" :string) + ("Ê" "¤" :string) + ("ö" "¤" :string) + ("ñ" "¤" :string) + ("È" "¤" :string) + ("ç" "¤" :string) + ("Ë" "¤" :string) + ("à" "¤" :string) + ("þ" "¤" :string) + ("Ç·" "¤" :string) + ("è" "¤" :string) + ("À" "¤" :string) + ("ë" "¤" :string) + ("Þ" "¤" :string) + ("ê" "¤" :string) + ("é" "¤" :string) + ("Ȝ" "¤" :string) + ("Æ¿" "¤" :string) + ("Ð" "¤" :string) + ("œ" "¤¤" :string) + ("Æ" "¤¤" :string) + ("Œ" "¤¤" :string) + ("æ" "¤¤" :string) + ("?" "¡" :string) + ("!" "¢" :string) + ("." "£" :string) + ("S" "¤" :string) + ("K" "¤" :string) + ("d" "¤" :string) + ("Y" "¤" :string) + ("E" "¤" :string) + ("y" "¤" :string) + ("g" "¤" :string) + ("e" "¤" :string) + ("J" "¤" :string) + ("q" "¤" :string) + ("D" "¤" :string) + ("b" "¤" :string) + ("z" "¤" :string) + ("w" "¤" :string) + ("Q" "¤" :string) + ("M" "¤" :string) + ("C" "¤" :string) + ("L" "¤" :string) + ("X" "¤" :string) + ("P" "¤" :string) + ("T" "¤" :string) + ("a" "¤" :string) + ("N" "¤" :string) + ("j" "¤" :string) + ("Z" "¤" :string) + ("u" "¤" :string) + ("k" "¤" :string) + ("t" "¤" :string) + ("W" "¤" :string) + ("v" "¤" :string) + ("s" "¤" :string) + ("B" "¤" :string) + ("H" "¤" :string) + ("c" "¤" :string) + ("I" "¤" :string) + ("G" "¤" :string) + ("U" "¤" :string) + ("F" "¤" :string) + ("r" "¤" :string) + ("x" "¤" :string) + ("V" "¤" :string) + ("h" "¤" :string) + ("f" "¤" :string) + ("i" "¤" :string) + ("A" "¤" :string) + ("O" "¤" :string) + ("n" "¤" :string) + ("m" "¤" :string) + ("l" "¤" :string) + ("p" "¤" :string) + ("R" "¤" :string) + ("o" "¤" :string) + ("-" "¥" :string) + ("'" "¦" :string) + ("{" "§" :string) + ("}" "¨" :string) + )) + +; The following section is customised for samplexdy.tex +; (copied from samplexdy.xdy automatically generated by +; samplexdy.tex) + +; required styles + +(require "tex.xdy") + +; list of allowed attributes (number formats) + +(define-attributes (("default" + "hyperbfit" + "pagehyperbfit" + "glsnumberformat" + "pageglsnumberformat" + "textrm" + "pagetextrm" + "textsf" + "pagetextsf" + "texttt" + "pagetexttt" + "textbf" + "pagetextbf" + "textmd" + "pagetextmd" + "textit" + "pagetextit" + "textup" + "pagetextup" + "textsl" + "pagetextsl" + "textsc" + "pagetextsc" + "emph" + "pageemph" + "glshypernumber" + "pageglshypernumber" + "hyperrm" + "pagehyperrm" + "hypersf" + "pagehypersf" + "hypertt" + "pagehypertt" + "hyperbf" + "pagehyperbf" + "hypermd" + "pagehypermd" + "hyperit" + "pagehyperit" + "hyperup" + "pagehyperup" + "hypersl" + "pagehypersl" + "hypersc" + "pagehypersc" + "hyperemph" + "pagehyperemph"))) + +; user defined alphabets + + + +; location class definitions + +(define-location-class "roman-page-numbers" + ( :sep "{}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-roman-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-roman-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-roman-page-numbers" + ( :sep "{" "alpha" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-roman-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-roman-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers" + ( :sep "{}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-Roman-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-Roman-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-Roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-Roman-page-numbers" + ( :sep "{" "alpha" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-Roman-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-Roman-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-Roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers" + ( :sep "{}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-arabic-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-arabic-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-arabic-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-arabic-page-numbers" + ( :sep "{" "alpha" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-arabic-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-arabic-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-arabic-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers" + ( :sep "{}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-alpha-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-alpha-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-alpha-page-numbers" + ( :sep "{" "alpha" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers" + ( :sep "{}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-Alpha-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-Alpha-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-Alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-Alpha-page-numbers" + ( :sep "{" "alpha" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-Alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-Alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-Alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers" + ( :sep "{}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-Appendix-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-Appendix-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-Appendix-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-Appendix-page-numbers" + ( :sep "{" "alpha" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-Appendix-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-Appendix-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-Appendix-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers" + ( :sep "{}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-arabic-section-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-arabic-section-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-arabic-section-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-arabic-section-numbers" + ( :sep "{" "alpha" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-arabic-section-numbers" + ( :sep "{" "ALPHA" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-arabic-section-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-arabic-section-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) + +; user defined location classes + +(define-location-class "Numberstring" + (:sep "{}{" :sep "\protect \Numberstringnum {" "arabic-numbers" :sep "}" :sep "}")) + +; define cross-reference class + +(define-crossref-class "see" :unverified ) +(markup-crossref-list :class "see" + :open "\glsseeformat" :close "{}") + +; define the order of the location classes +(define-location-class-order ( + "roman-page-numbers" + "arabic-page-numbers" + "arabic-section-numbers" + "alpha-page-numbers" + "Roman-page-numbers" + "Alpha-page-numbers" + "Appendix-page-numbers" + "see" )) + +; define the glossary markup + +(markup-index + :open "\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble +\providecommand*\glsXpageXhyperbfit[2]{\setentrycounter[#1]{page}\hyperbfit{#2}} +\providecommand*\glsXpageXglsnumberformat[2]{\setentrycounter[#1]{page}\glsnumberformat{#2}} +\providecommand*\glsXpageXtextrm[2]{\setentrycounter[#1]{page}\textrm{#2}} +\providecommand*\glsXpageXtextsf[2]{\setentrycounter[#1]{page}\textsf{#2}} +\providecommand*\glsXpageXtexttt[2]{\setentrycounter[#1]{page}\texttt{#2}} +\providecommand*\glsXpageXtextbf[2]{\setentrycounter[#1]{page}\textbf{#2}} +\providecommand*\glsXpageXtextmd[2]{\setentrycounter[#1]{page}\textmd{#2}} +\providecommand*\glsXpageXtextit[2]{\setentrycounter[#1]{page}\textit{#2}} +\providecommand*\glsXpageXtextup[2]{\setentrycounter[#1]{page}\textup{#2}} +\providecommand*\glsXpageXtextsl[2]{\setentrycounter[#1]{page}\textsl{#2}} +\providecommand*\glsXpageXtextsc[2]{\setentrycounter[#1]{page}\textsc{#2}} +\providecommand*\glsXpageXemph[2]{\setentrycounter[#1]{page}\emph{#2}} +\providecommand*\glsXpageXglshypernumber[2]{\setentrycounter[#1]{page}\glshypernumber{#2}} +\providecommand*\glsXpageXhyperrm[2]{\setentrycounter[#1]{page}\hyperrm{#2}} +\providecommand*\glsXpageXhypersf[2]{\setentrycounter[#1]{page}\hypersf{#2}} +\providecommand*\glsXpageXhypertt[2]{\setentrycounter[#1]{page}\hypertt{#2}} +\providecommand*\glsXpageXhyperbf[2]{\setentrycounter[#1]{page}\hyperbf{#2}} +\providecommand*\glsXpageXhypermd[2]{\setentrycounter[#1]{page}\hypermd{#2}} +\providecommand*\glsXpageXhyperit[2]{\setentrycounter[#1]{page}\hyperit{#2}} +\providecommand*\glsXpageXhyperup[2]{\setentrycounter[#1]{page}\hyperup{#2}} +\providecommand*\glsXpageXhypersl[2]{\setentrycounter[#1]{page}\hypersl{#2}} +\providecommand*\glsXpageXhypersc[2]{\setentrycounter[#1]{page}\hypersc{#2}} +\providecommand*\glsXpageXhyperemph[2]{\setentrycounter[#1]{page}\hyperemph{#2}} +\begin{theglossary}\glossaryheader~n" + :close "%~n\end{theglossary}\glossarypostamble~n" + :tree) +(markup-letter-group-list :sep "\glsgroupskip~n") +(markup-indexentry :open "\relax\glsresetentrylist~n") +(markup-locclass-list :open "{\glossaryentrynumbers{\relax " + :sep ", " :close "}}") +(markup-locref-list :sep "\delimN ") +(markup-range :sep "\delimR ") + +; define format to use for locations + + +(markup-locref :open "~n\glsXpageXhyperbfit" + :close "" + :attr "pagehyperbfit") +(markup-locref :open "~n\glsXpageXglsnumberformat" + :close "" + :attr "pageglsnumberformat") +(markup-locref :open "~n\glsXpageXtextrm" + :close "" + :attr "pagetextrm") +(markup-locref :open "~n\glsXpageXtextsf" + :close "" + :attr "pagetextsf") +(markup-locref :open "~n\glsXpageXtexttt" + :close "" + :attr "pagetexttt") +(markup-locref :open "~n\glsXpageXtextbf" + :close "" + :attr "pagetextbf") +(markup-locref :open "~n\glsXpageXtextmd" + :close "" + :attr "pagetextmd") +(markup-locref :open "~n\glsXpageXtextit" + :close "" + :attr "pagetextit") +(markup-locref :open "~n\glsXpageXtextup" + :close "" + :attr "pagetextup") +(markup-locref :open "~n\glsXpageXtextsl" + :close "" + :attr "pagetextsl") +(markup-locref :open "~n\glsXpageXtextsc" + :close "" + :attr "pagetextsc") +(markup-locref :open "~n\glsXpageXemph" + :close "" + :attr "pageemph") +(markup-locref :open "~n\glsXpageXglshypernumber" + :close "" + :attr "pageglshypernumber") +(markup-locref :open "~n\glsXpageXhyperrm" + :close "" + :attr "pagehyperrm") +(markup-locref :open "~n\glsXpageXhypersf" + :close "" + :attr "pagehypersf") +(markup-locref :open "~n\glsXpageXhypertt" + :close "" + :attr "pagehypertt") +(markup-locref :open "~n\glsXpageXhyperbf" + :close "" + :attr "pagehyperbf") +(markup-locref :open "~n\glsXpageXhypermd" + :close "" + :attr "pagehypermd") +(markup-locref :open "~n\glsXpageXhyperit" + :close "" + :attr "pagehyperit") +(markup-locref :open "~n\glsXpageXhyperup" + :close "" + :attr "pagehyperup") +(markup-locref :open "~n\glsXpageXhypersl" + :close "" + :attr "pagehypersl") +(markup-locref :open "~n\glsXpageXhypersc" + :close "" + :attr "pagehypersc") +(markup-locref :open "~n\glsXpageXhyperemph" + :close "" + :attr "pagehyperemph") + +; define letter group list format + +(markup-letter-group-list :sep "\glsgroupskip~n") + +; letter group headings + +(markup-letter-group :open-head "\glsgroupheading{" + :close-head "}") + +; additional letter groups + +(define-letter-group "glsnumbers" + :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9") + :before "A") + +; additional sort rules + + +; The following is copied from xindy/lang/english/utf8-lang.xdy + +(define-sort-rule-orientations (forward backward forward forward)) +(use-rule-set :run 0 + :rule-set ("en-alphabetize" "en-ignore-special")) +(use-rule-set :run 1 + :rule-set ("en-resolve-diacritics" "en-ignore-special")) +(use-rule-set :run 2 + :rule-set ("en-resolve-case" "en-ignore-special")) +(use-rule-set :run 3 + :rule-set ("en-resolve-special")) + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*samplexdy-mc207.xdy> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +;; xindy style file for samplexdy.tex that has Mc letter group + +(define-letter-group "A" :prefixes ("€")) +(define-letter-group "B" :after "A" :prefixes ("„")) +(define-letter-group "C" :after "B" :prefixes ("†")) +(define-letter-group "D" :after "C" :prefixes ("")) +(define-letter-group "E" :after "D" :prefixes ("—")) +(define-letter-group "F" :after "E" :prefixes ("œ")) +(define-letter-group "G" :after "F" :prefixes ("")) +(define-letter-group "H" :after "G" :prefixes ("¤")) +(define-letter-group "I" :after "H" :prefixes ("¨")) +(define-letter-group "J" :after "I" :prefixes ("¬")) +(define-letter-group "K" :after "J" :prefixes ("®")) +(define-letter-group "L" :after "K" :prefixes ("´")) +(define-letter-group "Mc" :after "L" :prefixes ("»†")) +(define-letter-group "M" :after "Mc" :prefixes ("»")) +(define-letter-group "N" :after "M" :prefixes ("¼")) +(define-letter-group "O" :after "N" :prefixes ("Ã")) +(define-letter-group "P" :after "O" :prefixes ("È")) +(define-letter-group "Q" :after "P" :prefixes ("Ê")) +(define-letter-group "R" :after "Q" :prefixes ("Ë")) +(define-letter-group "S" :after "R" :prefixes ("Ð")) +(define-letter-group "T" :after "S" :prefixes ("Ú")) +(define-letter-group "U" :after "T" :prefixes ("à")) +(define-letter-group "V" :after "U" :prefixes ("å")) +(define-letter-group "W" :after "V" :prefixes ("æ")) +(define-letter-group "X" :after "W" :prefixes ("ë")) +(define-letter-group "Y" :after "X" :prefixes ("í")) +(define-letter-group "Ȝ" :after "Y" :prefixes ("ï")) +(define-letter-group "Z" :after "Ȝ" :prefixes ("ð")) +(define-letter-group "Þ" :after "Z" :prefixes ("ö")) +(define-letter-group "Æ¿" :after "Þ" :prefixes ("÷")) + +(define-rule-set "en-alphabetize" + + :rules (("à" "€" :string) + ("À" "€" :string) + ("Æ" "€—" :string) + ("æ" "€—" :string) + ("Ç" "†" :string) + ("ç" "†" :string) + ("ð" "" :string) + ("Ð" "" :string) + ("É" "—" :string) + ("Ê" "—" :string) + ("È" "—" :string) + ("Ë" "—" :string) + ("è" "—" :string) + ("ë" "—" :string) + ("ê" "—" :string) + ("é" "—" :string) + ("Ï" "¨" :string) + ("ï" "¨" :string) + ("Ñ" "¼" :string) + ("ñ" "¼" :string) + ("Ö" "Ã" :string) + ("Ô" "Ã" :string) + ("ô" "Ã" :string) + ("ö" "Ã" :string) + ("œ" "×" :string) + ("Œ" "×" :string) + ("ȝ" "ï" :string) + ("Ȝ" "ï" :string) + ("þ" "ö" :string) + ("Þ" "ö" :string) + ("Ç·" "÷" :string) + ("Æ¿" "÷" :string) + ("a" "€" :string) + ("A" "€" :string) + ("b" "„" :string) + ("B" "„" :string) + ("C" "†" :string) + ("c" "†" :string) + ("d" "" :string) + ("D" "" :string) + ("E" "—" :string) + ("e" "—" :string) + ("F" "œ" :string) + ("f" "œ" :string) + ("g" "" :string) + ("G" "" :string) + ("H" "¤" :string) + ("h" "¤" :string) + ("I" "¨" :string) + ("i" "¨" :string) + ("J" "¬" :string) + ("j" "¬" :string) + ("K" "®" :string) + ("k" "®" :string) + ("L" "´" :string) + ("l" "´" :string) + ("Mc" "»†" :string) + ("Mac" "»†" :string) + ("M" "»" :string) + ("m" "»" :string) + ("N" "¼" :string) + ("n" "¼" :string) + ("O" "Ã" :string) + ("o" "Ã" :string) + ("P" "È" :string) + ("p" "È" :string) + ("q" "Ê" :string) + ("Q" "Ê" :string) + ("r" "Ë" :string) + ("R" "Ë" :string) + ("S" "Ð" :string) + ("s" "Ð" :string) + ("T" "Ú" :string) + ("t" "Ú" :string) + ("u" "à" :string) + ("U" "à" :string) + ("v" "å" :string) + ("V" "å" :string) + ("w" "æ" :string) + ("W" "æ" :string) + ("X" "ë" :string) + ("x" "ë" :string) + ("Y" "í" :string) + ("y" "í" :string) + ("z" "ð" :string) + ("Z" "ð" :string) + )) + +(define-rule-set "en-resolve-diacritics" + + :rules (("ȝ" "¢" :string) + ("þ" "¢" :string) + ("Ç·" "¢" :string) + ("Þ" "¢" :string) + ("Ȝ" "¢" :string) + ("Æ¿" "¢" :string) + ("Ö" "£" :string) + ("Ñ" "£" :string) + ("ð" "£" :string) + ("Ç" "£" :string) + ("É" "£" :string) + ("Ï" "£" :string) + ("ï" "£" :string) + ("ö" "£" :string) + ("ñ" "£" :string) + ("ç" "£" :string) + ("à" "£" :string) + ("À" "£" :string) + ("é" "£" :string) + ("Ð" "£" :string) + ("Ô" "¤" :string) + ("ô" "¤" :string) + ("È" "¤" :string) + ("è" "¤" :string) + ("Ë" "¥" :string) + ("ë" "¥" :string) + ("Ê" "¦" :string) + ("ê" "¦" :string) + ("œ" "ÿ" :string) + ("Æ" "ÿ" :string) + ("Œ" "ÿ" :string) + ("æ" "ÿ" :string) + ("S" "¢" :string) + ("K" "¢" :string) + ("d" "¢" :string) + ("Y" "¢" :string) + ("E" "¢" :string) + ("y" "¢" :string) + ("g" "¢" :string) + ("e" "¢" :string) + ("J" "¢" :string) + ("q" "¢" :string) + ("D" "¢" :string) + ("b" "¢" :string) + ("z" "¢" :string) + ("w" "¢" :string) + ("Q" "¢" :string) + ("M" "¢" :string) + ("C" "¢" :string) + ("L" "¢" :string) + ("X" "¢" :string) + ("P" "¢" :string) + ("T" "¢" :string) + ("a" "¢" :string) + ("N" "¢" :string) + ("j" "¢" :string) + ("Z" "¢" :string) + ("u" "¢" :string) + ("k" "¢" :string) + ("t" "¢" :string) + ("W" "¢" :string) + ("v" "¢" :string) + ("s" "¢" :string) + ("B" "¢" :string) + ("H" "¢" :string) + ("c" "¢" :string) + ("I" "¢" :string) + ("G" "¢" :string) + ("U" "¢" :string) + ("F" "¢" :string) + ("r" "¢" :string) + ("x" "¢" :string) + ("V" "¢" :string) + ("h" "¢" :string) + ("f" "¢" :string) + ("i" "¢" :string) + ("A" "¢" :string) + ("O" "¢" :string) + ("n" "¢" :string) + ("m" "¢" :string) + ("l" "¢" :string) + ("p" "¢" :string) + ("R" "¢" :string) + ("o" "¢" :string) + )) + +(define-rule-set "en-resolve-case" + + :rules (("Ö" "8" :string) + ("Ñ" "8" :string) + ("Ô" "8" :string) + ("Ç" "8" :string) + ("É" "8" :string) + ("Ï" "8" :string) + ("Ê" "8" :string) + ("È" "8" :string) + ("Ë" "8" :string) + ("Ç·" "8" :string) + ("À" "8" :string) + ("Þ" "8" :string) + ("Ȝ" "8" :string) + ("Ð" "8" :string) + ("Æ" "89" :string) + ("Œ" "89" :string) + ("ð" "9" :string) + ("ô" "9" :string) + ("ȝ" "9" :string) + ("ï" "9" :string) + ("ö" "9" :string) + ("ñ" "9" :string) + ("ç" "9" :string) + ("à" "9" :string) + ("þ" "9" :string) + ("è" "9" :string) + ("ë" "9" :string) + ("ê" "9" :string) + ("é" "9" :string) + ("Æ¿" "9" :string) + ("œ" "99" :string) + ("æ" "99" :string) + ("S" "8" :string) + ("K" "8" :string) + ("Y" "8" :string) + ("E" "8" :string) + ("J" "8" :string) + ("D" "8" :string) + ("Q" "8" :string) + ("M" "8" :string) + ("C" "8" :string) + ("L" "8" :string) + ("X" "8" :string) + ("P" "8" :string) + ("T" "8" :string) + ("N" "8" :string) + ("Z" "8" :string) + ("W" "8" :string) + ("B" "8" :string) + ("H" "8" :string) + ("I" "8" :string) + ("G" "8" :string) + ("U" "8" :string) + ("F" "8" :string) + ("V" "8" :string) + ("A" "8" :string) + ("O" "8" :string) + ("R" "8" :string) + ("d" "9" :string) + ("y" "9" :string) + ("g" "9" :string) + ("e" "9" :string) + ("q" "9" :string) + ("b" "9" :string) + ("z" "9" :string) + ("w" "9" :string) + ("a" "9" :string) + ("j" "9" :string) + ("u" "9" :string) + ("k" "9" :string) + ("t" "9" :string) + ("v" "9" :string) + ("s" "9" :string) + ("c" "9" :string) + ("r" "9" :string) + ("x" "9" :string) + ("h" "9" :string) + ("f" "9" :string) + ("i" "9" :string) + ("n" "9" :string) + ("m" "9" :string) + ("l" "9" :string) + ("p" "9" :string) + ("o" "9" :string) + )) + +(define-rule-set "en-ignore-special" + + :rules (("-" "" :string) + ("!" "" :string) + ("{" "" :string) + ("'" "" :string) + ("}" "" :string) + ("?" "" :string) + ("." "" :string) + )) + +(define-rule-set "en-resolve-special" + + :rules (("Ö" "¤" :string) + ("Ñ" "¤" :string) + ("ð" "¤" :string) + ("Ô" "¤" :string) + ("Ç" "¤" :string) + ("É" "¤" :string) + ("ô" "¤" :string) + ("Ï" "¤" :string) + ("ȝ" "¤" :string) + ("ï" "¤" :string) + ("Ê" "¤" :string) + ("ö" "¤" :string) + ("ñ" "¤" :string) + ("È" "¤" :string) + ("ç" "¤" :string) + ("Ë" "¤" :string) + ("à" "¤" :string) + ("þ" "¤" :string) + ("Ç·" "¤" :string) + ("è" "¤" :string) + ("À" "¤" :string) + ("ë" "¤" :string) + ("Þ" "¤" :string) + ("ê" "¤" :string) + ("é" "¤" :string) + ("Ȝ" "¤" :string) + ("Æ¿" "¤" :string) + ("Ð" "¤" :string) + ("œ" "¤¤" :string) + ("Æ" "¤¤" :string) + ("Œ" "¤¤" :string) + ("æ" "¤¤" :string) + ("?" "¡" :string) + ("!" "¢" :string) + ("." "£" :string) + ("S" "¤" :string) + ("K" "¤" :string) + ("d" "¤" :string) + ("Y" "¤" :string) + ("E" "¤" :string) + ("y" "¤" :string) + ("g" "¤" :string) + ("e" "¤" :string) + ("J" "¤" :string) + ("q" "¤" :string) + ("D" "¤" :string) + ("b" "¤" :string) + ("z" "¤" :string) + ("w" "¤" :string) + ("Q" "¤" :string) + ("M" "¤" :string) + ("C" "¤" :string) + ("L" "¤" :string) + ("X" "¤" :string) + ("P" "¤" :string) + ("T" "¤" :string) + ("a" "¤" :string) + ("N" "¤" :string) + ("j" "¤" :string) + ("Z" "¤" :string) + ("u" "¤" :string) + ("k" "¤" :string) + ("t" "¤" :string) + ("W" "¤" :string) + ("v" "¤" :string) + ("s" "¤" :string) + ("B" "¤" :string) + ("H" "¤" :string) + ("c" "¤" :string) + ("I" "¤" :string) + ("G" "¤" :string) + ("U" "¤" :string) + ("F" "¤" :string) + ("r" "¤" :string) + ("x" "¤" :string) + ("V" "¤" :string) + ("h" "¤" :string) + ("f" "¤" :string) + ("i" "¤" :string) + ("A" "¤" :string) + ("O" "¤" :string) + ("n" "¤" :string) + ("m" "¤" :string) + ("l" "¤" :string) + ("p" "¤" :string) + ("R" "¤" :string) + ("o" "¤" :string) + ("-" "¥" :string) + ("'" "¦" :string) + ("{" "§" :string) + ("}" "¨" :string) + )) + +; The following section is customised for samplexdy.tex +; (copied from samplexdy.xdy automatically generated by +; samplexdy.tex) + +; required styles + +(require "tex.xdy") + +; list of allowed attributes (number formats) + +(define-attributes (("default" + "glsnumberformat" + "textrm" + "textsf" + "texttt" + "textbf" + "textmd" + "textit" + "textup" + "textsl" + "textsc" + "emph" + "glshypernumber" + "hyperrm" + "hypersf" + "hypertt" + "hyperbf" + "hypermd" + "hyperit" + "hyperup" + "hypersl" + "hypersc" + "hyperemph" + "hyperbfit"))) + +; user defined alphabets + + + +; location class definitions + +(define-location-class "roman-page-numbers" + ("roman-numbers-lowercase")) +(define-location-class "Roman-page-numbers" + ("roman-numbers-uppercase")) +(define-location-class "arabic-page-numbers" + ("arabic-numbers")) +(define-location-class "alpha-page-numbers" + ("alpha")) +(define-location-class "Alpha-page-numbers" + ("ALPHA")) +(define-location-class "Appendix-page-numbers" + ("ALPHA" :sep "." "arabic-numbers")) +(define-location-class "arabic-section-numbers" + ("arabic-numbers" :sep "." "arabic-numbers")) + +; user defined location classes + +(define-location-class "Numberstring" + (:sep "\protect \Numberstringnum {" "arabic-numbers" :sep "}")) + +; define cross-reference class + +(define-crossref-class "see" :unverified ) +(markup-crossref-list :class "see" + :open "\glsseeformat" :close "{}") + +; define the order of the location classes +(define-location-class-order ( + "roman-page-numbers" + "arabic-page-numbers" + "arabic-section-numbers" + "alpha-page-numbers" + "Roman-page-numbers" + "Alpha-page-numbers" + "Appendix-page-numbers" + "see" )) + +; define the glossary markup + +(markup-index + :open "\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble~n\begin{theglossary}\glossaryheader~n" + :close "~n\end{theglossary}~n\glossarypostamble~n" + :tree) +(markup-letter-group-list :sep "\glsgroupskip~n") +(markup-indexentry :open "~n" :depth 0) +(markup-locclass-list :open "{\glossaryentrynumbers{\relax " + :sep ", " :close "}}") +(markup-locref-list :sep "\delimN ") +(markup-range :sep "\delimR ") + +; define format to use for locations + + +(markup-locref :open "~n\setentrycounter{page}\glsnumberformat{" + :close "}" + :attr "glsnumberformat") +(markup-locref :open "~n\setentrycounter{page}\textrm{" + :close "}" + :attr "textrm") +(markup-locref :open "~n\setentrycounter{page}\textsf{" + :close "}" + :attr "textsf") +(markup-locref :open "~n\setentrycounter{page}\texttt{" + :close "}" + :attr "texttt") +(markup-locref :open "~n\setentrycounter{page}\textbf{" + :close "}" + :attr "textbf") +(markup-locref :open "~n\setentrycounter{page}\textmd{" + :close "}" + :attr "textmd") +(markup-locref :open "~n\setentrycounter{page}\textit{" + :close "}" + :attr "textit") +(markup-locref :open "~n\setentrycounter{page}\textup{" + :close "}" + :attr "textup") +(markup-locref :open "~n\setentrycounter{page}\textsl{" + :close "}" + :attr "textsl") +(markup-locref :open "~n\setentrycounter{page}\textsc{" + :close "}" + :attr "textsc") +(markup-locref :open "~n\setentrycounter{page}\emph{" + :close "}" + :attr "emph") +(markup-locref :open "~n\setentrycounter{page}\glshypernumber{" + :close "}" + :attr "glshypernumber") +(markup-locref :open "~n\setentrycounter{page}\hyperrm{" + :close "}" + :attr "hyperrm") +(markup-locref :open "~n\setentrycounter{page}\hypersf{" + :close "}" + :attr "hypersf") +(markup-locref :open "~n\setentrycounter{page}\hypertt{" + :close "}" + :attr "hypertt") +(markup-locref :open "~n\setentrycounter{page}\hyperbf{" + :close "}" + :attr "hyperbf") +(markup-locref :open "~n\setentrycounter{page}\hypermd{" + :close "}" + :attr "hypermd") +(markup-locref :open "~n\setentrycounter{page}\hyperit{" + :close "}" + :attr "hyperit") +(markup-locref :open "~n\setentrycounter{page}\hyperup{" + :close "}" + :attr "hyperup") +(markup-locref :open "~n\setentrycounter{page}\hypersl{" + :close "}" + :attr "hypersl") +(markup-locref :open "~n\setentrycounter{page}\hypersc{" + :close "}" + :attr "hypersc") +(markup-locref :open "~n\setentrycounter{page}\hyperemph{" + :close "}" + :attr "hyperemph") +(markup-locref :open "~n\setentrycounter{page}\hyperbfit{" + :close "}" + :attr "hyperbfit") + +; define letter group list format + +(markup-letter-group-list :sep "\glsgroupskip~n") + +; letter group headings + +(markup-letter-group :open-head "\glsgroupheading{" + :close-head "}") + +(define-letter-group "glsnumbers" + :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9") + :before "A") + +; The following is copied from xindy/lang/english/utf8-lang.xdy + +(define-sort-rule-orientations (forward backward forward forward)) +(use-rule-set :run 0 + :rule-set ("en-alphabetize" "en-ignore-special")) +(use-rule-set :run 1 + :rule-set ("en-resolve-diacritics" "en-ignore-special")) +(use-rule-set :run 2 + :rule-set ("en-resolve-case" "en-ignore-special")) +(use-rule-set :run 3 + :rule-set ("en-resolve-special")) + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*database1.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This is a sample database of glossary entries + % Only those entries used in the document with \glslink, \gls, + % \glspl, and uppercase variants will have entries in the + % glossary. Note that the type key is not used, as the + % glossary type can be specified in \loadglsentries + +\newglossaryentry{array}{name=array, +description={A list of values identified by a numeric value}} + +\newglossaryentry{binary}{name=binary, +description={Pertaining to numbers represented in base 2}} + +\newglossaryentry{comment}{name=comment, +description={A remark that doesn't affect the meaning of the +code}} + +\newglossaryentry{global}{name=global, +description={Something that maintains its state when it leaves +the current group}} + +\newglossaryentry{local}{name=local, +description={Something that only maintains its state until +it leaves the group in which it was defined/changed}} + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*database2.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This is a sample database of glossary entries + % Only those entries used in the document with \glslink, \gls, + % \glspl, and uppercase variants will have entries in the + % glossary. Note that the type key is not used, as the + % glossary type can be specified in \loadglsentries + + % Don't need to worry about makeindex special characters +\newglossaryentry{quote}{name={"}, +description={the double quote symbol}} + +\newglossaryentry{at}{name={@}, +description={the ``at'' symbol}} + +\newglossaryentry{excl}{name={!}, +description={the exclamation mark symbol}} + +\newglossaryentry{bar}{name={\ensuremath{|}}, +description={the vertical bar symbol}} + +\newglossaryentry{hash}{name={\#}, +description={the hash symbol}} + +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*glossaries.perl> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +# File : glossaries.perl +# Author : Nicola L.C. Talbot +# Date : 14th June 2007 +# Last Modified : 2014-09-24 +# Version : 1.06 +# Description : LaTeX2HTML (limited!) implementation of glossaries +# package. Note that not all the glossaries.sty +# macros have been implemented. +# Note that this may not work with new versions of +# LaTeX2HTML. + +# This is a LaTeX2HTML style implementing the glossaries package, and +# is distributed as part of that package. +# Copyright 2007 Nicola L.C. 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 of (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.dtx and glossaries.ins +# and the derived files glossaries.sty, glossaries-prefix.sty, +# glossary-hypernav.sty, glossary-inline.sty, glossary-list.sty, +# glossary-long.sty, glossary-longbooktabs.sty, glossary-longragged.sty, +# glossary-mcols.sty, glossary-super.sty, glossary-superragged.sty, +# glossary-tree.sty, glossaries-compatible-207.sty, +# glossaries-compatible-307.sty, glossaries-accsupp.sty, +# glossaries-babel.sty, glossaries-polyglossia.sty, glossaries.perl. +# Also makeglossaries and makeglossaries-lite.lua. + + +package main; + +&do_require_package("mfirstuc"); + + %glossary_style = (); + &set_glossarystyle('altlist');# default style + + $CURRENT_STYLE='altlist'; + +&process_commands_nowrap_in_tex( <<_RAW_ARG_CMDS_); +newglossarystyle # {} # {} +_RAW_ARG_CMDS_ + +# These are the only package options implemented. + +sub do_glossaries_style_altlist{ +} + +sub do_glossaries_toc{ +} + +sub do_glossaries_toc_true{ +} + +$INDEXONLYFIRST=0; + +sub do_glossaries_indexonlyfirst{ + $INDEXONLYFIRST=1; +} + +$gls_nonumberlist{'main'} = 0; + +sub do_glossaries_nonumberlist{ + $gls_nonumberlist{'main'} = 1; +} + +$GLSCURRENTFORMAT="textrm" if (!defined($GLSCURRENTFORMAT)); +$GLOSSARY_END_DESCRIPTION = '.' if (!defined($GLOSSARY_END_DESCRIPTION)); + +sub do_cmd_glossaryname{ + "Glossary$_[0]" +} + +$gls_mark{'main'} = ""; +$gls_file_mark{'main'} = ""; +$gls_title{'main'} = "\\glossaryname"; +$gls_toctitle{'main'} = "\\glossaryname"; +$delimN{'main'} = ", "; +$glsnumformat{'main'} = $GLSCURRENTFORMAT; +@{$gls_entries{'main'}} = (); +$gls_displayfirst{'main'} = "glsdisplayfirst"; +$gls_display{'main'} = "glsdisplay"; + + %glsentry = (); + +$acronymtype = 'main'; + +sub do_glossaries_acronym{ + &do_glossaries_acronym_true +} + +sub do_glossaries_acronym_true{ + &make_newglossarytype("acronym", "\\acronymname"); + $acronymtype = 'acronym'; +} + +sub do_glossaries_acronym_false{ + $acronymtype = 'main'; +} + +sub do_cmd_acronymname{ + join('', 'Acronyms', $_[0]); +} + +sub do_cmd_acronymtype{ + join('', $acronymtype, $_[0]); +} + +$global{'glossaryentry'} = 0; +$global{'glossarysubentry'} = 0; + +sub do_cmd_theglossaryentry{ + join('', $global{'glossaryentry'}, $_[0]); +} + +sub do_cmd_theglossarysubentry{ + join('', $global{'glossarysubentry'}, $_[0]); +} + +sub do_glossaries_entrycounter{ + &do_glossaries_entrycounter_true +} + +sub do_glossaries_entrycounter_true{ + eval(<<'_END_DEF'); + sub do_cmd_glsresetentrycounter{ + $global{'entrycounter'} = 0; + $_[0]; + } +_END_DEF +} + +sub do_glossaries_entrycounter_false{ + eval(<<'_END_DEF'); + sub do_cmd_glsresetentrycounter{ + $_[0]; + } +_END_DEF +} + +sub do_cmd_glsresetentrycounter{$_[0];} + +sub do_glossaries_subentrycounter{ + &do_glossaries_subentrycounter_true +} + +sub do_glossaries_subentrycounter_true{ + eval(<<'_END_DEF'); + sub do_cmd_glsresetsubentrycounter{ + $global{'subentrycounter'} = 0; + $_[0]; + } +_END_DEF +} + +sub do_glossaries_subentrycounter_false{ + eval(<<'_END_DEF'); + sub do_cmd_glsresetsubentrycounter{ + $_[0]; + } +_END_DEF +} + +sub do_cmd_glsresetsubentrycounter{ $_[0]; } + +# modify set_depth_levels so that glossary is added + +sub replace_glossary_markers{ + foreach $type (keys %gls_mark) + { + if (defined &add_gls_hook) + {&add_gls_hook if (/$gls_mark{$type}/);} + else + {&add_gls($type) if (/$gls_mark{$type}/);} + + s/$gls_file_mark{$type}/$glsfile{$type}/g; + } +} + +# there must be a better way of doing this +# other than copying the original code and adding to it. +sub replace_general_markers { + if (defined &replace_infopage_hook) {&replace_infopage_hook if (/$info_page_mark/);} + else { &replace_infopage if (/$info_page_mark/); } + if (defined &add_idx_hook) {&add_idx_hook if (/$idx_mark/);} + else {&add_idx if (/$idx_mark/);} + &replace_glossary_markers; + + if ($segment_figure_captions) { +s/$lof_mark/$segment_figure_captions/o + } else { s/$lof_mark/$figure_captions/o } + if ($segment_table_captions) { +s/$lot_mark/$segment_table_captions/o + } else { s/$lot_mark/$table_captions/o } + &replace_morelinks(); + if (defined &replace_citations_hook) {&replace_citations_hook if /$bbl_mark/;} + else {&replace_bbl_marks if /$bbl_mark/;} + if (defined &add_toc_hook) {&add_toc_hook if (/$toc_mark/);} + else {&add_toc if (/$toc_mark/);} + if (defined &add_childs_hook) {&add_childs_hook if (/$childlinks_on_mark/);} + else {&add_childlinks if (/$childlinks_on_mark/);} + &remove_child_marks; + + if (defined &replace_cross_references_hook) {&replace_cross_references_hook;} + else {&replace_cross_ref_marks if /$cross_ref_mark||$cross_ref_visible_mark/;} + if (defined &replace_external_references_hook) {&replace_external_references_hook;} + else {&replace_external_ref_marks if /$external_ref_mark/;} + if (defined &replace_cite_references_hook) {&replace_cite_references_hook;} + else { &replace_cite_marks if /$cite_mark/; } + if (defined &replace_user_references) { + &replace_user_references if /$user_ref_mark/; } + +} + +sub add_gls{ + local($sidx_style, $eidx_style) =('',''); + if ($INDEX_STYLES) { +if ($INDEX_STYLES =~/,/) { +local(@styles) = split(/\s*,\s*/,$INDEX_STYLES); + $sidx_style = join('','<', join('><',@styles) ,'>'); + $eidx_style = join('',''); +} else { + $sidx_style = join('','<', $INDEX_STYLES,'>'); + $eidx_style = join('',''); +} + } + &add_real_gls +} + +sub gls_compare{ + local($x, $y) = @_; + + if ($x eq '' or $y eq '') + { + if ($x ne '') + { + # y is the shorter string + return 1; + } + elsif ($y ne '') + { + # x is the shorter string + return -1; + } + else + { + # both empty + return 0; + } + } + + local($x0) = ''; + local($y0) = ''; + + #v1.06 added /i for case-insensitive match + if ($x=~s/^(&#(?:\d+|x[\da-f]+);)//i) + { + $x0 = $1; + } + elsif ($x=~s/^(.)//) + { + $x0 = $1; + } + + if ($y=~s/^(&#(?:\d+|x[\da-f]+);)//i) + { + $y0 = $1; + } + elsif ($y=~s/^(.)//) + { + $y0 = $1; + } + + local($numx); + + if ($x0=~/&#(\d+|x[\da-f]+);/i) + { + $numx = $1; + + $numx = hex("0$numx") if $numx=~/^x/; + } + else + { + $numx = ord($x0); + } + + local($numy); + + if ($y0=~/&#(\d+|x[\da-f]+);/i) + { + $numy = $1; + + $numy = hex("0$numy") if $numy=~/^x/; + } + else + { + $numy = ord($y0); + } + + if ($numx == $numy) + { + return &gls_compare($x, $y); + } + elsif ($numx >= 48 and $numx <= 57) # x in range '0' ... '9' + { + if ($numy >= 48 and $numy <= 57) # y in range '0' ... '9' + { + return $numx <=> $numy; + } + elsif (($numy >= 97 and $numy <= 122) or ($numy >= 65 and $numy <= 90)) # y a letter + { + # digits are less than letters + return -1; + } + else + { + # digits are greater than symbols + return 1; + } + } + elsif (($numx >= 97 and $numx <= 122) or ($numx >= 65 and $numx <= 90)) # x a letter + { + if (($numy >= 97 and $numy <= 122) or ($numy >= 65 and $numy <= 90)) # y a letter + { + if (($numx <= 90 and $numy <= 90) or ($numx >= 97 and $numy >= 97)) + { + # same case (already checked if they are equal) + + return $numx <=> $numy; + } + + # are they upper/lower case versions of each other? + + if (($numx >= 97 and $numy == $numx-32)) + { + # x is upper case version of y + + if ($x or $y) + { + return &gls_compare($x, $y); + } + else + { + return -1; + } + } + + if (($numy >= 97 and $numx == $numy-32)) + { + # y is upper case version of x + + if ($x or $y) + { + return &gls_compare($x, $y); + } + else + { + return 1; + } + } + + # compare lower case values + return lc(chr($numx)) cmp lc(chr($numy)); + } + else + { + # a-z greater than symbols and digits + return 1; + } + } + elsif ($numy >= 48 and $numy <= 57) # y in range '0' ... '9' + { + # already checked for '0' < x < '9' and '0' < y < '9' + # already checked for 'a' < x < 'z' and '0' < y < '9' + + # digits greater than symbols + return 1; + } + elsif (($numy >= 97 and $numy <= 122) or ($numy >= 65 and $numy <= 90)) # y is a letter + { + # already checked for x is digit and y a is letter + # already checked for x is letter and y a is letter + + # symbols and digits are less than letters + + return -1; + } + + $numx <=> $numy +} + +sub gloskeysort{ + + $a=~/^(.*)###(\d+)$/; + + local($labelx) = $1; + local($x_id) =$2; + + $b=~/^(.*)###(\d+)$/; + + local($labely) = $1; + local($y_id) = $2; + + local($sortx) = &gls_get_sort($labelx); + local($sorty) = &gls_get_sort($labely); + + local($n); + + # are they case-insensitive equivalent? + + if (lc($sortx) eq lc($sorty)) + { + $n = ($sortx cmp $sorty); + } + else + { + $n = &gls_compare($sortx, $sorty); + } + + unless ($n) + { + $n = ($x_id <=> $y_id); + } + + $n +} + +sub add_parent_if_required{ + local($label) = @_; + + local($parent) = &gls_get_parent($label); + + if ($parent) + { + local($type) = &gls_get_type($parent); + + # does this parent have a backlink? + + for my $key (keys %{$glossary{$type}}) + { + return if $key=~/^$parent###\d+$/; + } + + # none found, so add empty one + + my $id = ++$global{'max_id'}; + + $glossary{$type}{"$parent###$id"} = ''; + $glossary_entry{$type}{"$parent###$id"} = $parent; + + # check if parent also has a parent + + &add_parent_if_required($parent); + } +} + +sub add_real_gls{ + local($type) = @_; + print "\nDoing glossary '$type' ..."; + local($key, $str, @keys, $thisglsentry, $level, $count, + $previous, $current, $id, $linktext, $delimN); + + $TITLE = $gls_toctitle{$type}; + + local($oldstyle) = $CURRENT_STYLE; + + if ($gls_style{$type}) + { + &set_glossarystyle($gls_style{$type}); + } + + # add any parent entries that haven't been referenced + + for my $key (keys %{$glossary{$type}}) + { + my $label = $key; + $label =~ s/###\d+$//o; # Remove the unique id's + + &add_parent_if_required($label); + } + + @keys = keys %{$glossary{$type}}; + + @keys = sort gloskeysort @keys; + + $level = 0; + + $delimN = $delimN{$type}; + + $previous = ''; + + local($previousentry) = ''; + + my $glossaryentryfield = ''; + + my $previouscat = ''; + + local ($entry); + + foreach $key (@keys) + { + $current = $key; + $current =~ s/\#\#\#\d+$//o; # Remove the unique id's + + my $issame = ($current eq $previous ? 1 : 0); + + $previous = $current; + + $entry = $glossary_entry{$type}{$key}; + + unless ($issame) + { + if ($glossaryentryfield) + { + $id = ++$global{'max_id'}; + + my $level = &gls_get_level($previousentry); + + if ($level > 0) + { + my $id2 = ++$global{'max_id'}; + + $thisglsentry .= + "\\glossarysubentryfield $OP$id2$CP$level$OP$id2$CP$glossaryentryfield$OP$id$CP$linktext$OP$id$CP"; + } + else + { + $thisglsentry .= + "\\glossaryentryfield $glossaryentryfield$OP$id$CP$linktext$OP$id$CP"; + } + + $glossaryentryfield = ''; + } + + $linktext = ''; + + my $currentcat = substr(&gls_get_sort($current), 0, 1); + + if ($currentcat=~/[a-zA-Z]/) + { + $currentcat = uc($currentcat); + } + elsif ($currentcat=~/[0-9]/) + { + $currentcat = 'glsnumbers'; + } + else + { + $currentcat = 'glssymbols'; + } + + unless ($previouscat eq $currentcat) + { + $id = ++$global{'max_id'}; + $thisglsentry .= "\\glsgroupheading$OP$id$CP$currentcat$OP$id$CP"; + + $previouscat = $currentcat; + } + } + + $previousentry = $entry; + + # Back ref + + if ($gls_nonumberlist{$type}) + { + $linktext = ''; + } + elsif ($glossary{$type}{$key}) + { + $id = ++$global{'max_id'}; + + $linktext .= $delimN if ($linktext); + + $linktext .= "$glossary{$type}{$key}\\$glossary_format{$type}{$key}${OP}$id${CP}$glossary_linktext{$type}{$key}${OP}$id${CP}"; + + } + + unless ($issame) + { + $id = ++$global{'max_id'}; + local($name) = &translate_commands( + "\\glsnamefont $OP$id$CP$glsentry{$entry}{name}$OP$id$CP"); + + local($symbol) = ($glsentry{$entry}{'symbol'} ? + " $glsentry{$entry}{symbol}" : ''); + + $id = ++$global{'max_id'}; + my $id2 = ++$global{'max_id'}; + my $id3 = ++$global{'max_id'}; + my $id4 = ++$global{'max_id'}; + + $glossaryentryfield = "$OP$id$CP$entry$OP$id$CP" # label + . "$OP$id2$CP$name$OP$id2$CP" # name + . "$OP$id3$CP$glsentry{$entry}{description}$OP$id3$CP" # description + . "$OP$id4$CP$symbol$OP$id4$CP" # symbol + } + + } + + if ($glossaryentryfield and $entry) + { + my $level = &gls_get_level($entry); + + if ($level > 0) + { + my $id2 = ++$global{'max_id'}; + + $thisglsentry .= + "\\glossarysubentryfield $OP$id2$CP$level$OP$id2$CP$glossaryentryfield$OP$id$CP$linktext$OP$id$CP"; + } + else + { + $id = ++$global{'max_id'}; + $thisglsentry .= + "\\glossaryentryfield $glossaryentryfield$OP$id$CP$linktext$OP$id$CP"; + } + } + + $str = &do_env_theglossary($thisglsentry) . &translate_commands("\\glossarypostamble"); + + if ($gls_style{$type}) + { + &set_glossarystyle($oldstyle); + } + + s/$gls_mark{$type}/$preglossary\n$str\n/s; +} + +sub do_cmd_glstarget{ + local($_) = @_; + + local($id, $label, $text); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo; + + $text = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$text=$2;''/eo; + + "$text$_"; +} + +sub do_cmd_newglossarystyle{ + local($_) = @_; + + local($id,$style,$defs); + + $style = &missing_braces unless + s/$next_pair_rx/$id=$1;$style=$2;''/eo; + + $defs = &missing_braces unless + s/$next_pair_rx/$id=$1;$defs=$2;''/eo; + + $glossary_style{$style} = $defs; + + $_; +} + +sub do_cmd_glossarystyle{ + local($_) = @_; + + local($id,$style); + + $style = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$style=$2;''/eo; + + &set_glossarystyle($style); + + $_; +} + +sub set_glossarystyle{ + local($style) = @_; + + $CURRENT_STYLE = $style; + + if ($glossary_style{$style}) + { + local($_) = $glossary_style{$style}; + + s/$O(\d+)$C/$OP$1$CP/g; + + &translate_commands($_); + } + else + { + my $cmd_sub = "set_glossarystyle_$style"; + + if (defined(&$cmd_sub)) + { + &$cmd_sub(); + } + else + { + &write_warnings("Unknown glossary style '$style', defaulting to 'altlist'"); + &set_glossarystyle_altlist(); + + $CURRENT_STYLE = 'altlist'; + } + } + +} + +sub do_cmd_glspar{ "

".$_[0]; } + +sub do_cmd_glossaryheader{ + local($_) = @_; + $_ +} + +sub do_cmd_glsentryitem{ + local($_) = @_; + + local($id, $label); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo; + + $_ +} + +sub do_cmd_glssubentryitem{ + local($_) = @_; + + local($id, $label); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo; + + $_ +} + +sub do_cmd_glsgroupheading{ + local($_) = @_; + + local($id, $heading); + + $heading = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$heading=$2;''/eo; + + $_; +} + +sub do_cmd_glossaryentryfield{ + local($_) = @_; + + local($id, $label, $name, $desc, $symbol, $backlink); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo; + + $name = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$name=$2;''/eo; + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$symbol=$2;''/eo; + + $backlink = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$backlink=$2;''/eo; + + local($id2) = ++$global{'max_id'}; + + "\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP\n$desc $backlink\n$_"; +} + +sub do_cmd_glossarysubentryfield{ + local($_) = @_; + + local($id, $level, $label, $name, $desc, $symbol, $backlink); + + $level = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$level=$2;''/eo; + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo; + + $name = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$name=$2;''/eo; + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$symbol=$2;''/eo; + + $backlink = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$backlink=$2;''/eo; + + local($id2) = ++$global{'max_id'}; + + "\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP\n$desc $backlink\n$_"; +} + +sub do_env_theglossary{ + local($_) = @_; + + &translate_commands($_); +} + +sub set_glossarystyle_altlist{ + eval(<<'END_STYLE'); + sub do_cmd_glossaryheader{ + local($_) = @_; + $_ + } + + sub do_cmd_glsgroupheading{ + local($_) = @_; + + local($id, $heading); + + $heading = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$heading=$2;''/eo; + + $_ + } + + sub do_cmd_glossaryentryfield{ + local($_) = @_; + + local($id, $id2, $id3, $id4, $id5, $label, $name, $desc, $symbol, $backlink); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo; + + $name = &missing_braces unless + s/$next_pair_pr_rx/$id2=$1;$name=$2;''/eo; + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id3=$1;$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id4=$1;$symbol=$2;''/eo; + + $backlink = &missing_braces unless + s/$next_pair_pr_rx/$id5=$1;$backlink=$2;''/eo; + + "

\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP\n
" + . "$desc\\glspostdescription\\space $backlink$_"; + } + + sub do_cmd_glossarysubentryfield{ + local($_) = @_; + + local($id, $id2, $id3, $id4, $id5, $id6, $level, + $label, $name, $desc, $symbol, $backlink); + + $level = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$level=$2;''/eo; + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id2=$1;$label=$2;''/eo; + + $name = &missing_braces unless + s/$next_pair_pr_rx/$id3=$1;$name=$2;''/eo; + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id4=$1;$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id5=$1;$symbol=$2;''/eo; + + $backlink = &missing_braces unless + s/$next_pair_pr_rx/$id6=$1;$backlink=$2;''/eo; + + "

\\glssubentryitem $OP$id$CP$label$OP$id$CP" + ."\\glstarget $OP$id2$CP$label$OP$id2$CP$OP$id3$CP$name$OP$id3$CP" + ."$desc\\glspostdescription\\space $backlink\n$_"; + } + + sub do_env_theglossary{ + local($_) = @_; + + "

".&translate_commands("\\glossaryheader $_")."
"; + } +END_STYLE +} + +sub set_glossarystyle_inline{ + eval(<<'END_STYLE'); + sub do_cmd_glossaryheader{ + local($_) = @_; + $_ + } + + sub do_cmd_glsgroupheading{ + local($_) = @_; + + local($id, $heading); + + $heading = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$heading=$2;''/eo; + + $_; + } + + sub do_cmd_glossaryentryfield{ + local($_) = @_; + + local($id, $id2, $id3, $id4, $id5, $label, $name, $desc, $symbol, $backlink); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$label=$2;''/eo; + + $name = &missing_braces unless + s/$next_pair_pr_rx/$id2=$1;$name=$2;''/eo; + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id3=$1;$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id4=$1;$symbol=$2;''/eo; + + $backlink = &missing_braces unless + s/$next_pair_pr_rx/$id5=$1;$backlink=$2;''/eo; + + local($field) = "\\glsinlinedopostchild $glsinlinesep"; + + $field .= "\\glsentryitem $OP$id$CP$label$OP$id$CP" + . "\\glsinlinenameformat $OP$id2$CP$label$OP$id2$CP$OP$id3$CP$name$OP$id3$CP"; + + $id3 = ++$global{'max_id'}; + + if ($desc) + { + $field .= + "\\glsinlinedescformat $OP$id3$CP$desc$OP$id3$CP" + ."$OP$id4$CP$symbol$OP$id4$CP" + ."$OP$id5$CP$backlink$OP$id5$CP"; + } + else + { + $field .= + "\\glsinlineemptydescformat " + ."$OP$id4$CP$symbol$OP$id4$CP" + ."$OP$id5$CP$backlink$OP$id5$CP"; + } + +# TODO : check if has children + + local($haschildren) = 0; + + if ($haschildren) + { + $field .= "\\glsresetsubentrycounter " + . "\\glsinlineparentchildseparator " + . "\\glsinlinepostchild "; + } + + $glsinlinesep = &translate_commands("\\glsinlineseparator ") + unless $glsinlinesep; + + $field.$_; + } + + sub do_cmd_glossarysubentryfield{ + local($_) = @_; + + local($id, $id2, $id3, $id4,$id5,$id6,$level, + $label, $name, $desc, $symbol, $backlink); + + $level = &missing_braces unless + s/$next_pair_pr_rx/$id=$1;$level=$2;''/eo; + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id2=$1;$label=$2;''/eo; + + $name = &missing_braces unless + s/$next_pair_pr_rx/$id3=$1;$name=$2;''/eo; + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id4=$1;$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id5=$1;$symbol=$2;''/eo; + + $backlink = &missing_braces unless + s/$next_pair_pr_rx/$id6=$1;$backlink=$2;''/eo; + + "\\glsinlinesubnameformat $OP$id$CP$label$OP$id$CP$OP$id2$CP$name$OP$id2$CP" + ."\\glssubentryitem $OP$id3$CP$label$OP$id3$CP" + ."\\glsinlinesubdescformat $OP$id4$CP$desc$OP$id4$CP$OP$id5$CP$symbol$OP$id5$CP$OP$id6$CP$backlink$OP$id6$CP" + .$_; + } + + sub do_env_theglossary{ + local($_) = @_; + + $glsinlinesep = ''; + + &translate_commands("\\glossaryheader $_\\glspostinline "); + } +END_STYLE +} + +local($glsinlinesep,$glsinlinepostchild); + +sub do_cmd_glsinlineseparator{ + local($_) = @_; + + "; $_"; +} + +sub do_cmd_glsinlinedopostchild{ + local($_) = @_; + + $_; +} + +sub do_cmd_glspostdescription{ + local($_) = @_; + + $GLOSSARY_END_DESCRIPTION.$_; +} + +sub do_cmd_glspostinline{ + local($_) = @_; + + &translate_commands("\\glspostdescription\\space ").$_; +} + +sub do_cmd_glsinlinepostchild{ + local($_) = @_; + + $_; +} + +sub do_cmd_glsinlineparentchildseparator{ + local($_) = @_; + + ": $_"; +} + +sub do_cmd_glsinlinesubseparator{ + local($_) = @_; + + ", $_"; +} + +sub do_cmd_glsinlinenameformat{ + &do_cmd_glstarget(@_); +} + +sub do_cmd_glsinlinedescformat{ + local($_) = @_; + + local($id, $desc, $symbol, $backlinks); + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$symbol=$2;''/eo; + + $backlinks = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$backlinks=$2;''/eo; + + "\\space $desc$_"; +} + +sub do_cmd_glsinlineemptydescformat{ + local($_) = @_; + + local($id, $symbol, $backlinks); + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$symbol=$2;''/eo; + + $backlinks = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$backlinks=$2;''/eo; + + $_; +} + +sub do_cmd_glsinlinesubnameformat{ + local($_) = @_; + + local($id, $id2, $label, $name); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo; + + $name = &missing_braces unless + s/$next_pair_pr_rx/$id2=$1,$name=$2;''/eo; + + "\\glstarget $OP$id$CP$label$OP$id$CP$OP$id2$CP$OP$id2$CP$_"; +} + +sub do_cmd_glsinlinesubdescformat{ + local($_) = @_; + + local($id, $desc, $symbol, $backlinks); + + $desc = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$desc=$2;''/eo; + + $symbol = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$symbol=$2;''/eo; + + $backlinks = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$backlinks=$2;''/eo; + + "$desc$_"; +} + +sub set_depth_levels { + # Sets $outermost_level + local($level); + # scan the document body, not the preamble, for use of sectioning commands + my ($contents) = $_; + if ($contents =~ /\\begin\s*((?:$O|$OP)\d+(?:$C|$CP))document\1|\\startdocument/s) { +$contents = $'; + } + foreach $level ("part", "chapter", "section", "subsection", + "subsubsection", "paragraph") { +last if (($outermost_level) = $contents =~ /\\($level)$delimiter_rx/); +last if (($outermost_level) = $contents =~ /\\endsegment\s*\[\s*($level)\s*\]/s); +if ($contents =~ /\\segment\s*($O\d+$C)[^<]+\1\s*($O\d+$C)\s*($level)\s*\2/s) +{ $outermost_level = $3; last }; + } + $level = ($outermost_level ? $section_commands{$outermost_level} : + do {$outermost_level = 'section'; 3;}); + + if ($REL_DEPTH && $MAX_SPLIT_DEPTH) { +$MAX_SPLIT_DEPTH = $level + $MAX_SPLIT_DEPTH; + } elsif (!($MAX_SPLIT_DEPTH)) { $MAX_SPLIT_DEPTH = 1 }; + + %unnumbered_section_commands = ( + 'tableofcontents', $level +, 'listoffigures', $level +, 'listoftables', $level +, 'bibliography', $level +, 'textohtmlindex', $level +, 'textohtmlglossary', $level +, 'textohtmlglossaries', $level + , %unnumbered_section_commands + ); + + %section_commands = ( + %unnumbered_section_commands + , %section_commands + ); +} + +sub add_bbl_and_idx_dummy_commands { + local($id) = $global{'max_id'}; + + s/([\\]begin\s*$O\d+$C\s*thebibliography)/$bbl_cnt++; $1/eg; + ## if ($bbl_cnt == 1) { +s/([\\]begin\s*$O\d+$C\s*thebibliography)/$id++; "\\bibliography$O$id$C$O$id$C $1"/geo; + #} + $global{'max_id'} = $id; + s/([\\]begin\s*$O\d+$C\s*theindex)/\\textohtmlindex $1/o; + s/[\\]printindex/\\textohtmlindex /o; + &add_gls_dummy_commands; + &lib_add_bbl_and_idx_dummy_commands() if defined(&lib_add_bbl_and_idx_dummy_commands); +} + +sub add_gls_dummy_commands{ + s/[\\]printglossary/\\textohtmlglossary/sg; + s/[\\]printglossaries/\\textohtmlglossaries/sg; +} + +sub get_firstkeyval{ + local($key,$_) = @_; + local($value); + + s/\b$key\s*=$OP(\d+)$CP(.*)$OP\1$CP\s*(,|$)/$value=$2;','/es; + undef($value) if $`=~/\b$key\s*=/; + + unless (defined($value)) + { + s/(^|,)\s*$key\s*=\s*([^,]*)\s*(,|$)/,/s; + $value=$2; + } + + ($value,$_); +} + +# need to get the value of the last key of a given name +# in the event of multiple occurrences. +sub get_keyval{ + local($key,$_) = @_; + local($value); + + while (/\b$key\s*=/g) + { + ($value,$_) = &get_firstkeyval($key, $_); + last unless defined($value); + } + + ($value,$_); +} + +sub get_boolval{ + local($key,$_) = @_; + local($value); + + while (/\b$key\s*(?:=(true|false))?\b/g) + { + $value = ($1 ? $1 : 'true'); + } + + ($value eq 'true' ? 1 : 0, $_); +} + +# This is modified from do_cmd_textohtmlindex + +sub do_cmd_textohtmlglossary{ + local($_) = @_; + + local($keyval,$pat) = &get_next_optional_argument; + + local($type,$title,$toctitle,$style,$nonumberlist); + + $nonumberlist = 'default'; + + ($type,$keyval) = &get_keyval('type', $keyval); + ($title,$keyval) = &get_keyval('title', $keyval); + ($toctitle,$keyval) = &get_keyval('toctitle', $keyval); + ($style,$keyval) = &get_keyval('style', $keyval); + ($nonumberlist,$keyval) = &get_boolval('nonumberlist', $keyval); + + &make_textohtmlglossary($type,$toctitle,$title,$style,$nonumberlist).$_; +} + +# add_real_gls does the actual glossary +sub make_textohtmlglossary{ + local($type,$toctitle,$title,$style,$nonumberlist) = @_; + + unless (defined($type)) {$type = 'main';} + + unless (defined $gls_mark{$type}) + { + &write_warnings("glossary type '$type' not implemented"); + } + + if ($style) + { + $gls_style{$type} = $style; + } + + $toctitle = $gls_toctitle{$type} unless ($toctitle or $title); + + $title = $gls_title{$type} unless ($title); + $toctitle = $title unless ($toctitle); + + $gls_toctitle{$type} = $toctitle; + + $gls_nonumberlist{$type} = $nonumberlist unless ($nonumberlist eq 'default'); + + $toc_sec_title = $toctitle; + $glsfile{$type} = $CURRENT_FILE; + + if (defined($frame_main_suffix)) + { + $glsfile{$type}=~s/$frame_main_suffix/$frame_body_suffix/; + } + + $TITLE=&translate_commands($toctitle); + + if (%glossary_labels) { &make_glossary_labels(); } + + if (($SHORT_INDEX) && (%glossary_segment)) + { + &make_preglossary(); + } + else + { + $preglossary = &translate_commands("\\glossarypreamble"); + } + + local $idx_head = $section_headings{'textohtmlindex'}; + local($heading) = join('' + , &make_section_heading($title, $idx_head) + , $gls_mark{$type} ); + local($pre,$post) = &minimize_open_tags($heading); + + join('',"
\n" , $pre); +} + +sub do_cmd_textohtmlglossaries{ + local($_) = @_; + + foreach $type (keys %gls_mark) + { + $id = ++$global{'max_id'}; + $_ = &make_textohtmlglossary($type,$gls_title{'main'}).$_; + } + + $_; +} + +sub make_glossary_labels { + local($key, @keys); + @keys = keys %glossary_labels; + foreach $key (@keys) { + if (($ref_files{$key}) && !($ref_files{$key} eq "$glsfile{'main'}")) { + local($tmp) = $ref_files{$key}; + &write_warnings("\nmultiple label $key , target in $glsfile{'main'} masks $tmp "); + } + $ref_files{$key} .= $glsfile{'main'}; + } +} + +sub make_preglossary{ &make_real_preglossary } +sub make_real_preglossary{ + local($key, @keys, $head, $body); + $head = "
\n

Legend:

\n
"; + @keys = keys %glossary_segment; + foreach $key (@keys) { + local($tmp) = "segment$key"; + $tmp = $ref_files{$tmp}; + $body .= "\n
$key
".&make_named_href('',$tmp,$glossary_segment{$key}); + } + $preglossary = join('', $head, $body, "\n
") if ($body); +} + +sub do_cmd_glossary { &do_real_glossary(@_) } +sub do_real_glossary { + local($_) = @_; + local($type) = "main"; + local($anchor,$entry); + + local($type,$pat) = &get_next_optional_argument; + + $entry = &missing_braces unless + (s/$next_pair_pr_rx//o&&($entry=$2)); + + $anchor = &make_glossary_entry($entry,$anchor_invisible_mark,$type); + + join('', $anchor, $_); +} + +sub make_glossary_entry { &make_real_glossary_entry(@_) } +sub make_real_glossary_entry { + local($entry,$text,$type) = @_; + local($this_file) = $CURRENT_FILE; + + $TITLE = $saved_title + if (($saved_title)&&(!($TITLE)||($TITLE eq $default_title))); + + # Save the reference + local($str) = "$label###" . ++$global{'max_id'}; # Make unique + + local($id) = ++$glsentry{$entry}{'maxid'}; + local($glsanchor)="gls:$entry$id"; + + local($target) = $frame_body_name; + + if (defined($frame_main_suffix)) + { + $this_file=~s/$frame_main_suffix/$frame_body_suffix/; + } + + $glossary{$type}{$str} .= &make_half_href($this_file."#$glsanchor"); + $glossary_format{$type}{$str} = $GLSCURRENTFORMAT; + $glossary_entry{$type}{$str} = $entry; + $glossary_linktext{$type}{$str} = $TITLE; + + local($mark) = $gls_file_mark{$type}; + + $mark = &get_gls_file_mark($type, $entry) if (defined(&get_gls_file_mark)); + + $text = &translate_commands($text); + + if (defined($frame_foot_name)) + { + "$text<\/A>"; + } + else + { + "$text<\/A>"; + } +} + +sub make_real_glossary_entry_no_backlink { + local($entry,$text,$type) = @_; + local($this_file) = $CURRENT_FILE; + + local($target) = $frame_body_name; + + if (defined($frame_main_suffix)) + { + $this_file=~s/$frame_main_suffix/$frame_body_suffix/; + } + + local($mark) = $gls_file_mark{$type}; + + $mark = &get_gls_file_mark($type, $entry) if (defined(&get_gls_file_mark)); + + $text = &translate_commands($text); + + if (defined($frame_foot_name)) + { + "$text<\/A>"; + } + else + { + "$text<\/A>"; + } +} + +sub do_cmd_newglossary{ + local($_) = @_; + local($type,$out,$in,$opt,$pat,$title); + + ($opt,$pat) = &get_next_optional_argument; + + $type = &missing_braces unless + (s/$next_pair_pr_rx//o&&($type=$2)); + $in = &missing_braces unless + (s/$next_pair_pr_rx//o&&($in=$2)); + $out = &missing_braces unless + (s/$next_pair_pr_rx//o&&($out=$2)); + $title = &missing_braces unless + (s/$next_pair_pr_rx//o&&($title=$2)); + + ($opt,$pat) = &get_next_optional_argument; + + &make_newglossarytype($type, $title); + + $_; +} + +sub make_newglossarytype{ + local($type, $title) = @_; + + $gls_mark{$type} = ""; + $gls_file_mark{$type} = ""; + $gls_title{$type} = $title; + $gls_toctitle{$type} = $title; + $delimN{$type} = ", "; + $glsnumformat{$type} = $GLSCURRENTFORMAT; + @{$gls_entries{$type}} = (); + $gls_displayfirst{$type} = "glsdisplayfirst"; + $gls_display{$type} = "glsdisplay"; + $gls_nonumberlist{$type} = $gls_nonumberlist{'main'}; +} + +sub do_cmd_glsdisplay{ + local($_) = @_; + local($text,$description,$symbol,$insert); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + $description = &missing_braces unless + (s/$next_pair_pr_rx/$description=$2;''/eo); + + $symbol = &missing_braces unless + (s/$next_pair_pr_rx/$symbol=$2;''/eo); + + $insert = &missing_braces unless + (s/$next_pair_pr_rx/$insert=$2;''/eo); + + "$text$insert" . $_; +} + +sub do_cmd_glsdisplayfirst{ + local($_) = @_; + local($text,$description,$symbol,$insert); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + $description = &missing_braces unless + (s/$next_pair_pr_rx/$description=$2;''/eo); + + $symbol = &missing_braces unless + (s/$next_pair_pr_rx/$symbol=$2;''/eo); + + $insert = &missing_braces unless + (s/$next_pair_pr_rx/$insert=$2;''/eo); + + "$text$insert" . $_; +} + +sub gls_get_displayfirst{ + local($type) = @_; + local($display)= $gls_displayfirst{$type}; + + if (not defined($display)) + { + &write_warnings("Glossary '$type' is not defined"); + $display=''; + } + elsif ($display eq '') + { + &write_warnings("glsdisplayfirst not set for glossary '$type'"); + } + else + { + $display = "\\$display "; + } + + $display; +} + +sub gls_get_display{ + local($type) = @_; + local($display)= $gls_display{$type}; + + if (not defined($display)) + { + &write_warnings("Glossary '$type' is not defined"); + $display = ''; + } + elsif ($display eq '') + { + &write_warnings("glsdisplay not set for glossary '$type'"); + } + else + { + $display = "\\$display "; + } + + $display; +} + +sub do_cmd_glsnamefont{ + local($_) = @_; + local($text); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + "$text$_"; +} + +sub do_cmd_newacronym{ + local($_) = @_; + local($label,$abbrev,$long,$opt,$shortplural,$longplural); + + ($opt,$pat) = &get_next_optional_argument; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + $abbrv = &missing_braces unless + (s/$next_pair_pr_rx/$abbrv=$2;''/eo); + $long = &missing_braces unless + (s/$next_pair_pr_rx/$long=$2;''/eo); + + ($longplural,$opt) = &get_keyval('longplural', $opt); + ($shortplural,$opt) = &get_keyval('shortplural', $opt); + + $longplural = $long.'s' unless ($longplural); + $shortplural = $abbrv.'s' unless ($shortplural); + + local($cmd) = "\\newglossaryentry"; + local($id); + $id = ++$global{'max_id'}; + $cmd .= "$OP$id$CP$label$OP$id$CP"; + $id = ++$global{'max_id'}; + local($entry) = "type=$OP$id$CP\\acronymtype$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "name=$OP$id$CP$abbrv$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "description=$OP$id$CP$long$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "text=$OP$id$CP$abbrv$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "first=$OP$id$CP$long ($abbrv)$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "plural=$OP$id$CP$shortplural$OP$id$CP,"; + $id = ++$global{'max_id'}; + $entry .= "firstplural=$OP$id$CP$longplural ($shortplural)$OP$id$CP"; + + $id = ++$global{'max_id'}; + $cmd .= "$OP$id$CP$entry,$opt$OP$id$CP"; + + &translate_commands($cmd).$_; +} + +sub gls_entry_init{ + local($label, $type, $name, $desc) = @_; + + %{$glsentry{$label}} = + ( type => $type, + name => $name, + 'sort' => $name, + description => $desc, + text => $name, + first => $name, + plural => "${name}s", + firstplural => "${name}s", + symbol => '', + flag => 0, + maxid => 0, + level => 0, + parent => '' + ); + + $#{@{$glsentry{$label}{children}}} = -1; + + $glsentry{$label}; +} + +sub gls_get_type{ + local($label) = @_; + local($type) = ''; + + if (&gls_entry_defined($label)) + { + $type = $glsentry{$label}{'type'}; + } + else + { + &write_warnings("gls_get_type: glossary entry '$label' has not been defined"); + } + + $type; +} + +sub gls_set_type{ + local($label, $type) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'type'} = $type; + } + else + { + &write_warnings("gls_set_type: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_name{ + local($label) = @_; + local($name) = ''; + + if (&gls_entry_defined($label)) + { + $name = $glsentry{$label}{'name'}; + } + else + { + &write_warnings("gls_get_name: glossary entry '$label' has not been defined"); + } + + $name; +} + +sub gls_set_name{ + local($label, $name) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'name'} = $name; + } + else + { + &write_warnings("gls_set_name: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_description{ + local($label) = @_; + local($description) = ''; + + if (&gls_entry_defined($label)) + { + $description = $glsentry{$label}{'description'}; + } + else + { + &write_warnings("gls_get_description: glossary entry '$label' has not been defined"); + } + + $description; +} + +sub gls_set_description{ + local($label, $description) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'description'} = $description; + } + else + { + &write_warnings("gls_set_description: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_symbol{ + local($label) = @_; + local($symbol) = ''; + + if (&gls_entry_defined($label)) + { + $symbol = $glsentry{$label}{'symbol'}; + } + else + { + &write_warnings("gls_get_symbol: glossary entry '$label' has not been defined"); + } + + $symbol; +} + +sub gls_set_symbol{ + local($label, $symbol) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'symbol'} = $symbol; + } + else + { + &write_warnings("gls_set_symbol: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_sort{ + local($label) = @_; + local($sort) = ''; + + if (&gls_entry_defined($label)) + { + $sort = $glsentry{$label}{'sort'}; + } + else + { + &write_warnings("gls_get_sort: glossary entry '$label' has not been defined"); + } + + $sort; +} + +sub gls_set_sort{ + local($label, $sort) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'sort'} = $sort; + } + else + { + &write_warnings("gls_set_sort: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_text{ + local($label) = @_; + local($text) = ''; + + if (&gls_entry_defined($label)) + { + $text = $glsentry{$label}{'text'}; + } + else + { + &write_warnings("gls_get_text: glossary entry '$label' has not been defined"); + } + + $text; +} + +sub gls_set_text{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'text'} = $text; + } + else + { + &write_warnings("gls_set_text: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_plural{ + local($label) = @_; + local($plural) = ''; + + if (&gls_entry_defined($label)) + { + $plural = $glsentry{$label}{'plural'}; + } + else + { + &write_warnings("gls_get_plural: glossary entry '$label' has not been defined"); + } + + $plural; +} + +sub gls_set_plural{ + local($label, $plural) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'plural'} = $plural; + } + else + { + &write_warnings("gls_set_plural: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_firstplural{ + local($label) = @_; + local($firstplural) = ''; + + if (&gls_entry_defined($label)) + { + $firstplural = $glsentry{$label}{'firstplural'}; + } + else + { + &write_warnings("gls_get_firstplural: glossary entry '$label' has not been defined"); + } + + $firstplural; +} + +sub gls_set_firstplural{ + local($label, $firstplural) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'firstplural'} = $firstplural; + } + else + { + &write_warnings("gls_set_firstplural: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_first{ + local($label) = @_; + local($first) = ''; + + if (&gls_entry_defined($label)) + { + $first = $glsentry{$label}{'first'}; + } + else + { + &write_warnings("gls_get_first: glossary entry '$label' has not been defined"); + } + + $first; +} + +sub gls_set_first{ + local($label, $first) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'first'} = $first; + } + else + { + &write_warnings("gls_set_first: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_parent{ + local($label) = @_; + + local($parent); + + if (&gls_entry_defined($label)) + { + $parent = $glsentry{$label}{'parent'}; + } + else + { + &write_warnings("gls_get_parent: glossary entry '$label' has not been defined"); + } + + $parent; +} + +sub gls_get_level{ + local($label) = @_; + + local($level) = 0; + + if (&gls_entry_defined($label)) + { + $level = $glsentry{$label}{'level'}; + } + else + { + &write_warnings("gls_get_level: glossary entry '$label' has not been defined"); + } + + $level; +} + +sub gls_set_parent{ + local ($label, $parent) = @_; + + if (&gls_entry_defined($label)) + { + if ($parent) + { + if (&gls_entry_defined($parent)) + { + $glsentry{$label}{'parent'} = $parent; + + push @{$glsentry{$parent}{'children'}}, $label; + + $glsentry{$label}{'level'} = $glsentry{$parent}{'level'}+1; + } + else + { + &write_warnings("gls_set_parent: parent '$parent' for glossary entry '$label' has not been defined"); + } + } + else + { + $glsentry{$label}{'parent'} = ''; + } + } + else + { + &write_warnings("gls_set_parent: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_childcount{ + my($label) = @_; + + my($count) = 0; + + if (&gls_entry_defined($label)) + { + $count = scalar(@{$glsentry{$label}{'children'}}); + } + else + { + &write_warnings("gls_get_childcount: glossary entry '$label' has not been defined"); + } + + $count; +} + +sub gls_get_referenced_childcount{ + my($label) = @_; + + my($count) = 0; + + if (&gls_entry_defined($label)) + { + $count = scalar(grep(($glsentry{$_}{'maxid'} > 0), @{$glsentry{$label}{'children'}})); + } + else + { + &write_warnings("gls_get_childcount: glossary entry '$label' has not been defined"); + } + + $count; +} + +sub gls_set_userkeys{ + local($label, @user) = @_; + + if (&gls_entry_defined($label)) + { + for (my $idx = 0; $idx < 6; $idx++) + { + $glsentry{$label}{"user".($idx+1)} = $user[$idx]; + } + } + else + { + &write_warnings("gls_set_user: glossary entry '$label' has not been defined"); + } +} + +sub gls_set_user{ + local($label, $idx, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{"user$idx"} = $text; + } + else + { + &write_warnings("gls_set_user: glossary entry '$label' has not been defined"); + } +} + +sub gls_set_useri{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'user1'} = $text; + } + else + { + &write_warnings("gls_set_useri: glossary entry '$label' has not been defined"); + } +} + +sub gls_set_userii{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'user2'} = $text; + } + else + { + &write_warnings("gls_set_userii: glossary entry '$label' has not been defined"); + } +} + +sub gls_set_useriii{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'user3'} = $text; + } + else + { + &write_warnings("gls_set_useriii: glossary entry '$label' has not been defined"); + } +} + +sub gls_set_useriv{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'user4'} = $text; + } + else + { + &write_warnings("gls_set_useriv: glossary entry '$label' has not been defined"); + } +} + +sub gls_set_userv{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'user5'} = $text; + } + else + { + &write_warnings("gls_set_userv: glossary entry '$label' has not been defined"); + } +} + +sub gls_set_uservi{ + local($label, $text) = @_; + + if (&gls_entry_defined($label)) + { + $glsentry{$label}{'user6'} = $text; + } + else + { + &write_warnings("gls_set_uservi: glossary entry '$label' has not been defined"); + } +} + +sub gls_get_user{ + local($label, $idx) = @_; + local($value) = ''; + + if (&gls_entry_defined($label)) + { + $value = $glsentry{$label}{"user".$idx}; + } + else + { + &write_warnings("gls_get_user[$idx]: glossary entry '$label' has not been defined"); + } + + $value; +} + +sub gls_used{ + local($label) = @_; + local($flag) = 0; + + if (&gls_entry_defined($label)) + { + $flag = $glsentry{$label}{'flag'}; + } + else + { + &write_warnings("gls_used: glossary entry '$label' has not been defined"); + } + + $flag; +} + +sub gls_entry_defined{ + local($label) = @_; + + (%{$glsentry{$label}}) ? 1 : 0; +} + +sub do_cmd_newglossaryentry{ + local($_) = @_; + local($label,$name,$description,$symbol,$sort,$text,$first, + $plural,$firstplural,$type,$keyval,$parent,@user); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + $keyval = &missing_braces unless + s/$next_pair_pr_rx/$keyval=$2;''/eo; + + ($name,$keyval) = &get_keyval('name', $keyval); + ($description,$keyval) = &get_keyval('description', $keyval); + ($symbol,$keyval) = &get_keyval('symbol', $keyval); + ($sort,$keyval) = &get_keyval('sort', $keyval); + ($text,$keyval) = &get_keyval('text', $keyval); + ($first,$keyval) = &get_keyval('first', $keyval); + ($firstplural,$keyval) = &get_keyval('firstplural', $keyval); + ($plural,$keyval) = &get_keyval('plural', $keyval); + ($type,$keyval) = &get_keyval('type', $keyval); + ($parent,$keyval) = &get_keyval('parent', $keyval); + + if ($parent and not $name) + { + $name = &gls_get_name($parent); + } + + @user = (); + + for (my $idx = 0; $idx < 6; $idx++) + { + ($user[$idx],$keyval) = &get_keyval("user".($idx+1), $keyval); + } + + if (defined($type)) + { + $type = &translate_commands($type); + } + else + { + $type = 'main'; + } + + &gls_entry_init($label, $type, $name, $description); + + &gls_set_symbol($label, defined($symbol)?$symbol:''); + + $sort = "$name $description" unless (defined($sort) and $sort); + + &gls_set_sort($label, $sort); + + $text = $name unless (defined($text) and $text); + + &gls_set_text($label, $text); + + $first = $text unless (defined($first) and $first); + + &gls_set_first($label, $first); + + $plural = "${text}s" unless (defined($plural) and $plural); + + &gls_set_plural($label, $plural); + + $firstplural = "${first}s" unless (defined($firstplural) and $firstplural); + + &gls_set_firstplural($label, $firstplural); + + &gls_set_userkeys($label, @user); + + &gls_set_parent($label, $parent); + + push @{$gls_entries{$type}}, $label; + + $_; +} + +sub reset_entry{ + local($label) = @_; + + $glsentry{$label}{'flag'} = 0; +} + +sub unset_entry{ + local($label) = @_; + + $glsentry{$label}{'flag'} = 1; +} + +sub do_cmd_glsreset{ + local($_) = @_; + local($label); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + &reset_entry($label); + + $_; +} + +sub do_cmd_glsunset{ + local($_) = @_; + local($label); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + &unset_entry($label); + + $_; +} + +sub do_cmd_ifglsused{ + local($_) = @_; + local($label,$true,$false); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + $true = &missing_braces unless + s/$next_pair_pr_rx/$true=$2;''/eo; + + $false = &missing_braces unless + s/$next_pair_pr_rx/$false=$2;''/eo; + + (&gls_used($label) ? $true : $false) . $_; +} + +sub do_cmd_ifglsentryexists{ + local($_) = @_; + local($label,$true,$false); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$label=$2;''/eo; + + $true = &missing_braces unless + s/$next_pair_pr_rx/$true=$2;''/eo; + + $false = &missing_braces unless + s/$next_pair_pr_rx/$false=$2;''/eo; + + (&gls_entry_defined($label) ? $true : $false) . $_; +} + +sub gls_add_entry{ + local($type, $label, $format, $text) = @_; + + local($oldfmt) = $GLSCURRENTFORMAT; + + if (defined($format)) + { + $format=~s/[\(\)]//; + + if ($format) + { + $GLSCURRENTFORMAT=$format; + } + } + + $id = ++$global{'max_id'}; + + local($str) = &make_real_glossary_entry($label,$text,$type); + $GLSCURRENTFORMAT = $oldfmt; + + $str; +} + +sub do_cmd_glsadd{ + local($_) = @_; + local($optarg,$pat,$label,$str,$id,$type,$format); + ($optarg,$pat) = &get_next_optional_argument; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + $type = &gls_get_type($label); + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + &unset_entry($label); + } + + if (defined $type) + { + ($format,$optarg) = &get_keyval('format', $optarg); + $format='' unless(defined($format)); + + if ($dobacklink) + { + &gls_add_entry($type,$label,$format,""); + } + else + { + $glsentry{$label}{'maxid'} = ++$glsentry{$entry}{'maxid'}; + my $key = $label."###".$glsentry{$label}{'maxid'}; + $glossary{$type}{$key}=''; + } + } + else + { + &write_warnings("gls_add: glossary entry '$label' undefined"); + $str = ''; + } + + $str . $_; +} + +sub do_cmd_glsaddall{ + local($_) = @_; + local($optarg,$pat) = &get_next_optional_argument; + + local($format,$list); + + ($list,$optarg) = &get_keyval('types', $optarg); + ($format,$optarg) = &get_keyval('format', $optarg); + + $format='' unless(defined($format)); + + local(@types) = keys(%gls_mark); + + if ($list) + { + @types = split /\s*,\s*/, $list; + } + + foreach $type (@types) + { + # strip leading and trailing spaces + $type=~s/^\s*([^\s]+)\s*$/\1/; + + foreach $label (@{$gls_entries{$type}}) + { + local($dobacklink) = 1; + + if (&gls_used($label)) + { + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + &unset_entry($label); + } + + if ($dobacklink) + { + &gls_add_entry($type,$label,$format,""); + } + } + } + + $_; +} + +sub do_cmd_glsresetall{ + local($_) = @_; + local($types,$pat) = &get_next_optional_argument; + + local(@types) = keys(%gls_mark); + + if (defined($types) and $types) + { + @types = split /,/, $types; + } + + foreach $type (@types) + { + # strip leasing and trailing spaces + $type=~s/^\s*([^\s]+)\s*$/\1/; + + foreach $label (@{$gls_entries{$type}}) + { + &reset_entry($label); + } + } + + $_; +} + +sub do_cmd_glsunsetall{ + local($_) = @_; + local($types,$pat) = &get_next_optional_argument; + + local(@types) = keys(%gls_mark); + + if (defined($types) and $types) + { + @types = split /,/, $types; + } + + foreach $type (@types) + { + # strip leasing and trailing spaces + $type=~s/^\s*([^\s]+)\s*$/\1/; + + foreach $label (@{$gls_entries{$type}}) + { + &reset_entry($label); + } + } + + $_; +} + +$glslabel = ''; + +sub do_cmd_glslabel{ $glslabel.$_[0] } + +sub make_glslink{ + local($type,$label,$format,$text) = @_; + local($str) = ''; + + $glslabel = $label; + + if (defined $type) + { + $str = &gls_add_entry($type,$label,$format,$text); + } + else + { + &write_warnings("glossary '$type' undefined"); + } + + $str; +} + +sub do_cmd_glslink{ + local($_) = @_; + local($optarg,$pat,$label,$text,$type,$format,$str); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + # v1.01 removed following lines (\glslink doesn't have + # a final optional argument! + #local ($space) = ''; + #if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + #($optarg,$pat) = &get_next_optional_argument; + + $type = &gls_get_type($label); + + #&make_glslink($type, $label, $format, $text).$space . $_; + &make_glslink($type, $label, $format, $text) . $_; +} + +sub do_cmd_glslinkstar{ + local($_) = @_; + local($optarg,$pat,$label,$text,$type,$format,$str); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + $type = &gls_get_type($label); + + $text . $_; +} + +sub do_cmd_glsdisp{ + local($_) = @_; + local($optarg,$pat,$label,$text,$type,$format,$str); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + $text = &missing_braces unless + (s/$next_pair_pr_rx/$text=$2;''/eo); + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + &unset_entry($label); + } + + $type = &gls_get_type($label); + + if ($dobacklink) + { + &make_glslink($type, $label, $format, $text) .$space . $_; + } + else + { + &make_real_glossary_entry_no_backlink($label, $text, $type). $space . $_; + } +} + +sub do_cmd_glshyperlink{ + local($_) = @_; + + local($text,$pat) = &get_next_optional_argument; + + local($id, $label); + + $label = &missing_braces unless + s/$next_pair_pr_rx/$id=$1,$label=$2;''/eo; + + $text = &gls_get_text($label) unless $text; + + local($type) = &gls_get_type($label); + + "$text<\/A>" + .$_; +} + +sub do_cmd_glsentrydesc{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_description($label).$_; +} + +sub do_cmd_Glsentrydesc{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &do_real_makefirstuc(&gls_get_description($label)).$_; +} + +sub do_cmd_glsentrytext{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_text($label).$_; +} + +sub do_cmd_Glsentrytext{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &do_real_makefirstuc(&gls_get_text($label)).$_; +} + +sub do_cmd_glsentryname{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_name($label).$_; +} + +sub do_cmd_Glsentryname{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &do_real_makefirstuc(&gls_get_name($label)).$_; +} + +sub do_cmd_glsentryfirst{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_first($label).$_; +} + +sub do_cmd_Glsentryfirst{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &do_real_makefirstuc(&gls_get_first($label)).$_; +} + +sub do_cmd_glsentryplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_plural($label).$_; +} + +sub do_cmd_Glsentryplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &do_real_makefirstuc(&gls_get_plural($label)).$_; +} + +sub do_cmd_glsentryfirstplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local($text)=$glsentry{$label}{'firstplural'}; + + unless (defined($text)) + { + &write_warnings("glossary entry '$label' has not been defined"); + $text = ''; + } + + "$text$_"; + &gls_get_firstplural($label).$_; +} + +sub do_cmd_Glsentryfirstplural{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &do_real_makefirstuc(&gls_get_firstplural($label)).$_; +} + +sub do_cmd_glsentrysymbol{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_symbol($label).$_; +} + +sub do_cmd_Glsentrysymbol{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &do_real_makefirstuc(&gls_get_symbol($label)).$_; +} + +sub do_cmd_glsentryuseri{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_user($label, 1).$_; +} + +sub do_cmd_glsentryuserii{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_user($label, 2).$_; +} + +sub do_cmd_glsentryuseriii{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_user($label, 3).$_; +} + +sub do_cmd_glsentryuseriv{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_user($label, 4).$_; +} + +sub do_cmd_glsentryuserv{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_user($label, 5).$_; +} + +sub do_cmd_glsentryuservi{ + local($_) = @_; + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + &gls_get_user($label, 6).$_; +} + +sub do_cmd_gls{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type); + + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + if ($dobacklink) + { + &make_glslink($type, $label, $format, $link_text) .$space . $_; + } + else + { + &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_; + } +} + +# added v1.04 +sub do_cmd_glsstar{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type); + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + $link_text . $space . $_; +} + +sub do_cmd_glspl{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + if ($dobacklink) + { + &make_glslink($type, $label, $format, $link_text) .$space . $_; + } + else + { + &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_; + } +} + +# added v1.04 +sub do_cmd_glsplstar{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + $link_text . $space . $_; +} + +sub do_cmd_Gls{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type);; + + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &do_real_makefirstuc(&translate_commands("$display$args")); + + if ($dobacklink) + { + &make_glslink($type, $label, $format, $link_text) .$space . $_; + } + else + { + &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_; + } +} + +# added v1.04 +sub do_cmd_Glsstar{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &do_real_makefirstuc($link_text). $space . $_; +} + +sub do_cmd_Glspl{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &do_real_makefirstuc(&translate_commands("$display$args")); + + if ($dobacklink) + { + &make_glslink($type, $label, $format, $link_text) .$space . $_; + } + else + { + &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_; + } +} + +# added v1.04 +sub do_cmd_Glsplstar{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + &do_real_makefirstuc($link_text).$space . $_; +} + +sub do_cmd_GLS{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type);; + + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = uc(&translate_commands("$display$args")); + + if ($dobacklink) + { + &make_glslink($type, $label, $format, $link_text) .$space . $_; + } + else + { + &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_; + } +} + +# added v1.04 +sub do_cmd_GLSstar{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_text($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_first($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + uc($link_text).$space . $_; +} + +sub do_cmd_GLSpl{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + local($dobacklink) = 1; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + + if ($INDEXONLYFIRST) + { + $dobacklink = 0; + } + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = uc(&translate_commands("$display$args")); + + if ($dobacklink) + { + &make_glslink($type, $label, $format, $link_text) .$space . $_; + } + else + { + &make_real_glossary_entry_no_backlink($label, $link_text, $type). $space . $_; + } +} + +# added v1.04 +sub do_cmd_GLSplstar{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = $glsentry{$label}{'type'}; + + if (&gls_used($label)) + { + # entry has already been used + + $text = &gls_get_plural($label); + $display = &gls_get_display($type);; + } + else + { + # entry hasn't been used + + $text = &gls_get_firstplural($label); + $display = &gls_get_displayfirst($type); + + &unset_entry($label); + } + + local($args) = ''; + + local($id) = ++$global{'max_id'}; + $args .= "$OP$id$CP$text$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{description}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$glsentry{$label}{symbol}$OP$id$CP"; + + $id = ++$global{'max_id'}; + $args .= "$OP$id$CP$insert$OP$id$CP"; + + local($link_text) = &translate_commands("$display$args"); + + uc($link_text).$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_glstext{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_text($label); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_Glstext{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_text($label); + + &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_GLStext{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_text($label); + + &make_glslink($type, $label, $format, uc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_glsname{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_name($label); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_Glsname{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_name($label); + + &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_GLSname{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_name($label); + + &make_glslink($type, $label, $format, uc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_glsfirst{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_first($label); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_Glsfirst{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_first($label); + + &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_GLSfirst{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_first($label); + + &make_glslink($type, $label, $format, uc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_glsfirstplural{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_firstplural($label); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_Glsfirstplural{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_firstplural($label); + + &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_GLSfirstplural{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_firstplural($label); + + &make_glslink($type, $label, $format, uc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_glsplural{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_plural($label); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_Glsplural{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_plural($label); + + &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_GLSplural{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_plural($label); + + &make_glslink($type, $label, $format, uc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_glsdesc{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_description($label); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_Glsdesc{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_description($label); + + &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_GLSdesc{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_description($label); + + &make_glslink($type, $label, $format, uc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_glssymbol{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_symbol($label); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_Glssymbol{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_symbol($label); + + &make_glslink($type, $label, $format, &do_real_makefirstuc($text)) .$space . $_; +} + +# added 22 Feb 2008 +sub do_cmd_GLSsymbol{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_symbol($label); + + &make_glslink($type, $label, $format, uc($text)) .$space . $_; +} + +sub do_cmd_glsuseri{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_user($label, 1); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_Glsuseri{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &do_real_makefirstuc(&gls_get_user($label, 1)); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_glsuserii{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_user($label, 2); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_Glsuserii{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &do_real_makefirstuc(&gls_get_user($label, 2)); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_glsuseriii{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_user($label, 3); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_Glsuseriii{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &do_real_makefirstuc(&gls_get_user($label, 3)); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_glsuseriv{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_user($label, 4); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_Glsuseriv{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &do_real_makefirstuc(&gls_get_user($label, 4)); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_glsuserv{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_user($label, 5); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_Glsuserv{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &do_real_makefirstuc(&gls_get_user($label, 5)); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_glsuservi{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &gls_get_user($label, 6); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_Glsuservi{ + local($_) = @_; + local($optarg,$pat,$label,$text, $format, $insert); + + ($optarg,$pat) = &get_next_optional_argument; + + ($format,$optarg) = &get_keyval('format', $optarg); + + $label = &missing_braces unless + (s/$next_pair_pr_rx/$label=$2;''/eo); + + local ($space) = ''; + if (/^\s+[^\[]/ or /^\s*\[.*\]\s/) {$space = ' ';} + + $insert = ''; + ($insert,$pat) = &get_next_optional_argument; + + local($display) = ''; + + local($type) = &gls_get_type($label); + + $text = &do_real_makefirstuc(&gls_get_user($label, 6)); + + &make_glslink($type, $label, $format, $text) .$space . $_; +} + +sub do_cmd_acrshort{ + &do_cmd_glstext(@_) +} + +sub do_cmd_Acrshort{ + &do_cmd_Glstext(@_) +} + +sub do_cmd_ACRshort{ + &do_cmd_GLStext(@_) +} + +sub do_cmd_acrlong{ + &do_cmd_glsdesc(@_) +} + +sub do_cmd_Acrlong{ + &do_cmd_Glsdesc(@_) +} + +sub do_cmd_ACRlong{ + &do_cmd_GLSdesc(@_) +} + +sub do_cmd_acrfull{ + &do_cmd_glsfirst(@_) +} + +sub do_cmd_Acrfull{ + &do_cmd_Glsfirst(@_) +} + +sub do_cmd_ACRfull{ + &do_cmd_GLSfirst(@_) +} + +sub do_cmd_glossarypreamble{ + local($_) = @_; + $_[0]; +} + +sub do_cmd_glossarypostamble{ + local($_) = @_; + $_[0]; +} + +sub do_cmd_glsnumformat{ + local($_) = @_; + + $_; +} + +sub do_cmd_hyperit{ + join('', "\\textit ", $_[0]); +} + +sub do_cmd_hyperrm{ + join('', "\\textrm ", $_[0]); +} + +sub do_cmd_hypertt{ + join('', "\\texttt ", $_[0]); +} + +sub do_cmd_hypersf{ + join('', "\\textsf ", $_[0]); +} + +sub do_cmd_hyperbf{ + join('', "\\textbf ", $_[0]); +} + +&ignore_commands( <<_IGNORED_CMDS_ ); +makeglossary +makeglossaries +glossaryentrynumbers # {} +_IGNORED_CMDS_ + +1; +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\Finale +\endinput diff --git a/macros/latex/contrib/glossaries/glossaries.ins b/macros/latex/contrib/glossaries/glossaries.ins new file mode 100644 index 0000000000..14ad799bbb --- /dev/null +++ b/macros/latex/contrib/glossaries/glossaries.ins @@ -0,0 +1,129 @@ +% glossaries.ins generated using makedtx version 1.2 2019/1/6 19:06 +\input docstrip + +\preamble + + glossaries.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.dtx and glossaries.ins and the derived files glossaries.sty, glossaries-prefix.sty, glossary-hypernav.sty, glossary-inline.sty, glossary-list.sty, glossary-long.sty, glossary-longbooktabs.sty, glossary-longragged.sty, glossary-mcols.sty, glossary-super.sty, glossary-superragged.sty, glossary-tree.sty, glossaries-compatible-207.sty, glossaries-compatible-307.sty, glossaries-accsupp.sty, glossaries-babel.sty, glossaries-polyglossia.sty, minimalgls.tex, glossary-lipsum-examples.tex, example-glossaries-acronym-desc.tex, example-glossaries-acronym.tex, example-glossaries-acronyms-lang.tex, example-glossaries-brief.tex, example-glossaries-childnoname.tex, example-glossaries-cite.tex, example-glossaries-images.tex, example-glossaries-long.tex, example-glossaries-multipar.tex, example-glossaries-parent.tex, example-glossaries-symbolnames.tex, example-glossaries-symbols.tex, example-glossaries-url.tex, sample-chap-hyperfirst.tex, sample-crossref.tex, sample-custom-acronym.tex, sample-dot-abbr.tex, sample-dual.tex, sample-entrycount.tex, sample-entryfmt.tex, sample-FnDesc.tex, sample-font-abbr.tex, sample-ignored.tex, sample-index.tex, sample-inline.tex, sample-langdict.tex, sample-newkeys.tex, sample-noidxapp-utf8.tex, sample-noidxapp.tex, sample-nomathhyper.tex, sample-numberlist.tex, sample-prefix.tex, sample-si.tex, sample-storage-abbr-desc.tex, sample-storage-abbr.tex, sample.tex, sample4col.tex, sampleaccsupp.tex, sampleAcr.tex, sampleAcrDesc.tex, sampleacronyms.tex, sampleCustomAcr.tex, sampleDB.tex, sampleDesc.tex, sampleEq.tex, sampleEqPg.tex, sampleFnAcrDesc.tex, sampleNtn.tex, samplePeople.tex, sampleSec.tex, sampleSort.tex, sampletree.tex, sampleutf8.tex, samplexdy.tex, samplexdy2.tex, samplexdy3.tex, mwe-acr-desc.tex, mwe-acr.tex, mwe-gls.tex, samplexdy-mc.xdy, samplexdy-mc207.xdy, database1.tex, database2.tex, glossaries.perl. + +\endpreamble + +\askforoverwritefalse + +\generate{\file{glossaries.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries.sty,package}} +\file{glossaries-prefix.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries-prefix.sty,package}} +\file{glossary-hypernav.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-hypernav.sty,package}} +\file{glossary-inline.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-inline.sty,package}} +\file{glossary-list.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-list.sty,package}} +\file{glossary-long.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-long.sty,package}} +\file{glossary-longbooktabs.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-longbooktabs.sty,package}} +\file{glossary-longragged.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-longragged.sty,package}} +\file{glossary-mcols.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-mcols.sty,package}} +\file{glossary-super.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-super.sty,package}} +\file{glossary-superragged.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-superragged.sty,package}} +\file{glossary-tree.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossary-tree.sty,package}} +\file{glossaries-compatible-207.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries-compatible-207.sty,package}} +\file{glossaries-compatible-307.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries-compatible-307.sty,package}} +\file{glossaries-accsupp.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries-accsupp.sty,package}} +\file{glossaries-babel.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries-babel.sty,package}} +\file{glossaries-polyglossia.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries.dtx}{glossaries-polyglossia.sty,package}} +\file{minimalgls.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{minimalgls.tex}} +\file{glossary-lipsum-examples.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{glossary-lipsum-examples.tex}} +\file{example-glossaries-acronym-desc.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-acronym-desc.tex}} +\file{example-glossaries-acronym.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-acronym.tex}} +\file{example-glossaries-acronyms-lang.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-acronyms-lang.tex}} +\file{example-glossaries-brief.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-brief.tex}} +\file{example-glossaries-childnoname.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-childnoname.tex}} +\file{example-glossaries-cite.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-cite.tex}} +\file{example-glossaries-images.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-images.tex}} +\file{example-glossaries-long.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-long.tex}} +\file{example-glossaries-multipar.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-multipar.tex}} +\file{example-glossaries-parent.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-parent.tex}} +\file{example-glossaries-symbolnames.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-symbolnames.tex}} +\file{example-glossaries-symbols.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-symbols.tex}} +\file{example-glossaries-url.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{example-glossaries-url.tex}} +\file{sample-chap-hyperfirst.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-chap-hyperfirst.tex}} +\file{sample-crossref.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-crossref.tex}} +\file{sample-custom-acronym.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-custom-acronym.tex}} +\file{sample-dot-abbr.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-dot-abbr.tex}} +\file{sample-dual.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-dual.tex}} +\file{sample-entrycount.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-entrycount.tex}} +\file{sample-entryfmt.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-entryfmt.tex}} +\file{sample-FnDesc.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-FnDesc.tex}} +\file{sample-font-abbr.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-font-abbr.tex}} +\file{sample-ignored.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-ignored.tex}} +\file{sample-index.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-index.tex}} +\file{sample-inline.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-inline.tex}} +\file{sample-langdict.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-langdict.tex}} +\file{sample-newkeys.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-newkeys.tex}} +\file{sample-noidxapp-utf8.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-noidxapp-utf8.tex}} +\file{sample-noidxapp.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-noidxapp.tex}} +\file{sample-nomathhyper.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-nomathhyper.tex}} +\file{sample-numberlist.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-numberlist.tex}} +\file{sample-prefix.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-prefix.tex}} +\file{sample-si.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-si.tex}} +\file{sample-storage-abbr-desc.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-storage-abbr-desc.tex}} +\file{sample-storage-abbr.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample-storage-abbr.tex}} +\file{sample.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample.tex}} +\file{sample4col.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sample4col.tex}} +\file{sampleaccsupp.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleaccsupp.tex}} +\file{sampleAcr.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleAcr.tex}} +\file{sampleAcrDesc.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleAcrDesc.tex}} +\file{sampleacronyms.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleacronyms.tex}} +\file{sampleCustomAcr.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleCustomAcr.tex}} +\file{sampleDB.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleDB.tex}} +\file{sampleDesc.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleDesc.tex}} +\file{sampleEq.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleEq.tex}} +\file{sampleEqPg.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleEqPg.tex}} +\file{sampleFnAcrDesc.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleFnAcrDesc.tex}} +\file{sampleNtn.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleNtn.tex}} +\file{samplePeople.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{samplePeople.tex}} +\file{sampleSec.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleSec.tex}} +\file{sampleSort.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleSort.tex}} +\file{sampletree.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampletree.tex}} +\file{sampleutf8.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{sampleutf8.tex}} +\file{samplexdy.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{samplexdy.tex}} +\file{samplexdy2.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{samplexdy2.tex}} +\file{samplexdy3.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{samplexdy3.tex}} +\file{mwe-acr-desc.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{mwe-acr-desc.tex}} +\file{mwe-acr.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{mwe-acr.tex}} +\file{mwe-gls.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{mwe-gls.tex}} +\file{samplexdy-mc.xdy}{\nopreamble\nopostamble\from{glossaries.dtx}{samplexdy-mc.xdy}} +\file{samplexdy-mc207.xdy}{\nopreamble\nopostamble\from{glossaries.dtx}{samplexdy-mc207.xdy}} +\file{database1.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{database1.tex}} +\file{database2.tex}{\nopreamble\nopostamble\from{glossaries.dtx}{database2.tex}} +\file{glossaries.perl}{\nopreamble\nopostamble\from{glossaries.dtx}{glossaries.perl}} +} + +\endbatchfile diff --git a/macros/latex/contrib/glossaries/glossariesbegin.html b/macros/latex/contrib/glossaries/glossariesbegin.html new file mode 100644 index 0000000000..ff79fcb0ef --- /dev/null +++ b/macros/latex/contrib/glossaries/glossariesbegin.html @@ -0,0 +1,3949 @@ + + + + + + + + + + + + + +

+

+ + + +

+ + + +

+
+

+

The glossaries package v4.42: a guide for +beginners +

+
Nicola L.C. Talbot
+
+

2019-01-06

+
+
+

+

Abstract

+

The glossaries package is very flexible, but this means that it has a lot + of options, and since a user guide is supposed to provide a complete list + of all the high-level user commands, the main user manual is quite big. + This can be rather daunting for beginners, so this document is a brief + introduction just to help get you started. If you find yourself saying, “Yeah, + but how can I do…?” then it’s time to move on to the main user manual. +

I’ve made some statements in this document that don’t actually tell + you the full truth, but it would clutter the document and cause confusion + if I keep writing “except when …” or “but you can also do this, that or + the other” or “you can do it this way but you can also do it that way, but + that way may cause complications under certain circumstances”. +

+
+

Contents

+ +

+

+

Top

1 Getting Started

+

As with all packages, you need to load glossaries with \usepackage, but +there are certain packages that must be loaded before glossaries, if they are +required: hyperref, babel, polyglossia, inputenc and fontenc. (You don’t have +to load these packages, but if you want them, you must load them before +glossaries.) +

If you require multilingual support you must also install the relevant +language module. Each language module is called glossaries-language⟩, where +⟨language⟩ is the root language name. For example, glossaries-french or +glossaries-german. If a language module is required, the glossaries package will +automatically try to load it and will give a warning if the module isn’t found. +
+

+

Once you have loaded glossaries, you need to define your terms in the +preamble and then you can use them throughout the document. Here’s a simple +example: + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries} + 
 \newglossaryentry{ex}{name={sample},description={an example}} + 
 \begin{document} + 
 Here's my \gls{ex} term. + 
 \end{document} +
+

This produces: +

+

Here’s my sample term.

+

Here’s another example: + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries} + 
 \setacronymstyle{long-short} + 
 \newacronym{svm}{SVM}{support vector machine} + 
 \begin{document} + 
 First use: \gls{svm}. Second use: \gls{svm}. + 
 \end{document} +
+

This produces: +

+

First use: support vector machine (SVM). Second use: SVM.

+

In this case, the text produced by \gls{svm} changed after the first use. The first use +produced the long form followed by the short form in parentheses because I set the +acronym style to long-short. I suggest you try the above two examples to +make sure you have the package correctly installed. If you get an undefined +control sequence error, check that the version number at the top of this +document matches the version you have installed. (Open the .log file and search +for the line that starts with Package: glossaries followed by a date and +version.) +

Be careful of fragile commands. If a command causes a problem when used in one +of the \newglossaryentry fields, consider adding \glsnoexpandfields before you +start defining your entries.
+

+

Abbreviations are slightly different if you use the extension package glossaries-extra +(which needs to be installed separately): + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries-extra} + 
 \setabbreviationstyle{long-short}% glossaries-extra.sty + 
 \newabbreviation{svm}{SVM}{support vector machine}% glossaries-extra.sty + 
 \begin{document} + 
 First use: \gls{svm}. Second use: \gls{svm}. + 
 \end{document} +
+

If you still want to use \newacronym (rather than \newabbreviation) then you need +the optional argument of \setabbreviationstyle: + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries-extra} + 
 \setabbreviationstyle[acronym]{long-short}% glossaries-extra.sty only + 
 \newacronym{svm}{SVM}{support vector machine} + 
 \begin{document} + 
 First use: \gls{svm}. Second use: \gls{svm}. + 
 \end{document} +
+

+

You can’t use \setacronymstyle with glossaries-extra.
+

+

If you like, you can put all your definitions in another file (for example, +defns.tex) and load that file in the preamble using \loadglsentries with the +filename as the argument. For example: + + + +

+
+\loadglsentries{defns} +
+

If you find you have a really large number of definitions that are hard to manage in a +.tex file, you might want to have a look at bib2gls (installed separately) which +requires a .bib format instead that can be managed by an application such as +JabRef. +

Don’t try inserting formatting commands into the definitions as they can interfere +with the underlying mechanism. Instead, the formatting should be done by the +style. For example, suppose I want to replace SVM with \textsc{svm}, then +I need to select a style that uses \textsc, like this (for the base glossaries +style): + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries} + 
 \setacronymstyle{long-sc-short} + 
 \newacronym{svm}{svm}{support vector machine} + 
 \begin{document} + 
 First use: \gls{svm}. Second use: \gls{svm}. + 
 \end{document} +
+

The abbreviation styles have a different naming scheme with glossaries-extra: + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries-extra} + 
 \setabbreviationstyle{long-short-sc}% glossaries-extra.sty + 
 \newabbreviation{svm}{svm}{support vector machine}% glossaries-extra.sty + 
 \begin{document} + 
 First use: \gls{svm}. Second use: \gls{svm}. + 
 \end{document} +
+

With glossaries-extra you can have multiple abbreviation styles for different +categories. Many of these styles have their own associated formatting commands that +can be redefined for minor adjustments. For example: + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries-extra} + 
 \setabbreviationstyle[statistical]{long-short-sc} + 
 \setabbreviationstyle[bacteria]{long-only-short-only} + 
 % Formatting commands used by 'long-only-short-only' style: + 
 \renewcommand*{\glsabbrvonlyfont}[1]{\emph{#1}} + 
 \renewcommand*{\glslongonlyfont}[1]{\emph{#1}} + 
 % Formatting command used by 'long-short-sc' style: + 
 % (make sure abbreviation is converted to lower case) + 
 \renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeLowercase{#1}}} + 
 \newabbreviation + 
  [ + 
    category={statistical}% glossaries-extra.sty key + 
  ] + 
  {svm}{SVM}{support vector machine} + 
 \newabbreviation + 
  [ + 
    category={bacteria}% glossaries-extra.sty key + 
  ] + 
  {cbot}{C.~botulinum}{Clostridium botulinum} + 
 \begin{document} + 
 First use: \gls{svm}, \gls{cbot}. + 
 Next use: \gls{svm}, \gls{cbot}. + 
 \end{document} +
+

This produces: +

+

First use: support vector machine (svm), Clostridium botulinum. +

Next use: svm, C. botulinum.

+

As you can hopefully see from the above examples, there are two main ways of +defining a term: as a general entry (\newglossaryentry) or as an abbreviation +(\newacronym or, with glossaries-extra, \newabbreviation). +

Regardless of the method of defining a term, the term is always given a label. In + + + +the first example, the label was ex and in the other examples the label was svm (and +cbot in the last example). The label is used to uniquely identify the term (like the +standard \label/\ref or \cite mechanism). It’s best to just use the following +alphanumerics in the labels: a, …, z, A, …, Z, 0, …, 9. Sometimes you can also use +punctuation characters but not if another package (such as babel) meddles with +them. Don’t try using any characters outside of the basic Latin set with +inputenc (for example, é or ß) or things will go horribly wrong. This warning +only applies to the label. It doesn’t apply to the text that appears in the +document. +

Don’t use \gls in chapter or section headings as it can have some unpleasant +side-effects. Instead use \glsentrytext for regular entries and one of \glsentryshort, +\glsentrylong or \glsentryfull for acronyms. Alternatively use glossaries-extra +which provides special commands for use in section headings, such as \glsfmtshort +{label}.
+

+

The above examples are reasonably straightforward. The difficulty comes if you +want to display a sorted list of all the entries you have used in the document. The +glossaries-extra package provides a really easy way of listing all the defined +entries: + + + +

+
+ \documentclass{article} + 
 \usepackage[sort=none]{glossaries-extra} + 
 \newglossaryentry{potato}{name={potato},plural={potatoes}, + 
  description={starchy tuber}} + 
 \newglossaryentry{cabbage}{name={cabbage}, + 
  description={vegetable with thick green or purple leaves}} + 
 \newglossaryentry{turnip}{name={turnip}, + 
  description={round pale root vegetable}} + 
 \newglossaryentry{carrot}{name={carrot}, + 
  description={orange root}} + 
 \begin{document} + 
 Chop the \gls{cabbage}, \glspl{potato} and \glspl{carrot}. + 
 \printunsrtglossaries % list all entries + 
 \end{document} +
+

However this method doesn’t sort the entries (they’re listed in order of definition) +and it will display all the defined entries, regardless of whether or not you’ve used +them all in the document, so “turnip” appears in the glossary even though there’s no +\gls{turnip} (or similar) in the document. +

The sort=none option isn’t essential in this case (there’s no other sort option +available for this document), but it prevents the automatic construction of the sort +value and so slightly improves the document build time. +

Note that this example document uses the same command (\printunsrtglossaries) +that’s used with bib2gls (Option 4) but with bib2gls you instead need to use the +record package option and one or more instances of \GlsXtrLoadResources in the +preamble (see below). +

Most users prefer to have an automatically sorted list that only contains entries +that have been used in the document. The glossaries package provides three options: +use TEX to perform the sorting (Option 1); use makeindex to perform +the sorting (Option 2); use xindy to perform the sorting (Option 3). The +extension package glossaries-extra provides a fourth method: use bib2gls +(Option 4). +

The first option (using TEX) is the simplest method, as it doesn’t require an +external tool, but it’s very inefficient and the sorting is done according to the English +alphabet. To use this method, add \makenoidxglossaries to the preamble and put +\printnoidxglossaries at the place where you want your glossary. For + + + +example: + + + +

+
+ \documentclass{article} + 
 \usepackage{glossaries} + 
 \makenoidxglossaries % use TeX to sort + 
 \newglossaryentry{potato}{name={potato},plural={potatoes}, + 
  description={starchy tuber}} + 
 \newglossaryentry{cabbage}{name={cabbage}, + 
  description={vegetable with thick green or purple leaves}} + 
 \newglossaryentry{turnip}{name={turnip}, + 
  description={round pale root vegetable}} + 
 \newglossaryentry{carrot}{name={carrot}, + 
  description={orange root}} + 
 \begin{document} + 
 Chop the \gls{cabbage}, \glspl{potato} and \glspl{carrot}. + 
 \printnoidxglossaries + 
 \end{document} +
+

+

The \makenoidxglossaries method is very slow, uses an ASCII comparator and +often breaks if there are commands in the name key.
+

+

Try this out and run LATEX (or pdfLATEX) twice. The first run won’t show the +glossary. It will only appear on the second run. This doesn’t include “turnip” in the +glossary because that term hasn’t been used (with commands like \gls{turnip}) in +the document. +

The glossary has a vertical gap between the “carrot” term and the “potato” term. +This is because the entries in the glossaries are grouped according to their +first letter. If you don’t want this gap, just add nogroupskip to the package +options: + + + +

+
+\usepackage[nogroupskip]{glossaries} +
+

or you may want to try out a style that shows the group headings: + + + +

+
+\usepackage[style=indexgroup]{glossaries} +
+

If you try out this example you may also notice that the description is followed by a +full stop (period) and a number. The number is the location in the document where +the entry was used (page 1 in this case), so you can lookup the term in the glossary +and be directed to the relevant pages. It may be that you don’t want this +back-reference, in which case you can suppress it using the nonumberlist package +option: + + + +

+
+\usepackage[nonumberlist]{glossaries} +
+

If you don’t like the terminating full stop, you can suppress that with the nopostdot +package option: + + + +

+
+\usepackage[nopostdot]{glossaries} +
+

+

If you tried out the previous example with glossaries-extra and \printunsrtglossaries +the terminating full stop is missing and there are no number lists. You can add the +full stop back with + + + +

+
+\usepackage[nopostdot=false]{glossaries-extra} +
+

or + + + +

+
+\usepackage[postdot]{glossaries-extra} +
+

If you want the number lists then you need to use an indexing option. +

You may have noticed that I’ve used another command in the above example: +\glspl. This displays the plural form. By default, this is just the singular form with +the letter “s” appended, but in the case of “potato” I had to specify the correct +plural using the plural key. +

As I mentioned earlier, using TEX to sort the entries is the simplest but least +efficient method. If you have a large glossary or if your terms contain non-Latin or +extended Latin characters, then you will have a much faster build time if you use +makeindex (Option 2) or xindy (Option 3) or bib2gls (Option 4). If you are using +extended Latin or non-Latin characters, then xindy or bib2gls are the +recommended methods. These methods are described in more detail in §4 Displaying +a List of Entries. +

The rest of this document briefly describes the main commands provided by the +glossaries package. (Most of these are also available with glossaries-extra but may +behave slightly differently.) +

+

+

Top

2 Defining Terms

+

When you use the glossaries package, you need to define glossary entries in the +document preamble. These entries could be a word, phrase, abbreviation or symbol. +They’re usually accompanied by a description, which could be a short sentence or an +in-depth explanation that spans multiple paragraphs. The simplest method of +defining an entry is to use: +


+
+\newglossaryentry{label} +
{ +
  name={name}, +
  description={description}, +
  other options⟩ +
} +
+

+ + + +

+where ⟨label⟩ is a unique label that identifies this entry. (Don’t include the angle +brackets ⟨ ⟩. They just indicate the parts of the code you need to change when you use +this command in your document.) The ⟨name⟩ is the word, phrase or symbol +you are defining, and ⟨description⟩ is the description to be displayed in the +glossary. +

This command is a “short” command, which means that ⟨description⟩ can’t +contain a paragraph break. If you have a long description, you can instead +use: +


+
+\longnewglossaryentry{label} +
{ +
  name={name}, +
  other options⟩ +
} +
{description} +
+

+

+

Examples: +

    +
  1. Define the term “set” with the label set: + + + +
    + \newglossaryentry{set} +  
    { +  
      name={set}, +  
      description={a collection of objects} +  
    } +
    +

    +

  2. +
  3. Define the symbol with the label emptyset: + + + +
    + \newglossaryentry{emptyset} +  
    { +  
      name={\ensuremath{\emptyset}}, +  
      description={the empty set} +  
    } +
    +

    (This will also need a sort key if you use Options 1 or 3, see below.) +

  4. +
  5. Define the phrase “Fish Age” with the label fishage: + + + +
    + \longnewglossaryentry{fishage} +  
    {name={Fish Age}} +  
    {% +  
      A common name for the Devonian geologic period +  
      spanning from the end of the Silurian Period to +  
      the beginning of the Carboniferous Period. +  
      This age was known for its remarkable variety of +  
      fish species. +  
    } +
    +

    (The percent character discards the end of line character that would otherwise + cause an unwanted space to appear at the start of the description.) +

  6. +
  7. Take care if the first letter is an extended Latin or non-Latin character (either + specified via a command such as \’e or explicitly via the inputenc package such + as é). This first letter must be placed in a group: + + + +
    + \newglossaryentry{elite} +  
    { +  
      name={{\'e}lite}, +  
      description={select group or class} +  
    } +
    +

    or

    +
    + \newglossaryentry{elite} +
    { +
      name={{é}lite}, +
      description={select group or class} +
    } +
    +
+

(For further details, see the section “UTF-8” of the mfirstuc user manual.) +

If you use bib2gls with glossaries-extra then the terms must be defined in a .bib +file. For example:

+
+% Encoding: UTF-8 +
+
@entry{set, +
  name={set}, +
  description={a collection of objects} +
} +
+
@entry{emptyset, +
  name={\ensuremath{\emptyset}}, +
  description={the empty set} +
} +
+
@entry{fishage, +
  name={Fish Age}, +
  description={A common name for the Devonian geologic period +
  spanning from the end of the Silurian Period to +
  the beginning of the Carboniferous Period. + + + +
+
  This age was known for its remarkable variety of +
  fish species.} +
} +
+
@entry{elite, +
  name={{é}lite}, +
  description={select group or class} +
} +
+
(The .bib format doesn’t allow spaces in labels so you can’t have fish age as the +label, but you can have fish-age.) This method requires the glossaries-extra’s record +package option: + + + +
+\usepackage[record]{glossaries-extra} +
+

and the .bib file is specified in the resource command. For example, if the +.bib file is called entries.bib then put the following line in the document +preamble: + + + +

+
+\GlsXtrLoadResources[src={entries}] +
+

You can have a comma-separated list. For example, if you also have entries defined +in the file entries2.bib: + + + +

+
+\GlsXtrLoadResources[src={entries,entries2.bib}] +
+

+

There are other keys you can use when you define an entry. For example, the name +key indicates how the term should appear in the list of entries (glossary), but if the +term should appear differently when you reference it with \gls{label} in the +document, you need to use the text key as well. +

For example: + + + +

+
+\newglossaryentry{latinalph} + 
{ + 
  name={Latin Alphabet}, + 
  text={Latin alphabet}, + 
  description={alphabet consisting of the letters + 
  a, \ldots, z, A, \ldots, Z} + 
} +
+

This will appear in the text as “Latin alphabet” but will be listed in the glossary +as “Latin Alphabet”. With bib2gls this entry is defined in the .bib file +as: + + + +

+
+@entry{latinalph, + 
  name={Latin Alphabet}, + 
  text={Latin alphabet}, + 
  description={alphabet consisting of the letters + 
  a, \ldots, z, A, \ldots, Z} + 
} +
+

+

Another commonly used key is plural for specifying the plural of the term. This +defaults to the value of the text key with an “s” appended, but if this is incorrect, +just use the plural key to override it: + + + +

+
+\newglossaryentry{oesophagus} + 
{ + 
  name={{\oe}sophagus}, + 
  plural={{\oe}sophagi}, + 
  description={canal from mouth to stomach} + 
} +
+

(Remember from earlier that the initial ligature \oe needs to be grouped.) +

Abbreviations can be defined using +


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

+

+where ⟨label⟩ is the label (as per \newglossaryentry), ⟨short⟩ is the short form and +⟨long⟩ is the long form. For example, the following defines an abbreviation: + + + +

+
+\newacronym{svm}{SVM}{support vector machine} +
+

This internally uses \newglossaryentry to define an entry with the label svm. By +default, the name key is set to ⟨short⟩ (“SVM” in the above example) and the +description key is set to ⟨long⟩ (“support vector machine” in the above example). If, +instead, you want to be able to specify your own description you can do this using +the optional argument: + + + +

+
+\newacronym + 
 [description={statistical pattern recognition technique}] + 
 {svm}{SVM}{support vector machine} +
+

+

Before you define your acronyms (or other types of abbreviations), you need to +specify which style to use with +


\setacronymstyle{style name}

+

+where ⟨style name⟩ is the name of the style. There are a number of predefined styles, +such as: long-short (on first use display the long form with the short form in +parentheses); short-long (on first use display the short form with the long form in +parentheses); long-short-desc (like long-short but you need to specify the +description); or short-long-desc (like short-long but you need to specify the +description). There are some other styles as well that use \textsc to typeset the +acronym or that use a footnote on first use. See the main user guide for further +details. +

The glossaries-extra package provides improved abbreviation handling with a lot +more predefined styles. With this extension package, abbreviations are defined +using: +


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

+

+You can still use \newacronym but it’s redefined to use the new abbreviation +interface. The style must now be set using: +


\setabbreviationstyle[category]{style name}

+

+The default ⟨category⟩ is abbreviation. If you use \newacronym the category is +acronym, which is why you need to use the optional argument if you define +abbreviations with \newacronym when glossaries-extra has been loaded:

+
+\setabbreviationstyle[acronym]{style name} +
+
If you use bib2gls then abbreviations are defined in the .bib file in the format: +
+
+@abbreviation{label, +
  long={long form}, + + + +
  short={short form} +
} +
+
+

The plural forms for abbreviations can be specified using the longplural and +shortplural keys. For example: + + + +

+
+\newacronym + 
 [longplural={diagonal matrices}] + 
 {dm}{DM}{diagonal matrix} +
+

or (with glossaries-extra): + + + +

+
+\newabbreviation % glossaries-extra.sty + 
 [longplural={diagonal matrices}] + 
 {dm}{DM}{diagonal matrix} +
+

If omitted, the defaults are again obtained by appending an “s” to the singular +versions. With bib2gls, the definition in the .bib file is: + + + +

+
+@abbreviation{dm, + 
  short={DM}, + 
  long={diagonal matrix}, + 
  longplural={diagonal matrices} + 
} +
+

+

It’s also possible to have both a name and a corresponding symbol. +Just use the name key for the name and the symbol key for the symbol. For +example: + + + +

+
+\newglossaryentry{emptyset} + 
{ + 
  name={empty set}, + 
  symbol={\ensuremath{\emptyset}}, + 
  description={the set containing no elements} + 
} +
+

or with bib2gls the definition in the .bib file is: + + + +

+
+@entry{emptyset, + 
  name={empty set}, + 
  symbol={\ensuremath{\emptyset}}, + 
  description={the set containing no elements} + 
} +
+

+

If you want the symbol in the name field then you must supply a sort value with +Options 1 and 3 otherwise you’ll end up with errors from TEX or xindy. With +Option 2 (makeindex) it’s not quite so important but you may find the resulting +order is a little odd. For example: + + + +

+
+\newglossaryentry{emptyset} + 
{ + 
  name={\ensuremath{\emptyset}}, + 
  sort={empty set}, + 
  description={the set containing no elements} + 
} +
+

This displays the symbol as but sorts according to “empty set”. You +may want to consider using glossaries-extra’s symbols package option which +provides +


\glsxtrnewsymbol[options]{label}{symbol}

+

+This internally uses \newglossaryentry but automatically sets the sort key to the +⟨label⟩. For example: + + + +

+
+\documentclass{article} + 
\usepackage[symbols]{glossaries-extra} + 
\makeglossaries + 
\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option + 
 [description={the set containing no elements}] + 
 {emptyset}% label (and sort value) + 
 {\ensuremath{\emptyset}}% symbol + 
\begin{document} + 
\gls{emptyset} + 
\printglossaries + 
\end{document} +
+

Now the sort value is “emptyset” rather than the previous “empty set”. +

With bib2gls you can define this in the .bib file as + + + +

+
+@entry{emptyset, + 
  name={\ensuremath{\emptyset}}, + 
  description={the set containing no elements} + 
} +
+

in which case bib2gls will try to interpret the name field to determine the sort +value. Alternatively you can use: + + + +

+
+@symbol{emptyset, + 
  name={\ensuremath{\emptyset}}, + 
  description={the set containing no elements} + 
} +
+

which will use the label (emptyset) as the sort value. (You don’t need the symbols +package option in this case, unless you want a separate symbols list.) The +corresponding document (where the definition is in the file entries.bib) is +now: + + + +

+
+\documentclass{article} + 
\usepackage[record]{glossaries-extra} + 
\GlsXtrLoadResources[src=entries] + 
\begin{document} + 
\gls{emptyset} + 
\printunsrtglossaries + 
\end{document} +
+

+

+

+

Top

3 Using Entries

+

Once you have defined your entries, as described above, you can reference them in +your document. There are a number of commands to do this, but the most common +one is: +


\gls{label}

+

+where ⟨label⟩ is the label you assigned to the entry when you defined it. For example, +\gls{fishage} will display “Fish Age” in the text (given the definition from the +previous section). If you are using bib2gls then this will display ?? (like +\ref and \cite) until bib2gls has created the relevant files and LATEX is +rerun. +

If you are using the hyperref package (remember to load it before glossaries) \gls +will create a hyperlink to the corresponding entry in the glossary. If you want to +suppress the hyperlink for a particular instance, use the starred form \gls* for +example, \gls*{fishage}. The other commands described in this section all have a +similar starred form. +

If the entry was defined as an acronym (using \newacronym with glossaries +described above) or an abbreviation (using \newabbreviation with glossaries-extra), +then \gls will display the full form the first time it’s used and just the +short form on subsequent use. For example, if the style is set to long-short, +then \gls{svm} will display “support vector machine (SVM)” the first time +it’s used, but the next occurrence of \gls{svm} will just display “SVM”. +(If you use \newacronym with glossaries-extra the default doesn’t show the +long form on first use. You’ll need to change the style first, as described +earlier.) + + + +

If you want the plural form, you can use: +


\glspl{label}

+

+instead of \gls{label}. For example, \glspl{set} displays “sets”. +

If the term appears at the start of a sentence, you can convert the first letter to +upper case using: +


\Gls{label}

+

+for the singular form or +


\Glspl{label}

+

+for the plural form. For example: + + + +

+
+\Glspl{set} are collections. +
+

produces “Sets are collections”. +

If you’ve specified a symbol using the symbol key, you can display it +using: +


\glssymbol{label}

+

+

+

+

Top

4 Displaying a List of Entries

+

In §1 Getting Started, I mentioned that there are three options you can +choose from to create an automatically sorted glossary with the base glossaries +package. These are also available with the extension package glossaries-extra +along with a fourth option. These four options are listed below in a little +more detail. Table 1 summarises the main advantages and disadvantages. +(There’s a more detailed summary in the main glossaries user manual.) See also +Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document +build. +

+
+ + + +


+ + + +
Table 1: Comparison of Glossary Options
+
+ + + + + + + + + + +

Option 1 Option 2 Option 3 Option 4

Requires + glossaries-extra?

Requires + an + external + application?

Requires + Perl?

Requires + Java?

Can + sort + extended + Latin + or + non-Latin + alphabets?

Efficient + sort + algorithm?

Can + use + different + sort + methods + for + each + glossary?

Any + problematic + sort + values?

Can + form + ranges + in + the + location + lists?

Can + have + non-standard + locations?

+

Requires some setting up. + + + +

+

+
+
+
Option 1: +

This is the simplest option but it’s slow and if you want a sorted + list, it doesn’t work for non-Latin alphabets. The name mustn’t contain + commands (or, if it does, the sort value must be supplied) unless you + have the package option sanitizesort or sort=def or sort=use. +

    +
  1. Add \makenoidxglossaries to your preamble (before you start + defining your entries, as described in §2 Defining Terms). +
  2. +
  3. Put +


    \printnoidxglossary[sort=order,other options]

    +

    + where you want your list of entries to appear. The sort ⟨order⟩ may be one + of: word (word ordering), letter (letter ordering), case (case-sensitive + letter ordering), def (in order of definition) or use (in order of use). + Alternatively, use +


    \printnoidxglossaries

    +

    + to display all your glossaries (if you have more than one). This command + doesn’t have any arguments. +

    This option allows you to have different sort methods. For example: + + + +

    +
    + \printnoidxglossary[sort=word]% main glossary +  
    \printnoidxglossary[type=symbols,sort=use]% symbols glossary +
    +

    +

  4. +
  5. Run LATEX twice on your document. (As you would do to make a table + of contents appear.) For example, click twice on the “typeset” or “build” + or “PDFLATEX” button in your editor.
+

Here’s a complete document (myDoc.tex): + + + +

+
+ \documentclass{article} +  
\usepackage{glossaries} +  
\makenoidxglossaries % use TeX to sort +  
\newglossaryentry{sample}{name={sample}, +  
  description={an example}} +  
\begin{document} +  
A \gls{sample}. +  
\printnoidxglossaries % iterate over all indexed entries +  
\end{document} +
+

Document build: + + + +

+
+ pdflatex myDoc +  
pdflatex myDoc +
+

+

+
Option 2: +

This option uses an application called makeindex to sort the entries. This + application comes with all modern TEX distributions, but it’s hard-coded for + the non-extended Latin alphabet. This process involves making LATEX write + the glossary information to a temporary file which makeindex reads. + Then makeindex writes a new file containing the code to typeset the + glossary. LATEX then reads this file on the next run. The makeindex + application is automatically invoked by the helper makeglossaries + script, which works out all the appropriate settings from the .aux + file. +

    +
  1. If you are using ngerman1 + or some other package that makes the double-quote character " a + shorthand, then use \GlsSetQuote to change this to some other character. + For example: + + + +
    + \GlsSetQuote{+} +
    +

    Use this as soon as possible after you’ve loaded the glossaries + package. +

  2. +
  3. Add \makeglossaries to your preamble (before you start defining your + entries). +
  4. +
  5. Put +


    \printglossary[options]

    +

    + where you want your list of entries (glossary) to appear. (The sort key + isn’t available in ⟨options⟩.) Alternatively, use +


    \printglossaries

    +

    + which will display all glossaries (if you have more than one). This + command doesn’t have any arguments. +

    All glossaries are sorted using the same method which may be identified + with one of the package options: sort=standard (default), sort=use or + sort=def.
    +

    +

  6. +
  7. Run LATEX on your document. This creates files with the extensions + .glo and .ist (for example, if your LATEX document is called + myDoc.tex, then you’ll have two extra files called myDoc.glo and + myDoc.ist). If you look at your document at this point, you won’t see the + glossary as it hasn’t been created yet. +
  8. +
  9. Run makeglossaries with the base name of your document (without the + .tex) extension. If you have access to a terminal or a command prompt + (for example, the MSDOS command prompt for Windows users or + the bash console for Unix-like users) then you need to run the + command: + + + +
    + makeglossaries myDoc +
    +

    (Replace myDoc with the base name of your LATEX document file + without the .tex extension. Avoid spaces in the file name.) If you don’t + have Perl installed use makeglossaries-lite instead: + + + +

    +
    + makeglossaries-lite myDoc +
    +

    +

    Some beginners get confused by makeglossaries the application (run as + a system command) and \makeglossaries the LATEX command + which should be typed in the document preamble. These are two + different concepts that happen to have similar looking names. +
    +

    +

    If you don’t know how to use the command prompt, then you can + probably configure your text editor to add makeglossaries (or + makeglossaries-lite) as a build tool, but each editor has a different + method of doing this, so I can’t give a general description. You will have + to check your editor’s manual. If you still have problems, try adding the + automake package option: + + + +

    +
    + \usepackage[automake]{glossaries} +
    +

    +

    The default sort is word order (“sea lion” comes before “seal”). If you + want letter ordering you need to add the order=letter package + option + + + +

    +
    + \usepackage[order=letter]{glossaries} +
    +

    +

  10. +
  11. Once you have successfully completed the previous step, you can now run + LATEX on your document again.
+

Here’s a complete document (myDoc.tex): + + + +

+
+ \documentclass{article} +  
\usepackage{glossaries} +  
\makeglossaries % create makeindex files +  
\newglossaryentry{sample}{name={sample}, +  
  description={an example}} +  
\begin{document} +  
A \gls{sample}. +  
\printglossaries % input files created by makeindex +  
\end{document} +
+

Document build: + + + +

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

or + + + +

+
+ pdflatex myDoc +  
makeglossaries-lite myDoc +  
pdflatex myDoc +
+

+

+
Option 3: +

This option uses an application called xindy to sort the entries. This + application is more flexible than makeindex and is able to sort extended Latin + or non-Latin alphabets. It comes with both TEX Live and MiKTEX. + Since xindy is a Perl script, you will also need to ensure that Perl is + installed. In a similar way to Option 2, this option involves making + LATEX write the glossary information to a temporary file which xindy + reads. Then xindy writes a new file containing the code to typeset + the glossary. LATEX then reads this file on the next run. The xindy + application is automatically invoked by the helper makeglossaries + script, which works out all the appropriate settings from the .aux + file. +

    +
  1. Add the xindy option to the glossaries package option list: + + + +
    + \usepackage[xindy]{glossaries} +
    +

    +

  2. +
  3. Add \makeglossaries to your preamble (before you start defining your + entries). +
  4. +
  5. Put +


    \printglossary[options]

    +

    + where you want your list of entries (glossary) to appear. (The sort key + isn’t available in ⟨options⟩.) Alternatively, use +


    \printglossaries

    +

    +

    All glossaries are sorted using the same method which may be identified + with one of the package options: sort=standard (default), sort=use or + sort=def.
    +

    +

  6. +
  7. Run LATEX on your document. This creates files with the extensions + .glo and .xdy (for example, if your LATEX document is called + myDoc.tex, then you’ll have two extra files called myDoc.glo and + myDoc.xdy). If you look at your document at this point, you won’t see the + glossary as it hasn’t been created yet. +
  8. +
  9. Run makeglossaries with the base name of the document (omitting the + .tex extension). If you have access to a terminal or a command prompt + (for example, the MSDOS command prompt for Windows users or + the bash console for Unix-like users) then you need to run the + command: + + + +
    + makeglossaries myDoc +
    +

    (Replace myDoc with the base name of your LATEX document file + without the .tex extension. Avoid spaces in the file name. If you don’t + know how to use the command prompt, then as mentioned above, you may + be able to configure your text editor to add makeglossaries as a build + tool. +

    The default sort is word order (“sea lion” comes before “seal”). If you + want letter ordering you need to add the order=letter package + option: + + + +

    +
    + \usepackage[xindy,order=letter]{glossaries} +
    +

    +

  10. +
  11. Once you have successfully completed the previous step, you can now run + LATEX on your document again. +
+

Here’s a complete document (myDoc.tex): + + + +

+
+ \documentclass{article} +  
\usepackage[xindy]{glossaries} +  
\makeglossaries % create xindy files +  
\newglossaryentry{sample}{name={sample}, +  
  description={an example}} +  
\begin{document} +  
A \gls{sample}. +  
\printglossaries % input files created by xindy +  
\end{document} +
+

Document build: + + + +

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

+

+
Option 4: +

This requires the extension package glossaries-extra and an application called + bib2gls. This application is able to sort extended Latin or non-Latin + alphabets. It comes with both TEX Live and MiKTEX but requires at least + Java 7. This method works differently to Options 2 and 3. Instead of + creating a file containing the code to typeset the glossary it creates a + .glstex file containing the entry definitions fetched from the .bib file (or + files), but only those entries that are required in the document are + defined and they are defined in the order obtained from the chosen sort + method. This means that you can just use \printunsrtglossary to + display each glossary (or \printunsrtglossaries to display them + all). +

    +
  1. Add the record option to the glossaries-extra package option list: + + + +
    + \usepackage[record]{glossaries-extra} +
    +

    +

  2. +
  3. Add one or more +


    \GlsXtrLoadResources[src={bib list},options]

    +

    + to your preamble where ⟨bib list⟩ is the list of .bib files containing the + entries. You may use different sort methods for each resource set. For + example: + + + +

    +
    + \usepackage[record,% using bib2gls +  
     abbreviations, +  
     symbols, +  
     numbers +  
    ]{glossaries-extra} +  
    \GlsXtrLoadResources[ +  
      src={terms},% entries in terms.bib +  
      type=main,% put these entries in the 'main' (default) list +  
      sort={de-CH-1996}% sort according to this locale +  
    ] +  
    \GlsXtrLoadResources[ +  
      src={abbrvs},% entries in abbrvs.bib +  
      type=abbreviations,% put these entries in the 'abbreviations' list +  
      sort={letter-case}% case-sensitive letter (non-locale) sort +  
    ] +  
    \GlsXtrLoadResources[ +  
      src={syms},% entries in syms.bib +  
      type=symbols,% put these entries in the 'symbols' list +  
      sort={use}% sort according to first use in the document +  
    ] +  
    \GlsXtrLoadResources[ +  
      src={constants},% entries in constants.bib +  
      type=numbers,% put these entries in the 'numbers' list +  
      sort-field={user1},% sort according to this field +  
      sort={double}% double-precision sort +  
    ] +
    +

    The last resource set assumes that the entries defined in the file + constants.bib have a number stored in the user1 field. For + example: + + + +

    +
    + @number{pi, +  
      name={\ensuremath{\pi}}, +  
      description={pi}, +  
      user1={3.141592654} +  
    } +
    +

    +

  4. +
  5. Put +


    \printunsrtglossary[type={type},options]

    +

    + where you want your list of entries (glossary) to appear. (The sort key + isn’t available in ⟨options⟩. It needs to be used in \GlsXtrLoadResources + instead.) Alternatively, use +


    \printunsrtglossaries

    +

    +

  6. +
  7. Run LATEX on your document. The record option adds information to + the .aux file that provides bib2gls with all required details for each + resource set. For example, if the file is called myDoc.tex: + + + +
    + pdflatex myDoc +
    +

    +

  8. +
  9. Run bib2gls + + + +
    + bib2gls myDoc +
    +

    or (if you need letter groups) + + + +

    +
    + bib2gls --group myDoc +
    +

    +

  10. +
  11. Run LATEX again.
+

Here’s a complete document (myDoc.tex): + + + +

+
+ \documentclass{article} +  
\usepackage[record]{glossaries-extra} +  
\GlsXtrLoadResources % input file created by bib2gls +  
 [% instructions to bib2gls: +  
   src={entries}, % terms defined in entries.bib +  
   sort={en-GB}% sort according to this locale +  
 ] +  
\newglossaryentry{sample}{name={sample}, +  
  description={an example}} +  
\begin{document} +  
A \gls{sample}. +  
\printunsrtglossaries % iterate over all defined entries +  
\end{document} +
+

The accompanying entries.bib file: + + + +

+
+ @entry{sample, +  
  name = {sample}, +  
  description = {an example} +  
} +
+

Document build: + + + +

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

+

+
+

If you are having difficulty integrating makeglossaries into your document build +process, you may want to consider using arara, which is a Java application that +searches the document for special comment lines that tell arara which applications +to run. For example, the file myDoc.tex might start with: + + + +

+
+ % arara: pdflatex + 
 % arara: makeglossaries + 
 % arara: pdflatex + 
 \documentclass{article} + 
 \usepackage{glossaries} + 
 \makeglossaries +
+

then to build the document you just need the single system call: + + + +

+
+ arara myDoc +
+

(The currently pending version 4.0 of arara has directives for makeglossaries-lite +and bib2gls. These aren’t available in earlier versions, but you could try copying +and adapting the makeglossaries.yaml file and replace makeglossaries as +appropriate.) +

When sorting the entries, the string comparisons are made according to each +entry’s sort key. If this is omitted, the name key is used. For example, recall the +earlier definition: + + + +

+
+ \newglossaryentry{elite} + 
 { + 
   name={{\'e}lite}, + 
   description={select group or class} + 
 } +
+

No sort key was used, so it’s set to the same as the name key: {\’e}lite. How this +is interpreted depends on which option you have used: +

+Option 1:
By default, the accent command will be stripped so the sort value + will be elite. This will put the entry in the “E” letter group. However + if you use the sanitizesort=true package option, the sort value will be + interpreted as the sequence of characters: { \ ’ e } l i t and e. This will + place this entry in the “symbols” group since it starts with a symbol. +
+Option 2:
The sort key will be interpreted the sequence of characters: { \ e + }lit and e. The first character is an opening curly brace { so makeindex + will put this entry in the “symbols” group. +
+Option 3:
xindy disregards LATEX commands so it sorts on elite, which puts + this entry in the “E” group. If stripping all commands leads to an empty string + (such as \ensuremath{\emptyset}) then xindy will fail, so in these + situations you need to provide an appropriate sort value that xindy will + accept. +

xindy merges entries with duplicate sort values. xindy forbids empty sort + values. A sort value may degrade into an empty or duplicate value once xindy + has stripped all commands and braces.
+

+

+Option 4:
bib2gls has a primitive LATEX parser that recognises a limited set of + commands, which includes the standard accent commands and some maths + commands, so it can convert {\’e}lite to élite. It disregards unknown + commands. This may lead to an empty sort value, but bib2gls doesn’t mind + that. +

Note that even if the name is given as {\’e}lite, the letter group heading + (if the --group switch is used) may end up with the character É + depending on the locale used by the sort comparator. In this case you + + + + will need to ensure the document can support this character either + with inputenc or by switching to a LATEX engine with native UTF-8 + support. +

+
+

If the inputenc package is used: + + + +

+
+ \usepackage[utf8]{inputenc} +
+

and the entry is defined as:

+
+ \newglossaryentry{elite} +
 { +
   name={{é}lite}, +
   description={select group or class} +
 } +
+
then: +
+Option 1:
By default the sort value will be interpreted as elite so the entry + will be put in the “E” letter group. If you use the sanitizesort=true package + option, the sort value will be interpreted as élite where é has been + sanitized (so it’s no longer an active character and is in fact seen as two + octets 0xC3 0xA9) which will put this entry before the “A” letter group. + (The group is determined by the first octet 0xC3.) +
+Option 2:
makeindex sees é as two octets (0xC3 0xA9) rather than a single + character so it tries to put élite in the 0xC3 (“Ô) letter group (which, + in this case, comes after “Z”). +
+Option 3:
xindy will correctly recognise the sort value élite and will place + it in whatever letter group is appropriate for the given language setting. + (In English, this would just be the “E” letter group, but another language + might put it in the “É” letter group.) +
+Option 4:
The inputenc package doesn’t affect the encoding used with .bib entry + definitions, since these are dependent on the encoding used to save the .bib file + (although the labels must still be ASCII). You can help bib2gls (and + JabRef) by putting an encoding comment at the start of the .bib file: +
+
+ % Encoding: UTF-8 + + + +
+
+

With the correct encoding set up, bib2gls will determine that the sort value is + élite and will place it in whatever letter group is appropriate for the given + sort rule. For example, sort=en-GB (or just sort=en) will put élite in the + “E” letter group, but another language might put it in the “É” letter + group. +

+
+

Therefore if you have extended Latin or non-Latin characters, your best option is +to use either xindy (Option 3) or bib2gls (Option 4) with the inputenc or fontspec +package. If you use makeindex (Option 2) you need to specify the sort key like +this: + + + +

+
+\newglossaryentry{elite} + 
{ + 
  name={{\'e}lite}, + 
  sort={elite}, + 
  description={select group or class} + 
} +
+

or

+
+\newglossaryentry{elite} +
{ +
  name={{é}lite}, +
  sort={elite}, +
  description={select group or class} +
} +
+
If you use Option 1, you may or may not need to use the sort key, but you will +need to be careful about fragile commands in the name key if you don’t set the sort +key. +

If you use Option 3 and the name only contains a command or commands (such +as \P or \ensuremath{\pi}) you must add the sort key. This is also advisable +for the other options (except Option 4), but is essential for Option 3. For +example: + + + +

+
+ \newglossaryentry{P}{name={\P},sort={P}, + 
  description={paragraph symbol}} +
+

+

+

Top

5 Customising the Glossary

+

The default glossary style uses the description environment to display the entry list. +Each entry name is set in the optional argument of \item which means that it will +typically be displayed in bold. You can switch to medium weight by redefining +\glsnamefont: + + + +

+
+\renewcommand*{\glsnamefont}[1]{\textmd{#1}} +
+

Some classes and packages redefine the description environment in such as way that’s +incompatible with the glossaries package. In which case you’ll need to select a +different glossary style (see below). +

By default, a full stop is appended to the description (unless you use +glossaries-extra). To prevent this from happening use the nopostdot package +option: + + + +

+
+\usepackage[nopostdot]{glossaries} +
+

or to add it with glossaries-extra: + + + +

+
+\usepackage[postdot]{glossaries-extra} +
+

+

By default, a location list is displayed for each entry (unless you use +\printunsrtglossary without bib2gls). This refers to the document locations (for +example, the page number) where the entry has been referenced. If you use +Options 2 or 3 described in §4 Displaying a List of Entries or Option 4 (with +bib2gls and glossaries-extra) then location ranges will be compressed. For example, if +an entry was used on pages 1, 2 and 3, with Options 2 or 3 or Option 4 the +location list will appear as 1–3, but with Option 1 it will appear as 1, 2, 3. If you +don’t want the locations displayed you can hide them using the nonumberlist package +option: + + + +

+
+\usepackage[nonumberlist]{glossaries} +
+

or with bib2gls use save-locations=false in the optional argument of the +appropriate \GlsXtrLoadResources (it’s possible to have some resource sets with +locations and some without). +

Entries are grouped according to the first letter of each entry’s sort key. By +default a vertical gap is placed between letter groups. You can suppress this with the +nogroupskip package option: + + + +

+
+\usepackage[nogroupskip]{glossaries} +
+

+

If the default style doesn’t suit your document, you can change the style +using: +


\setglossarystyle{style name}

+

+There are a number of predefined styles. Glossaries can vary from a list of symbols +with a terse description to a list of words or phrases with descriptions that span +multiple paragraphs, so there’s no “one style fits all” solution. You need to choose +a style that suits your document. For example: + + + +

+
+\setglossarystyle{index} +
+

You can also use the style package option for the preloaded styles. For example: + + + +

+
+\usepackage[style=index]{glossaries} +
+

+

Examples: +

    +
  1. You have entries where the name is a symbol and the description is a brief + phrase or short sentence. Try one of the “mcol” styles defined in the + glossary-mcols package. For example: + + + +
    + \usepackage[nopostdot]{glossaries} +  
    \usepackage{glossary-mcols} +  
    \setglossarystyle{mcolindex} +
    +

    or + + + +

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

    +

  2. +
  3. You have entries where the name is a word or phrase and the description spans + multiple paragraphs. Try one of the “altlist” styles. For example: + + + +
    + \usepackage[nopostdot]{glossaries} +  
    \setglossarystyle{altlist} +
    +

    or + + + +

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

    +

  4. +
  5. You have entries where the name is a single word, the description is + brief, and an associated symbol has been set. Use one of the styles that + display the symbol (not all of them do). For example, one of the tabular + styles: + + + +
    + \usepackage[nopostdot,nonumberlist]{glossaries} +  
    \setglossarystyle{long4col} +
    +

    or one of the “tree” styles: + + + +

    +
    + \usepackage[nopostdot,nonumberlist]{glossaries} +  
    \setglossarystyle{tree} +
    +

+

If your glossary consists of a list of abbreviations and you also want to specify +a description as well as the long form, then you need to use an abbreviation style +that will suit the glossary style. For example, use the long-short-desc acronym +style: + + + +

+
+\setacronymstyle{long-short-desc} +
+

Define the acronyms with a description: + + + +

+
+\newacronym + 
 [description={statistical pattern recognition technique}] + 
 {svm}{SVM}{support vector machine} +
+

Alternatively with glossaries-extra: + + + +

+
+\setabbreviationstyle{long-short-desc} + 
\newabbreviation + 
 [description={statistical pattern recognition technique}] + 
 {svm}{SVM}{support vector machine} +
+

+

Choose a glossary style that suits wide entry names. For example: + + + +

+
+\setglossarystyle{altlist} +
+

+

+

+

Top

6 Multiple Glossaries

+

The glossaries package predefines a default main glossary. When you define an entry +(using one of the commands described in §2 Defining Terms), that entry is +automatically assigned to the default glossary, unless you indicate otherwise using the +type key. However you first need to make sure the desired glossary has been defined. +This is done using: +


\newglossary[glg]{label}{gls}{glo}{title}

+

+The ⟨label⟩ is a label that uniquely identifies this new glossary. As with other types of +identifying labels, be careful not to use active characters in ⟨label⟩. The final +argument ⟨title⟩ is the section or chapter heading used by \printglossary or +\printnoidxglossary. The other arguments indicate the file extensions used by +makeindex/xindy (described in §4 Displaying a List of Entries). If you use Option 1 +described above (or bib2gls and \printunsrtglossaries), then the ⟨glg⟩, ⟨gls⟩ and ⟨glo⟩ +arguments are ignored, in which case you may prefer to use the starred version where +you don’t specify the extensions: +


\newglossary*{label}{title}

+

+

In the case of Options 2 or 3, all glossary definitions must come before +\makeglossaries. (Entries definitions should come after \makeglossaries.) In the case +of Option 4, all glossary definitions must come before any \GlsXtrLoadResources +that requires them. +

Since it’s quite common for documents to have both a list of terms and a list of +abbreviations, the glossaries package provides the package option acronym (or +acronyms), which is a convenient shortcut for + + + +

+
+\newglossary[alg]{acronym}{acr}{acn}{\acronymname} +
+

The option also changes the behaviour of \newacronym so that acronyms are +automatically put in the list of acronyms instead of the main glossary. The +glossaries-extra package also provides this option for abbreviations defined using +\newacronym but additionally has the package option abbreviations to create a list of +abbreviations for \newabbreviation. +

There are some other package options for creating commonly used lists: symbols +(lists of symbols), numbers (lists of numbers), index (index of terms without +descriptions defined with \newterm[options]{label}). +

For example, suppose you want a main glossary for terms, a list of acronyms and +a list of notation: + + + +

+
+ \usepackage[acronyms]{glossaries} + 
 \newglossary[nlg]{notation}{not}{ntn}{Notation} +
+

After \makeglossaries (or \makenoidxglossaries) you can define the entries in +the preamble. For example: + + + +

+
+ \newglossaryentry{gls:set} + 
 {% This entry goes in the `main' glossary + 
   name=set, + 
   description={A collection of distinct objects} + 
 } + 
 % This entry goes in the `acronym' glossary: + 
 \newacronym{svm}{svm}{support vector machine} + 
 \newglossaryentry{not:set} + 
 {% This entry goes in the `notation' glossary: + 
   type=notation, + 
   name={\ensuremath{\mathcal{S}}}, + 
   description={A set}, + 
   sort={S}} +
+

or if you don’t like using \ensuremath: + + + +

+
+ \newglossaryentry{not:set} + 
 {% This entry goes in the `notation' glossary: + 
   type=notation, + 
   name={$\mathcal{S}$}, + 
   text={\mathcal{S}}, + 
   description={A set}, + 
   sort={S}} +
+

+

Each glossary is displayed using: +


\printnoidxglossary[type=type]

+

+(Option 1) or +


\printglossary[type=type]

+

+(Options 2 and 3). Where ⟨type⟩ is the glossary label. If the type is omitted the +default main glossary is assumed. +

If you’re using bib2gls then each glossary is displayed using: +


\printunsrtglossary[type=type]

+

+With this method you don’t use \makeglossaries or \makenoidxglossaries. +Instead you can assign the entry type with the resource command. For example: + + + +

+
+ \usepackage[record,abbreviations,symbols]{glossaries-extra} + 
 \GlsXtrLoadResources[ + 
  src={terms}, % entries defined in terms.bib + 
  type={main}% put in main glossary + 
 ] + 
 \GlsXtrLoadResources[ + 
  src={abbrvs}, % entries defined in abbrvs.bib + 
  type={abbreviations}% put in abbreviations glossary + 
 ] + 
 \GlsXtrLoadResources[ + 
  src={syms}, % entries defined in syms.bib + 
  type={symbols}% put in symbols glossary + 
 ] +
+

Later in the document: + + + +

+
+ \printunsrtglossary % main + 
 \printunsrtglossary[type=abbreviations] + 
 \printunsrtglossary[type=symbols] +
+

+

There’s a convenient shortcut that will display all the defined glossaries +depending on the indexing method: +


\printnoidxglossaries

+

+(Option 1) or +


\printglossaries

+

+(Options 2 and 3) or (glossaries-extra only) +


\printunsrtglossaries

+

+

If you use Option 1, you don’t need to do anything else. If you use Options 2 +or 3 with the makeglossaries Perl script or the makeglossaries-lite Lua script, +you similarly don’t need to do anything else. If you use Options 2 or 3 without the +makeglossaries Perl script then you need to make sure you run makeindex/xindy +for each defined glossary. The ⟨gls⟩ and ⟨glo⟩ arguments of \newglossary specify the file +extensions to use instead of .gls and .glo. The optional argument ⟨glg⟩ is the file +extension for the transcript file. This should be different for each glossary in +case you need to check for makeindex/xindy errors or warnings if things go +wrong. +

For example, suppose you have three glossaries in your document (main, acronym +and notation), specified using: + + + +

+
+\usepackage[acronyms]{glossaries} + 
\newglossary[nlg]{notation}{not}{ntn}{Notation} +
+

Then (assuming your LATEX document is in a file called myDoc.tex): +

+

+
Option 2 Either use one makeglossaries or makeglossaries-lite call: + + + +
+ makeglossaries myDoc +
+

or + + + +

+
+ makeglossaries-lite myDoc +
+

Or you need to run makeindex three times: + + + +

+
+ makeindex -t myDoc.glg -s myDoc.ist -o myDoc.gls myDoc.glo +  
makeindex -t myDoc.alg -s myDoc.ist -o myDoc.acr myDoc.acn +  
makeindex -t myDoc.nlg -s myDoc.ist -o myDoc.not myDoc.ntn +
+

+

+
Option 3 Either use one makeglossaries call: + + + +
+ makeglossaries myDoc +
+

Or you need to run xindy three times (be careful not to insert line breaks + where the line has wrapped.) + + + +

+
+ xindy  -L english -C utf8 -I xindy -M myDoc -t myDoc.glg +  
-o myDoc.gls myDoc.glo +  
xindy  -L english -C utf8 -I xindy -M myDoc -t myDoc.alg +  
-o myDoc.acr myDoc.acn +  
xindy  -L english -C utf8 -I xindy -M myDoc -t myDoc.nlg +  
-o myDoc.not myDoc.ntn +
+

+

+
Option 4 With bib2gls only one call is required: + + + +
+ pdflatex myDoc +  
bib2gls --group myDoc +  
pdflatex myDoc +
+

(Omit --group if you don’t need letter groups.)

+

+

+

Top

7 glossaries and hyperref

+

Take care if you use the glossaries package with hyperref. Contrary to the usual advice +that hyperref should be loaded last, glossaries (and glossaries-extra) must be loaded +after hyperref: + + + +

+
+\usepackage[colorlinks]{hyperref} + 
\usepackage{glossaries} +
+

If you use hyperref make sure you use PDFLATEX rather than the LATEX to DVI +engine. The DVI format can’t break hyperlinks across a line so long glossary entries +(such as the full form of acronyms) won’t line wrap with the DVI engine. +Also, hyperlinks in sub- or superscripts aren’t correctly sized with the DVI +format. +

By default, if the hyperref package has been loaded, commands like \gls will form +a hyperlink to the relevant entry in the glossary. If you to disable this for all your +glossaries, then use +


\glsdisablehyper

+

+If you want hyperlinks suppressed for entries in specific glossaries, then use the +nohypertypes package option. For example, if you don’t want hyperlinks for entries in +the acronym and notation glossaries but you do want them for entries in the main +glossary, then do: + + + +

+
+\usepackage[colorlinks]{hyperref} + 
\usepackage[acronym,nohypertypes={acronym,notation}]{glossaries} + 
\newglossary[nlg]{notation}{not}{ntn}{Notation} +
+

+

If you want the hyperlinks suppressed the first time an entry is used, but you +want hyperlinks for subsequence references then use the hyperfirst=false package +option: + + + +

+
+\usepackage[colorlinks]{hyperref} + 
\usepackage[hyperfirst=false]{glossaries} +
+

+

Take care not to use non-expandable commands in PDF bookmarks. This isn’t +specific to the glossaries package but is a limitation of PDF bookmarks. +Non-expandable commands include commands like \gls, \glspl, \Gls and \Glspl. +The hyperref package provides a way of specifying alternative text for the PDF +bookmarks via \texorpdfstring. For example: + + + +

+
+\section{The \texorpdfstring{\gls{fishage}}{Fish Age}} +
+

However, it’s not a good idea to use commands like \gls in a section heading as +you’ll end up with the table of contents in your location list. Instead you can +use +


\glsentrytext{label}

+

+This is expandable provided that the text key doesn’t contain non-expandable code. +For example, the following works: + + + +

+
+\section{The \glsentrytext{fishage}} +
+

and it doesn’t put the table of contents in the location list. +

If you use glossaries-extra then use the commands that are provided specifically for +use in section headers. For example: + + + +

+
+\section{The \glsfmttext{fishage}} +
+

+

+

+

Top

8 Cross-References

+

You can add a reference to another entry in a location list using the see={label list} +key when you define an entry. The referenced entry (or entries) must also be +defined. +

For example: + + + +

+
+\longnewglossaryentry{devonian}{name={Devonian}}% + 
{% + 
  The geologic period spanning from the end of the + 
  Silurian Period to the beginning of the Carboniferous Period. + 
  This age was known for its remarkable variety of + 
  fish species. + 
} + 
\newglossaryentry{fishage} + 
{ + 
  name={Fish Age}, + 
  description={Common name for the Devonian period}, + 
  see={devonian} + 
} +
+

The cross-reference will appear as “see Devonian”. You can change the “see” tag +using the format see=[tag]label⟩. For example: + + + +

+
+\newglossaryentry{latinalph} + 
{ + 
  name={Latin alphabet}, + 
  description={alphabet consisting of the letters + 
  a, \ldots, z, A, \ldots, Z}, + 
  see=[see also]{exlatinalph} + 
} + 
\newglossaryentry{exlatinalph} + 
{ + 
   name={extended Latin alphabet}, + 
   description={The Latin alphabet extended to include + 
   other letters such as ligatures or diacritics.} + 
} +
+

If you use the see key in the optional argument of \newacronym, make sure you +enclose the value in braces. For example: + + + +

+
+\newacronym{ksvm}{ksvm}{kernel support vector machine} + 
\newacronym + 
 [see={[see also]{ksvm}}] + 
 {svm}{svm}{support vector machine} +
+

The glossaries-extra package provides a seealso key. This doesn’t allow a tag but +behaves much like see={[\seealsoname]{label}}. For example: + + + +

+
+\newabbreviation{ksvm}{ksvm}{kernel support vector machine} + 
\newabbreviation + 
 [seealso={ksvm}] + 
 {svm}{svm}{support vector machine} +
+

+

Since the cross-reference appears in the location list, if you suppress the +location list using the nonumberlist package option, then the cross-reference +will also be suppressed. With bib2gls, don’t use the nonumberlist package +option. Instead use the save-locations=false in the resource options. For +example: + + + +

+
+\usepackage[record,abbreviations,symbols]{glossaries-extra} + 
\GlsXtrLoadResources[ + 
 src={terms}, % entries defined in terms.bib + 
 type={main}% put in main glossary + 
] + 
\GlsXtrLoadResources[ + 
 src={abbrvs}, % entries defined in abbrvs.bib + 
 type={abbreviations},% put in abbreviations glossary + 
 save-locations=false% no number list for these entries + 
] + 
\GlsXtrLoadResources[ + 
 src={syms}, % entries defined in syms.bib + 
 type={symbols}% put in symbols glossary + 
] +
+

+

+

+

Top

9 Further Information

+ +

1deprecated, use babel instead

+ + + + + + diff --git a/macros/latex/contrib/glossaries/glossariesbegin.pdf b/macros/latex/contrib/glossaries/glossariesbegin.pdf new file mode 100644 index 0000000000..456669e405 Binary files /dev/null and b/macros/latex/contrib/glossaries/glossariesbegin.pdf differ diff --git a/macros/latex/contrib/glossaries/glossariesbegin.tex b/macros/latex/contrib/glossaries/glossariesbegin.tex new file mode 100644 index 0000000000..d630031205 --- /dev/null +++ b/macros/latex/contrib/glossaries/glossariesbegin.tex @@ -0,0 +1,2092 @@ +\documentclass{nlctdoc} + +\usepackage[utf8]{inputenc} +\ifpdf +\usepackage[T1]{fontenc} +\usepackage{mathpazo} +\usepackage[scaled=.88]{helvet} +\usepackage{courier} +\usepackage{xr-hyper} +\fi + +\usepackage{alltt} +\usepackage{pifont} +\usepackage{array} +\usepackage{color} + +\usepackage[colorlinks,linkcolor=blue,pdfauthor={Nicola L.C. Talbot}, + pdftitle={The glossaries package: a guide for beginners}]{hyperref} +\usepackage[nomain]{glossaries} + +\newcommand*{\yes}{\ding{52}} +\newcommand*{\no}{\ding{56}} + +\newcommand*{\proyes}{\textcolor{green}{\yes}} +\newcommand*{\prono}{\textcolor{red}{\no}} + +\newcommand*{\conyes}{\textcolor{red}{\yes}} +\newcommand*{\conno}{\textcolor{green}{\no}} + +\newcommand*{\code}[1]{% + \texorpdfstring{{\frenchspacing\obeyspaces\ttfamily#1}}{#1}} +\newcommand*{\file}[1]{\texorpdfstring{\texttt{#1}}{#1}} + +\title{The glossaries package v4.42: +a guide for beginners} +\author{Nicola L.C. Talbot} +\date{2019-01-06} + +\ifpdf + \externaldocument{glossaries-user} +\fi + +\makeatletter +\newcommand*{\optionlabel}[1]{% + \@glstarget{option#1}{}\textbf{Option~#1}} +\makeatother + +\newcommand*{\opt}[1]{\hyperlink{option#1}{Option~#1}} +\newcommand*{\optsor}[2]{Options~\hyperlink{option#1}{#1} +or~\hyperlink{option#2}{#2}} +\newcommand*{\optsand}[2]{Options~\hyperlink{option#1}{#1} +and~\hyperlink{option#2}{#2}} + +\begin{document} +\maketitle + +\begin{abstract} +The \styfmt{glossaries} package is very flexible, but this means +that it has a~lot of options, and since a user guide is supposed to +provide a complete list of all the high-level user commands, the main +user manual is quite big. This can be rather +daunting for beginners, so this document is a brief introduction +just to help get you started. If you find yourself saying, \qt{Yeah, +but how can I do\ldots?} then it's time to move on to the +\docref{main user manual}{glossaries-user}. + +I've made some statements in this document that don't actually tell +you the full truth, but it would clutter the document and cause +confusion if I keep writing \qt{except when \ldots} or \qt{but you can +also do this, that or the other} or \qt{you can do it this way but +you can also do it that way, but that way may cause complications +under certain circumstances}. +\end{abstract} + +\tableofcontents + +\section{Getting Started} +\label{sec:start} + +As with all packages, you need to load \styfmt{glossaries} with +\cs{usepackage}, but there are certain packages that must be loaded +before \styfmt{glossaries}, \emph{if} they are required: \sty{hyperref}, +\sty{babel}, \sty{polyglossia}, \sty{inputenc} and \sty{fontenc}. +(You don't have to load these packages, but if you want them, you +must load them before \styfmt{glossaries}.) + +\begin{important} +If you require multilingual support you must also install +the relevant language module. Each language module is called +\file{glossaries-}\meta{language}, where \meta{language} is the +root language name. For example, \file{glossaries-french} +or \file{glossaries-german}. If a language module is required, +the \styfmt{glossaries} package will automatically try to load it +and will give a warning if the module isn't found. +\end{important} + +Once you have loaded \styfmt{glossaries}, you need to define +your terms in the preamble and then you can use them throughout the +document. Here's a simple example: +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries} + + \newglossaryentry{ex}{name={sample},description={an example}} + + \begin{document} + Here's my \gls{ex} term. + \end{document} +\end{verbatim} +This produces: +\begin{quote} +Here's my sample term. +\end{quote} +Here's another example: +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries} + + \setacronymstyle{long-short} + + \newacronym{svm}{SVM}{support vector machine} + + \begin{document} + First use: \gls{svm}. Second use: \gls{svm}. + \end{document} +\end{verbatim} +This produces: +\begin{quote} +First use: support vector machine (SVM). Second use: SVM. +\end{quote} +In this case, the text produced by \verb|\gls{svm}| changed after the first +use. The first use produced the long form followed by the short form +in parentheses because I set the acronym style to +\code{long-short}. I suggest you try the above two examples to +make sure you have the package correctly installed. +If you get an \code{undefined control sequence} error, check that +the version number at the top of this document matches the version +you have installed. (Open the \file{.log} file and search for the +line that starts with \code{Package: glossaries} followed by a +date and version.) + +\begin{important} +Be careful of fragile commands. If a command causes a problem when +used in one of the \cs{newglossaryentry} fields, consider adding +\cs{glsnoexpandfields} before you start defining your entries. +\end{important} + +Abbreviations are slightly different if you use the extension package +\sty{glossaries-extra} (which needs to be installed separately): +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries-extra} + + \setabbreviationstyle{long-short}% glossaries-extra.sty + + \newabbreviation{svm}{SVM}{support vector machine}% glossaries-extra.sty + + \begin{document} + First use: \gls{svm}. Second use: \gls{svm}. + \end{document} +\end{verbatim} +If you still want to use \cs{newacronym} (rather than +\cs{newabbreviation}) then you need the optional +argument of \cs{setabbreviationstyle}: +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries-extra} + + \setabbreviationstyle[acronym]{long-short}% glossaries-extra.sty only + + \newacronym{svm}{SVM}{support vector machine} + + \begin{document} + First use: \gls{svm}. Second use: \gls{svm}. + \end{document} +\end{verbatim} +\begin{important} +You can't use \cs{setacronymstyle} with \sty{glossaries-extra}. +\end{important} + +If you like, you can put all your definitions in another file (for +example, \file{defns.tex}) and load that file in the preamble using +\cs{loadglsentries} with the filename as the argument. For example: +\begin{verbatim} +\loadglsentries{defns} +\end{verbatim} +If you find you have a really large number of definitions that are +hard to manage in a \file{.tex} file, you might want to have a +look at \app{bib2gls} (installed separately) which requires +a \file{.bib} format instead that can be managed by an application +such as JabRef. + +Don't try inserting formatting commands into the definitions as they +can interfere with the underlying mechanism. Instead, the +formatting should be done by the style. For example, suppose I~want +to replace \code{SVM} with \verb|\textsc{svm}|, then +I~need to select a style that uses \cs{textsc}, like this (for the +base \styfmt{glossaries} style): +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries} + + \setacronymstyle{long-sc-short} + + \newacronym{svm}{svm}{support vector machine} + + \begin{document} + First use: \gls{svm}. Second use: \gls{svm}. + \end{document} +\end{verbatim} +The abbreviation styles have a different naming scheme with +\sty{glossaries-extra}: +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries-extra} + + \setabbreviationstyle{long-short-sc}% glossaries-extra.sty + + \newabbreviation{svm}{svm}{support vector machine}% glossaries-extra.sty + + \begin{document} + First use: \gls{svm}. Second use: \gls{svm}. + \end{document} +\end{verbatim} +With \sty{glossaries-extra} you can have multiple abbreviation +styles for different categories. Many of these styles have their +own associated formatting commands that can be redefined +for minor adjustments. For example: +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries-extra} + + \setabbreviationstyle[statistical]{long-short-sc} + \setabbreviationstyle[bacteria]{long-only-short-only} + + % Formatting commands used by 'long-only-short-only' style: + \renewcommand*{\glsabbrvonlyfont}[1]{\emph{#1}} + \renewcommand*{\glslongonlyfont}[1]{\emph{#1}} + + % Formatting command used by 'long-short-sc' style: + % (make sure abbreviation is converted to lower case) + \renewcommand*{\glsabbrvscfont}[1]{\textsc{\MakeLowercase{#1}}} + + \newabbreviation + [ + category={statistical}% glossaries-extra.sty key + ] + {svm}{SVM}{support vector machine} + + \newabbreviation + [ + category={bacteria}% glossaries-extra.sty key + ] + {cbot}{C.~botulinum}{Clostridium botulinum} + + \begin{document} + First use: \gls{svm}, \gls{cbot}. + + Next use: \gls{svm}, \gls{cbot}. + \end{document} +\end{verbatim} +This produces: +\begin{quote} +First use: support vector machine (\textsc{svm}), \emph{Clostridium +botulinum}. + +Next use: \textsc{svm}, \emph{C.~botulinum}. +\end{quote} + +As you can hopefully see from the above examples, there are two main ways of +defining a term: as a general entry (\cs{newglossaryentry}) or as an +abbreviation (\cs{newacronym} or, with \sty{glossaries-extra}, +\cs{newabbreviation}). + +Regardless of the method of defining a term, the term is always +given a label. In the first example, the label was +\code{ex} and in the other examples the label was \code{svm} +(and \code{cbot} in the last example). The +label is used to uniquely identify the term (like the standard +\cs{label}\slash\cs{ref} or \cs{cite} mechanism). It's best to just use the +following alphanumerics in the labels: \code{a}, \ldots, +\code{z}, \code{A}, \ldots, \code{Z}, \code{0}, \ldots, +\code{9}. Sometimes you can also use punctuation characters but +not if another package (such as \sty{babel}) meddles with them. +Don't try using any characters outside of the basic Latin set with +\sty{inputenc} (for example, \'e or \ss) or things will go horribly +wrong. This warning only applies to the label. It doesn't apply to +the text that appears in the document. + +\begin{important} +Don't use \cs{gls} in chapter or section headings as it can have +some unpleasant side-effects. Instead use \cs{glsentrytext} for +regular entries and one of \cs{glsentryshort}, \cs{glsentrylong} +or \cs{glsentryfull} for acronyms. Alternatively use +\sty{glossaries-extra} which provides special commands for use in +section headings, such as \cs{glsfmtshort}\marg{label}. +\end{important} + +The above examples are reasonably straightforward. The difficulty +comes if you want to display a \emph{sorted} list of all the entries you +have used in the document. The \sty{glossaries-extra} package +provides a really easy way of listing all the defined entries: +\begin{verbatim} + \documentclass{article} + + \usepackage[sort=none]{glossaries-extra} + + \newglossaryentry{potato}{name={potato},plural={potatoes}, + description={starchy tuber}} + + \newglossaryentry{cabbage}{name={cabbage}, + description={vegetable with thick green or purple leaves}} + + \newglossaryentry{turnip}{name={turnip}, + description={round pale root vegetable}} + + \newglossaryentry{carrot}{name={carrot}, + description={orange root}} + + \begin{document} + Chop the \gls{cabbage}, \glspl{potato} and \glspl{carrot}. + + \printunsrtglossaries % list all entries + \end{document} +\end{verbatim} +However this method doesn't sort the entries (they're listed in +order of definition) and it will display all the defined entries, +regardless of whether or not you've used them all in the document, +so \qt{turnip} appears in the glossary even though there's +no \verb|\gls{turnip}| (or similar) in the document. + +The \pkgopt[none]{sort} option isn't essential in this case (there's +no other sort option available for this document), but it prevents +the automatic construction of the sort value and so slightly +improves the document build time. + +Note that this example document uses the same command +(\cs{printunsrtglossaries}) that's used with \app{bib2gls} (\opt4) +but with \app{bib2gls} you instead need to use the +\pkgopt{record} package option and one or more instances of +\cs{GlsXtrLoadResources} in the preamble (see below). + +Most users prefer to have an automatically sorted list that only +contains entries that have been used in the document. +The \styfmt{glossaries} package provides +three options: use \TeX\ to perform the sorting (\opt1); use +\app{makeindex} to perform the sorting (\opt2); use \app{xindy} to +perform the sorting (\opt3). The extension package \sty{glossaries-extra} +provides a fourth method: use \app{bib2gls} (\opt4). + +The first option (using \TeX) is the simplest method, as it doesn't +require an external tool, but it's very inefficient and the sorting +is done according to the English alphabet. To use this method, add +\cs{makenoidxglossaries} to the preamble and put +\cs{printnoidxglossaries} at the place where you want your glossary. +For example: +\begin{verbatim} + \documentclass{article} + + \usepackage{glossaries} + + \makenoidxglossaries % use TeX to sort + + \newglossaryentry{potato}{name={potato},plural={potatoes}, + description={starchy tuber}} + + \newglossaryentry{cabbage}{name={cabbage}, + description={vegetable with thick green or purple leaves}} + + \newglossaryentry{turnip}{name={turnip}, + description={round pale root vegetable}} + + \newglossaryentry{carrot}{name={carrot}, + description={orange root}} + + \begin{document} + Chop the \gls{cabbage}, \glspl{potato} and \glspl{carrot}. + + \printnoidxglossaries + \end{document} +\end{verbatim} + +\begin{important} +The \cs{makenoidxglossaries} method is very slow, uses an ASCII +comparator and often breaks if there are commands in the +\code{name} key. +\end{important} + +Try this out and run \LaTeX\ (or pdf\LaTeX) \emph{twice}. The first +run won't show the glossary. It will only appear on the second run. +This doesn't include \qt{turnip} in the glossary because that term +hasn't been used (with commands like \verb|\gls{turnip}|) in the document. + +The glossary has a vertical gap between the \qt{carrot} term and the +\qt{potato} term. This is because the entries in the glossaries are +grouped according to their first letter. If you don't want this gap, +just add \pkgopt{nogroupskip} to the package options: +\begin{verbatim} +\usepackage[nogroupskip]{glossaries} +\end{verbatim} +or you may want to try out a style that shows the group headings: +\begin{verbatim} +\usepackage[style=indexgroup]{glossaries} +\end{verbatim} +If you try out this example you may also notice that the description +is followed by a full stop (period) and a number. The number is the +location in the document where the entry was used (page~1 in this +case), so you can lookup the term in the glossary and be directed to +the relevant pages. It may be that you don't want this +back-reference, in which case you can suppress it using the +\pkgopt{nonumberlist} package option: +\begin{verbatim} +\usepackage[nonumberlist]{glossaries} +\end{verbatim} +If you don't like the terminating full stop, you can suppress that +with the \pkgopt{nopostdot} package option: +\begin{verbatim} +\usepackage[nopostdot]{glossaries} +\end{verbatim} + +If you tried out the previous example with \sty{glossaries-extra} +and \cs{printunsrtglossaries} the terminating full stop is missing +and there are no number lists. You can add the full stop back with +\begin{verbatim} +\usepackage[nopostdot=false]{glossaries-extra} +\end{verbatim} +or +\begin{verbatim} +\usepackage[postdot]{glossaries-extra} +\end{verbatim} +If you want the number lists then you need to use an indexing option. + + +You may have noticed that I've used another command in the above example: +\cs{glspl}. This displays the plural form. By default, this is just +the singular form with the letter \qt{s} appended, but in the case of +\qt{potato} I had to specify the correct plural using the +\code{plural} key. + +As I mentioned earlier, using \TeX\ to sort the entries is the +simplest but least efficient method. If you have a large glossary or +if your terms contain non-Latin or extended Latin characters, then +you will have a much faster build time if you use \app{makeindex} +(\opt2) or \app{xindy} (\opt3) or \app{bib2gls} (\opt4). If +you are using extended Latin or non-Latin characters, then +\app{xindy} or \app{bib2gls} are the recommended methods. +These methods are described in more detail in +\sectionref{sec:printglossaries}. + +The rest of this document briefly describes the main commands +provided by the \styfmt{glossaries} package. (Most of these are also +available with \sty{glossaries-extra} but may behave slightly +differently.) + +\section{Defining Terms} +\label{sec:defterm} + +When you use the \sty{glossaries} package, you need to define +glossary entries in the document preamble. These entries could be +a~word, phrase, abbreviation or symbol. They're usually accompanied by +a~description, which could be a short sentence or an in-depth +explanation that spans multiple paragraphs. The simplest method of +defining an entry is to use: +\begin{definition} +\begin{alltt} +\cs{newglossaryentry}\marg{label} +\verb|{| + name=\marg{name}, + description=\marg{description}, + \meta{other options} +\verb|}| +\end{alltt} +\end{definition} +where \meta{label} is a unique label that identifies this entry. +(Don't include the angle brackets \meta{ }. They just indicate the parts of +the code you need to change when you use this command in your document.) +The \meta{name} is the word, phrase or symbol you are defining, +and \meta{description} is the description to be displayed in the +glossary. + +This command is a \qt{short} command, which means that +\meta{description} can't contain a~paragraph break. If you have +a~long description, you can instead use: +\begin{definition} +\begin{alltt} +\cs{longnewglossaryentry}\marg{label} +\verb|{| + name=\marg{name}, + \meta{other options} +\verb|}| +\marg{description} +\end{alltt} +\end{definition} + +Examples: +\begin{enumerate} +\item Define the term \qt{set} with the label \code{set}: +\begin{verbatim} +\newglossaryentry{set} +{ + name={set}, + description={a collection of objects} +} +\end{verbatim} + +\item Define the symbol $\emptyset$ with the label +\code{emptyset}: +\begin{verbatim} +\newglossaryentry{emptyset} +{ + name={\ensuremath{\emptyset}}, + description={the empty set} +} +\end{verbatim} +(This will also need a \code{sort} key if you use \optsor13, see +below.) + +\item Define the phrase \qt{Fish Age} with the label +\code{fishage}: +\begin{verbatim} +\longnewglossaryentry{fishage} +{name={Fish Age}} +{% + A common name for the Devonian geologic period + spanning from the end of the Silurian Period to + the beginning of the Carboniferous Period. + + This age was known for its remarkable variety of + fish species. +} +\end{verbatim} +(The percent character discards the end of line character that would +otherwise cause an unwanted space to appear at the start of the +description.) + +\item Take care if the first letter is an extended Latin or +non-Latin character (either specified via a~command such as +\verb|\'e| or explicitly via the \sty{inputenc} package such +as \code{\'e}). This first letter must be placed in a~group: + +\begin{verbatim} +\newglossaryentry{elite} +{ + name={{\'e}lite}, + description={select group or class} +} +\end{verbatim} +or +\begin{alltt} +\verb|\newglossaryentry{elite}| +\verb|{| + name=\verb|{{|\'e\verb|}lite}|, + description=\verb|{select group or class}| +\verb|}| +\end{alltt} +\end{enumerate} +(For further details, see the section \qt{UTF-8} of the +\href{https://ctan.org/pkg/mfirstuc}{\styfmt{mfirstuc}} user manual.) + +If you use \app{bib2gls} with \sty{glossaries-extra} then the +terms must be defined in a \file{.bib} file. For example: +\begin{alltt} +\% Encoding: UTF-8 + +@entry\{set, + name=\{set\}, + description=\{a collection of objects\} +\} + +@entry\{emptyset, + name=\verb|{\ensuremath{\emptyset}}|, + description=\{the empty set\} +\} + +@entry\{fishage, + name=\{Fish Age\}, + description=\{A common name for the Devonian geologic period + spanning from the end of the Silurian Period to + the beginning of the Carboniferous Period. + + This age was known for its remarkable variety of + fish species.\} +\} + +@entry\{elite, + name=\verb|{{|\'e\verb|}lite}|, + description=\verb|{select group or class}| +\} +\end{alltt} +(The \file{.bib} format doesn't allow spaces in labels so you can't +have \code{fish age} as the label, but you can have +\code{fish-age}.) +This method requires the \sty{glossaries-extra}'s \pkgopt{record} +package option: +\begin{verbatim} +\usepackage[record]{glossaries-extra} +\end{verbatim} +and the \file{.bib} file is specified in the resource command. For +example, if the \file{.bib} file is called \file{entries.bib} +then put the following line in the document preamble: +\begin{verbatim} +\GlsXtrLoadResources[src={entries}] +\end{verbatim} +You can have a comma-separated list. For example, if you also +have entries defined in the file \file{entries2.bib}: +\begin{verbatim} +\GlsXtrLoadResources[src={entries,entries2.bib}] +\end{verbatim} + +There are other keys you can use when you define an entry. For +example, the \code{name} key indicates how the term +should appear in the list of entries (glossary), but if the term should +appear differently when you reference it with \cs{gls}\marg{label} in +the document, you need to use the \code{text} key as well. + +For example: +\begin{verbatim} +\newglossaryentry{latinalph} +{ + name={Latin Alphabet}, + text={Latin alphabet}, + description={alphabet consisting of the letters + a, \ldots, z, A, \ldots, Z} +} +\end{verbatim} +This will appear in the text as \qt{Latin alphabet} but will be listed in +the glossary as \qt{Latin Alphabet}. +With \app{bib2gls} this entry is defined in the \file{.bib} +file as: +\begin{verbatim} +@entry{latinalph, + name={Latin Alphabet}, + text={Latin alphabet}, + description={alphabet consisting of the letters + a, \ldots, z, A, \ldots, Z} +} +\end{verbatim} + +Another commonly used key is \code{plural} for specifying the +plural of the term. This defaults to the value of the \code{text} +key with an \qt{s} appended, but if this is incorrect, just use the +\code{plural} key to override it: +\begin{verbatim} +\newglossaryentry{oesophagus} +{ + name={{\oe}sophagus}, + plural={{\oe}sophagi}, + description={canal from mouth to stomach} +} +\end{verbatim} +(Remember from earlier that the initial ligature \cs{oe} needs to +be grouped.) + +Abbreviations can be defined using +\begin{definition} +\cs{newacronym}\oarg{options}\marg{label}\marg{short}\marg{long} +\end{definition} +where \meta{label} is the label (as per \cs{newglossaryentry}), +\meta{short} is the short form and \meta{long} is the long form. +For example, the +following defines an abbreviation: +\begin{verbatim} +\newacronym{svm}{SVM}{support vector machine} +\end{verbatim} +This internally uses \cs{newglossaryentry} to define an entry with +the label \code{svm}. By default, the \code{name} key is set to +\meta{short} (\qt{SVM} in the above example) and the +\code{description} key is set to \meta{long} (\qt{support vector +machine} in the above example). If, instead, you want to be able to +specify your own description you can do this using the optional +argument: +\begin{verbatim} +\newacronym + [description={statistical pattern recognition technique}] + {svm}{SVM}{support vector machine} +\end{verbatim} + +Before you define your acronyms (or other types of abbreviations), you +need to specify which style to use with +\begin{definition} +\cs{setacronymstyle}\marg{style name} +\end{definition} +where \meta{style name} is the name of the style. There are a number +of predefined styles, such as: \code{long-short} (on first use +display the long form with the short form in parentheses); +\code{short-long} (on first use display the short form with the +long form in parentheses); \code{long-short-desc} (like +\code{long-short} but you need to specify the description); or +\code{short-long-desc} (like \code{short-long} but you need to +specify the description). There are some other styles as well that +use \cs{textsc} to typeset the acronym or that use a footnote on +first use. See the main user guide for further details. + +The \sty{glossaries-extra} package provides improved abbreviation +handling with \href{http://www.dickimaw-books.com/gallery/sample-abbr-styles.shtml}{a lot more predefined styles}. +With this extension package, abbreviations are defined using: +\begin{definition} +\cs{newabbreviation}\oarg{options}\marg{label}\marg{short}\marg{long} +\end{definition} +You can still use \cs{newacronym} but it's redefined to +use the new abbreviation interface. The style must now be set using: +\begin{definition} +\cs{setabbreviationstyle}\oarg{category}\marg{style name} +\end{definition} +The default \meta{category} is \code{abbreviation}. If you use +\cs{newacronym} the category is \code{acronym}, which is why you +need to use the optional argument if you define abbreviations with +\cs{newacronym} when \sty{glossaries-extra} has been loaded: +\begin{alltt} +\cs{setabbreviationstyle}[acronym]\marg{style name} +\end{alltt} +If you use \app{bib2gls} then abbreviations are defined in the +\file{.bib} file in the format: +\begin{alltt} +@abbreviation\{\meta{label}, + long=\marg{long form}, + short=\marg{short form} +\} +\end{alltt} + +The plural forms for abbreviations can be specified using the +\code{longplural} and \code{shortplural} keys. For example: +\begin{verbatim} +\newacronym + [longplural={diagonal matrices}] + {dm}{DM}{diagonal matrix} +\end{verbatim} +or (with \sty{glossaries-extra}): +\begin{verbatim} +\newabbreviation % glossaries-extra.sty + [longplural={diagonal matrices}] + {dm}{DM}{diagonal matrix} +\end{verbatim} +If omitted, the defaults are again obtained by appending an \qt{s} to +the singular versions. With \app{bib2gls}, the definition in the +\file{.bib} file is: +\begin{verbatim} +@abbreviation{dm, + short={DM}, + long={diagonal matrix}, + longplural={diagonal matrices} +} +\end{verbatim} + +It's also possible to have both a~name and a~corresponding symbol. +Just use the \code{name} key for the name and the \code{symbol} key +for the symbol. For example: +\begin{verbatim} +\newglossaryentry{emptyset} +{ + name={empty set}, + symbol={\ensuremath{\emptyset}}, + description={the set containing no elements} +} +\end{verbatim} +or with \app{bib2gls} the definition in the \file{.bib} file is: +\begin{verbatim} +@entry{emptyset, + name={empty set}, + symbol={\ensuremath{\emptyset}}, + description={the set containing no elements} +} +\end{verbatim} + +If you want the symbol in the \code{name} field then you must +supply a \code{sort} value with \optsand13 otherwise you'll end up +with errors from \TeX\ or \app{xindy}. With \opt2 +(\app{makeindex}) it's not quite so important but you may find +the resulting order is a little odd. For example: +\begin{verbatim} +\newglossaryentry{emptyset} +{ + name={\ensuremath{\emptyset}}, + sort={empty set}, + description={the set containing no elements} +} +\end{verbatim} +This displays the symbol as $\emptyset$ but sorts according to +\qt{empty set}. You may want to consider using +\sty{glossaries-extra}'s \pkgopt{symbols} package option which +provides +\begin{definition} +\cs{glsxtrnewsymbol}\oarg{options}\marg{label}\marg{symbol} +\end{definition} +This internally uses \cs{newglossaryentry} but automatically sets +the \code{sort} key to the \meta{label}. For example: +\begin{verbatim} +\documentclass{article} + +\usepackage[symbols]{glossaries-extra} + +\makeglossaries + +\glsxtrnewsymbol % requires glossaries-extra.sty 'symbols' option + [description={the set containing no elements}] + {emptyset}% label (and sort value) + {\ensuremath{\emptyset}}% symbol + +\begin{document} +\gls{emptyset} + +\printglossaries +\end{document} +\end{verbatim} +Now the sort value is \qt{emptyset} rather than the previous +\qt{empty set}. + +With \app{bib2gls} you can define this in the \file{.bib} file +as +\begin{verbatim} +@entry{emptyset, + name={\ensuremath{\emptyset}}, + description={the set containing no elements} +} +\end{verbatim} +in which case \app{bib2gls} will try to interpret the \code{name} +field to determine the sort value. Alternatively you can use: +\begin{verbatim} +@symbol{emptyset, + name={\ensuremath{\emptyset}}, + description={the set containing no elements} +} +\end{verbatim} +which will use the label (\code{emptyset}) as the sort value. +(You don't need the \pkgopt{symbols} package option in this case, +unless you want a separate symbols list.) The corresponding document +(where the definition is in the file \file{entries.bib}) is now: +\begin{verbatim} +\documentclass{article} + +\usepackage[record]{glossaries-extra} + +\GlsXtrLoadResources[src=entries] + +\begin{document} +\gls{emptyset} + +\printunsrtglossaries +\end{document} +\end{verbatim} + +\section{Using Entries} +\label{sec:useterm} + +Once you have defined your entries, as described above, you can +reference them in your document. There are a~number of commands to +do this, but the most common one is: +\begin{definition} +\cs{gls}\marg{label} +\end{definition} +where \meta{label} is the label you assigned to the entry when you +defined it. For example, \verb|\gls{fishage}| will display \qt{Fish +Age} in the text (given the definition from the previous section). +If you are using \app{bib2gls} then this will display ?? (like +\cs{ref} and \cs{cite}) until \app{bib2gls} has created the +relevant files and \LaTeX\ is rerun. + +If you are using the \sty{hyperref} package (remember to load it +before \styfmt{glossaries}) \cs{gls} will create a hyperlink to the +corresponding entry in the glossary. If you want to suppress the +hyperlink for a particular instance, use the starred form \cs{gls*} +for example, \verb|\gls*{fishage}|. The other commands described in +this section all have a similar starred form. + +If the entry was defined as an acronym (using \cs{newacronym} with +\styfmt{glossaries} described above) or an abbreviation (using +\cs{newabbreviation} with \sty{glossaries-extra}), then \cs{gls} +will display the full form the first time it's used and just the +short form on subsequent use. For example, if the style is +set to \code{long-short}, then \verb|\gls{svm}| will display +\qt{support vector machine (SVM)} the first time it's used, but the +next occurrence of \verb|\gls{svm}| will just display \qt{SVM}. +(If you use \cs{newacronym} with \sty{glossaries-extra} the default +doesn't show the long form on first use. You'll need to change the +style first, as described earlier.) + +If you want the plural form, you can use: +\begin{definition} +\cs{glspl}\marg{label} +\end{definition} +instead of \cs{gls}\marg{label}. For example, \verb|\glspl{set}| +displays \qt{sets}. + +If the term appears at the start of a~sentence, you can convert the +first letter to upper case using: +\begin{definition} +\cs{Gls}\marg{label} +\end{definition} +for the singular form or +\begin{definition} +\cs{Glspl}\marg{label} +\end{definition} +for the plural form. For example: +\begin{verbatim} +\Glspl{set} are collections. +\end{verbatim} +produces \qt{Sets are collections}. + +If you've specified a symbol using the \code{symbol} key, you can +display it using: +\begin{definition} +\cs{glssymbol}\marg{label} +\end{definition} + +\section{Displaying a List of Entries} +\label{sec:printglossaries} + +In \sectionref{sec:start}, I mentioned that there are three options +you can choose from to create an automatically sorted glossary with the base +\styfmt{glossaries} package. These are also available with the +extension package \styfmt{glossaries-extra} along with a fourth +option. These four options are listed below in a little more detail. +\Tableref{tab:optionsp+c} summarises the main advantages and +disadvantages. (There's a more detailed summary in the main +\styfmt{glossaries} user manual.) See also +\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build}. + +\begin{table}[htbp] + \caption{Comparison of Glossary Options} + \label{tab:optionsp+c} + {% + \centering + \begin{tabular}{>{\raggedright}p{0.3\textwidth}cccc} + & \bfseries \opt1 & \bfseries \opt2 & \bfseries \opt3 & \bfseries +\opt4\\ + Requires \sty{glossaries-extra}? & + \conno & \conno & \conno & \conyes\\ + Requires an external application? & + \conno & \conyes & \conyes & \conyes\\ + Requires Perl? & + \conno & \conno & \conyes & \conno\\ + Requires Java? & + \conno & \conno & \conno & \conyes\\ + Can sort extended Latin + or non-Latin alphabets? & + \prono & \prono & \proyes & \proyes\\ + Efficient sort algorithm? & + \prono & \proyes & \proyes & \proyes\\ + Can use different sort methods for each glossary? & + \proyes & \prono & \prono & \proyes\\ + Any problematic sort values? & + \conyes & \conyes & \conyes & \conno\\ + Can form ranges in the location lists? & + \prono & \proyes & \proyes & \proyes\\ + Can have non-standard locations? & + \proyes & \prono & \proyes\textsuperscript{\textdagger} & \proyes + \end{tabular} + \par}\medskip\footnotesize\textsuperscript{\textdagger} Requires some setting up. +\end{table} + + +\begin{description} +\item[]\optionlabel1: + + This is the simplest option but it's slow and if + you want a sorted list, it doesn't work for non-Latin alphabets. + The \code{name} mustn't contain commands (or, if it does, the + \code{sort} value must be supplied) unless you + have the package option \pkgopt{sanitizesort} or \pkgopt[def]{sort} + or \pkgopt[use]{sort}. + + \begin{enumerate} + \item Add \cs{makenoidxglossaries} to your preamble (before you + start defining your entries, as described in + \sectionref{sec:defterm}). + + \item Put +\begin{definition} +\cs{printnoidxglossary}[sort=\meta{order},\meta{other options}] +\end{definition} + where you want your list of entries to appear. The sort + \meta{order} may be one of: \code{word} (word ordering), + \code{letter} (letter ordering), \code{case} (case-sensitive + letter ordering), \code{def} (in order of definition) or + \code{use} (in order of use). Alternatively, use +\begin{definition} +\cs{printnoidxglossaries} +\end{definition} + to display all your glossaries (if you have more than one). This + command doesn't have any arguments. + + This option allows you to have different sort methods. For + example: +\begin{verbatim} +\printnoidxglossary[sort=word]% main glossary +\printnoidxglossary[type=symbols,sort=use]% symbols glossary +\end{verbatim} + + \item Run \LaTeX\ twice on your document. (As you would do to + make a~table of contents appear.) For example, click twice on + the \qt{typeset} or \qt{build} or \qt{PDF\LaTeX} button in your editor. + \end{enumerate} +Here's a complete document (\file{myDoc.tex}): +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} + +\makenoidxglossaries % use TeX to sort + +\newglossaryentry{sample}{name={sample}, + description={an example}} + +\begin{document} +A \gls{sample}. + +\printnoidxglossaries % iterate over all indexed entries +\end{document} +\end{verbatim} +Document build: +\begin{verbatim} +pdflatex myDoc +pdflatex myDoc +\end{verbatim} + +\item[]\optionlabel2: + + This option uses an application called \app{makeindex} to sort + the entries. This application comes with all modern \TeX\ distributions, + but it's hard-coded for the non-extended Latin alphabet. This process + involves making \LaTeX\ write the glossary information to a temporary + file which \app{makeindex} reads. Then \app{makeindex} writes + a~new file containing the code to typeset the glossary. \LaTeX\ then + reads this file on the next run. The \app{makeindex} + application is automatically invoked by the helper + \app{makeglossaries} script, which works out all the + appropriate settings from the \file{.aux} file. + + \begin{enumerate} + \item If you are using \sty{ngerman}\footnote{deprecated, use +\sty{babel} instead} or some other package that +makes the double-quote character \verb|"| a shorthand, then use +\cs{GlsSetQuote} to change this to some other character. For +example: +\begin{verbatim} +\GlsSetQuote{+} +\end{verbatim} + Use this as soon as possible after you've loaded the +\styfmt{glossaries} package. + + \item Add \cs{makeglossaries} to your preamble (before you start + defining your entries). + + \item Put +\begin{definition} +\cs{printglossary}\oarg{options} +\end{definition} + where you want your list of entries (glossary) to appear. (The + \code{sort} key isn't available in \meta{options}.) + Alternatively, use +\begin{definition} +\cs{printglossaries} +\end{definition} + which will display all glossaries (if you have more than one). + This command doesn't have any arguments. + +\begin{important} +All glossaries are sorted using the same method +which may be identified with one of the package options: +\pkgopt[standard]{sort} (default), \pkgopt[use]{sort} +or \pkgopt[def]{sort}. +\end{important} + + \item Run \LaTeX\ on your document. This creates files with the + extensions \file{.glo} and \file{.ist} (for example, if your + \LaTeX\ document is called \file{myDoc.tex}, then you'll have + two extra files called \file{myDoc.glo} and \file{myDoc.ist}). + If you look at your document at this point, you won't see the + glossary as it hasn't been created yet. + + \item Run \app{makeglossaries} with the base name of your + document (without the \file{.tex}) extension. If + you have access to a terminal or a command prompt (for example, the + MSDOS command prompt for Windows users or the bash console for + Unix-like users) then you need to run the command: +\begin{verbatim} +makeglossaries myDoc +\end{verbatim} + (Replace \file{myDoc} with the base name of your \LaTeX\ + document file without the \file{.tex} extension. + Avoid spaces in the file name.) If you don't have Perl installed + use \app{makeglossaries-lite} instead: +\begin{verbatim} +makeglossaries-lite myDoc +\end{verbatim} + +\begin{important} +Some beginners get confused by \app{makeglossaries} the +application (run as a system command) and \cs{makeglossaries} +the \LaTeX\ command which should be typed in the document +preamble. These are two different concepts that happen to have +similar looking names. +\end{important} + + If you don't know how to use the command prompt, then you can + probably configure your text editor to add + \app{makeglossaries} (or \app{makeglossaries-lite}) + as a build tool, but each editor has a + different method of doing this, so I~can't give a~general + description. You will have to check your editor's manual. + If you still have problems, try adding the \pkgopt{automake} + package option: +\begin{verbatim} +\usepackage[automake]{glossaries} +\end{verbatim} + + The default sort is word order (\qt{sea lion} comes before \qt{seal}). + If you want letter ordering you need to add the + \pkgopt[letter]{order} package option +\begin{verbatim} +\usepackage[order=letter]{glossaries} +\end{verbatim} + + \item Once you have successfully completed the previous step, + you can now run \LaTeX\ on your document again. + \end{enumerate} +Here's a complete document (\file{myDoc.tex}): +\begin{verbatim} +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries % create makeindex files + +\newglossaryentry{sample}{name={sample}, + description={an example}} + +\begin{document} +A \gls{sample}. + +\printglossaries % input files created by makeindex +\end{document} +\end{verbatim} +Document build: +\begin{verbatim} +pdflatex myDoc +makeglossaries myDoc +pdflatex myDoc +\end{verbatim} +or +\begin{verbatim} +pdflatex myDoc +makeglossaries-lite myDoc +pdflatex myDoc +\end{verbatim} + + +\item[]\optionlabel3: + + This option uses an application called + \app{xindy} to sort the entries. This application is more + flexible than \app{makeindex} and is able to sort extended + Latin or non-Latin alphabets. It comes with both \TeX~Live and + MiK\TeX. Since \app{xindy} is a Perl script, you will also + need to ensure that Perl is installed. In a~similar way to \opt2, this + option involves making \LaTeX\ write the glossary information to + a~temporary file which \app{xindy} reads. Then \app{xindy} + writes a~new file containing the code to typeset the glossary. + \LaTeX\ then reads this file on the next run. The \app{xindy} + application is automatically invoked by the helper + \app{makeglossaries} script, which works out all the + appropriate settings from the \file{.aux} file. + + \begin{enumerate} + \item Add the \pkgopt{xindy} option to the \sty{glossaries} +package option list: +\begin{verbatim} +\usepackage[xindy]{glossaries} +\end{verbatim} + + \item Add \cs{makeglossaries} to your preamble (before you start + defining your entries). + + \item Put +\begin{definition} +\cs{printglossary}\oarg{options} +\end{definition} + where you want your list of entries (glossary) to appear. (The + \code{sort} key isn't available in \meta{options}.) + Alternatively, use +\begin{definition} +\cs{printglossaries} +\end{definition} + +\begin{important} +All glossaries are sorted using the same method +which may be identified with one of the package options: +\pkgopt[standard]{sort} (default), \pkgopt[use]{sort} +or \pkgopt[def]{sort}. +\end{important} + + \item Run \LaTeX\ on your document. This creates files with the + extensions \file{.glo} and \file{.xdy} (for example, if your + \LaTeX\ document is called \file{myDoc.tex}, then you'll have + two extra files called \file{myDoc.glo} and \file{myDoc.xdy}). + If you look at your document at this point, you won't see the + glossary as it hasn't been created yet. + + \item Run \app{makeglossaries} with the base name of the + document (omitting the \file{.tex} extension). + If you have access to a terminal or a command prompt (for example, the + MSDOS command prompt for Windows users or the bash console for + Unix-like users) then you need to run the command: +\begin{verbatim} +makeglossaries myDoc +\end{verbatim} + (Replace \file{myDoc} with the base name of your \LaTeX\ + document file without the \file{.tex} extension. + Avoid spaces in the file name. If you don't know + how to use the command prompt, then as mentioned above, you may + be able to configure your text editor to add + \app{makeglossaries} as a build tool. + + The default sort is word order (\qt{sea lion} comes before +\qt{seal}). + If you want letter ordering you need to add the + \code{order=letter} package option: +\begin{verbatim} +\usepackage[xindy,order=letter]{glossaries} +\end{verbatim} + + \item Once you have successfully completed the previous step, + you can now run \LaTeX\ on your document again. + + \end{enumerate} +Here's a complete document (\file{myDoc.tex}): +\begin{verbatim} +\documentclass{article} + +\usepackage[xindy]{glossaries} + +\makeglossaries % create xindy files + +\newglossaryentry{sample}{name={sample}, + description={an example}} + +\begin{document} +A \gls{sample}. + +\printglossaries % input files created by xindy +\end{document} +\end{verbatim} +Document build: +\begin{verbatim} +pdflatex myDoc +makeglossaries myDoc +pdflatex myDoc +\end{verbatim} + +\item[]\optionlabel4: + + This requires the extension package \sty{glossaries-extra} and + an application called \app{bib2gls}. This application is able + to sort extended Latin or non-Latin alphabets. It comes with both + \TeX~Live and MiK\TeX\ but requires at least Java~7. This method + works differently to \optsand23. Instead of creating a file + containing the code to typeset the glossary it creates a + \file{.glstex} file containing the entry definitions fetched + from the \file{.bib} file (or files), but only those entries + that are required in the document are defined and they are + defined in the order obtained from the chosen sort method. + This means that you can just use + \cs{printunsrtglossary} to display each glossary (or + \cs{printunsrtglossaries} to display them all). + + \begin{enumerate} + \item Add the \pkgopt{record} option to the \sty{glossaries-extra} + package option list: +\begin{verbatim} +\usepackage[record]{glossaries-extra} +\end{verbatim} + + \item Add one or more +\begin{definition} +\cs{GlsXtrLoadResources}[src=\marg{bib list},\meta{options}] +\end{definition} + to your preamble where \meta{bib list} is the + list of \file{.bib} files containing the entries. You may + use different sort methods for each resource set. For example: +\begin{verbatim} +\usepackage[record,% using bib2gls + abbreviations, + symbols, + numbers +]{glossaries-extra} + +\GlsXtrLoadResources[ + src={terms},% entries in terms.bib + type=main,% put these entries in the 'main' (default) list + sort={de-CH-1996}% sort according to this locale +] +\GlsXtrLoadResources[ + src={abbrvs},% entries in abbrvs.bib + type=abbreviations,% put these entries in the 'abbreviations' list + sort={letter-case}% case-sensitive letter (non-locale) sort +] +\GlsXtrLoadResources[ + src={syms},% entries in syms.bib + type=symbols,% put these entries in the 'symbols' list + sort={use}% sort according to first use in the document +] +\GlsXtrLoadResources[ + src={constants},% entries in constants.bib + type=numbers,% put these entries in the 'numbers' list + sort-field={user1},% sort according to this field + sort={double}% double-precision sort +] +\end{verbatim} +The last resource set assumes that the entries defined in the +file \file{constants.bib} have a number stored in the \code{user1} +field. For example: +\begin{verbatim} +@number{pi, + name={\ensuremath{\pi}}, + description={pi}, + user1={3.141592654} +} +\end{verbatim} + + \item Put +\begin{definition} +\cs{printunsrtglossary}[type=\marg{type},\meta{options}] +\end{definition} + where you want your list of entries (glossary) to appear. (The + \code{sort} key isn't available in \meta{options}. It needs to be + used in \cs{GlsXtrLoadResources} instead.) + Alternatively, use +\begin{definition} +\cs{printunsrtglossaries} +\end{definition} + + \item Run \LaTeX\ on your document. The \pkgopt{record} option + adds information to the \file{.aux} file that provides + \app{bib2gls} with all required details for each resource set. + For example, if the file is called \file{myDoc.tex}: +\begin{verbatim} +pdflatex myDoc +\end{verbatim} + + \item Run \app{bib2gls} +\begin{verbatim} +bib2gls myDoc +\end{verbatim} +or (if you need letter groups) +\begin{verbatim} +bib2gls --group myDoc +\end{verbatim} + + \item Run \LaTeX\ again. + \end{enumerate} +Here's a complete document (\file{myDoc.tex}): +\begin{verbatim} +\documentclass{article} + +\usepackage[record]{glossaries-extra} + +\GlsXtrLoadResources % input file created by bib2gls + [% instructions to bib2gls: + src={entries}, % terms defined in entries.bib + sort={en-GB}% sort according to this locale + ] + +\newglossaryentry{sample}{name={sample}, + description={an example}} + +\begin{document} +A \gls{sample}. + +\printunsrtglossaries % iterate over all defined entries +\end{document} +\end{verbatim} +The accompanying \file{entries.bib} file: +\begin{verbatim} +@entry{sample, + name = {sample}, + description = {an example} +} +\end{verbatim} +Document build: +\begin{verbatim} +pdflatex myDoc +bib2gls myDoc +pdflatex myDoc +\end{verbatim} + +\end{description} + +If you are having difficulty integrating \app{makeglossaries} +into your document build process, you may want to consider using +\app{arara}, which is a Java application that searches the +document for special comment lines that tell \app{arara} which +applications to run. For example, the file \file{myDoc.tex} might +start with: +\begin{verbatim} + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex + \documentclass{article} + \usepackage{glossaries} + \makeglossaries +\end{verbatim} +then to build the document you just need the single system call: +\begin{verbatim} + arara myDoc +\end{verbatim} +(The currently pending version 4.0 of \app{arara} has +directives for \app{makeglossaries-lite} and \app{bib2gls}. +These aren't available in earlier versions, but you could try +copying and adapting the \file{makeglossaries.yaml} file and +replace \app{makeglossaries} as appropriate.) + +When sorting the entries, the string comparisons are made according +to each entry's \code{sort} key. If this is omitted, the +\code{name} key is used. For example, recall the earlier +definition: +\begin{verbatim} + \newglossaryentry{elite} + { + name={{\'e}lite}, + description={select group or class} + } +\end{verbatim} +No \code{sort} key was used, so it's set to the same as the +\code{name} key: \verb|{\'e}lite|. How this is interpreted depends +on which option you have used: +\begin{description} +\item[\opt1:] By default, the accent command will be stripped so the +sort value will be \code{elite}. This will put the entry in the +\qt{E} letter group. However if you use the +\pkgopt[true]{sanitizesort} package option, the sort value will be +interpreted as the sequence of characters: \verb|{| \verb|\| \code{'} \code{e} +\verb|}| \code{l} \code{i} \code{t} and \code{e}. This will place +this entry in the \qt{symbols} group since it starts with a symbol. + +\item[\opt2:] The sort key will be interpreted the sequence of characters: +\verb|{| \verb|\| \verb|'| \code{e} \verb|}| \code{l} \code{i} \code{t} +and \code{e}. The first character is an opening curly brace +\verb|{| so \app{makeindex} will put this entry in the +\qt{symbols} group. + +\item[\opt3:] +\app{xindy} disregards \LaTeX\ commands so it sorts on +\code{elite}, which puts this entry in the \qt{E} group. +If stripping all commands leads to an empty string (such as +\verb|\ensuremath{\emptyset}|) then \app{xindy} will fail, so in +these situations you need to provide an appropriate \code{sort} +value that \app{xindy} will accept. +\begin{important} +\app{xindy} merges entries with duplicate sort values. +\app{xindy} forbids empty sort values. +A sort value may degrade into an empty or duplicate value once +\app{xindy} has stripped all commands and braces. +\end{important} + +\item[\opt4:] +\app{bib2gls} has a primitive \LaTeX\ parser that recognises a +limited set of commands, which includes the standard accent commands +and some maths commands, so it can convert \verb|{\'e}lite| to +\code{\'elite}. It disregards unknown commands. This may lead to +an empty sort value, but \app{bib2gls} doesn't mind that. + +Note that even if the name is given as \verb|{\'e}lite|, the letter +group heading (if the \verb|--group| switch is used) may end up with +the character \'E depending on the locale used by the sort +comparator. In this case you will need to ensure the document can +support this character either with \sty{inputenc} or by switching to +a \LaTeX\ engine with native UTF-8 support. + +\end{description} + + +If the \sty{inputenc} package is used: +\begin{verbatim} + \usepackage[utf8]{inputenc} +\end{verbatim} +and the entry is defined as: +\begin{alltt} + \verb|\newglossaryentry{elite}| + \verb|{| + name=\verb|{{|\'e\verb|}lite},| + description=\verb|{select group or class}| + \verb|}| +\end{alltt} +then: +\begin{description} +\item[\opt1:] By default the sort value will be interpreted as +\code{elite} so the entry will be put in the \qt{E} letter group. +If you use the \pkgopt[true]{sanitizesort} package option, the +sort value will be interpreted as \code{\'elite} where \'e has +been sanitized (so it's no longer an active character and is in fact +seen as two octets 0xC3 0xA9) which will +put this entry before the \qt{A} letter group. (The group is +determined by the first octet 0xC3.) + +\item[\opt2:] \app{makeindex} sees \code{\'e} as two octets +(0xC3 0xA9) rather than a single character so it tries to put +\code{\'elite} in the 0xC3 (\qt{\~A}) letter group (which, in this +case, comes after \qt{Z}). + +\item[\opt3:] \app{xindy} will correctly recognise the sort value +\code{\'elite} and will place it in whatever letter group is +appropriate for the given language setting. (In English, this would +just be the \qt{E} letter group, but another language +might put it in the \qt{\'E} letter group.) + +\item[\opt4:] The \sty{inputenc} package doesn't affect the +encoding used with \file{.bib} entry definitions, since these are dependent +on the encoding used to save the \file{.bib} file (although the +labels must still be ASCII). You can help \app{bib2gls} (and +JabRef) by putting an encoding comment at the start of the \file{.bib} file: +\begin{alltt} +\% Encoding: UTF-8 +\end{alltt} + +With the correct encoding set up, \app{bib2gls} will determine +that the sort value is \code{\'elite} and will place it in +whatever letter group is appropriate for the given sort rule. +For example, \verb|sort=en-GB| (or just \verb|sort=en|) will put +\code{\'elite} in the \qt{E} letter group, but another language +might put it in the \qt{\'E} letter group. + +\end{description} + +Therefore if you have extended Latin or non-Latin characters, your +best option is to use either \app{xindy} (\opt3) or +\app{bib2gls} (\opt4) with the \sty{inputenc} or \sty{fontspec} package. +If you use \app{makeindex} (\opt2) you need to specify the +\code{sort} key like this: +\begin{verbatim} +\newglossaryentry{elite} +{ + name={{\'e}lite}, + sort={elite}, + description={select group or class} +} +\end{verbatim} +or +\begin{alltt} +\cs{newglossaryentry}\{elite\} +\{ + name=\{\{\'e\}lite\}, + sort=\{elite\}, + description=\{select group or class\} +\} +\end{alltt} +If you use \opt1, you may or may not need to use the \code{sort} +key, but you will need to be careful about fragile commands in the +\code{name} key if you don't set the \code{sort} key. + +If you use \opt3 and the \code{name} only contains a command or +commands (such as \cs{P} or \verb|\ensuremath{\pi}|) you must add the +\code{sort} key. This is also advisable for the other options +(except \opt4), but is essential for \opt3. For example: +\begin{verbatim} + \newglossaryentry{P}{name={\P},sort={P}, + description={paragraph symbol}} +\end{verbatim} + +\section{Customising the Glossary} +\label{sec:glosstyle} + +The default glossary style uses the \env{description} environment +to display the entry list. Each entry name is set in the optional +argument of \cs{item} which means that it will typically be +displayed in bold. You can switch to medium weight by redefining +\cs{glsnamefont}: +\begin{verbatim} +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} +\end{verbatim} +Some classes and packages redefine the \env{description} environment +in such as way that's incompatible with the \styfmt{glossaries} +package. In which case you'll need to select a different glossary +style (see below). + +By default, a~full stop is appended to the description (unless you +use \sty{glossaries-extra}). To prevent +this from happening use the \pkgopt{nopostdot} package option: +\begin{verbatim} +\usepackage[nopostdot]{glossaries} +\end{verbatim} +or to add it with \styfmt{glossaries-extra}: +\begin{verbatim} +\usepackage[postdot]{glossaries-extra} +\end{verbatim} + +By default, a~location list is displayed for each entry (unless you +use \cs{printunsrtglossary} without \app{bib2gls}). This refers +to the document locations (for example, the page number) where the +entry has been referenced. If you use \optsor23 described in +\sectionref{sec:printglossaries} or \opt4 (with \app{bib2gls} and +\sty{glossaries-extra}) then location ranges will be compressed. +For example, if an entry was used on pages~1, 2 and~3, with +\optsor23 or \opt4 the location list will appear as 1--3, but with \opt1 it +will appear as 1, 2, 3. If you don't want the locations displayed +you can hide them using the \pkgopt{nonumberlist} package option: +\begin{verbatim} +\usepackage[nonumberlist]{glossaries} +\end{verbatim} +or with \app{bib2gls} use \code{save-locations=false} in the +optional argument of the appropriate \cs{GlsXtrLoadResources} +(it's possible to have some resource sets with locations and some +without). + +Entries are grouped according to the first letter of +each entry's \code{sort} key. By default a~vertical gap is placed +between letter groups. You can suppress this with the +\pkgopt{nogroupskip} package option: +\begin{verbatim} +\usepackage[nogroupskip]{glossaries} +\end{verbatim} + +If the default style doesn't suit your document, you can change the +style using: +\begin{definition} +\cs{setglossarystyle}\marg{style name} +\end{definition} +\href{http://www.dickimaw-books.com/gallery/glossaries-styles/}{There are a~number of predefined styles.} Glossaries can vary from +a~list of symbols with a~terse description to a~list of words or +phrases with descriptions that span multiple paragraphs, so there's +no \qt{one style fits all} solution. You need to choose a~style that +suits your document. For example: +\begin{verbatim} +\setglossarystyle{index} +\end{verbatim} +You can also use the \pkgopt{style} package option for the preloaded +styles. For example: +\begin{verbatim} +\usepackage[style=index]{glossaries} +\end{verbatim} + +Examples: +\begin{enumerate} + \item You have entries where the name is a~symbol and the + description is a~brief phrase or short sentence. Try one of the + \qt{mcol} styles defined in the \sty{glossary-mcols} package. For example: +\begin{verbatim} +\usepackage[nopostdot]{glossaries} +\usepackage{glossary-mcols} +\setglossarystyle{mcolindex} +\end{verbatim} +or +\begin{verbatim} +\usepackage[stylemods={mcols},style=mcolindex]{glossaries-extra} +\end{verbatim} + + \item You have entries where the name is a~word or phrase and the +description spans multiple paragraphs. Try one of the \qt{altlist} styles. For +example: +\begin{verbatim} +\usepackage[nopostdot]{glossaries} +\setglossarystyle{altlist} +\end{verbatim} +or +\begin{verbatim} +\usepackage[stylemods,style=altlist]{glossaries-extra} +\end{verbatim} + + \item You have entries where the name is a~single word, the + description is brief, and an associated symbol has been set. + Use one of the styles that display the symbol (not all of them do). + For example, one of the tabular styles: +\begin{verbatim} +\usepackage[nopostdot,nonumberlist]{glossaries} +\setglossarystyle{long4col} +\end{verbatim} +or one of the \qt{tree} styles: +\begin{verbatim} +\usepackage[nopostdot,nonumberlist]{glossaries} +\setglossarystyle{tree} +\end{verbatim} +\end{enumerate} + +If your glossary consists of a~list of abbreviations and you also want to +specify a~description as well as the long form, then you need to use +an abbreviation style that will suit the glossary style. For example, +use the \code{long-short-desc} acronym style: +\begin{verbatim} +\setacronymstyle{long-short-desc} +\end{verbatim} +Define the acronyms with a~description: +\begin{verbatim} +\newacronym + [description={statistical pattern recognition technique}] + {svm}{SVM}{support vector machine} +\end{verbatim} +Alternatively with \sty{glossaries-extra}: +\begin{verbatim} +\setabbreviationstyle{long-short-desc} + +\newabbreviation + [description={statistical pattern recognition technique}] + {svm}{SVM}{support vector machine} +\end{verbatim} + +Choose a~glossary style that suits wide entry names. For example: +\begin{verbatim} +\setglossarystyle{altlist} +\end{verbatim} + +\section{Multiple Glossaries} +\label{sec:multigloss} + +The \sty{glossaries} package predefines a~default \code{main} +glossary. When you define an entry (using one of the commands +described in \sectionref{sec:defterm}), that entry is automatically +assigned to the default glossary, unless you indicate otherwise +using the \code{type} key. However you first need to +make sure the desired glossary has been defined. This is done using: +\begin{definition} +\cs{newglossary}\oarg{glg}\marg{label}\marg{gls}\marg{glo}\marg{title} +\end{definition} +The \meta{label} is a~label that uniquely identifies this new +glossary. As with other types of identifying labels, be careful not +to use active characters in \meta{label}. The final argument +\meta{title} is the section or chapter heading used by +\cs{printglossary} or \cs{printnoidxglossary}. The other arguments +indicate the file extensions used by +\app{makeindex}\slash\app{xindy} (described in +\sectionref{sec:printglossaries}). If you use \opt1 described +above (or \app{bib2gls} and \cs{printunsrtglossaries}), +then the \meta{glg}, \meta{gls} and \meta{glo} arguments are +ignored, in which case you may prefer to use the starred version +where you don't specify the extensions: +\begin{definition} +\cs{newglossary*}\marg{label}\marg{title} +\end{definition} + +In the case of \optsor23, all glossary definitions must come before +\cs{makeglossaries}. (Entries definitions should come after +\cs{makeglossaries}.) In the case of \opt4, all glossary definitions +must come before any \cs{GlsXtrLoadResources} that requires them. + +Since it's quite common for documents to have both a~list of terms +and a~list of abbreviations, the \sty{glossaries} package provides the +package option \pkgopt{acronym} (or \pkgopt{acronyms}), which +is a~convenient shortcut for +\begin{verbatim} +\newglossary[alg]{acronym}{acr}{acn}{\acronymname} +\end{verbatim} +The option also changes the behaviour of \cs{newacronym} so that acronyms +are automatically put in the list of acronyms instead of the main +glossary. The \sty{glossaries-extra} package also provides this +option for abbreviations defined using \cs{newacronym} but +additionally has the package option \pkgopt{abbreviations} to create +a list of abbreviations for \cs{newabbreviation}. + +There are some other package options for creating commonly used +lists: \pkgopt{symbols} (lists of symbols), \pkgopt{numbers} (lists +of numbers), \pkgopt{index} (index of terms without descriptions defined with +\cs{newterm}\oarg{options}\marg{label}). + +For example, suppose you want a~main glossary for terms, a~list of +acronyms and a~list of notation: +\begin{verbatim} + \usepackage[acronyms]{glossaries} + \newglossary[nlg]{notation}{not}{ntn}{Notation} +\end{verbatim} +After \cs{makeglossaries} (or \cs{makenoidxglossaries}) you can +define the entries in the preamble. For example: +\begin{verbatim} + \newglossaryentry{gls:set} + {% This entry goes in the `main' glossary + name=set, + description={A collection of distinct objects} + } + + % This entry goes in the `acronym' glossary: + \newacronym{svm}{svm}{support vector machine} + + \newglossaryentry{not:set} + {% This entry goes in the `notation' glossary: + type=notation, + name={\ensuremath{\mathcal{S}}}, + description={A set}, + sort={S}} +\end{verbatim} +or if you don't like using \cs{ensuremath}: +\begin{verbatim} + \newglossaryentry{not:set} + {% This entry goes in the `notation' glossary: + type=notation, + name={$\mathcal{S}$}, + text={\mathcal{S}}, + description={A set}, + sort={S}} +\end{verbatim} + +Each glossary is displayed using: +\begin{definition} +\cs{printnoidxglossary}[type=\meta{type}] +\end{definition} +(\opt1) or +\begin{definition} +\cs{printglossary}[type=\meta{type}] +\end{definition} +(\optsand23). Where \meta{type} is the glossary label. If the +type is omitted the default \code{main} glossary is assumed. + +If you're using \app{bib2gls} then each glossary is displayed +using: +\begin{definition} +\cs{printunsrtglossary}[type=\meta{type}] +\end{definition} +With this method you don't use \cs{makeglossaries} or +\cs{makenoidxglossaries}. Instead you can assign the entry type +with the resource command. For example: +\begin{verbatim} + \usepackage[record,abbreviations,symbols]{glossaries-extra} + + \GlsXtrLoadResources[ + src={terms}, % entries defined in terms.bib + type={main}% put in main glossary + ] + \GlsXtrLoadResources[ + src={abbrvs}, % entries defined in abbrvs.bib + type={abbreviations}% put in abbreviations glossary + ] + \GlsXtrLoadResources[ + src={syms}, % entries defined in syms.bib + type={symbols}% put in symbols glossary + ] +\end{verbatim} +Later in the document: +\begin{verbatim} + \printunsrtglossary % main + \printunsrtglossary[type=abbreviations] + \printunsrtglossary[type=symbols] +\end{verbatim} + +There's a~convenient shortcut that will display all the defined +glossaries depending on the indexing method: +\begin{definition} +\cs{printnoidxglossaries} +\end{definition} +(\opt1) or +\begin{definition} +\cs{printglossaries} +\end{definition} +(\optsand23) or (\sty{glossaries-extra} only) +\begin{definition} +\cs{printunsrtglossaries} +\end{definition} + +If you use \opt1, you don't need to do anything else. If you use +\optsor23 with the \app{makeglossaries} Perl script or the +\app{makeglossaries-lite} Lua script, you +similarly don't need to do anything else. If you use \optsor23 +without the \app{makeglossaries} Perl script then you need to +make sure you run \app{makeindex}\slash\app{xindy} \emph{for +each defined glossary}. The \meta{gls} and \meta{glo} arguments of +\cs{newglossary} specify the file extensions to use instead of +\file{.gls} and \file{.glo}. The optional argument \meta{glg} is +the file extension for the transcript file. This should be different +for each glossary in case you need to check for +\app{makeindex}\slash\app{xindy} errors or warnings if things +go wrong. + +For example, suppose you have three glossaries in your document +(\code{main}, \code{acronym} and \code{notation}), +specified using: +\begin{verbatim} +\usepackage[acronyms]{glossaries} +\newglossary[nlg]{notation}{not}{ntn}{Notation} +\end{verbatim} +Then (assuming your \LaTeX\ document is in a~file called +\file{myDoc.tex}): + +\begin{description} +\item\opt2 +Either use one \app{makeglossaries} or +\app{makeglossaries-lite} call: +\begin{verbatim} +makeglossaries myDoc +\end{verbatim} +or +\begin{verbatim} +makeglossaries-lite myDoc +\end{verbatim} +Or you need to run \app{makeindex} three times: +\begin{verbatim} +makeindex -t myDoc.glg -s myDoc.ist -o myDoc.gls myDoc.glo +makeindex -t myDoc.alg -s myDoc.ist -o myDoc.acr myDoc.acn +makeindex -t myDoc.nlg -s myDoc.ist -o myDoc.not myDoc.ntn +\end{verbatim} + +\item\opt3 +Either use one \app{makeglossaries} call: +\begin{verbatim} +makeglossaries myDoc +\end{verbatim} +Or you need to run \app{xindy} three times (be careful not to insert +line breaks where the line has wrapped.) +\begin{verbatim} +xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg +-o myDoc.gls myDoc.glo +xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.alg +-o myDoc.acr myDoc.acn +xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.nlg +-o myDoc.not myDoc.ntn +\end{verbatim} + +\item\opt4 +With \app{bib2gls} only one call is required: +\begin{verbatim} +pdflatex myDoc +bib2gls --group myDoc +pdflatex myDoc +\end{verbatim} +(Omit \verb|--group| if you don't need letter groups.) +\end{description} + + +\section[glossaries and hyperref]{\styfmt{glossaries} and \styfmt{hyperref}} +\label{sec:hyperref} + +Take care if you use the \sty{glossaries} package with +\sty{hyperref}. Contrary to the usual advice that \sty{hyperref} +should be loaded last, \sty{glossaries} (and \sty{glossaries-extra}) +must be loaded \emph{after} \sty{hyperref}: +\begin{verbatim} +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} +\end{verbatim} +If you use \sty{hyperref} make sure you use PDF\LaTeX\ rather than +the \LaTeX\ to DVI engine. The DVI format can't break hyperlinks across +a~line so long glossary entries (such as the full form of acronyms) +won't line wrap with the DVI engine. Also, hyperlinks in sub- or +superscripts aren't correctly sized with the DVI format. + +By default, if the \sty{hyperref} package has been loaded, commands +like \cs{gls} will form a~hyperlink to the relevant entry in the +glossary. If you to disable this for \emph{all} your +glossaries, then use +\begin{definition} +\cs{glsdisablehyper} +\end{definition} +If you want hyperlinks suppressed for entries in specific +glossaries, then use the \pkgopt{nohypertypes} package option. For +example, if you don't want hyperlinks for entries in the \code{acronym} and +\code{notation} glossaries but you do want them for entries in the +\code{main} glossary, then do: +\begin{verbatim} +\usepackage[colorlinks]{hyperref} +\usepackage[acronym,nohypertypes={acronym,notation}]{glossaries} +\newglossary[nlg]{notation}{not}{ntn}{Notation} +\end{verbatim} + +If you want the hyperlinks suppressed the first time an entry is +used, but you want hyperlinks for subsequence references then use +the \pkgopt[false]{hyperfirst} package option: +\begin{verbatim} +\usepackage[colorlinks]{hyperref} +\usepackage[hyperfirst=false]{glossaries} +\end{verbatim} + +Take care not to use non-expandable commands in PDF bookmarks. This +isn't specific to the \sty{glossaries} package but is a~limitation +of PDF bookmarks. Non-expandable commands include commands like +\cs{gls}, \cs{glspl}, \cs{Gls} and \cs{Glspl}. The \sty{hyperref} +package provides a~way of specifying alternative text for the PDF +bookmarks via \cs{texorpdfstring}. For example: +\begin{verbatim} +\section{The \texorpdfstring{\gls{fishage}}{Fish Age}} +\end{verbatim} +However, it's not a~good idea to use commands like \cs{gls} in +a~section heading as you'll end up with the table of contents in +your location list. Instead you can use +\begin{definition} +\cs{glsentrytext}\marg{label} +\end{definition} +This is expandable provided that the \code{text} key doesn't +contain non-expandable code. For example, the following works: +\begin{verbatim} +\section{The \glsentrytext{fishage}} +\end{verbatim} +and it doesn't put the table of contents in the location list. + +If you use \sty{glossaries-extra} then use the commands that are +provided specifically for use in section headers. For example: +\begin{verbatim} +\section{The \glsfmttext{fishage}} +\end{verbatim} + +\section{Cross-References} +\label{sec:xr} + +You can add a~reference to another entry in a~location list using +the \code{see=}\marg{label list} key when you define an entry. +The referenced entry (or entries) must also be defined. + +For example: +\begin{verbatim} +\longnewglossaryentry{devonian}{name={Devonian}}% +{% + The geologic period spanning from the end of the + Silurian Period to the beginning of the Carboniferous Period. + + This age was known for its remarkable variety of + fish species. +} + +\newglossaryentry{fishage} +{ + name={Fish Age}, + description={Common name for the Devonian period}, + see={devonian} +} +\end{verbatim} +The cross-reference will appear as \qt{\emph{see} Devonian}. You can +change the \qt{see} tag using the format +\code{see=}\oarg{tag}\meta{label}. For example: +\begin{verbatim} +\newglossaryentry{latinalph} +{ + name={Latin alphabet}, + description={alphabet consisting of the letters + a, \ldots, z, A, \ldots, Z}, + see=[see also]{exlatinalph} +} +\newglossaryentry{exlatinalph} +{ + name={extended Latin alphabet}, + description={The Latin alphabet extended to include + other letters such as ligatures or diacritics.} +} +\end{verbatim} +If you use the \code{see} key in the optional argument of +\cs{newacronym}, make sure you enclose the value in braces. For +example: +\begin{verbatim} +\newacronym{ksvm}{ksvm}{kernel support vector machine} +\newacronym + [see={[see also]{ksvm}}] + {svm}{svm}{support vector machine} +\end{verbatim} +The \sty{glossaries-extra} package provides a \code{seealso} +key. This doesn't allow a tag but behaves much like +\code{see=\{[\cs{seealsoname}]\marg{label}\}}. For example: +\begin{verbatim} +\newabbreviation{ksvm}{ksvm}{kernel support vector machine} +\newabbreviation + [seealso={ksvm}] + {svm}{svm}{support vector machine} +\end{verbatim} + +Since the cross-reference appears in the location list, if you +suppress the location list using the \pkgopt{nonumberlist} package +option, then the cross-reference will also be suppressed. With +\app{bib2gls}, don't use the \pkgopt{nonumberlist} package +option. Instead use the \code{save-locations=false} in the resource +options. For example: +\begin{verbatim} +\usepackage[record,abbreviations,symbols]{glossaries-extra} + +\GlsXtrLoadResources[ + src={terms}, % entries defined in terms.bib + type={main}% put in main glossary +] +\GlsXtrLoadResources[ + src={abbrvs}, % entries defined in abbrvs.bib + type={abbreviations},% put in abbreviations glossary + save-locations=false% no number list for these entries +] +\GlsXtrLoadResources[ + src={syms}, % entries defined in syms.bib + type={symbols}% put in symbols glossary +] +\end{verbatim} + +\section{Further Information} +\label{sec:moreinfo} + +\begin{itemize} +\item \href{http://mirrors.ctan.org/support/bib2gls/bib2gls-begin.pdf}{\styfmt{glossaries-extra} +and \appfmt{bib2gls}: an introductory guide}. +\item The main \sty{glossaries} \docref{user manual}{glossaries-user}. +\item The \href{http://www.dickimaw-books.com/faqs/glossariesfaq.html}{glossaries FAQ}. +\item \href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating +makeglossaries or makeglossaries-lite or bib2gls into the document +build}. +\item The \href{https://ctan.org/pkg/glossaries-extra}{\styfmt{glossaries-extra}} package. +\item The \href{https://ctan.org/pkg/bib2gls}{\appfmt{bib2gls}} +application. +\end{itemize} +\end{document} diff --git a/macros/latex/contrib/glossaries/glossary2glossaries.html b/macros/latex/contrib/glossaries/glossary2glossaries.html new file mode 100644 index 0000000000..56312bb11a --- /dev/null +++ b/macros/latex/contrib/glossaries/glossary2glossaries.html @@ -0,0 +1,1882 @@ + + + + + + + + + + + + + +

+

+ + + +

+ + + +

+
+

+

Upgrading from the glossary package to the +glossaries package +

+
Nicola L.C. Talbot
+
+

2019-01-06

+
+
+

+

Abstract

+

The purpose of this document is to provide advice if you want to + convert a LATEX document from using the obsolete glossary package to + the replacement glossaries package. +

+
+

Contents

+ +

+

+

Top

1 Why the Need for a New Package?

+

The glossary package started out as an example in a tutorial, but I decided that I +may as well package it up and upload it to CTAN. Unfortunately it was fairly rigid +and unable to adapt well to the wide variation in glossary styles. Users began making +requests for enhancements, but with each enhancement the code became more +complicated and bugs crept in. Each fix in one place seemed to cause another +problem elsewhere. In the end, it was taking up too much of my time to maintain, so +I decided to replace it with a much better designed package. With the new glossaries +package: +

+
    +
  • you can define irregular plurals; +
  • +
  • glossary terms can have an associated symbol in addition to the name and + description; +
  • +
  • new glossary styles are much easier to design; +
  • +
  • you can add dictionaries to supply translations for the fixed names used + in headings and by some of the glossary styles; +
  • +
  • you can choose1 + between using makeindex or xindy to sort the glossary. Using xindy means + that: + + + +
      +
    • there is much better support for terms containing accented or + non-Latin characters; +
    • +
    • there is support for non-standard location numbers;
    +
  • +
  • you don’t need to remember to escape makeindex’s special characters as this is + done internally; +
  • +
  • hierarchical entries and homographs are + supported;2 +
  • +
  • there is better support for cross-referencing glossary entries; +
  • +
  • acronyms are just another glossary term which helps to maintain consistency; +
  • +
  • different acronym styles are supported. +
+

+

+

Top

2 Package Options

+

When converting a document that currently uses the obsolete glossary package to the +replacement glossaries package, it should be fairly obvious that the first thing you +need to do is replace \usepackage{glossary} with \usepackage{glossaries}, +however some of the package options are different, so you may need to change those +as well. Table 1 shows the mappings from the glossary to the glossaries package +options. +

+
+ + + +


+ + + +
Table 1: Mappings from glossary to glossaries package options
+
+

+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
glossary option glossaries option
style=list style=list
style=altlist style=altlist
style=long,header=none,border=none,cols=2 style=long
style=long,header=plain,border=none,cols=2 style=longheader
style=long,header=none,border=plain,cols=2 style=longborder
style=long,header=plain,border=plain,cols=2 style=longheaderborder
style=long,header=none,border=none,cols=3 style=long3col
style=long,header=plain,border=none,cols=3 style=long3colheader
style=long,header=none,border=plain,cols=3 style=long3colborder
style=long,header=plain,border=plain,cols=3 style=long3colheaderborder
style=super,header=none,border=none,cols=2 style=super
style=super,header=plain,border=none,cols=2style=superheader
style=super,header=none,border=plain,cols=2style=superborder
style=super,header=plain,border=plain,cols=2style=superheaderborder
style=super,header=none,border=none,cols=3 style=super3col
style=super,header=plain,border=none,cols=3style=super3colheader
style=super,header=none,border=plain,cols=3style=super3colborder
style=super,header=plain,border=plain,cols=3style=super3colheaderborder
number=none nonumberlist
number=⟨counter namecounter=⟨counter name
toc toc
hypertoc toc
hyper no corresponding option
section=true section
section=false no corresponding option
acronym acronym
global no corresponding option
+
+ + + +

+
+

Top

3 Defining new glossary types

+

If you have created new glossary types, you will need to replace all instances +of +


glossary + \newglossarytype[log-ext]{type}{out-ext}{in-ext}[old style +list]
+
\newcommand{\typename}{title} +

+
+with +


glossaries + \newglossary[log-ext]{type}{out-ext}{in-ext}{title} +

+
+in the preamble, and, if the new glossary requires a different style to the main +(default) glossary, you will also need to put +


glossaries + \setglossarystyle{new style} +

+
+immediately before the glossary is displayed, or you can specify the style when you +display the glossary using \printglossary (see below). +

The ⟨old style list⟩ optional argument can be converted to ⟨new style⟩ using the same +mapping given in Table 1. +

For example, if your document contains the following: + + + +

+
+\newglossarytype[nlg]{notation}{not}{ntn}[style=long,header] + 
\newcommand{\notationname}{Index of Notation} +
+

You will need to replace the above two lines with: + + + +

+
+\newglossary[nlg]{notation}{not}{ntn}{Index of Notation} +
+

in the preamble and + + + +

+
+\setglossarystyle{longheader} +
+

immediately prior to displaying this glossary. Alternatively, you can specify the +style using the style key in the optional argument of \printglossary. For +example: + + + +

+
+\printglossary[type=notation,style=longheader] +
+

+

Note that the glossary title is no longer specified using \glossary-typename (except +for \glossaryname and \acronymname) but is instead specified in the ⟨title⟩ argument +of \newglossary. The short title which is specified in the glossary package by the +command \shortglossary-namename is now specified using the toctitle key in the +optional argument to \printglossary. +

+

+

Top

4 \makeglossary name

+

All instances of \makeglossary name⟩ (e.g. \makeglossary and \makeacronym) +should be replaced by the single command \makeglossaries. For example, if your +document contained the following: + + + +

+
+\makeglossary + 
\makeacronym +
+

then you should replace both lines with the single line: + + + +

+
+\makeglossaries +
+

+

+

+

Top

5 Storing glossary information

+

With the old glossary package you could optionally store glossary information for later +use, or you could simply use \glossary whenever you wanted to add information to +the glossary. With the new glossaries package, the latter option is no longer +available.3 +If you have stored all the glossary information using \storeglosentry, then you will +need to convert these commands into the equivalent \newglossaryentry. If you have +only used \glossary, then see §6.4 \glossary. +

Substitute all instances of +


glossary + \storeglosentry{label}{gls-entry} +

+
+with +


glossaries + \newglossaryentry{label}{gls-entry} +

+
+This should be fairly easy to do using the search and replace facility in your editor +(but see notes below). +

If you have used the optional argument of \storeglosentry (i.e. you have +multiple glossaries) then you will need to substitute +


glossary + \storeglosentry[gls-type]{label}{gls-entry} +

+
+with +


glossaries + \newglossaryentry{label}{gls-entry,type=gls-type} +

+ + + +
+

The glossary entry information ⟨gls-entry⟩ may also need changing. If ⟨gls-entry⟩ +contains any of makeindex’s special characters (i.e. @ ! " or |) then they should no +longer be escaped with " since the glossaries package deals with these characters +internally. For example, if your document contains the following: + + + +

+
+\storeglosentry{card}{name={$"|\mathcal{S}"|$}, + 
description={The cardinality of the set $\mathcal{S}$}} +
+

then you will need to replace it with: + + + +

+
+\newglossaryentry{card}{name={$|\mathcal{S}|$}, + 
description={The cardinality of the set $\mathcal{S}$}} +
+

+

The format and number keys available in \storeglosentry are not available with +\newglossaryentry. +

+

+

Top

6 Adding an entry to the glossary

+

The glossary package provided two basic means to add information to the glossary: +firstly, the term was defined using \storeglosentry and the entries for that term +were added using \useglosentry, \useGlosentry and \gls. Secondly, the term was +added to the glossary using \glossary. This second approach is unavailable with the +glossaries package. +

+

+

Top

6.1 \useglosentry

+

The glossary package allows you to add information to the glossary for a predefined +term without producing any text in the document using +


glossary + \useglosentry[old options]{label} +

+
+Any occurrences of this command will need to be replaced with +


glossaries + \glsadd[new options]{label} +

+
+The format key in ⟨old options⟩ remains the same in ⟨new options⟩. However the +number=counter name⟩ key in ⟨old options⟩ should be replaced with counter=counter +name⟩ in ⟨new options⟩. + + + +

+

+

Top

6.2 \useGlosentry

+

The glossary package allows you to add information to the glossary for a predefined +term with the given text using +


glossary + \useGlosentry[old options]{label}{text} +

+
+Any occurrences of this command will need to be replaced with +


glossaries + \glslink[new options]{label}{text} +

+
+The mapping from ⟨old options⟩ to ⟨new options⟩ is the same as that given §6.1 +\useglosentry. +

+

+

Top

6.3 \gls

+

Both the glossary and the glossaries packages define the command \gls. In this +case, the only thing you need to change is the number key in the optional +argument to counter. Note that the new form of \gls also takes a final optional +argument which can be used to insert text into the automatically generated +text. +

+

+

Top

6.4 \glossary

+

When using the glossaries package, you should not use \glossary +directly.4 +If, with the old package, you have opted to explicitly use \glossary instead of storing +the glossary information with \storeglosentry, then converting from glossary to +glossaries will be more time-consuming, although in the end, I hope you will see the +benefits.5 +If you have used \glossary with the old glossary package, you will instead need to +define the relevant glossary terms using \newglossaryentry and reference the terms +using \glsadd, \glslink, \gls etc. +

If you don’t like the idea of continually scrolling back to the preamble to type all +your \newglossaryentry commands, you may prefer to create a new file, in which to +store all these commands, and then input that file in your document’s preamble. + + + +Most text editors and front-ends allow you to have multiple files open, and you can +tab back and forth between them. +

+

+

Top

7 Acronyms

+

In the glossary package, acronyms were treated differently to glossary entries. This +resulted in inconsistencies and sprawling unmaintainable code. The new glossaries +package treats acronyms in exactly the same way as normal glossary terms. In fact, in +the glossaries package, the default definition of: +


glossaries + \newacronym[options]{label}{abbrv}{long} +

+
+is a shortcut for: +


glossaries + \newglossaryentry{label}{type=\acronymtype, +
name={abbrv}, +
description={long}, +
text={abbrv}, +
first={long(abbrv)}, +
plural={abbrvs}, +
firstplural={longs (abbrvs)}, +
options} +

+
+

This is different to the glossary package which set the name key to ⟨long⟩ +(⟨abbrv⟩) and allowed you to set a description using the description key. If +you still want to do this, you can use one of the description styles, such as +long-short-desc, and use the description key in the optional argument of +\newacronym. +

For example, if your document originally had the following: + + + +

+
+\newacronym{SVM}{Support Vector Machine}{description=Statistical + 
pattern recognition technique} +
+

Then you would need to first set the style: + + + +

+
+\setacronymstyle{long-short-desc} +
+

and change the acronym definition to: + + + +

+
+\newacronym[description=Statistical pattern recognition + 
technique]{svm}{SVM}{Support Vector Machine} +
+

You can then reference the acronym using any of the new referencing commands, +such as \gls or \glsadd. +

With the old glossary package, when you defined an acronym, it also defined a +command \acr-name⟩ which could be used to display the acronym in the text. +So the above SVM example would create the command \SVM with the old +package. In the new glossaries package, the acronyms are just another type of +glossary entry, so they are displayed using \gls{label}. Therefore, in the +above example, you will also need to replace all occurrences of \SVM with +\gls{svm}. +

If you have used \useacronym instead of \acr-name⟩, then you will need to +replace all occurrences of +


glossary + \useacronym[insert]{acr-name} +

+
+with +


glossaries + \gls{label}[insert] +

+
+Note that the starred versions of \useacronym and \acr-name⟩ (which make the first +letter uppercase) should be replaced with \Gls{label}. +

Alternatively (as from v1.18 of the glossaries package), you can use \oldacronym +which uses the same syntax as the old glossary package’s \newacronym and +also defines \acr-name⟩. For example, if your document originally had the +following: +


glossary + + + +
+

\newacronym{SVM}{Support Vector Machine}{description=Statistical +

pattern recognition technique} + +

+

+


+

+then you can change this to: +


glossaries + + + +
+

\oldacronym{SVM}{Support Vector Machine}{description=Statistical +

pattern recognition technique} + +

+

+


+

+You can then continue to use \SVM. However, remember that LATEX generally +ignores spaces after command names that consist of alphabetical characters. You will +therefore need to force a space after \acr-name⟩, unless you also load the xspace +package. (See Acronyms of the glossaries documentation for further details.) Note +that \oldacronym uses its first argument to define the acronym’s label (as used by +commands like \gls), so in the above example, with the new glossaries package, +\SVM becomes a shortcut for \gls{SVM} and \SVM* becomes a shortcut for +\Gls{SVM}. +

+

+

Top

7.1 \acrln and \acrsh

+

In the glossary package, it is possible to produce the long and short forms of an +acronym without adding an entry to the glossary using \acrln and \acrsh. With the +glossaries package (provided you defined the acronym using \newacronym or +\oldacronym and provided you haven’t redefined \newacronym) you can +replace +


glossary + \acrsh{acr-name} +

+
+with +


glossaries + \acrshort{label} +

+
+and you can replace +


glossary + \acrln{acr-name} +

+ + + +
+with +


glossaries + \acrlong{label} +

+
+The glossaries package also provides the related commands \acrshortpl (plural short +form) and \acrlongpl (plural long form) as well as upper case variations. If you use +the glossaries “shortcuts” package option, you can use \acs in place of \acrshort +and \acl in place of \acrlong. +

See Acronyms of the glossaries manual for further details of how to use these +commands. +

+

+

Top

7.2 \ifacronymfirstuse

+

The glossary package command +


glossary + \ifacronymfirstuse{acr-name}{text1}{text2} +

+
+can be replaced by the glossaries command: +


glossaries + \ifglsused{label}{text2}{text1} +

+
+Note that \ifglsused evaluates the opposite condition to that of \ifacronymfirstuse +which is why the last two arguments have been reversed. +

+

+

Top

7.3 \resetacronym and \unsetacronym

+

The glossary package allows you to reset and unset the acronym flag which is used to +determine whether the acronym has been used in the document. The glossaries +package also provides a means to do this on either a local or a global level. To reset +an acronym, you will need to replace: +


glossary + \resetacronym{acr-name} +

+ + + +
+with either +


glossaries + \glsreset{label} +

+
+or +


glossaries + \glslocalreset{label} +

+
+

To unset an acronym, you will need to replace: +


glossary + \unsetacronym{acr-name} +

+
+with either +


glossaries + \glsunset{label} +

+
+or +


glossaries + \glslocalunset{label} +

+
+

To reset all acronyms, you will need to replace: +


glossary + \resetallacronyms +

+
+with +


glossaries + \glsresetall[\acronymtype] +

+
+ + + +or +


glossaries + \glslocalresetall[\acronymtype] +

+
+To unset all acronyms, you will need to replace: +


glossary + \unsetallacronyms +

+
+with +


glossaries + \glsunsetall[\acronymtype] +

+
+or +


glossaries + \glslocalunsetall[\acronymtype] +

+
+

+

+

Top

8 Displaying the glossary

+

The glossary package provides the command \printglossary (or \printtype⟩ for +other glossary types) which can be used to print individual glossaries. The glossaries +package provides the command \printglossaries which will print all the glossaries +which have been defined, or \printglossary[options] to print individual glossaries. +So if you just have \printglossary, then you can leave it as it is, but if you have, +say: + + + +

+
+\printglossary + 
\printglossary[acronym] +
+

or + + + +

+
+\printglossary + 
\printacronym +
+

then you will need to replace this with either + + + +

+
+\printglossaries +
+

or + + + +

+
+\printglossary + 
\printglossary[type=\acronymtype] +
+

+

The glossary package allows you to specify a short title (for the table of contents +and page header) by defining a command of the form \shortglossary-typename. The +glossaries package doesn’t do this, but instead provides the toctitle key which can be +used in the optional argument to \printglossary. For example, if you have created +a new glossary type called notation, and you had defined + + + +

+
+\newcommand{\shortnotationname}{Notation} +
+

then you would need to use the toctitle key: + + + +

+
+\printglossary[type=notation,toctitle=Notation] +
+

The glossaries package will ignore \shortnotationname, so unless you have used it +elsewhere in the document, you may as well remove the definition. +

+

+

Top

9 Processing Your Document

+

If you convert your document from using the glossary package to the glossaries +package, you will need to delete any of the additional files, such as the .glo file, that +were created by the glossary package, as the glossaries package uses a different format. +Remember also, that if you used the makeglos Perl script, you will need to use the +makeglossaries Perl script instead. As from v1.17, the glossaries package can +be used with either makeindex or xindy. Since xindy was designed to be +multilingual, the new glossaries package is a much better option for non-English +documents. If you use the extension package, glossaries-extra, then you also +have the option of using bib2gls instead (which also provides multilingual +support). +

For further information on using makeglossaries, makeindex or xindy to create +your glossaries, see Generating the Associated Glossary Files of the glossaries +documentation. +

+

+

Top

10 Troubleshooting

+

Please check the FAQ for the glossaries package if you have any problems. +

+

+

Index

+

B +

+
bib2gls  1
+

F + + + +file types
+    .glo  2
+

G +glossaries-extra package  3
+\gls options
+    counter  4
+    number  5
+\glsadd options
+    counter  6
+

M +makeglos  7
+makeglossaries  8, 9
+makeindex  10, 11, 12, 13, 14, 15, 16, 17, 18
+

N +\newglossaryentry options
+    description  19, 20
+    name  21
+

P +\printglossary options
+    style  22
+    toctitle  23, 24, 25
+

S +\storeglosentry options
+    format  26
+    number  27
+

U +\useglosentry options
+    format  28
+    number  29
+

X +xindy  30, 31, 32, 33, 34, 35, 36
+ + + +

+

1as from v1.17. Previous versions were designed to be used with makeindex only

+

2as from v1.17

3mainly because having a key value list in \glossary caused problems, but it also helps +consistency.

+

4This is because \glossary requires the argument to be in a specific format and doesn’t use +the key=valueformat that the old glossary package used. The new package’s internal commands set +this format, as well as escaping any of makeindex’s or xindy’s special characters. What’s more, the +format has changed as from v1.17 to allow the new package to be used with either makeindex or +xindy.

+

5From the user’s point of view, using \glossary throughout the document is time consuming, +and if you use it more than once for the same term, there’s a chance extra spaces may creep in which +will cause makeindex to treat the two entries as different terms, even though they look the same in +the document.

+ + + + + + diff --git a/macros/latex/contrib/glossaries/glossary2glossaries.pdf b/macros/latex/contrib/glossaries/glossary2glossaries.pdf new file mode 100644 index 0000000000..3300082598 Binary files /dev/null and b/macros/latex/contrib/glossaries/glossary2glossaries.pdf differ diff --git a/macros/latex/contrib/glossaries/glossary2glossaries.tex b/macros/latex/contrib/glossaries/glossary2glossaries.tex new file mode 100644 index 0000000000..f555c71db5 --- /dev/null +++ b/macros/latex/contrib/glossaries/glossary2glossaries.tex @@ -0,0 +1,667 @@ +\documentclass{nlctdoc} + +\usepackage[utf8]{inputenc} +\ifpdf +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{fourier} +\usepackage{mathpazo} +\usepackage[scaled=.88]{helvet} +\usepackage{courier} +\fi +\usepackage{cmap} + +\usepackage[colorlinks, + bookmarks, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, + pdftitle={Upgrading from the glossary package to + the glossaries package}]{hyperref} +\usepackage{xr-hyper} + +\newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}} +\newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}} +\newcommand*{\acrstyle}[1]{\texttt{#1}} + +\ifpdf +\newcommand{\glsentrytext}[1]{\texttt{#1}} +\externaldocument{glossaries-user} +\fi + +\IndexPrologue{\section*{Index}} +\setcounter{IndexColumns}{2} + +\title{Upgrading from the glossary package to the glossaries +package} +\author{Nicola L.C. Talbot} +\date{2019-01-06} + +\newenvironment{oldway}{% + \begin{labelledbox}{\styfmt{glossary}}\ttfamily\obeylines +}{% + \end{labelledbox}% +} + +\newenvironment{newway}{% + \begin{labelledbox}{\styfmt{glossaries}}\ttfamily\obeylines +}{% + \end{labelledbox}% +} + +\begin{document} +\maketitle + +\begin{abstract} +The purpose of this document is to provide advice if you want to +convert a \LaTeX\ document from using the obsolete \styfmt{glossary} +package to the replacement \styfmt{glossaries} package. +\end{abstract} + +\tableofcontents + +\section{Why the Need for a New Package?} +\label{whyglossaries} + +The \styfmt{glossary} package started out as an example in a tutorial, +but I decided that I may as well package it up and upload it to CTAN. +Unfortunately it was fairly rigid and unable to adapt well to the +wide variation in glossary styles. Users began making requests for +enhancements, but with each enhancement the code became more +complicated and bugs crept in. Each fix in one place seemed to cause +another problem elsewhere. In the end, it was taking up too much +of my time to maintain, so I decided to replace it with a much +better designed package. With the new \styfmt{glossaries} package: + +\begin{itemize} +\item you can define irregular plurals; + +\item glossary terms can have an associated symbol in addition +to the name and description; + +\item new glossary styles are much easier to design; + +\item you can add dictionaries to supply translations for the +fixed names used in headings and by some of the glossary styles; + +\item you can choose\footnote{as from v1.17. Previous versions +were designed to be used with \app{makeindex} only} between using +\app{makeindex} or \app{xindy} to sort the glossary. Using +\app{xindy} means that: + + \begin{itemize} + \item there is much better support for terms containing accented + or non-Latin characters; + + \item there is support for non-standard location numbers; + \end{itemize} + +\item you don't need to remember to escape \app{makeindex}'s +special characters as this is done internally; + +\item hierarchical entries and homographs are supported;\footnote{as +from v1.17} + +\item there is better support for cross-referencing glossary entries; + +\item acronyms are just another glossary term which helps to +maintain consistency; + +\item different acronym styles are supported. + +\end{itemize} + +\section{Package Options} + +When converting a document that currently uses the obsolete +\styfmt{glossary} package to the replacement \styfmt{glossaries} package, +it should be fairly obvious that the first thing you need to do is +replace \verb|\usepackage{glossary}| with +\verb|\usepackage{glossaries}|, however some of the package options +are different, so you may need to change those as well. +Table~\ref{tab:pkgopt} shows the mappings from the \styfmt{glossary} +to the \styfmt{glossaries} package options. + +\begin{table}[htbp] +\caption[Mappings]{Mappings from \styfmt{glossary} to \styfmt{glossaries} +package options} +\label{tab:pkgopt} +\begin{center} +\begin{tabular}{ll} +\bfseries \styfmt{glossary} option & \bfseries \styfmt{glossaries} option\\ +style=list & style=list\\ +style=altlist & style=altlist\\ +style=long,header=none,border=none,cols=2 & style=long\\ +style=long,header=plain,border=none,cols=2 & style=longheader\\ +style=long,header=none,border=plain,cols=2 & style=longborder\\ +style=long,header=plain,border=plain,cols=2 & style=longheaderborder\\ +style=long,header=none,border=none,cols=3 & style=long3col\\ +style=long,header=plain,border=none,cols=3 & style=long3colheader\\ +style=long,header=none,border=plain,cols=3 & style=long3colborder\\ +style=long,header=plain,border=plain,cols=3 & style=long3colheaderborder\\ +style=super,header=none,border=none,cols=2 & style=super\\ +style=super,header=plain,border=none,cols=2 & style=superheader\\ +style=super,header=none,border=plain,cols=2 & style=superborder\\ +style=super,header=plain,border=plain,cols=2 & style=superheaderborder\\ +style=super,header=none,border=none,cols=3 & style=super3col\\ +style=super,header=plain,border=none,cols=3 & style=super3colheader\\ +style=super,header=none,border=plain,cols=3 & style=super3colborder\\ +style=super,header=plain,border=plain,cols=3 & style=super3colheaderborder\\ +number=none & nonumberlist\\ +number=\meta{counter name} & counter=\meta{counter name}\\ +toc & toc\\ +hypertoc & toc\\ +hyper & \emph{no corresponding option}\\ +section=true & section\\ +section=false & \emph{no corresponding option}\\ +acronym & acronym\\ +global & \emph{no corresponding option} +\end{tabular} +\end{center} +\end{table} + +\section{Defining new glossary types} + +If you have created new glossary types, you will need to +replace all instances of +\begin{oldway} +\ics{newglossarytype}\oarg{log-ext}\marg{type}\marg{out-ext}\marg{in-ext}\oarg{old style list}\newline +\cs{newcommand}\verb|{\|\meta{type}name\verb|}|\marg{title} +\end{oldway}% +with +\begin{newway} +\ics{newglossary}\oarg{log-ext}\marg{type}\marg{out-ext}\marg{in-ext}\marg{title} +\end{newway}% +in the preamble, and, if the new glossary requires a different style +to the main (default) glossary, you will also need to put +\begin{newway} +\ics{setglossarystyle}\marg{new style} +\end{newway}% +immediately before the glossary is displayed, or you can specify +the style when you display the glossary using \ics{printglossary} +(see below). + +The \meta{old style list} optional argument can be converted to +\meta{new style} using the same mapping given in +Table~\ref{tab:pkgopt}. + +For example, if your document contains the following: +\begin{verbatim} +\newglossarytype[nlg]{notation}{not}{ntn}[style=long,header] +\newcommand{\notationname}{Index of Notation} +\end{verbatim} +You will need to replace the above two lines with: +\begin{verbatim} +\newglossary[nlg]{notation}{not}{ntn}{Index of Notation} +\end{verbatim} +in the preamble and +\begin{verbatim} +\setglossarystyle{longheader} +\end{verbatim} +immediately prior to displaying this glossary. Alternatively, you +can specify the style using the \csopt{printglossary}{style} key in +the optional argument of \ics{printglossary}. For example: +\begin{verbatim} +\printglossary[type=notation,style=longheader] +\end{verbatim} + +Note that the glossary title is no longer specified using +\cs{}\meta{glossary-type}\texttt{name} (except for \ics{glossaryname} +and \ics{acronymname}) but is instead specified in the \meta{title} +argument of \ics{newglossary}. The short title which is specified in +the \styfmt{glossary} package by the command +\cs{short}\meta{glossary-name}\texttt{name} is now specified using +the \csopt{printglossary}{toctitle} key in the optional argument to +\ics{printglossary}. + +\section{\texorpdfstring{\cs{make}\meta{glossary +name}}{\textbackslash make...}} + +All instances of \cs{make}\meta{glossary name} (e.g.\ +\ics{makeglossary} and \ics{makeacronym}) should be replaced +by the single command \ics{makeglossaries}. For example, if +your document contained the following: +\begin{verbatim} +\makeglossary +\makeacronym +\end{verbatim} +then you should replace both lines with the single line: +\begin{verbatim} +\makeglossaries +\end{verbatim} + +\section{Storing glossary information} + +With the old \styfmt{glossary} package you could optionally store +glossary information for later use, or you could simply use +\ics{glossary} whenever you wanted to add information to the glossary. +With the new \styfmt{glossaries} package, the latter option is no longer +available.\footnote{mainly because having a key value list in +\ics{glossary} caused problems, but it also helps consistency.} If +you have stored all the glossary information using +\ics{storeglosentry}, then you will need to convert these commands +into the equivalent \ics{newglossaryentry}. If you have only +used \ics{glossary}, then see \sectionref{sec:csglossary}. + +Substitute all instances of +\begin{oldway} +\ics{storeglosentry}\marg{label}\marg{gls-entry} +\end{oldway}% +with +\begin{newway} +\ics{newglossaryentry}\marg{label}\marg{gls-entry} +\end{newway}% +This should be fairly easy to do using the search and replace +facility in your editor (but see notes below). + +If you have used the optional argument of \ics{storeglosentry} +(i.e.\ you have multiple glossaries) then you will need to +substitute +\begin{oldway} +\ics{storeglosentry}\oarg{gls-type}\marg{label}\marg{gls-entry} +\end{oldway}% +with +\begin{newway} +\ics{newglossaryentry}\marg{label}\verb|{|\meta{gls-entry},type=\meta{gls-type}\verb|}| +\end{newway} + +The glossary entry information \meta{gls-entry} may also need +changing. If \meta{gls-entry} contains any of \app{makeindex}'s +special characters (i.e.\ \texttt{@} \texttt{!} \verb|"| or +\verb"|") then they should no longer be escaped with \verb'"' +since the \styfmt{glossaries} package deals with these characters +internally. For example, if your document contains the following: +\begin{verbatim} +\storeglosentry{card}{name={$"|\mathcal{S}"|$}, +description={The cardinality of the set $\mathcal{S}$}} +\end{verbatim} +then you will need to replace it with: +\begin{verbatim} +\newglossaryentry{card}{name={$|\mathcal{S}|$}, +description={The cardinality of the set $\mathcal{S}$}} +\end{verbatim} + +The \csopt{storeglosentry}{format} and +\csopt{storeglosentry}{number} keys available in \ics{storeglosentry} +are not available with \ics{newglossaryentry}. + +\section{Adding an entry to the glossary} + +The \styfmt{glossary} package provided two basic means to add +information to the glossary: firstly, the term was defined +using \ics{storeglosentry} and the entries for that term were +added using \ics{useglosentry}, \ics{useGlosentry} and \ics{gls}. +Secondly, the term was added to the glossary using \ics{glossary}. +This second approach is unavailable with the \styfmt{glossaries} +package. + +\subsection{\texorpdfstring{\cs{useglosentry}}{\textbackslash +useglosentry}} +\label{sec:useglosentry} + +The \styfmt{glossary} package allows you to add information to the +glossary for a predefined term without producing any text in the +document using +\begin{oldway} +\ics{useglosentry}\oarg{old options}\marg{label} +\end{oldway}% +Any occurrences of this command will need to be replaced with +\begin{newway} +\ics{glsadd}\oarg{new options}\marg{label} +\end{newway}% +The \csopt{useglosentry}{format} key in \meta{old options} remains +the same in \meta{new options}. However the +\csopt{useglosentry}{number}\texttt{=}\meta{counter name} key in +\meta{old options} should be replaced with +\csopt{glsadd}{counter}\texttt{=}\meta{counter name} in \meta{new +options}. + +\subsection{\texorpdfstring{\cs{useGlosentry}}{\textbackslash +useGlosentry}} + +The \styfmt{glossary} package allows you to add information to the +glossary for a predefined term with the given text using +\begin{oldway} +\ics{useGlosentry}\oarg{old options}\marg{label}\marg{text} +\end{oldway}% +Any occurrences of this command will need to be replaced with +\begin{newway} +\ics{glslink}\oarg{new options}\marg{label}\marg{text} +\end{newway}% +The mapping from \meta{old options} to \meta{new options} is +the same as that given \sectionref{sec:useglosentry}. + +\subsection{\texorpdfstring{\cs{gls}}{\textbackslash gls}} + +Both the \styfmt{glossary} and the \styfmt{glossaries} packages define +the command \ics{gls}. In this case, the only thing you need to +change is the \csopt{gls}{number} key in the optional argument +to \csopt{gls}{counter}. Note that the new form of \ics{gls} also takes +a final optional argument which can be used to insert text into the +automatically generated text. + +\subsection{\texorpdfstring{\cs{glossary}}{\textbackslash glossary}} +\label{sec:csglossary} + +When using the \styfmt{glossaries} package, you should not use +\ics{glossary} directly.\footnote{This is because \ics{glossary} +requires the argument to be in a specific format and doesn't use the +\meta{key}=\meta{value} format that the old glossary package used. +The new package's internal commands set this format, as well as +escaping any of \app{makeindex}'s or \app{xindy}'s special +characters. What's more, the format has changed as from v1.17 to +allow the new package to be used with either \app{makeindex} or +\app{xindy}.} If, with the old package, you have opted to +explicitly use \ics{glossary} instead of storing the glossary +information with \ics{storeglosentry}, then converting from +\styfmt{glossary} to \styfmt{glossaries} will be more time-consuming, +although in the end, I hope you will see the benefits.\footnote{From +the user's point of view, using \ics{glossary} throughout the +document is time consuming, and if you use it more than once for the +same term, there's a chance extra spaces may creep in which will +cause \app{makeindex} to treat the two entries as different +terms, even though they look the same in the document.} If you have +used \ics{glossary} with the old glossary package, you will instead +need to define the relevant glossary terms using +\ics{newglossaryentry} and reference the terms using +\ics{glsadd}, \ics{glslink}, \ics{gls} etc. + +If you don't like the idea of continually scrolling back to the +preamble to type all your \ics{newglossaryentry} commands, you may +prefer to create a new file, in which to store all these commands, +and then input that file in your document's preamble. Most text +editors and front-ends allow you to have multiple files open, and +you can tab back and forth between them. + +\section{Acronyms} + +In the \styfmt{glossary} package, acronyms were treated differently +to glossary entries. This resulted in inconsistencies and sprawling +unmaintainable code. The new \styfmt{glossaries} package treats +acronyms in exactly the same way as normal glossary terms. In fact, +in the \styfmt{glossaries} package, the default definition of: +\begin{newway} +\ics{newacronym}\oarg{options}\marg{label}\marg{abbrv}\marg{long} +\end{newway} +is a shortcut for: +\begin{newway} +\ics{newglossaryentry}\marg{label}\{type=\cs{acronymtype}, +name=\marg{abbrv}, +description=\marg{long}, +text=\marg{abbrv}, +first=\{\meta{long} (\meta{abbrv})\}, +plural=\{\meta{abbrv}s\}, +firstplural=\{\meta{long}s (\meta{abbrv}s)\}, +\meta{options}\} +\end{newway} + +This is different to the \styfmt{glossary} package which set the +\csopt{newglossaryentry}{name} key to \meta{long} (\meta{abbrv}) and +allowed you to set a description using the +\csopt{newglossaryentry}{description} key. If you still want to do +this, you can use one of the description styles, such as +\acrstyle{long-short-desc}, and use +the \csopt{newglossaryentry}{description} key in the optional +argument of \ics{newacronym}. + +For example, if your document originally had the following: +\begin{verbatim} +\newacronym{SVM}{Support Vector Machine}{description=Statistical +pattern recognition technique} +\end{verbatim} +Then you would need to first set the style: +\begin{verbatim} +\setacronymstyle{long-short-desc} +\end{verbatim} +and change the acronym definition to: +\begin{verbatim} +\newacronym[description=Statistical pattern recognition +technique]{svm}{SVM}{Support Vector Machine} +\end{verbatim} +You can then reference the acronym using any of the new referencing +commands, such as \ics{gls} or \ics{glsadd}. + +With the old \styfmt{glossary} package, when you defined an +acronym, it also defined a command \cs{}\meta{acr-name} which +could be used to display the acronym in the text. So the +above SVM example would create the command \cs{SVM} with the old +package. In the new \styfmt{glossaries} package, the acronyms are just +another type of glossary entry, so they are displayed using +\ics{gls}\marg{label}. Therefore, in the above example, you will +also need to replace all occurrences of \cs{SVM} with +\verb|\gls{svm}|. + +If you have used \ics{useacronym} instead of \cs{}\meta{acr-name}, +then you will need to replace all occurrences of +\begin{oldway} +\ics{useacronym}\oarg{insert}\marg{acr-name} +\end{oldway}% +with +\begin{newway} +\ics{gls}\marg{label}\oarg{insert} +\end{newway}% +Note that the starred versions of \ics{useacronym} and +\cs{}\meta{acr-name} (which make the first letter uppercase) should +be replaced with \ics{Gls}\marg{label}. + +Alternatively (as from v1.18 of the \styfmt{glossaries} package), +you can use \ics{oldacronym} which uses the same syntax as +the old \styfmt{glossary} package's \ics{newacronym} and also +defines \cs{}\meta{acr-name}. +For example, if your document originally had the following: +\begin{oldway} +\begin{verbatim} +\newacronym{SVM}{Support Vector Machine}{description=Statistical +pattern recognition technique} +\end{verbatim} +\end{oldway} +then you can change this to: +\begin{newway} +\begin{verbatim} +\oldacronym{SVM}{Support Vector Machine}{description=Statistical +pattern recognition technique} +\end{verbatim} +\end{newway} +You can then continue to use \cs{SVM}\@. However, remember that +\LaTeX\ generally ignores spaces after command names that consist of +alphabetical characters. You will therefore need to force a space +after \cs{}\meta{acr-name}, unless you also load the \styfmt{xspace} +package. (See +\xrsectionref{sec:acronyms}{glossaries-user}{Acronyms} +of the \styfmt{glossaries} documentation for further +details.) Note that \ics{oldacronym} uses its first argument to +define the acronym's label (as used by commands like \ics{gls}), so +in the above example, with the new \styfmt{glossaries} package, +\cs{SVM} becomes a shortcut for \verb|\gls{SVM}| and \cs{SVM*} +becomes a shortcut for \verb|\Gls{SVM}|. + +\subsection{\texorpdfstring{\cs{acrln} and +\cs{acrsh}}{\textbackslash acrln and \textbackslash acrsh}} + +In the \styfmt{glossary} package, it is possible to produce the +long and short forms of an acronym without adding an entry to +the glossary using \ics{acrln} and \ics{acrsh}. With the +\styfmt{glossaries} package (provided you defined the acronym using +\ics{newacronym} or \ics{oldacronym} and provided you haven't +redefined \ics{newacronym}) +you can replace +\begin{oldway} +\ics{acrsh}\marg{acr-name} +\end{oldway}% +with +\begin{newway} +\ics{acrshort}\marg{label} +\end{newway}% +and you can replace +\begin{oldway} +\ics{acrln}\marg{acr-name} +\end{oldway}% +with +\begin{newway} +\ics{acrlong}\marg{label} +\end{newway}% +The \styfmt{glossaries} package also provides the related commands +\ics{acrshortpl} (plural short form) and \ics{acrlongpl} (plural long +form) as well as upper case variations. If you use the +\styfmt{glossaries} \qt{shortcuts} package option, you can use +\ics{acs} in place of \ics{acrshort} and \ics{acl} in place of +\ics{acrlong}. + +See +\xrsectionref{sec:acronyms}{glossaries-user}{Acronyms} +of the \styfmt{glossaries} manual for further details of +how to use these commands. + +\subsection{\texorpdfstring{\cs{ifacronymfirstuse}}{\textbackslash +ifacronymfirstuse}} + +The \styfmt{glossary} package command +\begin{oldway} +\ics{ifacronymfirstuse}\marg{acr-name}\marg{text1}\marg{text2} +\end{oldway}% +can be replaced by the \styfmt{glossaries} command: +\begin{newway} +\ics{ifglsused}\marg{label}\marg{text2}\marg{text1} +\end{newway}% +Note that \ics{ifglsused} evaluates the opposite condition to +that of \ics{ifacronymfirstuse} which is why the last two arguments +have been reversed. + +\subsection{\texorpdfstring{\cs{resetacronym} and +\cs{unsetacronym}}{\textbackslash resetacronym and \textbackslash +unsetacronym}} + +The \styfmt{glossary} package allows you to reset and unset the +acronym flag which is used to determine whether the acronym has +been used in the document. The \styfmt{glossaries} package also +provides a means to do this on either a local or a global level. +To reset an acronym, you will need to replace: +\begin{oldway} +\ics{resetacronym}\marg{acr-name} +\end{oldway}% +with either +\begin{newway} +\ics{glsreset}\marg{label} +\end{newway}% +or +\begin{newway} +\ics{glslocalreset}\marg{label} +\end{newway} + +To unset an acronym, you will need to replace: +\begin{oldway} +\ics{unsetacronym}\marg{acr-name} +\end{oldway}% +with either +\begin{newway} +\ics{glsunset}\marg{label} +\end{newway}% +or +\begin{newway} +\ics{glslocalunset}\marg{label} +\end{newway} + +To reset all acronyms, you will need to replace: +\begin{oldway} +\ics{resetallacronyms} +\end{oldway} +with +\begin{newway} +\ics{glsresetall}[\ics{acronymtype}] +\end{newway} +or +\begin{newway} +\ics{glslocalresetall}[\ics{acronymtype}] +\end{newway} +To unset all acronyms, you will need to replace: +\begin{oldway} +\ics{unsetallacronyms} +\end{oldway} +with +\begin{newway} +\ics{glsunsetall}[\ics{acronymtype}] +\end{newway} +or +\begin{newway} +\ics{glslocalunsetall}[\ics{acronymtype}] +\end{newway} + +\section{Displaying the glossary} + +The \styfmt{glossary} package provides the command \ics{printglossary} +(or \cs{print}\meta{type} for other glossary types) which +can be used to print individual glossaries. The \styfmt{glossaries} +package provides the command \ics{printglossaries} which +will print all the glossaries which have been defined, or +\ics{printglossary}\oarg{options} to print individual glossaries. +So if you just have \ics{printglossary}, then you can leave it as +it is, but if you have, say: +\begin{verbatim} +\printglossary +\printglossary[acronym] +\end{verbatim} +or +\begin{verbatim} +\printglossary +\printacronym +\end{verbatim} +then you will need to replace this with either +\begin{verbatim} +\printglossaries +\end{verbatim} +or +\begin{verbatim} +\printglossary +\printglossary[type=\acronymtype] +\end{verbatim} + +The \styfmt{glossary} package allows you to specify a short title +(for the table of contents and page header) by defining a command of +the form \cs{short}\meta{glossary-type}\texttt{name}. The +\styfmt{glossaries} package doesn't do this, but instead provides +the \csopt{printglossary}{toctitle} key which can be used in the +optional argument to \ics{printglossary}. For example, if you have +created a new glossary type called \texttt{notation}, and you had +defined +\begin{verbatim} +\newcommand{\shortnotationname}{Notation} +\end{verbatim} +then you would need to use the \csopt{printglossary}{toctitle} key: +\begin{verbatim} +\printglossary[type=notation,toctitle=Notation] +\end{verbatim} +The \styfmt{glossaries} package will ignore \ics{shortnotationname}, +so unless you have used it elsewhere in the document, you may as +well remove the definition. + +\section{Processing Your Document} + +If you convert your document from using the \styfmt{glossary} package +to the \styfmt{glossaries} package, you will need to delete any of +the additional files, such as the \filetype{.glo} file, that were +created by the \styfmt{glossary} package, as the \styfmt{glossaries} +package uses a different format. +Remember also, that if you used the \app{makeglos} Perl script, +you will need to use the \app{makeglossaries} Perl script +instead. As from v1.17, the \styfmt{glossaries} package can be +used with either \app{makeindex} or \app{xindy}. Since +\app{xindy} was designed to be multilingual, the +new \styfmt{glossaries} package is a much better option for +non-English documents. If you use the extension package, +\sty{glossaries-extra}, then you also have the option of using +\app{bib2gls} instead (which also provides multilingual support). + +For further information on using \app{makeglossaries}, +\app{makeindex} or \app{xindy} to create your glossaries, see +\xrsectionref{sec:makeglossaries}{glossaries-user}{Generating the +Associated Glossary Files} +of the \styfmt{glossaries} documentation. + +\section{Troubleshooting} + +Please check the \urlfootref{http://www.dickimaw-books.com/faqs/glossariesfaq.html}{FAQ} +for the \styfmt{glossaries} package if you have any +problems. + +\PrintIndex + +\end{document} diff --git a/macros/latex/contrib/glossaries/makeglossaries b/macros/latex/contrib/glossaries/makeglossaries new file mode 100755 index 0000000000..643e36b3c1 --- /dev/null +++ b/macros/latex/contrib/glossaries/makeglossaries @@ -0,0 +1,1676 @@ +#!/usr/bin/env perl + +# File : makeglossaries +# Author : Nicola Talbot +# Version : 4.41 +# Description: simple Perl script that calls makeindex or xindy. +# Intended for use with "glossaries.sty" (saves having to remember +# all the various switches) + +# This file is distributed as part of the glossaries LaTeX package. +# Copyright 2007 Nicola L.C. 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 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.dtx and glossaries.ins +# and the derived files glossaries.sty, glossaries-prefix.sty, +# glossary-hypernav.sty, glossary-inline.sty, glossary-list.sty, +# glossary-long.sty, glossary-longbooktabs.sty, glossary-longragged.sty, +# glossary-mcols.sty, glossary-super.sty, glossary-superragged.sty, +# glossary-tree.sty, glossaries-compatible-207.sty, +# glossaries-compatible-307.sty, glossaries-accsupp.sty, +# glossaries-babel.sty, glossaries-polyglossia.sty, glossaries.perl. +# Also makeglossaries and makeglossaries-lite.lua. + +my $version="4.41 (2018-07-23)"; + +# History: +# v4.41: +# * No change. +# v4.40: +# * No change. +# v4.39: +# * No change. +# v4.38: +# * No change. +# v4.37: +# * No change. +# v4.36: +# * No change. +# v4.35: +# * No change. +# v4.34: +# * Added check for \glsxtr@resource +# v4.33: +# * Version number synchronized with glossaries.sty +# v2.21: +# * Fixed spelling of \GlsAddXdyLocation +# * Adjusted range encap clash +# v2.20 (2016/12/16) +# * Added check for \glsxtr@makeglossaries +# v2.19 (2016/05/27) +# * Improved check in &parse_for_xindy_nosort +# v2.18 (2016/01/24) +# * Added &parse_for_xindy_nosort to help diagnose xindy's empty +# index key warning/error. +# * Added check for makeindex's multiple encap warning. +# v2.17 (2015/11/30) +# * Escaped { in regular expressions. +# http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=101 +# v2.16 (2015/06/28) +# * Added check for "german" and codepage that doesn't contain +# "din5007", "duden" or "braille". If missing, "din5007-" is +# prefixed to the codepage. +# v2.15 (2014/07/30) +# * Removed hard-coded three character extension assumption +# www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=55 +# * Added message to indicate the number of ignored glossaries +# when the extension is specified. +# v2.14 (2014/03/06) +# * Added -Q and -k options +# v2.13 (2014/01/21) +# * Added check for leading and trailing quotes in filename +# v2.12 (2014/01/20) +# * Added check for '*' in istfilename +# * Fixed bug report +# http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=33 +# * Added error text hashes +# v2.11 (2014/01/17): +# * Added check for backslashes in -x, -m and -d paths +# * Added double-quotes around $appname in &run_app +# v2.10 (2013/12/01): +# * initialise $language to suppress warnings +# v2.09 (2013-11-12): +# * added check for -q switch when issuing warnings. +# v2.08 (2013-10-14): +# * added -x and -m options +# v2.07 (2013-06-17): +# * added check for success on chdir if -d used +# * added dialect map +# v2.06 (2013-04-21): +# * added "din5007" as default if language is set to "german" +# v2.05 (2012-11-12): +# * added -d option +# v2.04 (2012-04-19): +# * fixed bug in &scan_aux +# v2.03 (2011-04-12): +# * added warning about possibly needing 'nomain' package option +# v2.02 (2011-04-2): +# * Prints version number at start of run unless -q +# * Added more diagnostics. +# v2.01 (2010-09-29): +# * Added 'use warnings' +# v2.0 (2010-06-30) : +# * Made file handle local in &scan_aux +# v1.9 (2010-06-14) : +# * Check for \@input +# v1.8 (2009-11-03) : +# * Create an empty output file if the input file is empty +# without calling xindy/makeindex +# v1.7 (2009-09-23) : +# * Issue warning rather than error when empty/non existant file +# checks fail +# v1.6 (2009-05-24) : +# * main glossary no longer automatically added +# (only added if information in aux file) +# * if file extension is specified, check added to ensure it +# corresponds to a known glossary extension. +# * added file existance test and file empty test +# v1.5 (2008-12-26) : +# * added support for xindy +# * picks up ordering information from aux file +# v1.4 (2008-05-10) : +# * added support for filenames with spaces. +# v1.3 (2008-03-08) : +# * changed first line from /usr/bin/perl -w to /usr/bin/env perl +# (Thanks to Karl Berry for suggesting this.) +# v1.2 (2008-03-02) : +# * added support for --help and --version +# * improved error handling +# v1.1 (2008-02-13) : +# * added -w and strict +# * added check to ensure .tex file not passed to makeglossaries +# +# v1.0 (2007-05-10) : Initial release. + +use Getopt::Std; +use strict; +# v2.01 added the following line +use warnings; +# v2.05 added $opt_d +# v2.08 added $opt_x and $opt_m +use vars qw($opt_q $opt_t $opt_o $opt_s $opt_p $opt_g $opt_c $opt_r + $opt_l $opt_i $opt_L $opt_n $opt_C $opt_d $opt_x $opt_m $opt_Q + $opt_k); + + +$Getopt::Std::STANDARD_HELP_VERSION = 1; + +# v1.5 added -L for xindy (but language can be specified in +# .tex file) +# v1.5 added -n (print the command that would be issued but +# don't actually run the command) +getopts('s:o:t:p:L:C:ilqQkrcgnd:x:m:'); + +unless ($#ARGV == 0) +{ + die "makeglossaries: Need exactly one file argument.\n", + "Use `makeglossaries --help' for help.\n"; +} + +# v2.02: added: +print "makeglossaries version $version\n" unless ($opt_q); + +# v2.07: added babel dialect -> xindy language map: +my %languagemap = +( + 'american' => 'english', + 'austrian' => 'german', + 'british' => 'english', + 'francais' => 'french', + 'frenchb' => 'french', + 'germanb' => 'german', + 'lsorbian' => 'lower-sorbian', + 'magyar' => 'hungarian', + 'naustrian' => 'german', + 'ngermanb' => 'german', + 'ngerman' => 'german', # v2.16 + 'norsk' => 'norwegian', + 'portuges' => 'portuguese', + 'russianb' => 'russian', + 'slovene' => 'slovenian', + 'UKenglish' => 'english', + 'USenglish' => 'english', + 'ukraineb' => 'ukrainian', + 'usorbian' => 'upper-sorbian' +); + +# v2.07 added check for success and for -q +# v2.05 added: + +if ($opt_d) +{ + # v2.11 check for backslash character if on Windows + $opt_d=~s/\\/\//g if $^O=~/Win/; + + if (chdir $opt_d) + { + print "Changed to '$opt_d'\n" unless ($opt_q); + } + else + { + die "Unable to chdir to '$opt_d' $!\n"; + } +} + +# v2.02: added: +# v2.19: changed value +my $xdynotist = 2; +# v2.13: removed +#my $needcompatibilitymode=2; + +# v2.13: added $istnotfound +my $istnotfound = 3; + +# v2.13: added error text: +my %makeindex_error_text = + ( + $xdynotist => "Style name indicates makeindex, but may be in xindy format.\n" + . "Remember to use \\setStyleFile to specify the name\n" + . "of the style file rather than redefining \\istfilename\n" + . "explicitly.", + $istnotfound => "Style file not found. (Have you used \\noist by mistake?)" + ); + +my %xindy_error_text = + ( + 'nosort' => "Sort key required for entries only containing command names.", + 'istnotxdy' => + "Style name has xdy extension, but may be in makeindex format.\n" + . "Remember to use \\setStyleFile to specify the name\n" + . "of the style file rather than redefining \\istfilename\n" + . "explicitly.", + 'missingendquote' => + "You may have missed a \" character in a command such as \\GlsAddXdyLocation.", + 'nolanguage' => + "No language detected.\nHave you remembered to use \\printglossary\n". + "or \\printglossaries in your document?", + 'nomain' => + "\nRemember to use package option 'nomain' if you don't\n". + "want to use the main glossary.", +#v2.21: fixed spelling of \GlsAddXdyLocation + 'badlocation' => + "You may have forgotten to add a location \n" + . "class with \\GlsAddXdyLocation or you may have \n" + . "the format incorrect.\n", + 'comp207' => "You may need to add 'compatible-2.07' package option.", + 'noxdyfile' => "Style file not found. (Have you used \\noist by mistake?)" + ); + +# define known extensions + +# v1.6: removed adding main glossary here as there's no guarantee +# that it's been used. If it has been used, the information will +# be picked up later in the aux file +my %exttype = ( +# main => {in=>'glo', out=>'gls', 'log'=>'glg'}, + ); + +# v1.5 define require languages for xindy + +my %language = (); +my %codepage = (); + +my $ext = ''; +my $name = $ARGV[0]; + +# v2.13 added: +#$name=~s/^"(.*)"$/$1/; +# v2.15: fix provided by Herb Schulz to allow for extensions that +# aren't exactly three characters: +# (HS) changes fix for 3 character extension limit +my ($basename,$extension) = ($name =~ m/^(.*?)(?:\.([^\.]*))?$/); +# (HS) end of changes fix for 3 character extension limit + +# make sure $extension is defined. (If there was no match in the +# above, it cause an uninitialised error later.) +$extension = '' unless ($extension); + +# Make sure users don't try passing the tex file: + +#if (length($ARGV[0]) > 3 and substr($ARGV[0],-4,1) eq ".") +#{ +# $name = substr($ARGV[0],0,length($ARGV[0])-4); +# +# $ext = substr($ARGV[0],-3,3); +# +# if (lc($ext) eq 'tex') +# (HS) changes fix for 3 character extension limit +#if (length($ARGV[0]) > 3 and substr($ARGV[0],-4,1) eq ".") +#{ +# $name = substr($ARGV[0],0,length($ARGV[0])-4); +# +# $ext = substr($ARGV[0],-3,3); +# +# if (lc($ext) eq 'tex') + if (lc($extension) eq 'tex') + { + die("Don't pass the tex file to makeglossaries:\n" + ."either omit the extension to make all the glossaries, " + ."or specify one of the glossary files, e.g. $name.glo, to " + ."make just that glossary.\n") + } +#} +# (HS) end of fix for 3 character extension limit + +# (HS) changes fix for 3 character extension limit +$ext = $extension; +$name = $basename; +# (HS) end of changes fix for 3 character extension limit + +# v2.01 add check to see if aux file exists + +unless (-e "$name.aux") +{ + die "Auxiliary file '$name.aux' doesn't exist. Have you run LaTeX?\n"; +} + +my $istfile = ""; + +my $glslist = ""; + +# should letter ordering be used? (v1.5 added) + +my $letterordering = defined($opt_l); + +# v2.19 added: +my $extramkidxopts = ''; + +# v4.34 added: +my $foundbib2glsresource = ''; + +# Check aux file for other glossary types, +# style file name and various other bits of information. + +&scan_aux($name); + +# has the style file been specified? +unless ($istfile) +{ + if ($foundbib2glsresource) + { + die "Found \\glsxtr\@resource in '$name.aux',\n", + "but not found \\\@istfilename.\n", + "You need to run bib2gls not makeglossaries.\n"; + } + else + { + die "No \\\@istfilename found in '$name.aux'.\n", + "Did your LaTeX run fail?\n", + "Did your LaTeX run produce any output?\n", + "Did you remember to use \\makeglossaries?\n"; + } +} + +# v2.08 added $xindyapp and $makeindexapp +# By default assume they are on the operating system's path +my $xindyapp = ($opt_x ? $opt_x :'xindy'); +my $makeindexapp = ($opt_m ? $opt_m :'makeindex'); + +# v2.11 check for backslash character if on Windows +if ($^O=~/Win/) +{ + $xindyapp=~s/\\/\//g; + $makeindexapp=~s/\\/\//g; +} + +# v1.5 save the general xindy switches + +my $xdyopts = ''; + +# v2.01 replaced 'unless ($opt_L eq "")' with 'if ($opt_L)' +if ($opt_L) +{ + $xdyopts .= " -L $opt_L"; +} + +# save all the general makeindex switches + +my $mkidxopts = ''; + +if ($opt_i) +{ + $mkidxopts .= " -i"; +} + +if ($letterordering) +{ + $mkidxopts .= " -l"; + $xdyopts .= " -M ord/letorder"; +} + +if ($opt_q) +{ +# v2.01 removed following lines. (This script now deals with +# printing messages to STDOUT.) + #$mkidxopts .= " -q"; + #$xdyopts .= " -q"; +} + +if ($opt_r) +{ + $mkidxopts .= " -r"; +} + +if ($opt_c) +{ + $mkidxopts .= " -c"; +} + +if ($opt_g) +{ + $mkidxopts .= " -g"; +} + +# v2.01 replaced 'unless ($opt_p eq "")' with 'if ($opt_p)' +if ($opt_p) +{ + $mkidxopts .= " -p $opt_p"; +} + +if ($extramkidxopts) +{ + $mkidxopts .= " $extramkidxopts"; +} + +# v2.01 replaced 'unless ($opt_s eq "")' with 'if ($opt_s)' +if ($opt_s) +{ + # v2.01 check if user has specified -s .ist but aux file + # indicates .xdy ought to be used and vice-versa. Also check if + # requested style file exists + + unless (-e $opt_s) + { + die "\n", + "Requested style file '$opt_s' doesn't exist.\n\n"; + } + + if ($istfile=~/\.xdy$/ and $opt_s!~/\.xdy$/) + { + die "\n", + "The auxiliary file indicates that you should be using xindy,\n", + "but you have specified makeindex style file '$opt_s'\n", + "Make sure you don't specify 'xindy' as a package option if\n", + "you want to use makeindex.\n\n", + "\\usepackage[makeindex]{glossaries}\n\n"; + } + elsif ($istfile!~/\.xdy$/ and $opt_s=~/\.xdy$/) + { + die "\n", + "The auxiliary file indicates that you should be using\n", + "makeindex, but you have specified xindy style file '$opt_s'.\n", + "Make sure you specify 'xindy' as a package option if you\n", + "want to use xindy.\n\n", + "\\usepackage[xindy]{glossaries}\n\n"; + } + + $istfile = $opt_s; +} + +# Use xindy if style file ends with .xdy otherwise use makeindex + +my $usexindy = ($istfile=~m/\.xdy\Z/); + +if ($ext) +{ + # an extension has been specified, so only process + # the specified file + + # v1.6 %thistype is no longer given a default value + my %thistype; + + my $thislang = ""; + my $thiscodepage = ""; + + my @types = ($glslist ? split /,/, $glslist : keys %exttype); + + foreach my $type (@types) + { + if ($exttype{$type}{'in'} eq $ext) + { + %thistype = %{$exttype{$type}}; + + $thislang = $language{$type}; + + $thiscodepage = $codepage{$type}; + + last; + } + } + + # v1.6 If %thistype hasn't been defined, then the given + # extension doesn't correspond to any known glossary type + + # v2.01 replaced deprecated 'defined(%thistype)' with %thistype + unless (%thistype) + { + die "The file extension '$ext' doesn't correspond to any\n", + "known glossary extension. Try running makeglossaries\n", + "without an extension, e.g. makeglossaries \"$name\".\n"; + } + + my $outfile; + +# v2.01 replaced 'if ($opt_o eq "")' with 'unless ($opt_o)' + unless ($opt_o) + { + $outfile = "$name.$thistype{out}"; + } + else + { + $outfile = $opt_o; + } + + my $transcript; + +# v2.01 replaced 'if ($opt_t eq "")' with 'unless ($opt_t)' + unless ($opt_t) + { + $transcript = "$name.$thistype{'log'}"; + } + else + { + $transcript = $opt_t; + } + +# v2.01 remove old transcript file + + unless ($opt_n) + { + unlink($transcript); + } + + if ($usexindy) + { + &xindy("$name.$ext", $outfile, $transcript,$istfile, + $thislang, $thiscodepage, $xdyopts, $opt_q, $opt_n, $xindyapp); + } + else + { + &makeindex("$name.$ext",$outfile,$transcript,$istfile, + $mkidxopts,$opt_q, $opt_n, $makeindexapp, 1); + } + + + # v2.15 added: + + my $num_omitted = $#types; + + if ($num_omitted == 1) + { + print "1 glossary ignored.\n" unless $opt_q; + } + elsif ($num_omitted > 1) + { + print "$num_omitted glossaries ignored.\n" unless $opt_q; + } +} +else +{ + # no file extension specified so process all glossary types + + my @types = ($glslist ? split /,/, $glslist : keys %exttype); + + foreach my $type (@types) + { + my %thistype = %{$exttype{$type}}; + + my $inputfile = "$name.$thistype{in}"; + + my $outfile; + +# v2.01 changed 'if ($opt_o eq "")' with 'unless ($opt_o)' + unless ($opt_o) + { + $outfile = "$name.$thistype{out}"; + } + else + { + $outfile = $opt_o; + } + + # v1.7 print warnings to STDOUT instead of STDERR + + # v1.6 added file existence test + unless (-e $inputfile) + { + # v2.09 suppress warning if -q switch in use + print "Warning: File '$inputfile' doesn't exist.\n", + "*** Skipping glossary '$type'. ***\n" unless ($opt_q); + next; + } + + unless (-r $inputfile) + { + print "Warning: No read access for '$inputfile' $!\n", + "*** Skipping glossary '$type'. ***\n" unless ($opt_q); + next; + } + + my $transcript; + +# v2.01 changed 'if ($opt_t eq "")' with 'unless ($opt)' + unless ($opt_t) + { + $transcript = "$name.$thistype{'log'}"; + } + else + { + $transcript = $opt_t; + } + + # v1.6 added file empty test + if (-z $inputfile) + { + my $message = + "Warning: File '$inputfile' is empty.\n". + "Have you used any entries defined in glossary '$type'?\n"; + + if ($type eq 'main') + { + $message .= + "Remember to use package option 'nomain' if you\n". + "don't want to use the main glossary.\n"; + } + + # v2.09 suppress warning if -q switch in use + warn $message unless $opt_q; + + # Write warning to transcript file. + + if (open TRANSFD, ">$transcript") + { + print TRANSFD $message; + close TRANSFD; + } + + # create an empty output file and move on to the next glossary + + if (open OFD, ">$outfile") + { + print OFD "\\null\n"; + close OFD; + } + else + { + warn "Unable to create '$outfile' $!\n"; + } + + next; + } + +# v2.01 remove old transcript file + + unless ($opt_n) + { + unlink($transcript); + } + + if ($usexindy) + { + &xindy($inputfile,$outfile,$transcript,$istfile, + $language{$type},$codepage{$type}, + $xdyopts,$opt_q,$opt_n, $xindyapp); + } + else + { + &makeindex($inputfile,$outfile,$transcript, + $istfile,$mkidxopts,$opt_q,$opt_n, $makeindexapp, 1); + } + } +} + +sub scan_aux{ + my $name = shift; + + # v2.0 added + local(*AUXFILE); + + if (open AUXFILE, "$name.aux") + { + while () + { + #v2.14 added + if (m/\\\@gls\@reference/ and not $glslist) + { + die "Your document has used \\makenoidxglossaries\n", + "You don't need makeindex or xindy.\n"; + } + + if (m/\\glsxtr\@makeglossaries\{(.*)\}/) + { + #v2.20 added + + $glslist = $1; + + unless ($opt_q) + { + print "only processing subset '$glslist'\n"; + } + } + elsif (m/\\\@input\{(.+)\.aux\}/) + { + # v1.9 added + # v2.17 escaped { in regex + &scan_aux($1); + + # v2.04 added + # (Fix provided by Daniel Grund) + next; + } + elsif (m/\\\@newglossary\s*\{(.*)\}\{(.*)\}\{(.*)\}\{(.*)\}/) + { + # v2.17 escaped { in regex + + $exttype{$1}{'log'} = $2; + $exttype{$1}{'out'} = $3; + $exttype{$1}{'in'} = $4; + + unless ($opt_q) + { + print "added glossary type '$1' ($2,$3,$4)\n"; + } + } + elsif (m/\\\@istfilename\s*\{([^}]*)\}/) + { + # v2.17 escaped { in regex + + $istfile = $1; + + # check if double quotes were added to \jobname + # v2.12 added check for xdy (bug ID 33) + $istfile=~s/^"(.*)"\.(ist|xdy)$/$1.$2/; + + # v2.12 if on Windows, substitute any '*' with ' ' + # to compensate for MiKTeX bug + # http://sourceforge.net/p/miktex/bugs/2301/ + + if ($^O=~/Win/) + { + $istfile=~tr/\*/ /; + } + } + elsif (m/\\\@xdylanguage\s*\{([^}]+)\}\{([^}]*)\}/) + { + # v1.5 added + # v2.17 escaped { in regex + + $language{$1} = $2; + } + elsif (m/\\\@gls\@codepage\s*\{([^}]+)\}\{([^}]*)\}/) + { + # v1.5 added + # v2.17 escaped { in regex + + $codepage{$1} = $2; + } + elsif (m/\\\@gls\@extramakeindexopts\{(.*)\}/) + { + # v2.19 added + + $extramkidxopts .= $1; + } + elsif (m/\\glsxtr\@resource/) + { + # v4.34 added + + # No error at this point as a hybrid method is allowed. + # Error only occurs if no \@istfilename found. + + $foundbib2glsresource = 1; + } + + # v1.5 added + # Allow -l switch to override specification in aux file + unless (defined($opt_l)) + { + # v2.17 escaped { in regex + if (m/\\\@glsorder\s*\{([^}]+)\}/) + { + my $ordering = $1; + + if ($ordering eq "word") + { + $letterordering = 0; + } + elsif ($ordering eq "letter") + { + $letterordering = 1; + } + else + { + warn + "Unknown ordering '$ordering'\n", + "Assuming word ordering\n" unless ($opt_q); + $letterordering = 0; + } + } + } + } + + close AUXFILE; + } + else + { + warn "Unable to open $name.aux: $!\n"; + } +} + +# v2.01 new subroutine run_app added +sub run_app{ + my($appname, $appargs, $trans, $quiet, $dontexec) = @_; + + local(*STATUS); + + my $status = ''; + my $warnings = ''; + my $errno = 0; + my $log = ''; + + print "$appname $appargs\n" if ($dontexec or not $quiet); + + return if ($dontexec); + + # v2.11 added double-quotes around $appname + # v2.14 added -k switch + if (not $opt_k and open (STATUS, "\"$appname\" $appargs 2>&1 |")) + { + while () + { + print unless ($quiet); + + $warnings .= $_ if (/WARNING:/); + + $status .= $_ unless (/^[\w]+ing/ or /^Finished/ or /^Usage:/); + + $log .= $_; + } + + close STATUS; + } + else + { + unless ($opt_k) + { + $warnings = "Unable to fork \"$appname\" with redirection $!\n"; + + # v2.14 added check for quiet switches + warn $warnings, + "Retrying without redirection.\n" unless ($quiet or $opt_Q); + } + + $status = `\"$appname\" $appargs`; + + $log = $status; + + print $status unless ($quiet); + } + + if ($?) + { + # v2.14 Fixed error number assignment + $errno = ($? >> 8); + + # v2.14 Added check for existence of transcript + unless (-e $trans) + { + $log .= "\n$appname didn't create a transcript.\n"; + + if (not $appname=~/\//) + { + # No path specified + $log .= "Check that $appname has been installed and\nis on your system's PATH.\n"; + + if (defined $ENV{PATH}) + { + $log .= "Your PATH environment variable is set to: \n" + . $ENV{PATH} . "\n"; + } + else + { + $log .= "I'm sorry, I can't detect your PATH environment variable\n"; + } + + $log .= "Try manually running:\n\"$appname\" $appargs\n"; + } + elsif (not -e $appname) + { + if ($^O=~/Win/) + { + if (-e "$appname.exe" or -e "$appname.bat") + { + $log .= "Try manually running:\n\"$appname\" $appargs\n"; + } + else + { + $log .= "File '$appname' doesn't exist.\n"; + } + } + else + { + $log .= "File '$appname' doesn't exist.\n"; + } + } + else + { + $log .= "Try manually running:\n\"$appname\" $appargs\n"; + } + } + + if (open LOGFILE, ">>$trans") + { + print LOGFILE "\n\n*** Unable to execute: '\"$appname\" $appargs' ***\n\n"; + print LOGFILE "Failed with error code $errno.\n\n"; + + if ($log) + { + print LOGFILE "Status report:\n\n"; + print LOGFILE "$log", "\n"; + } + + print LOGFILE "Warnings:\n\n",$warnings, "\n" if $warnings; + close LOGFILE; + } + else + { + warn "Unable to open '$trans' $!\n"; + } + } + + if ($log=~/\(0 entries accepted,/ + or ( ($log=~/(\d+) warnings?/ and $1 gt 0)) + or $log=~/not found/) + { + # Attempt to diagnose what's gone wrong + + if (open TRANS, $trans) + { + while () + { + if (/Index style file .* not found/) + { + $errno = $istnotfound; + last; + } + elsif (/Unknown specifier ;/) + { + $errno = $xdynotist; + last; + } + elsif (/## Warning \(.*\):\s*$/) + { + $warnings .= $_ . ; + } + } + + close TRANS; + } + + } + + return ($status, $warnings, $errno); +} + +# v2.08 added $app parameter +sub makeindex{ + my($in,$out,$trans,$ist,$rest,$quiet,$dontexec,$app,$repairencaps) = @_; + + my $args = "$rest -s \"$ist\" -t \"$trans\" -o \"$out\" \"$in\""; + +# v2.01 replaced code with call to &run_app + + my ($status, $warnings, $errno) + = &run_app($app, $args, $trans, $quiet, $dontexec); + + return if ($dontexec); + + if ($errno) + { + my $diagnostic = ''; + + if ($makeindex_error_text{$errno}) + { + $diagnostic = $makeindex_error_text{$errno}; + } + else + { + $diagnostic = "Can't find diagnostic message for error code $errno"; + } + + if (open LOGFILE, ">>$trans") + { + print LOGFILE "\nmakeglossaries diagnostic messages:\n$diagnostic\n"; + close LOGFILE; + } + + die "\n***Call to makeindex failed***\n", + ($diagnostic ? + "\nPossible cause of problem:\n\n". $diagnostic . "\n\n": + "\n" + ), + "Check '$trans' for details\n"; + } + + # 2.18: added check and repair for multiple encaps + if ($warnings) + { + warn $warnings unless $quiet; + + if ($repairencaps and $warnings=~/multiple encaps/) + { + unless ($quiet) + { + print "Multiple encaps detected. Attempting to remedy.\n"; + print "Reading $in...\n"; + } + + # if $in can't be opened at this point something wrong + # has occurred (otherwise how did makeindex manage to open + # it?) + + open INFD, $in or die "Can't open '$in' $!\n"; + + my @entries = (); + + while () + { + if (/\\glossaryentry\{(.*)\|([^\|]*)\}\{(.*?)\}/) + { + my %entry = + ( + 'entry' => $1, + 'encap' => $2, + 'location' => $3 + ); + + my $add = 1; + + for (my $idx = 0; $idx <= $#entries; $idx++) + { + my $existing = $entries[$idx]; + + if ($entry{'entry'} eq $existing->{'entry'} + and $entry{'location'} eq $existing->{'location'} + and $entry{'encap'} ne $existing->{'encap'}) + { + $add = 0 if ($add == 1); + + # Range encaps should take precedence. + + if ($entry{'encap'}=~/^[\(\)]/) + { + $add = 2; + + if ($existing->{'encap'}=~/^[\(\)]/) + { + # too complicated, keep both + + last; + } + else + { + # remove existing + + splice @entries, $idx, 1; + + $idx--; + } + } + elsif ($existing->{'encap'}=~/^[\(\)]/) + { + if ($entry{'encap'}=~/^[\(\)]/) + { + # too complicated, keep both + + $add = 1; + last; + } + # (otherwise drop new entry) + } + elsif (&encap_overrides($entry{'encap'}, + $existing->{'encap'})) + { + $entries[$idx] = \%entry; + } + } + } + + push @entries, \%entry if $add > 0; + } + else + { + warn "Abandoning attempt. Can't parse: $_" unless $quiet; + + close INFD; + return; + } + } + + close INFD; + + if (open OUTFD, ">$in") + { + print "Writing $in...\n" unless $quiet; + + foreach my $entry (@entries) + { + print OUTFD '\\glossaryentry{', + $entry->{'entry'}, '|', + $entry->{'encap'}, '}{', + $entry->{'location'}, '}', "\n"; + } + + close OUTFD; + + print "Retrying\n" unless $quiet; + + &makeindex($in,$out,$trans,$ist,$rest,$quiet,$dontexec,$app,0); + } + else + { + warn "Can't open '$in' $!\n" unless $quiet; + } + } + } +} + +# 2.18 new +# This is a subroutine in case of possible extension. +# For example, what happens in the event of 'textbf' and 'emph'? +# Should one override the other or be combined? Combining is harder +# as it would need a corresponding LaTeX command. +# 2.21 check for range encap moved earlier + +sub encap_overrides{ + my ($newencap, $existing) = @_; + + ($existing=~/\\glsnumberformat\s*$/ or $newencap!~/\\glsnumberformat\s*$/ ) +} + +# v2.08 added $app parameter +sub xindy{ + my($in,$out,$trans,$ist,$language,$codepage,$rest,$quiet, + $dontexec, $app) = @_; + my($args, $langparam, $main, $retry); + my($module); + + $module = $ist; + $module=~s/\.xdy\Z//; + + if ($language) + { + # map babel names to xindy names + + $language = $languagemap{$language} if ($languagemap{$language}); + + $langparam = "-L $language"; + } + else + { + $langparam = ""; + # v2.10 initialise $language to suppress warnings + $language = ""; + } + + # most languages work with xindy's default codepage, but + # some don't, so if the codepage isn't specific, check + # the known cases that will generate an error + # and supply a default. (For all other cases, it's up to the + # user to supply a codepage.) + +# v2.01 changed 'if ($codepage eq "")' to 'unless ($codepage)' + unless ($codepage) + { + if ($language eq 'dutch') + { + $codepage = "ij-as-ij"; + } + elsif ($language eq 'german') + { + $codepage = "din5007"; + } + elsif ($language eq 'gypsy') + { + $codepage = "northrussian"; + } + elsif ($language eq 'hausa') + { + $codepage = "utf"; + } + elsif ($language eq 'klingon') + { + $codepage = "utf"; + } + elsif ($language eq 'latin') + { + $codepage = "utf"; + } + elsif ($language eq 'mongolian') + { + $codepage = "cyrillic"; + } + elsif ($language eq 'slovak') + { + $codepage = "small"; + } + elsif ($language eq 'spanish') + { + $codepage = "modern"; + } + elsif ($language eq 'vietnamese') + { + $codepage = "utf"; + } + } + elsif ($language eq 'german' and $codepage!~/(din5007|duden|braille)/) + { +#v2.16 added check for german din/duden + + $codepage = "din5007-$codepage"; + } + + + my $codepageparam = ""; + + if ($codepage) + { + $codepageparam = "-C $codepage"; + } + + $main = join(' ', + "-I xindy", + "-M \"$module\"", + "-t \"$trans\"", + "-o \"$out\"", + "\"$in\""); + + $args = join(' ', $rest, $langparam, $codepageparam, $main); + +# v2.01 replaced code with call to &run_app + + my ($status, $warnings, $errno) + = &run_app($app, $args, $trans, $quiet, $dontexec); + + return if ($dontexec); + + if ($status=~/Cannot locate xindy module for language ([^\s]+) in codepage ([^\s]+)/) + { + $args = join(' ', $rest, $langparam, $main); + + unless ($quiet) + { + my $message = "$&\nRetrying using default codepage.\n"; + + warn $message; + + $retry .= $message; + } + + ($status, $warnings, $errno) + = &run_app('xindy', $args, $trans, $quiet, $dontexec); + + } + + if ($status=~/Cannot locate xindy module for language ([^\s]+)/ + and $1 ne 'general') + { + $args = join(' ', $rest, "-L general", $main); + + unless ($quiet) + { + my $message = "$&\nRetrying with -L general\n"; + + warn $message; + $retry .= $message; + } + + ($status, $warnings, $errno) + = &run_app('xindy', $args, $trans, $quiet, $dontexec); + + } + + if ($errno) + { + # attempt further diagnostic + + my $diagnostic = ''; + + if ($status=~/index 0 should be less than the length of the string/m) + { + $diagnostic = $xindy_error_text{nosort}; + + $diagnostic .= &parse_for_xindy_nosort($in); + } + elsif ($status=~/variable .+ has no value/m) + { + # v2.19 fixed misspelt key + $diagnostic = $xindy_error_text{istnotxdy}; + } + elsif ($status=~/Could not find file /m) + { + # v2.19 added + $diagnostic = $xindy_error_text{noxdyfile}; + } + elsif ($status=~/Possible read-error due to ill-formed string " :sep/m) + { + $diagnostic = $xindy_error_text{missingendquote}; + } + elsif (not $language) + { + # If the language hasn't been set, then it may be + # because the document doesn't contain + # \printglossaries/\printglossary or it may be + # because the user has a customized style file that + # contains the language settings. + + $diagnostic = $xindy_error_text{nolanguage}; + + if ($in eq 'glo') + { + # or it may be that the user doesn't want to use the main + # glossary and has forgotten to suppress it with the + # "nomain" package option + + $diagnostic .= $xindy_error_text{nomain}; + } + } + + # v2.19 added: + if ($diagnostic and open LOGFILE, ">>$trans") + { + print LOGFILE "\nmakeglossaries diagnostic messages:\n\n$diagnostic\n"; + close LOGFILE; + } + + die "\n***Call to xindy failed***\n", + ($diagnostic ? + "\nPossible cause of problem:\n\n". $diagnostic . "\n\n": + "\n"), + "Check '$trans' for details\n"; + } + + # Check xindy warnings + + if ($status=~/^WARNING:/m) + { + my $diagwarn = ''; + + if ($status=~/did not match any location-class/m) + { + $diagwarn = $xindy_error_text{badlocation}; + } + + if ($status=~/unknown attribute `pageglsnumberformat'/m) + { + $diagwarn .= $xindy_error_text{comp207}; + } + + if ($status=~/Would replace complete index key by empty string, ignoring/m) + { + $diagwarn .= $xindy_error_text{nosort}; + $diagwarn .= &parse_for_xindy_nosort($in); + } + + if ($diagwarn) + { + warn "\n**Warning:**\n\n", $diagwarn, "\n"; + + $warnings .= "\nmakeglossaries diagnostic messages:\n\n" + . $diagwarn; + } + } + + if ($retry or $warnings) + { + if (open LOGFILE, ">>$trans") + { + print LOGFILE "\n$warnings"; + + if ($retry) + { + print LOGFILE "\nmakeglossaries messages:\n\n", $retry; + } + + close LOGFILE; + } + else + { + warn "Unable to open '$trans' $!\n"; + } + } +} + +# v2.18 added: +sub parse_for_xindy_nosort{ + my ($in) = @_; + + my $msg = join("\n", "", + "Attempting to determine which entries have problem sort keys.", + "Parsing '$in'"); + + my %entries = (); + + if (open FD, $in) + { + while () + { +# v2.19 extra conditions added + if (/:tkey \(\("((?:\\\\[a-zA-Z@]+ *)+)" "\\\\glossentry\{(.*)\}"\) \)/) + { + my $label = $2; + + unless ($entries{$label}) + { + $entries{$label}->{sort} = $label; + $entries{$label}->{suggestion} = $label; + $entries{$label}->{suggestion}=~s/([\\\s]+)//g; + + } + } + elsif (/:tkey \(\("(\\\\[a-zA-Z@]+ *{(?:\\\\[a-zA-Z@]+ *)+})+" "\\\\glossentry\{(.*)\}"\) \)/) + { +# name in the form \cs{\cs} + my $label = $2; + + unless ($entries{$label}) + { + $entries{$label}->{sort} = $1; + $entries{$label}->{suggestion} = $label; + $entries{$label}->{suggestion}=~s/^[a-zA-Z]+[:\-\.]//; + $entries{$label}->{suggestion}=~s/([^\w]+)//g; + } + } + elsif (/:tkey \(\("(\$\s*(?:\{?\\\\[a-zA-Z@]+ *\}?)+\$)" "\\\\glossentry\{(.*)\}"\) \)/) + { +# name in the form $\cs$ + my $label = $2; + + unless ($entries{$label}) + { + $entries{$label}->{sort} = $1; + $entries{$label}->{suggestion} = $label; + $entries{$label}->{suggestion}=~s/^[a-zA-Z]+[:\-\.]//; + $entries{$label}->{suggestion}=~s/([^\w]+)//g; + } + } + } + + close FD; + + my @labels = keys %entries; + + my $n = $#labels+1; + + if ($n == 0) + { + $msg .= "\nCouldn't find anything! Sorry, I'm stumped."; + } + else + { + $msg .= ($n == 1 ? "\n1 problematic entry found:\n" + : "\n$n problematic entries found:\n"); + + foreach my $label (@labels) + { + my $thisentry = $entries{$label}; + + $msg .= "\nLabel: '$label'. Sort value : '$thisentry->{sort}'"; + $msg .= "\n(Try adding sort={$thisentry->{suggestion}} to the definition.)"; + } + } + } + else + { + $msg .= "\nFailed to open '$in' $!\n"; + } + + $msg; +} + +sub HELP_MESSAGE{ + print "\nSyntax : makeglossaries [options] \n\n"; + print "For use with the glossaries package to pass relevant\n"; + print "files to makeindex or xindy.\n\n"; + print "\tBase name of glossary file(s). This should\n"; + print "\t\tbe the name of your main LaTeX document without any\n"; + print "\t\textension.\n"; + print "\nGeneral Options:\n\n"; + print "-o \tUse as the output file.\n"; + print "\t\t(Don't use -o if you have more than one glossary.)\n"; + print "-q\t\tQuiet mode.\n"; + print "-Q\t\tSilence unable to fork warning.\n"; + print "-k\t\tDon't try to use piped redirection.\n"; + print "-l\t\tLetter ordering.\n"; + print "-s \tEmploy as the style file.\n"; + print "-t \tEmploy as the transcript file.\n"; + print "\t\t(Don't use -t if you have more than one glossary\n"; + print "\t\tor the transcripts will be overwritten.)\n"; + print "-d \tDirectory in which the .aux, .glo etc files are located.\n", + "\t\t(Default is the directory in which resides.)\n"; + print "-n\t\tPrint the command that would normally be executed,\n", + "\t\tbut don't execute it.\n"; + + print "\nXindy Options:\n\n"; + print "-L \tUse .\n"; + print "-x \tFull path to xindy executable.\n", + "\t\t(Default assumes xindy is on the operating system's path.)\n"; + + print "\nMakeindex Options:\n"; + print "(See makeindex documentation for further details on these "; + print "options.)\n\n"; + print "-c\t\tCompress intermediate blanks.\n"; + print "-g\t\tEmploy German word ordering.\n"; + print "-p \tSet the starting page number to be .\n"; + print "-r\t\tDisable implicit page range formation.\n"; + print "-m \tFull path to makeindex executable.\n", + "\t\t(Default assumes makeindex is on the operating system's path.)\n"; +} + +sub VERSION_MESSAGE{ + + my $verYear = ''; + + if ($version=~/(\d{4})-\d{2}-\d{2}/) + { + $verYear = "-$1"; + } + + print "Makeglossaries Version $version\n"; + print "Copyright (C) 2007$verYear Nicola L C Talbot\n"; + print "This material is subject to the LaTeX Project Public License.\n"; +} + +1; + +=head1 NAME + +makeglossaries - Calls makeindex/xindy for LaTeX documents using glossaries package + +=head1 SYNOPSIS + +B [B<-o> I] [B<-q>] [B<-Q>] [B<-k>] [B<-n>] +[B<-s> I] [B<-t> I] [B<-L> I] [B<-c>] [B<-g>] [B<-l>] +[B<-p> I] [B<-r>] [B<-d> I] [B<-m> I] [B<-x> I] +[B<--version>] [B<--help>] I + +=head1 DESCRIPTION + +B is designed for use with LaTeX documents that +use the glossaries package. The mandatory argument I should +be the name of the LaTeX document without the .tex extension. +B will read the auxiliary file to determine whether +B or B should be called. All the information +required to be passed to the relevant indexing application should +also be contained in the auxiliary file, but may be overridden by +the option arguments to B. + +=head1 OPTIONS + +=over 4 + +=item B<-q> + +Quiet mode. Reduces chatter to standard output. + +=item B<-Q> + +Silences warning about being unable to fork. + +=item B<-k> + +Don't try forking with piped redirection. (Lessens the +effect of -q) + +=item B<-n> + +Print the commands that would normally be executed but don't run them. + +=item B<-o> I + +Use I as the output file. (Only suitable for documents +containing a single glossary, otherwise each glossary will be +overridden.) + +=item B<-s> I + +Use I as the style file. Note that if you use this option, +you need to know whether B or B will be called, as +they have different style files. + +=item B<-t> I + +Use I as the transcript file. + +=item B<-l> + +Letter ordering. + +=item B<-L> I + +This option only has an effect if B is called. Sets the +language. See B documentation for further details. + +=item B<-c> + +Compress intermediate blanks (B only). + +=item B<-g> + +Employ German word ordering (B only). + +=item B<-p> I + +Sets the starting page number to be I (B only). + +=item B<-r> + +Disable implicit page range formation (B only). + +=item B<-d> I + +Specify the directory the .aux, .glo etc files are located. +Defaults to the parent directory of the base file I. + +=item B<-m> I + +Specify the full path name for B to I in the +event that B isn't on the operating system's path. + +=item B<-x> I + +Specify the full path name for B to I in the +event that B isn't on the operating system's path. + +=item B<--version> + +Prints version number and exits. + +=item B<--help> + +Prints help message and exits. + +=back + +=head1 REQUIRES + +Perl, Getopt::Std, and makeindex or xindy (depending on glossaries +package options). + +=head1 LICENSE + +This is free software distributed under the LaTeX Project Public +License. There is NO WARRANTY. +See L for details. + +=head1 AUTHOR + +Nicola L. C. Talbot, +L + +=head1 RECOMMENDED READING + +The glossaries manual: + + texdoc glossaries + +=cut diff --git a/macros/latex/contrib/glossaries/makeglossaries-lite.1 b/macros/latex/contrib/glossaries/makeglossaries-lite.1 new file mode 100644 index 0000000000..94a5df5d94 --- /dev/null +++ b/macros/latex/contrib/glossaries/makeglossaries-lite.1 @@ -0,0 +1,235 @@ +.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "MAKEGLOSSARIES-LITE 1" +.TH MAKEGLOSSARIES-LITE 1 "2019-01-06" "perl v5.28.1" "makeglossaries-lite Lua Script" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +makeglossaries\-lite \- Calls makeindex/xindy for LaTeX documents using glossaries package +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBmakeglossaries\fR [\fB\-o\fR \fIfile\fR] [\fB\-q\fR] [\fB\-n\fR] +[\fB\-s\fR \fIfile\fR] [\fB\-t\fR \fIfile\fR] [\fB\-L\fR \fIlanguage\fR] [\fB\-c\fR] [\fB\-g\fR] +[\fB\-l\fR] [\fB\-p\fR \fInum\fR] [\fB\-r\fR] [\fB\-m\fR \fIfile\fR] [\fB\-x\fR \fIfile\fR] +[\fB\-\-version\fR] [\fB\-\-help\fR] \fIbasename\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBmakeglossaries-lite\fR is cut-down Lua alternative to the +\&\fBmakeglossaries\fR Perl script. It's designed for use with LaTeX documents that +use the glossaries package. Some options that are available to +\&\fBmakeglossaries\fR aren't available with \fBmakeglossaries-lite\fR. +The mandatory argument \fIbasename\fR should +be the name of the LaTeX document without the .tex extension. +\&\fBmakeglossaries-lite\fR will read the auxiliary file to determine whether +\&\fBmakeindex\fR or \fBxindy\fR should be called. All the information +required to be passed to the relevant indexing application should +also be contained in the auxiliary file, but may be overridden by +the option arguments to \fBmakeglossaries-lite\fR. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-q\fR" 4 +.IX Item "-q" +Quiet mode. Reduces chatter to standard output. +.IP "\fB\-n\fR" 4 +.IX Item "-n" +Print the commands that would normally be executed but don't run +them. +.IP "\fB\-o\fR \fIfile\fR" 4 +.IX Item "-o file" +Use \fIfile\fR as the output file. (Only suitable for documents +containing a single glossary, otherwise each glossary will be +overridden.) +.IP "\fB\-s\fR \fIfile\fR" 4 +.IX Item "-s file" +Use \fIfile\fR as the style file. Note that if you use this option, +you need to know whether \fBmakeindex\fR or \fBxindy\fR will be called, as +they have different style files. +.IP "\fB\-t\fR \fIfile\fR" 4 +.IX Item "-t file" +Use \fIfile\fR as the transcript file. +.IP "\fB\-l\fR" 4 +.IX Item "-l" +Letter ordering. +.IP "\fB\-L\fR \fIlanguage\fR" 4 +.IX Item "-L language" +This option only has an effect if \fBxindy\fR is called. Sets the +language. See \fBxindy\fR documentation for further details. +.IP "\fB\-c\fR" 4 +.IX Item "-c" +Compress intermediate blanks (\fBmakeindex\fR only). +.IP "\fB\-g\fR" 4 +.IX Item "-g" +Employ German word ordering (\fBmakeindex\fR only). +.IP "\fB\-p\fR \fInum\fR" 4 +.IX Item "-p num" +Sets the starting page number to be \fInum\fR (\fBmakeindex\fR only). +.IP "\fB\-r\fR" 4 +.IX Item "-r" +Disable implicit page range formation (\fBmakeindex\fR only). +.IP "\fB\-m\fR \fIfile\fR" 4 +.IX Item "-m file" +Specify the full path name for \fBmakeindex\fR to \fIfile\fR in the +event that \fBmakeindex\fR isn't on the operating system's path. +.IP "\fB\-x\fR \fIfile\fR" 4 +.IX Item "-x file" +Specify the full path name for \fBxindy\fR to \fIfile\fR in the +event that \fBxindy\fR isn't on the operating system's path. +.IP "\fB\-\-version\fR" 4 +.IX Item "--version" +Prints version number and exits. +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +Prints help message and exits. +.SH "REQUIRES" +.IX Header "REQUIRES" +texlua and makeindex or xindy (depending on glossaries package options). +.SH "LICENSE" +.IX Header "LICENSE" +This is free software distributed under the LaTeX Project Public +License. There is \s-1NO WARRANTY.\s0 +See for details. +.SH "AUTHOR" +.IX Header "AUTHOR" +Nicola L. C. Talbot, + +.SH "RECOMMENDED READING" +.IX Header "RECOMMENDED READING" +The glossaries manual: +.PP +.Vb 1 +\& texdoc glossaries +.Ve diff --git a/macros/latex/contrib/glossaries/makeglossaries-lite.lua b/macros/latex/contrib/glossaries/makeglossaries-lite.lua new file mode 100755 index 0000000000..f812edacee --- /dev/null +++ b/macros/latex/contrib/glossaries/makeglossaries-lite.lua @@ -0,0 +1,559 @@ +#!/usr/bin/env texlua +--[[ + File : makeglossaries-lite.lua + Author : Nicola Talbot + + Lua alternative to the makeglossaries Perl script. + + Since Lua has limitations, this script isn't an exact + replacement to the Perl script. In particular the makeglossaries -d + switch isn't implemented in this Lua version. + This also doesn't provide the more detailed diagnostics that the Perl + version does nor does it attempt any language mappings. Since xindy + requires Perl, don't use this script if you want to use xindy. Instead + use the Perl makeglossaries script. + + This file is distributed as part of the glossaries LaTeX package. + Copyright 2015 Nicola L.C. 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 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'. + + This work consists of the files glossaries.dtx and glossaries.ins + and the derived files glossaries.sty, glossaries-prefix.sty, + glossary-hypernav.sty, glossary-inline.sty, glossary-list.sty, + glossary-long.sty, glossary-longbooktabs.sty, glossary-longragged.sty, + glossary-mcols.sty, glossary-super.sty, glossary-superragged.sty, + glossary-tree.sty, glossaries-compatible-207.sty, + glossaries-compatible-307.sty, glossaries-accsupp.sty, + glossaries-babel.sty, glossaries-polyglossia.sty, glossaries.perl. + Also makeglossaries and makeglossaries-lite.lua. + + History: + * 4.41: + - no change. + * 4.40: + - no change. + * 4.39: + - corrected script name in version and help messages + * 4.38: + - no change. + * 4.37: + - no change. + * 4.36: + - fixed check for double-quotes (from \jobname when the file name + contains spaces). + * 4.35: + - no change. + * 4.34: + - added check for \glsxtr@resource + * 4.33: + - version number synchronized with glossaries.sty + * 1.3 + - added check for \glsxtr@makeglossaries + * 1.2 (2016-05-27) + - added check for \@gls@extramakeindexopts + - added check for nil codepage + * 1.1 + - changed first line from lua to texlua +--]] + +thisversion = "4.41 (2018-07-23)" + +quiet = false +dryrun = false + +infile = nil +outfile = nil +styfile = nil +logfile = nil + +isxindy = false + +isbib2gls = false + +xindylang = nil +xindyexec = "xindy" + +makeindex_c = false +makeindex_g = false +letterorder = false +makeindex_r = false +makeindex_p = nil +makeindex_extra = nil +makeindex_m = "makeindex" + +function version() + + verYear = string.match(thisversion, "%d%d%d%d"); + + print(string.format("makeglossaries-lite version %s", thisversion)) + print(string.format("Copyright (C) 2015-%s Nicola L C Talbot", verYear)) + print("This material is subject to the LaTeX Project Public License.") +end + +function help() + version() + print([[ +Syntax : makeglossaries-lite [options] + +For use with the glossaries package to pass relevant +files to makeindex or xindy. + + Base name of glossary file(s). This should + be the name of your main LaTeX document without any + extension. If you do add an extension, only that + glossary file will be processed. + +General Options: + +-o Use as the output file. + (Don't use -o if you have more than one glossary.) +-s Employ as the style file. +-t Employ as the transcript file. + (Don't use -t if you have more than one glossary + or the transcripts will be overwritten.) +-q Quiet mode. +-l Letter ordering. +-n Print the command that would normally be executed, + but don't execute it (dry run). +--help Print this help message. +--version Print the version. + +Xindy Options: + +-L Use . +-x Full path to xindy executable. + (Default assumes xindy is on the operating system's path.) + +Makeindex Options: +(See makeindex documentation for further details on these options.) + +-c Compress intermediate blanks. +-g Employ German word ordering. +-p Set the starting page number to be . +-r Disable implicit page range formation. +-m Full path to makeindex executable. + (Default assumes makeindex is on the operating system's path.) + +This is a light-weight Lua alternative to the makeglossaries Perl script. +If you want to use xindy, it's better to use the Perl makeglossaries version +instead. + +]]) +end + +function dorun(name, glg, gls, glo, language, codepage) + + if isxindy then + doxindy(name, glg, gls, glo, language, codepage) + else + domakeindex(name, glg, gls, glo) + end + +end + +function doxindy(name, glg, gls, glo, language, codepage) + + if codepage == nil + then + codepage = "utf8" + end + + cmd = string.format('"%s" -I xindy -L %s -C %s -M "%s" -t "%s" -o "%s"', + xindyexec, language, codepage, styfile, glg, gls) + + if letterorder then cmd = string.format('%s -M ord/letorder', cmd) end + + if quiet then cmd = string.format('%s -q', cmd) end + + cmd = string.format('%s "%s"', cmd, glo) + + if dryrun then + + print(cmd) + + else + + assert(os.execute(cmd), + string.format("Failed to execute '%s'", cmd)) + + end + +end + +function domakeindex(name, glg, gls, glo) + + cmd = string.format('"%s"', makeindex_m) + + if makeindex_c then cmd = cmd .. " -c" end + + if makeindex_g then cmd = cmd .. " -g" end + + if letterorder then cmd = cmd .. " -l" end + + if makeindex_extra then cmd = cmd .. " " .. makeindex_extra end + + if quiet then cmd = cmd .. " -q" end + + if glg ~= nil then cmd = string.format('%s -t "%s"', cmd, glg) end + + if gls ~= nil then cmd = string.format('%s -o "%s"', cmd, gls) end + + if makeindex_p ~= nil then + cmd = string.format("%s -p %s", cmd, makeindex_p) + end + + if styfile ~= nil then + cmd = string.format('%s -s "%s"', cmd, styfile) + end + + cmd = string.format('%s "%s"', cmd, glo) + + if dryrun then + print(cmd) + else + assert(os.execute(cmd), + string.format("Failed to execute '%s'", cmd)) + end + +end + +if #arg < 1 +then + error("Syntax error: filename expected. Use --help for help.") +end + +i = 1 + +while i <= #arg do + +-- General Options + if arg[i] == "-q" then + quiet = true + elseif arg[i] == "-n" + then + dryrun = true + elseif arg[i] == "-o" + then + i = i + 1 + if i > #arg then error("-o requires a filename") end + outfile = arg[i] + elseif arg[i] == "-s" + then + i = i + 1 + if i > #arg then error("-s requires a filename") end + styfile = arg[i] + elseif arg[i] == "-t" + then + i = i + 1 + if i > #arg then error("-t requires a filename") end + logfile = arg[i] + elseif arg[i] == "--version" + then + version() + os.exit() + elseif arg[i] == "--help" + then + help() + os.exit() +-- General options for the Perl version that aren't implemented by +-- this light-weight version: + elseif (arg[i] == "-Q") or (arg[i] == "-k") + then + print(string.format("Ignoring option '%s' (only available with the Perl version).", arg[i])) + elseif arg[i] == "-d" + then + error(string.format( + "The '%s' option isn't available for this light-weight version.\nYou will need to use the Perl version instead.", + arg[i])) + +-- Xindy Options + elseif arg[i] == "-L" + then + i = i + 1 + if i > #arg then error("-L requires a language name") end + xindylang = arg[i] + elseif arg[i] == "-x" + then + i = i + 1 + if i > #arg then error("-x requires a filename") end + xindyexec = arg[i] + +-- Makeindex Options + elseif arg[i] == "-c" + then + makeindex_c = true + elseif arg[i] == "-g" + then + makeindex_g = true + elseif arg[i] == "-l" + then + letterorder = true + elseif arg[i] == "-r" + then + makeindex_r = true + elseif arg[i] == "-p" + then + i = i + 1 + if i > #arg then error("-p requires a page number") end + makeindex_p = arg[i] + elseif arg[i] == "-m" + then + i = i + 1 + if i > #arg then error("-m requires a filename") end + makeindex_m = arg[i] + +-- Unknown Option + elseif string.sub(arg[i], 1, 1) == "-" + then + error( + string.format("Syntax error: unknown option '%s'. Use '--help' for help.", + arg[i])); + +-- Input file + elseif infile == nil + then + infile = arg[i] + else + error("Syntax error: only one filename permitted"); + end + + i = i + 1 +end + +if not quiet then + print(string.format("makeglossaries.lua version %s", thisversion)) +end + +if infile == nil +then + error("Syntax error: missing filename") +end + +i, j = string.find(infile, "%.%a*$") + +ext = nil +inbase = infile + +if i ~= nil +then + ext = string.sub(infile, i, j); + + lext = string.lower(ext) + + inbase = string.sub(infile, 1, i-1); + + -- Just in case user has accidentally specified the aux or tex file + if lext == ".aux" or lext == ".tex" + then + ext = nil + infile = inbase + end +end + +auxfile = inbase..".aux" + +if not quiet then print(string.format("Parsing '%s'", auxfile)) end + +assert(io.input(auxfile), + string.format("Unable to open '%s'", auxfile)) + +aux = io.read("*a") + +if string.find(aux, "\\glsxtr@resource") ~= nil +then + isbib2gls = true +end + +if styfile == nil +then + +-- v4.36: corrected check for double-quotes + + styfile = string.match(aux, "\\@istfilename{([^}]*)}") + styfile = string.gsub(styfile, "\"", ""); + + if styfile == nil + then + if isbib2gls + then + error([[ +No \@istfilename found but found \glsxtr@resource. +You need to run bib2gls not makeglossaries-lite. + ]]) + else + error([[ +No \@istfilename found. +Did your LaTeX run fail? +Did your LaTeX run produce any output? +Did you remember to use \makeglossaries? + ]]) + end + end +end + +i = string.len(styfile) + +if string.sub(styfile, i-3, i) == ".xdy" +then + isxindy = true +end + +if not letterorder +then + if string.match(aux, "\\@glsorder{letter}") ~= nil + then + letterorder = true + end +end + +makeindex_extra = string.match(aux, "\\@gls@extramakeindexopts{([^}]*%.?%a*)}") + +if dryrun then print("Dry run mode. No commands will be executed.") end + +onlyname = nil + +glossaries = {} + +for name, glg, gls, glo in + string.gmatch(aux, "\\@newglossary{([^}]+)}{([^}]+)}{([^}]+)}{([^}]+)}") do + + if not quiet then + print(string.format("Found glossary type '%s' (%s,%s,%s)", + name, glg, gls, glo)) + end + + glossaries[name] = {} + + glossaries[name].glg = glg + glossaries[name].gls = gls + glossaries[name].glo = glo + + if "."..glo == ext then + + onlyname = name + + end + + if isxindy then + + if xindylang == nil then + glossaries[name].language = string.match(aux, + "\\@xdylanguage{"..name.."}{([^}]+)}"); + else + glossaries[name].language = xindylang + end + + glossaries[name].codepage = string.match(aux, + "\\@gls@codepage{"..name.."}{([^}]+)}"); + + end + +end + +onlytypes = string.match(aux, "\\glsxtr@makeglossaries{([^}]+)}") + +if onlytypes ~= nil +then + if not quiet then + print(string.format("Only process subset: '%s'", onlytypes)) + end + + onlyglossaries = {} + + for name in string.gmatch(onlytypes, '([^,]+)') do + onlyglossaries[name] = glossaries[name] + end + + glossaries = onlyglossaries +end + +if ext == nil +then + + done = false + + for name, value in pairs(glossaries) do + + glg = value.glg + gls = value.gls + glo = value.glo + + if logfile == nil then + glg = inbase .. "." .. glg + else + glg = logfile + end + + if outfile == nil then + gls = inbase .. "." .. gls + else + gls = outfile + end + + glo = infile .. "." .. glo + + dorun(name, glg, gls, glo, value.language, value.codepage) + + done = true + end + + if not done then + error([[ +No \@newglossary commands found in aux file. +Did you remember to use \makeglossaries? +Did you accidentally suppress the default glossary using "nomain" +and not provide an alternative glossary? +]]) + end + +else + + if onlyname == nil then + + glo = infile + gls = outfile + glg = logfile + + language = xindylang + codepage = 'utf8' + + if language == nil then language = 'english' end + + if gls == nil then gls = infile..".gls" end + + else + + value = glossaries[onlyname] + + glg = value.glg + gls = value.gls + glo = infile + + if logfile == nil then + glg = inbase .. "." .. glg + else + glg = logfile + end + + if outfile == nil then + gls = inbase .. "." .. gls + else + gls = outfile + end + + end + + if codepage == nil then + codepage = 'utf8'; + end + + dorun(onlyname, glg, gls, glo, language, codepage) +end diff --git a/macros/latex/contrib/glossaries/makeglossaries-lite.pod b/macros/latex/contrib/glossaries/makeglossaries-lite.pod new file mode 100644 index 0000000000..9d0bbe4d47 --- /dev/null +++ b/macros/latex/contrib/glossaries/makeglossaries-lite.pod @@ -0,0 +1,120 @@ +=head1 NAME + +makeglossaries-lite - Calls makeindex/xindy for LaTeX documents using glossaries package + +=head1 SYNOPSIS + +B [B<-o> I] [B<-q>] [B<-n>] +[B<-s> I] [B<-t> I] [B<-L> I] [B<-c>] [B<-g>] +[B<-l>] [B<-p> I] [B<-r>] [B<-m> I] [B<-x> I] +[B<--version>] [B<--help>] I + +=head1 DESCRIPTION + +B is cut-down Lua alternative to the +B Perl script. It's designed for use with LaTeX documents that +use the glossaries package. Some options that are available to +B aren't available with B. +The mandatory argument I should +be the name of the LaTeX document without the .tex extension. +B will read the auxiliary file to determine whether +B or B should be called. All the information +required to be passed to the relevant indexing application should +also be contained in the auxiliary file, but may be overridden by +the option arguments to B. + +=head1 OPTIONS + +=over 4 + +=item B<-q> + +Quiet mode. Reduces chatter to standard output. + +=item B<-n> + +Print the commands that would normally be executed but don't run +them. + +=item B<-o> I + +Use I as the output file. (Only suitable for documents +containing a single glossary, otherwise each glossary will be +overridden.) + +=item B<-s> I + +Use I as the style file. Note that if you use this option, +you need to know whether B or B will be called, as +they have different style files. + +=item B<-t> I + +Use I as the transcript file. + +=item B<-l> + +Letter ordering. + +=item B<-L> I + +This option only has an effect if B is called. Sets the +language. See B documentation for further details. + +=item B<-c> + +Compress intermediate blanks (B only). + +=item B<-g> + +Employ German word ordering (B only). + +=item B<-p> I + +Sets the starting page number to be I (B only). + +=item B<-r> + +Disable implicit page range formation (B only). + +=item B<-m> I + +Specify the full path name for B to I in the +event that B isn't on the operating system's path. + +=item B<-x> I + +Specify the full path name for B to I in the +event that B isn't on the operating system's path. + +=item B<--version> + +Prints version number and exits. + +=item B<--help> + +Prints help message and exits. + +=back + +=head1 REQUIRES + +texlua and makeindex or xindy (depending on glossaries package options). + +=head1 LICENSE + +This is free software distributed under the LaTeX Project Public +License. There is NO WARRANTY. +See L for details. + +=head1 AUTHOR + +Nicola L. C. Talbot, +L + +=head1 RECOMMENDED READING + +The glossaries manual: + + texdoc glossaries +=cut diff --git a/macros/latex/contrib/glossaries/makeglossaries.1 b/macros/latex/contrib/glossaries/makeglossaries.1 new file mode 100644 index 0000000000..640cf541d3 --- /dev/null +++ b/macros/latex/contrib/glossaries/makeglossaries.1 @@ -0,0 +1,243 @@ +.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +. ds C` +. ds C' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is >0, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX +.. +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{\ +. if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. if !\nF==2 \{\ +. nr % 0 +. nr F 2 +. \} +. \} +.\} +.rr rF +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "MAKEGLOSSARIES 1" +.TH MAKEGLOSSARIES 1 "2019-01-06" "perl v5.28.1" "makeglossaries Perl Script" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +makeglossaries \- Calls makeindex/xindy for LaTeX documents using glossaries package +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBmakeglossaries\fR [\fB\-o\fR \fIfile\fR] [\fB\-q\fR] [\fB\-Q\fR] [\fB\-k\fR] [\fB\-n\fR] +[\fB\-s\fR \fIfile\fR] [\fB\-t\fR \fIfile\fR] [\fB\-L\fR \fIlanguage\fR] [\fB\-c\fR] [\fB\-g\fR] [\fB\-l\fR] +[\fB\-p\fR \fInum\fR] [\fB\-r\fR] [\fB\-d\fR \fIaux dir\fR] [\fB\-m\fR \fIfile\fR] [\fB\-x\fR \fIfile\fR] +[\fB\-\-version\fR] [\fB\-\-help\fR] \fIbasename\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +\&\fBmakeglossaries\fR is designed for use with LaTeX documents that +use the glossaries package. The mandatory argument \fIbasename\fR should +be the name of the LaTeX document without the .tex extension. +\&\fBmakeglossaries\fR will read the auxiliary file to determine whether +\&\fBmakeindex\fR or \fBxindy\fR should be called. All the information +required to be passed to the relevant indexing application should +also be contained in the auxiliary file, but may be overridden by +the option arguments to \fBmakeglossaries\fR. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\fB\-q\fR" 4 +.IX Item "-q" +Quiet mode. Reduces chatter to standard output. +.IP "\fB\-Q\fR" 4 +.IX Item "-Q" +Silences warning about being unable to fork. +.IP "\fB\-k\fR" 4 +.IX Item "-k" +Don't try forking with piped redirection. (Lessens the +effect of \-q) +.IP "\fB\-n\fR" 4 +.IX Item "-n" +Print the commands that would normally be executed but don't run them. +.IP "\fB\-o\fR \fIfile\fR" 4 +.IX Item "-o file" +Use \fIfile\fR as the output file. (Only suitable for documents +containing a single glossary, otherwise each glossary will be +overridden.) +.IP "\fB\-s\fR \fIfile\fR" 4 +.IX Item "-s file" +Use \fIfile\fR as the style file. Note that if you use this option, +you need to know whether \fBmakeindex\fR or \fBxindy\fR will be called, as +they have different style files. +.IP "\fB\-t\fR \fIfile\fR" 4 +.IX Item "-t file" +Use \fIfile\fR as the transcript file. +.IP "\fB\-l\fR" 4 +.IX Item "-l" +Letter ordering. +.IP "\fB\-L\fR \fIlanguage\fR" 4 +.IX Item "-L language" +This option only has an effect if \fBxindy\fR is called. Sets the +language. See \fBxindy\fR documentation for further details. +.IP "\fB\-c\fR" 4 +.IX Item "-c" +Compress intermediate blanks (\fBmakeindex\fR only). +.IP "\fB\-g\fR" 4 +.IX Item "-g" +Employ German word ordering (\fBmakeindex\fR only). +.IP "\fB\-p\fR \fInum\fR" 4 +.IX Item "-p num" +Sets the starting page number to be \fInum\fR (\fBmakeindex\fR only). +.IP "\fB\-r\fR" 4 +.IX Item "-r" +Disable implicit page range formation (\fBmakeindex\fR only). +.IP "\fB\-d\fR \fIaux dir\fR" 4 +.IX Item "-d aux dir" +Specify the directory the .aux, .glo etc files are located. +Defaults to the parent directory of the base file \fIfilename\fR. +.IP "\fB\-m\fR \fIfile\fR" 4 +.IX Item "-m file" +Specify the full path name for \fBmakeindex\fR to \fIfile\fR in the +event that \fBmakeindex\fR isn't on the operating system's path. +.IP "\fB\-x\fR \fIfile\fR" 4 +.IX Item "-x file" +Specify the full path name for \fBxindy\fR to \fIfile\fR in the +event that \fBxindy\fR isn't on the operating system's path. +.IP "\fB\-\-version\fR" 4 +.IX Item "--version" +Prints version number and exits. +.IP "\fB\-\-help\fR" 4 +.IX Item "--help" +Prints help message and exits. +.SH "REQUIRES" +.IX Header "REQUIRES" +Perl, Getopt::Std, and makeindex or xindy (depending on glossaries +package options). +.SH "LICENSE" +.IX Header "LICENSE" +This is free software distributed under the LaTeX Project Public +License. There is \s-1NO WARRANTY.\s0 +See for details. +.SH "AUTHOR" +.IX Header "AUTHOR" +Nicola L. C. Talbot, + +.SH "RECOMMENDED READING" +.IX Header "RECOMMENDED READING" +The glossaries manual: +.PP +.Vb 1 +\& texdoc glossaries +.Ve diff --git a/macros/latex/contrib/glossaries/samples/README-samples b/macros/latex/contrib/glossaries/samples/README-samples new file mode 100644 index 0000000000..508aa54f98 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/README-samples @@ -0,0 +1,52 @@ +These are sample files illustrating the use of the glossaries +package. If you are new to this package, start with minimalgls.tex +to check you have glossaries correctly installed and to check that +you understand how to use it. + +1. Run minimalgls.tex through LaTeX ("compile the document") either +by typing + + latex minimalgls + +in a terminal or by using the relevant button or menu item in your +text editor or front-end. This will create the required associated +files but you will not see the glossary. If you use PDFLaTeX you +will also get warnings about non-existent references that look +something like: + +pdfTeX warning (dest): name{glo:aca} has been referenced but does +not exist, +replaced by a fixed one + +These warnings may be ignored on the first run. + +If you get a "Missing \begin{document}" error, then it's most likely +that your version of xkeyval.sty is out of date. Check the log file +for a warning of that nature. If this is the case, please update +your TeX distribution. + +2. Run makeglossaries on the document. This can be done on a +terminal either by typing + + makeglossaries minimalgls + +or by typing + + perl makeglossaries minimalgls + +If you don't have Perl installed you will need to run makeindex +directly: + + makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo + +Another alternative is to use the Java application makeglossariesgui +(http://ctan.org/pkg/makeglossariesgui) which has diagnostic tools +to help determine what has gone wrong if there's a problem. + +3. Repeat step 1. Your document minimalgls.pdf should now have a +glossary. + +If the above seems complicated, you can automate the process using +tools such as latexmk or arara. See +http://www.dickimaw-books.com/latex/thesis/html/build.html for +further details. diff --git a/macros/latex/contrib/glossaries/samples/database1.tex b/macros/latex/contrib/glossaries/samples/database1.tex new file mode 100644 index 0000000000..f9ecc9a420 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/database1.tex @@ -0,0 +1,24 @@ + % This is a sample database of glossary entries + % Only those entries used in the document with \glslink, \gls, + % \glspl, and uppercase variants will have entries in the + % glossary. Note that the type key is not used, as the + % glossary type can be specified in \loadglsentries + +\newglossaryentry{array}{name=array, +description={A list of values identified by a numeric value}} + +\newglossaryentry{binary}{name=binary, +description={Pertaining to numbers represented in base 2}} + +\newglossaryentry{comment}{name=comment, +description={A remark that doesn't affect the meaning of the +code}} + +\newglossaryentry{global}{name=global, +description={Something that maintains its state when it leaves +the current group}} + +\newglossaryentry{local}{name=local, +description={Something that only maintains its state until +it leaves the group in which it was defined/changed}} + diff --git a/macros/latex/contrib/glossaries/samples/database2.tex b/macros/latex/contrib/glossaries/samples/database2.tex new file mode 100644 index 0000000000..55bc08a1c4 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/database2.tex @@ -0,0 +1,22 @@ + % This is a sample database of glossary entries + % Only those entries used in the document with \glslink, \gls, + % \glspl, and uppercase variants will have entries in the + % glossary. Note that the type key is not used, as the + % glossary type can be specified in \loadglsentries + + % Don't need to worry about makeindex special characters +\newglossaryentry{quote}{name={"}, +description={the double quote symbol}} + +\newglossaryentry{at}{name={@}, +description={the ``at'' symbol}} + +\newglossaryentry{excl}{name={!}, +description={the exclamation mark symbol}} + +\newglossaryentry{bar}{name={\ensuremath{|}}, +description={the vertical bar symbol}} + +\newglossaryentry{hash}{name={\#}, +description={the hash symbol}} + diff --git a/macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.pdf b/macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.pdf new file mode 100644 index 0000000000..e42dac1305 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.tex b/macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.tex new file mode 100644 index 0000000000..c8fa373feb --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/glossary-lipsum-examples.tex @@ -0,0 +1,221 @@ + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex + % arara: bibtex + % arara: pdflatex + % arara: pdflatex +\documentclass{report} + +\usepackage{graphicx} + +\usepackage[colorlinks]{hyperref} +\usepackage[savewrites,nopostdot,toc,acronym,symbols]{glossaries} +\usepackage{glossary-mcols} +\usepackage{glossary-longragged} + +\newglossary*{symbolname}{Entries with Symbols in the Name} +\newglossary*{long}{Long Descriptions} +\newglossary*{multipar}{Multi-Paragraph Descriptions} +\newglossary*{acronymdesc}{Acronyms with Descriptions} +\newglossary*{images}{Descriptions with Images} +\newglossary*{acronymslang}{Acronyms with Translations} + +\newglossary*{parent}{Hierarchical Entries} +\newglossary*{homographs}{Homographs} +\newglossary*{cites}{Entries with Citations} +\newglossary*{urls}{Entries with URLs} + +\DeclareAcronymList{acronymdesc,acronymslang} + +\makeglossaries + +\loadglsentries{example-glossaries-brief} +\loadglsentries[long]{example-glossaries-long} +\loadglsentries[multipar]{example-glossaries-multipar} +\loadglsentries[symbols]{example-glossaries-symbols} +\loadglsentries[symbolname]{example-glossaries-symbolnames} +\loadglsentries[images]{example-glossaries-images} +\loadglsentries[parent]{example-glossaries-parent} +\loadglsentries[homographs]{example-glossaries-childnoname} +\loadglsentries[cites]{example-glossaries-cite} +\loadglsentries[urls]{example-glossaries-url} + +\setacronymstyle{long-short} + +\loadglsentries[acronym]{example-glossaries-acronym} + +\setacronymstyle{long-short-desc} + +\loadglsentries[acronymdesc]{example-glossaries-acronym-desc} + + % define an acronym style for the acronyms with a translation: + +\newacronymstyle{acronymslang}% +{% + \GlsUseAcrEntryDispStyle{long-short}% +} +{% + \GlsUseAcrStyleDefs{short-long}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}}% + \ifglshasfield{useri}{##1}% + {, English: \glsentryuseri{##1}}{})% + }% +} + +\setacronymstyle{acronymslang} + +\loadglsentries[acronymslang]{example-glossaries-acronyms-lang} + + % Define a style for the "images" glossary. The image names are + % stored in the user1 key. + % (The image insertion can probably be done more neatly using an + % appropriate package, but this is just a sample file.) + +\newsavebox\glsimagebox +\newlength\glswidth + +\newglossarystyle{images}% +{% + \setglossarystyle{tree}% + \renewenvironment{theglossary}{}{}% + \renewcommand{\glossentry}[2]{% + \ifglshasfield{useri}{##1}% + {\savebox + {\glsimagebox}% + {\includegraphics[height=4\baselineskip]{\glsentryuseri{##1}}}% + \settowidth{\glswidth}{\usebox\glsimagebox}% + \glswidth=\dimexpr\linewidth-\glswidth-1em\relax + \parshape=5 + 0pt \glswidth + 0pt \glswidth + 0pt \glswidth + 0pt \glswidth + 0pt \linewidth\relax + }% + {% + \savebox{\glsimagebox}{}% + }% + \noindent + \makebox[0pt][l]{% + \smash{\makebox[\linewidth][r]{\raisebox{-3\baselineskip}{\usebox\glsimagebox}}}}% + \glsentryitem{##1}\textbf{\glstarget{##1}{\glossentryname{##1}}}% + \space\glossentrydesc{##1}\par + \indexspace + }% + \renewcommand*{\glsgroupskip}{}% +} + + % glossary style for acronyms with a translation + +\newglossarystyle{acronymslang} +{% + \setglossarystyle{long}% + \renewcommand*{\glsgroupskip}{}% + \renewcommand{\glossentry}[2]{% + \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & + \glossentrydesc{##1}\glspostdescription + \ifglshasfield{useri}{##1}{ (English: \glsentryuseri{##1})}{}% + \space ##2\tabularnewline + }% +} + + % glossary style for the cites glossary + +\newglossarystyle{cites} +{% based on list style + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription + \ifglshasfield{useri}{##1}{\space + % in the event of multiple cites (as in the vestibulum2 + % sample entry), \glsentryuseri{##1} needs to be expanded + % before being passed to \cite. + \glsletentryfield{\thiscite}{##1}{useri}% + (See \expandafter\cite\expandafter{\thiscite})}{}% + \space ##2}% +} + + % glossary style for the urls glossary + +\newglossarystyle{urls} +{% based on list style + \setglossarystyle{list}% + \renewcommand{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription\space##2% + \ifglshasfield{useri}{##1}{\glspar + \glsletentryfield{\thisurl}{##1}{useri}% + \expandafter\url\expandafter{\thisurl}}{}}% +} + +\begin{document} +\tableofcontents + +\chapter{Sample} + +This is a sample document that uses the dummy glossary entries +supplied with the glossaries bundle for testing. + +Here are all the entries (including acronyms): + +\forallglossaries{\thistype}{\section{Glossary `\thistype'} +\forglsentries[\thistype]{\thislabel}{\gls{\thislabel}. }} + +\section{Acronyms Revisited} + +Here are just the acronyms again: +\forallacronyms{\thistype}{\forglsentries[\thistype]{\thislabel}{\gls{\thislabel}. }} + +\printglossary[style=mcolindex,title={Brief Descriptions}] + +\printglossary[type=long,style=list] + +\printglossary[type=multipar,style=altlist] + +\printglossary[type=symbols,style=altlongragged4col,nogroupskip] + +\printglossary[type=symbolname,style=list,nogroupskip] + +\printglossary[type=acronym,style=long] + +\printglossary[type=acronymdesc,style=altlist] + +\printglossary[type=images,style=images] + +\printglossary[type=acronymslang,style=acronymslang] + +\printglossary[type=homographs,style=mcoltreenoname,subentrycounter] + +\printglossary[type=parent,style=tree] + +\printglossary[type=cites,style=cites,nopostdot=false,nogroupskip] + +\printglossary[type=urls,style=urls,nopostdot=false,nogroupskip] + +\bibliographystyle{plain} +\bibliography{xampl} + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/minimalgls.pdf b/macros/latex/contrib/glossaries/samples/minimalgls.pdf new file mode 100644 index 0000000000..fc55ed5575 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/minimalgls.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/minimalgls.tex b/macros/latex/contrib/glossaries/samples/minimalgls.tex new file mode 100644 index 0000000000..5053aa0a12 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/minimalgls.tex @@ -0,0 +1,87 @@ + % This file is public domain. + % + % This is a minimal file for testing and debugging + % the glossaries package. Change the class file as + % desired, and add the relevant package options to + % both the class file and the glossaries package. + % Change the sample glossary entry and acronym if + % required. If the problem occurs with an additional + % glossary, add in the relevant \newglossary command + % and a sample entry. + % + % Only add extra packages or commands if they + % contribute to whatever problem you are trying to + % test. + % + % Remember that the document will not be complete + % until you have successfully completed all of the + % following steps: + % 1. latex minimalgls + % 2. makeglossaries minimalgls (note no extension) + % 3. latex minimalgls + % A further run through LaTeX will be required to ensure that + % the table of contents is up to date if the toc option + % is used. + % Alternatively, if you use arara, you can add the following + % directives in your document: + % + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + + % If you require multilingual support you must also install + % the appropriate glossaries language module. The language + % modules are distributed separately. + +\documentclass{article} +\listfiles + +\usepackage[colorlinks]{hyperref} + %\usepackage{glossaries} % abbreviation will go in main glossary + \usepackage[acronym]{glossaries} % make a separate list of acronyms + +\makeglossaries + +\longnewglossaryentry{par}{name={par}}% +{% + A long description with a paragraph break. + + This is the next paragraph. +} + +\newglossaryentry{sample}{name={sample}, +description={a sample entry}} + + % set the acronym style: +\setacronymstyle{long-short} + + % This contrived acronym has non-standard plural forms. + % These are specified in the optional argument. + % Remove the optional argument to revert to the default + % plurals. +\newacronym[\glsshortpluralkey=cas,\glslongpluralkey=contrived +acronyms]{aca}{aca}{a contrived acronym} + + % Keep all definitions in the preamble! + +\begin{document} + +A \gls{sample} entry and \gls{aca}. Second use: \gls{aca}. + +Plurals: \glspl{sample}. Reset acronym\glsreset{aca}. +First use: \glspl{aca}. Second use: \glspl{aca}. + +\glsresetall +First letter upper case: \Gls{sample}. First use: \Gls{aca}. +Subsequent use: \Gls{aca}. +\glsresetall +Plurals: \Glspl{sample}. First use: \Glspl{aca}. Next: \Glspl{aca}. + +If you want paragraph breaks in the description use +\verb|\longnewglossaryentry|, as with entry \gls{par}. + +Title case a particular field: +\glslink{sample}{\glsentrytitlecase{sample}{desc}}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/mwe-acr-desc.pdf b/macros/latex/contrib/glossaries/samples/mwe-acr-desc.pdf new file mode 100644 index 0000000000..7d39d828cb Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/mwe-acr-desc.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/mwe-acr-desc.tex b/macros/latex/contrib/glossaries/samples/mwe-acr-desc.tex new file mode 100644 index 0000000000..1cb34e284f --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/mwe-acr-desc.tex @@ -0,0 +1,26 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\setacronymstyle{short-long-desc} + +\newacronym[description={a device that emits a narrow beam of +light}]{laser}{laser}{light amplification by stimulated +emission of radiation} + +\begin{document} + +First use: \gls{laser}. + +Next use: \gls{laser} or \glspl{laser}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/mwe-acr.pdf b/macros/latex/contrib/glossaries/samples/mwe-acr.pdf new file mode 100644 index 0000000000..0056b9f4af Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/mwe-acr.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/mwe-acr.tex b/macros/latex/contrib/glossaries/samples/mwe-acr.tex new file mode 100644 index 0000000000..46b36dcc25 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/mwe-acr.tex @@ -0,0 +1,25 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\setacronymstyle{long-short} + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + +\begin{document} + +First use: \gls{laser}. + +Next use: \gls{laser} or \glspl{laser}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/mwe-gls.pdf b/macros/latex/contrib/glossaries/samples/mwe-gls.pdf new file mode 100644 index 0000000000..4a1f8d2516 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/mwe-gls.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/mwe-gls.tex b/macros/latex/contrib/glossaries/samples/mwe-gls.tex new file mode 100644 index 0000000000..9c5e7c6bc4 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/mwe-gls.tex @@ -0,0 +1,20 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\newglossaryentry{apple}{name={apple},description={a fruit}} + +\begin{document} + +\Gls{apple} or \gls{apple} or \glspl{apple}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-FnDesc.pdf b/macros/latex/contrib/glossaries/samples/sample-FnDesc.pdf new file mode 100644 index 0000000000..00eaff2cf3 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-FnDesc.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-FnDesc.tex b/macros/latex/contrib/glossaries/samples/sample-FnDesc.tex new file mode 100644 index 0000000000..e4c5d87d3d --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-FnDesc.tex @@ -0,0 +1,29 @@ + % This file is public domain + % If you are using arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[hyperfirst=false]{glossaries} + +\makeglossaries + +\renewcommand*{\glsentryfmt}{% + \glsgenentryfmt + \ifglsused{\glslabel}{}{\footnote{\glsentrydesc{\glslabel}}}% +} + +\newglossaryentry{sample}{name={sample},description={an example +description}} + +\begin{document} +\chapter{Sample Chapter} + +First use: \gls{sample}. + +Next use: \gls{sample}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.pdf b/macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.pdf new file mode 100644 index 0000000000..8ad12720ae Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.tex b/macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.tex new file mode 100644 index 0000000000..4e74e2e059 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-chap-hyperfirst.tex @@ -0,0 +1,59 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{chapter}{0}{\glschapnum} + +\loadglsentries{example-glossaries-brief} + +\renewcommand*{\glslinkpostsetkeys}{% + \edef\currentchap{\arabic{chapter}}% + \ifnum\currentchap=\glschapnum{\glslabel}\relax + % Already used this entry in the current chapter, so switch + % off the hyperlink. + \setkeys{glslink}{hyper=false}% + \else + % Hasn't been used in the current chapter. Update the value + % of the "chapter" field unless the hyperlink has been switched + % off. + \glsifhyperon + {% + \glsfieldxdef{\glslabel}{chapter}{\currentchap}% + }% + {}% + \fi +} + +\begin{document} +\chapter{Sample} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Another} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Start with a Star} + +Use all entries but suppress hyperlink: +\forglsentries{\thislabel}{\gls*{\thislabel}. } + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-crossref.pdf b/macros/latex/contrib/glossaries/samples/sample-crossref.pdf new file mode 100644 index 0000000000..1037320f51 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-crossref.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-crossref.tex b/macros/latex/contrib/glossaries/samples/sample-crossref.tex new file mode 100644 index 0000000000..8aaca674da --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-crossref.tex @@ -0,0 +1,36 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\makeglossaries + +\renewcommand{\glsseeitemformat}[1]{\textsc{\glsentryname{#1}}} + +\newglossaryentry{pear}{name=pear, +description={an oddly shaped fruit}} + +\newglossaryentry{apple}{name=apple, +description={firm, round fruit}, +see=[see also]{pear}} + +\newglossaryentry{banana}{name=banana, +description={a yellow fruit with an even odder shape than +a \gls{pear}}} + +\newglossaryentry{fruit}{name=fruit, +description={sweet, fleshy product of plant containing seed}} + +\glssee{fruit}{pear,apple,banana} + +\begin{document} +\gls{pear}, \gls{apple} and \gls{banana}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-custom-acronym.pdf b/macros/latex/contrib/glossaries/samples/sample-custom-acronym.pdf new file mode 100644 index 0000000000..f84073b018 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-custom-acronym.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-custom-acronym.tex b/macros/latex/contrib/glossaries/samples/sample-custom-acronym.tex new file mode 100644 index 0000000000..95b78a2773 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-custom-acronym.tex @@ -0,0 +1,152 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[acronym,% create list of acronyms + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain + ]{glossaries} + +\makeglossaries + + % This is a sample file to illustrate how to define a custom + % acronym style. This example defines the acronyms so that on first use + % they display the short form in the text and with the long form + % and description in a footnote. In the main body of the + % document the short form will be displayed in small caps, but in + % the list of acronyms the short form is displayed in normal + % capitals. To ensure this, the short form should be written in + % lower case when the acronym is defined, and \MakeTextUppercase is + % used when it's displayed in the list of acronyms. + +\newacronymstyle{custom-fn}% new style name +{% Check for long form in case of a mixed glossary + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% Style definitions: + % User needs to supply the description: + \renewcommand*{\GenericAcronymFields}{}% + % Need to ensure hyperlinks are switched off on first use: + \glshyperfirstfalse + % Redefine the commands used by \glsgenacfmt on first use: + \renewcommand*{\genacrfullformat}[2]{% + \firstacronymfont{\glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \firstacronymfont{\Glsentryshort{##1}}##2% + \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \firstacronymfont{\glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \firstacronymfont{\Glsentryshortpl{##1}}##2% + \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + % Redefine the no-link full forms: + \renewcommand*{\glsentryfull}[1]{% + \glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Glsentryfull}[1]{% + \Glsentrylong{##1}\space(\acronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\glsentryfullpl}[1]{% + \glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Glsentryfullpl}[1]{% + \Glsentrylongpl{##1}\space(\acronymfont{\glsentryshortpl{##1}})% + }% + % Redefine the link full forms: + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylong{##2}##3\space(\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylong{##2}##3\space(\acronymfont{\glsentryshort{##2}})% + }% + }% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylong{##2}##3\space + (\acronymfont{\glsentryshort{##2}})% + }% + }% + }% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{% + \Glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \MakeTextUppercase{% + \glsentrylongpl{##2}##3\space + (\acronymfont{\glsentryshortpl{##2}})% + }% + }% + }% + % Use smallcaps for the acronym in the document text: + \renewcommand*{\acronymfont}[1]{\textsc{##1}}% + \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}% + % Sort acronyms according to the long form: + \renewcommand*{\acronymsort}[2]{##2}% + % Set the name in the list of acronyms to the long form followed by + % the short form (in upper case) in parentheses: + \renewcommand*{\acronymentry}[1]{% + \Glsentrylong{##1}\space(\MakeTextUppercase{\glsentryshort{##1}})}% +} + + % Now set the new acronym style (to override the default style) +\setacronymstyle{custom-fn} + + % Set an appropriate glossary style: +\setglossarystyle{altlist} + + % Now define the acronyms (must be done after setting the custom + % style) + +\newacronym[description={set of tags for use in developing hypertext +documents}]{html}{html}{hyper text markup language} + +\newacronym[description={language used to describe the layout of a +document written in a markup language}]{css}{css}{cascading style +sheet} + +\begin{document} + +\gls{css}. \gls{html}. + +\gls{css}. \gls{html}. + +No-link full forms: \glsentryfull{css}, \Glsentryfull{css}. +Linking full forms: \acrfull{css}, \Acrfull{css}, \ACRfull{css}. +Linking with insert: \acrfull{css}['s], \Acrfull{css}['s], +\ACRfull{css}['s]. + +Now test plurals. + +No-link full forms: \glsentryfullpl{html}, \Glsentryfullpl{html}. +Linking full forms: \acrfullpl{html}, \Acrfullpl{html}, \ACRfullpl{html}. +Linking with insert: \acrfullpl{html}['s], \Acrfullpl{html}['s], +\ACRfullpl{html}['s]. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-dot-abbr.pdf b/macros/latex/contrib/glossaries/samples/sample-dot-abbr.pdf new file mode 100644 index 0000000000..c5a28552ae Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-dot-abbr.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex b/macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex new file mode 100644 index 0000000000..094fcf76dd --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-dot-abbr.tex @@ -0,0 +1,92 @@ + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{abbrtype}{word}{\abbrtype} + +\setacronymstyle{long-short} + +\newcommand*{\newabbr}[1][]{% + \newacronym[abbrtype=initials,#1]} + +\newabbr{eg}{e.g.}{exempli gratia} +\newabbr{ie}{i.e.}{id est} +\newabbr{bsc}{B.Sc.}{Bachelor of Science} +\newabbr{ba}{B.A.}{Bachelor of Arts} +\newabbr{agm}{A.G.M.}{annual general meeting} + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + + % See the sample-initialisms.tex example file provided with + % glossaries-extra.sty for a better way of doing this. + +\makeatletter +\renewcommand{\glspostlinkhook}{% + \ifglsfieldeq{\glslabel}{abbrtype}{initials}% + {\new@ifnextchar.\doendsentence\doendword} + {}% +} +\makeatother + +\newcommand{\doendsentence}[1]{\spacefactor=10000{}} +\newcommand{\doendword}{\spacefactor=1000{}} + +\begin{document} +This is a sample document that illustrates abbreviations with +full stops (periods) and abbreviations that are words (i.e.\ +acronyms). The examples switch to a typewriter font to make it +easier to see the inter-word and inter-sentence spaces. + +The extension package glossaries-extra.sty provides a better way of +doing this. + +First use: \gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} end of +sentence. + +End of sentence use: + +\ttfamily + +\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}. +Done. + +laser. e.g. i.e. B.Sc. B.A\@. A.G.M\@. Done. + +\rmfamily + +Mid-sentence use: + +\ttfamily + +\gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} Done. + +laser e.g.\ i.e.\ B.Sc.\ B.A. A.G.M. Done. + +\rmfamily + +Check other sentence terminators: + +\ttfamily + +\gls{laser}? \gls{eg}? \gls{ie}? \gls{bsc}! \gls{ba}! \gls{agm}? Done. + +laser? e.g.? i.e.? B.Sc.! B.A.! A.G.M.? Done. + +\rmfamily + +\glsresetall Reset. End of sentence use: + +\ttfamily + +\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}. +Done. + +\rmfamily +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-dual.pdf b/macros/latex/contrib/glossaries/samples/sample-dual.pdf new file mode 100644 index 0000000000..a2061a2b9b Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-dual.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-dual.tex b/macros/latex/contrib/glossaries/samples/sample-dual.tex new file mode 100644 index 0000000000..0015f9385a --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-dual.tex @@ -0,0 +1,33 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[acronym]{glossaries} + + % \newdualentry[main options]{label}{short}{long}{description} + +\newcommand*{\newdualentry}[5][]{% + \newglossaryentry{main-#2}{name={#4},% + text={#3\glsadd{#2}},% + description={#5},% + #1 + }% + \newacronym{#2}{#3\glsadd{main-#2}}{#4} +} + +\newdualentry{svm}% label + {SVM}% abbreviation + {support vector machine}% long form + {Statistical pattern recognition technique}% description + +\makeglossaries + +\begin{document} + +\gls{svm}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-entrycount.pdf b/macros/latex/contrib/glossaries/samples/sample-entrycount.pdf new file mode 100644 index 0000000000..af2438de51 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-entrycount.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-entrycount.tex b/macros/latex/contrib/glossaries/samples/sample-entrycount.tex new file mode 100644 index 0000000000..01f331440c --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-entrycount.tex @@ -0,0 +1,35 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage + [nomain,% 'nomain' is used to suppress the main glossary + acronym% 'acronym' is used to create the 'acronym' glossary + ] + {glossaries} +\makeglossaries + +\glsenableentrycount + +\setacronymstyle{long-short} + +\newacronym{html}{HTML}{hypertext markup language} +\newacronym{css}{CSS}{cascading style sheets} +\newacronym{xml}{XML}{extensible markup language} +\newacronym{sql}{SQL}{structured query language} +\newacronym{rdbms}{RDBMS}{relational database management system} +\newacronym{rdsms}{RDSMS}{relational data stream management system} + +\begin{document} +These entries are only used once: \cgls{sql}, \cgls{rdbms}, +\cgls{xml}. These entries are used multiple times: +\cgls{html}, \cgls{html}, \cgls{css}, \cgls{css}, \cgls{css}, +\cgls{rdsms}, \cgls{rdsms}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-entryfmt.pdf b/macros/latex/contrib/glossaries/samples/sample-entryfmt.pdf new file mode 100644 index 0000000000..407ea6961f Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-entryfmt.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-entryfmt.tex b/macros/latex/contrib/glossaries/samples/sample-entryfmt.tex new file mode 100644 index 0000000000..a057805db1 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-entryfmt.tex @@ -0,0 +1,28 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[style=tree]{glossaries} + +\makeglossaries + +\renewcommand*{\glsentryfmt}{% + \glsgenentryfmt + \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}% +} + +\newglossaryentry{distance}{name=distance, +description={The length between two points}, +symbol={km}} + +\begin{document} + +First use: \gls{distance}. Next use: \gls{distance}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-font-abbr.pdf b/macros/latex/contrib/glossaries/samples/sample-font-abbr.pdf new file mode 100644 index 0000000000..8a9ee959e1 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-font-abbr.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-font-abbr.tex b/macros/latex/contrib/glossaries/samples/sample-font-abbr.tex new file mode 100644 index 0000000000..c7b04e192b --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-font-abbr.tex @@ -0,0 +1,63 @@ + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{font}{}{\entryfont} + +\newacronymstyle{long-font-short} +{% + \GlsUseAcrEntryDispStyle{long-short}% +} +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}% + \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}% +} + +\setacronymstyle{long-font-short} + +\newcommand*{\newitabbr}[1][]{\newacronym[font=\em,#1]} +\newcommand*{\newupabbr}[1][]{\newacronym[#1]} + +\newitabbr{eg}{e.g.}{exempli gratia} +\newitabbr{ie}{i.e.}{id est} + +\newupabbr{bsc}{BSc}{Bachelor of Science} +\newupabbr{ba}{BA}{Bachelor of Arts} +\newupabbr{agm}{AGM}{annual general meeting} + +\begin{document} + +First use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}. + +Next use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}. + +Short: \acrshort{eg} \acrshort{ie} \acrshort{bsc} \acrshort{ba} +\acrshort{agm}. + +Full: \acrfull{eg} \acrfull{ie} \acrfull{bsc} \acrfull{ba} +\acrfull{agm}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-ignored.pdf b/macros/latex/contrib/glossaries/samples/sample-ignored.pdf new file mode 100644 index 0000000000..23bf60a938 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-ignored.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-ignored.tex b/macros/latex/contrib/glossaries/samples/sample-ignored.tex new file mode 100644 index 0000000000..090c755c95 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-ignored.tex @@ -0,0 +1,25 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\newignoredglossary{common} + +\makeglossaries + +\newglossaryentry{sample}{name={sample},description={an example}} + +\newglossaryentry{commonex}{type=common,name={common term}} + +\begin{document} + +\gls{sample}. \gls{commonex}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-index.pdf b/macros/latex/contrib/glossaries/samples/sample-index.pdf new file mode 100644 index 0000000000..80f293a51b Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-index.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-index.tex b/macros/latex/contrib/glossaries/samples/sample-index.tex new file mode 100644 index 0000000000..1f2441dbed --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-index.tex @@ -0,0 +1,61 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[toc,index,nohypertypes={index}]{glossaries} +\usepackage{glossary-mcols} + +\makeglossaries + + % define terms for the index + +\newterm[plural={stegosauruses}]{stegosaurus} +\newterm[plural={triceratopses}]{triceratops} +\newterm[plural={apatosauruses}]{apatosaurus} + + % To avoid labels conflicting with the same name in the main glossary + % prefix the index label with "ind-". (This means that the name must + % be set independently.) +\newterm[name={dinosaur}]{ind-dinosaur} +\newterm[name={Triassic}]{ind-triassic} + + % define terms for the main glossary + +\newglossaryentry{dinosaur}% +{% + name={dinosaur\glsadd{ind-dinosaur}},% + description={One of a group of dinosauria}% +} + +\newglossaryentry{Triassic}% +{% + name={Triassic\glsadd{ind-triassic}},% + description={The first period of the Mesozoic Era} +} + +\begin{document} +\tableofcontents + +\chapter{Dinosaurs} + +\Glspl{dinosaur} are now extinct. They first appeared during the +\gls{Triassic} period. Examples of \glspl{dinosaur} include the +\gls{triceratops}, the \gls{apatosaurus} and the \gls{stegosaurus}. + +Indexed term: \gls{ind-dinosaur}. + +\renewcommand*{\glsnamefont}[1]{\textbf{\makefirstuc{#1}}} + +\printglossary[style=long,nogroupskip] + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\printindex[style=mcolindexgroup] + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-inline.pdf b/macros/latex/contrib/glossaries/samples/sample-inline.pdf new file mode 100644 index 0000000000..b6050b20cc Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-inline.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-inline.tex b/macros/latex/contrib/glossaries/samples/sample-inline.tex new file mode 100644 index 0000000000..08a4198aa5 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-inline.tex @@ -0,0 +1,146 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[toc,order=word,subentrycounter]{glossaries} + +\usepackage{glossary-inline} + +\renewcommand*{\glossarysection}[2][]{\textbf{#1}: } +\renewcommand{\glsnamefont}[1]{\textsc{#1}} +\setglossarystyle{inline} + +\makeglossaries + +\newglossaryentry{Perl}{name=\texttt{Perl}, +sort=Perl, % need a sort key because name contains a command +description=A scripting language} + +\newglossaryentry{glossary}{name=glossary, +description={\nopostdesc}, +plural={glossaries}} + +\newglossaryentry{glossarycol}{ +description={collection of glosses}, +sort={2}, +parent={glossary}} + +\newglossaryentry{glossarylist}{ +description={list of technical words}, +sort={1}, +parent={glossary}} + +\newglossaryentry{pagelist}{name=page list, + % description value has to be enclosed in braces + % because it contains commas +description={a list of individual pages or page ranges +(e.g.\ 1,2,4,7-9)}} + +\newglossaryentry{mtrx}{name=matrix, +description={rectangular array of quantities}, + % plural is not simply obtained by appending an s, so specify +plural=matrices} + + % entry with a paragraph break in the description + +\newglossaryentry{par}{name=paragraph, +description={distinct section of piece of +writing. Beginning on new, usually indented, line}} + + % entry with two types of plural. Set the plural form to the + % form most likely to be used. If you want to use a different + % plural, you will need to explicity specify it in \glslink +\newglossaryentry{cow}{name=cow, + % this isn't necessary, as this form (appending an s) is + % the default +plural=cows, + % description: +description={(\emph{pl.}\ cows, \emph{archaic} kine) an adult +female of any bovine animal}} + +\newglossaryentry{bravo}{name={bravo}, +description={\nopostdesc}} + +\newglossaryentry{bravo1}{description={cry of approval (pl.\ bravos)}, +sort={1}, +plural={bravos}, +parent=bravo} + +\newglossaryentry{bravo2}{description={hired ruffian or killer (pl.\ bravoes)}, +sort={2}, +plural={bravoes}, +parent=bravo} + +\newglossaryentry{seal}{name=seal,description={sea mammal with +flippers that eats fish}} + +\newglossaryentry{sealion}{name={sea lion}, +description={large seal}} + +\begin{document} + +\title{Sample Document Using glossary Package} +\author{Nicola Talbot} +\pagenumbering{alph}% prevent duplicate page link names if using PDF +\maketitle + +\pagenumbering{roman} +\tableofcontents + +\chapter{Introduction} +\pagenumbering{arabic} + +This document has a glossary in a footnote\footnote{\printglossaries}. + +A \gls{glossarylist} (definition~\glsrefentry{glossarylist}) is a +very useful addition to any technical document, although a +\gls{glossarycol} (definition~\glsrefentry{glossarycol}) can also +simply be a collection of glosses, which is another thing entirely. +Some documents have multiple \glspl{glossarylist}. + +Once you have run your document through \LaTeX, you +will then need to run the \texttt{.glo} file through +\texttt{makeindex}. You will need to set the output +file so that it creates a \texttt{.gls} file instead +of an \texttt{.ind} file, and change the name of +the log file so that it doesn't overwrite the index +log file (if you have an index for your document). +Rather than having to remember all the command line +switches, you can call the \gls{Perl} script +\texttt{makeglossaries} which provides a convenient +wrapper. + +If a comma appears within the name or description, grouping +must be used, e.g.\ in the description of \gls{pagelist}. + +\chapter{Plurals and Paragraphs} + +Plurals are assumed to have the letter s appended, but if this is +not the case, as in \glspl{mtrx}, then you need to specify the +plural when you define the entry. If a term may have multiple +plurals (for example \glspl{cow}/\glslink{cow}{kine}) then +define the entry with the plural form most likely to be used and +explicitly specify the alternative form using \verb|\glslink|. +\Glspl{seal} and \glspl{sealion} have regular plural forms. + +\Gls{bravo} is a homograph, but the plural forms are spelt +differently. The plural of \gls{bravo1}, a cry of approval +(definition~\glsrefentry{bravo1}), is \glspl{bravo1}, whereas the +plural of \gls{bravo2}, a hired ruffian or killer +(definition~\glsrefentry{bravo2}), is \glspl{bravo2}. + +\Glspl{par} can cause a problem in commands, so care is needed +when having a paragraph break in a \gls{glossarylist} entry. + +\chapter{Ordering} + +There are two types of ordering: word ordering (which places +``\gls{sealion}'' before ``\gls{seal}'') and letter ordering +(which places ``\gls{seal}'' before ``\gls{sealion}''). + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-langdict.pdf b/macros/latex/contrib/glossaries/samples/sample-langdict.pdf new file mode 100644 index 0000000000..300afc33cf Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-langdict.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-langdict.tex b/macros/latex/contrib/glossaries/samples/sample-langdict.tex new file mode 100644 index 0000000000..5c1484c93e --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-langdict.tex @@ -0,0 +1,46 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + + % This file also requires the glossaries-english + % and glossaries-french language modules. These must + % be installed in addition to installing the glossaries package. +\documentclass[english,french]{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{babel} + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. +\usepackage[nomain]{glossaries} + +\newglossary[glg]{english}{gls}{glo}{English to French} +\newglossary[flg]{french}{flx}{flo}{French to English} + +\makeglossaries + + % \newword{label}{english}{determiner}{french} +\newcommand*{\newword}[4]{% + \newglossaryentry{en-#1}{type=english,name={#2},description={#3 #4}}% + \newglossaryentry{fr-#1}{type=french,name={#3 #4},text={#4},sort={#4},description={#2}}% +} + +\newword{cat}{cat}{le}{chat} +\newword{mat}{mat}{la}{natte} + +\begin{document} +\selectlanguage{english} +The \gls{en-cat} sat on the \gls{en-mat}. + +\selectlanguage{french} +Le \gls{fr-cat} s'est repos\'e sur la \gls{fr-mat}. + +\selectlanguage{english} +\printglossary[type=english] + +\selectlanguage{french} +\printglossary[type=french] +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-newkeys.pdf b/macros/latex/contrib/glossaries/samples/sample-newkeys.pdf new file mode 100644 index 0000000000..300767a45d Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-newkeys.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-newkeys.tex b/macros/latex/contrib/glossaries/samples/sample-newkeys.tex new file mode 100644 index 0000000000..323b28665c --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-newkeys.tex @@ -0,0 +1,64 @@ + % This file is public domain + % If you are using arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[nopostdot,nogroupskip]{glossaries} + +\glsaddkey*% star version needed as default value needs expanding + {ed}% key + {\glsentrytext{\glslabel}ed}% default value + {\glsentryed}% command analogous to \glsentrytext + {\Glsentryed}% command analogous to \Glsentrytext + {\glsed}% command analogous to \glstext + {\Glsed}% command analogous to \Glstext + {\GLSed}% command analogous to \GLStext + +\glsaddkey* + {ing}% key + {\glsentrytext{\glslabel}ing}% default value + {\glsentrying}% command analogous to \glsentrytext + {\Glsentrying}% command analogous to \Glsentrytext + {\glsing}% command analogous to \glstext + {\Glsing}% command analogous to \Glstext + {\GLSing}% command analogous to \GLStext + +\makeglossaries + +\newglossaryentry{jump}{name={jump},description={}} + +\newglossaryentry{run}{name={run},% + ed={ran},% + ing={running}, + description={}} + +\newglossaryentry{waddle}{name={waddle},% + ed={waddled},% + ing={waddling},% + description={}} + +\begin{document} + +This is a sample document illustrating how to add new glossary entry +keys. + +The dog \glsed{jump} over the duck. + +The duck was \glsing{waddle} round the dog. + +The dog \glsed{run} away from the duck. + +First letter uppercase: \Glsed{jump}, \Glsing{jump}, +\Glsed{waddle}, \Glsing{waddle}, +\Glsed{run}, \Glsing{run}. + +All uppercase: \GLSed{jump}, \GLSing{jump}, +\GLSed{waddle}, \GLSing{waddle}, +\GLSed{run}, \GLSing{run}. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.pdf b/macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.pdf new file mode 100644 index 0000000000..7a922cd6ea Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.tex b/macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.tex new file mode 100644 index 0000000000..e8d2bfb8b6 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-noidxapp-utf8.tex @@ -0,0 +1,148 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: pdflatex +\documentclass{report} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} + +\usepackage[colorlinks]{hyperref} +\usepackage[index,symbols,nohypertypes={index}]{glossaries} +\usepackage{glossary-mcols} + +\makenoidxglossaries + +\renewcommand{\theHequation}{\theequation} + + % main entries + +\newglossaryentry{elite}{% + name={{é}lite}, + description={select group of people} +} + +\newglossaryentry{elephant}{% + name={elephant}, + description={very large mammal with tusks} +} + +\newglossaryentry{elk}{% + name={elk}, + description={large northern deer} +} + +\newglossaryentry{emigre}{% + name={{é}migré}, + description={person who has emigrated to another country, + especially for political reasons} +} + + % Symbols + +\newglossaryentry{set}{% + type=symbols, + name={$\mathcal{S}$}, + text={\mathcal{S}}, + sort={S}, + description={A set}} + +\newglossaryentry{U}{% + type=symbols, + name={$\mathcal{U}$}, + text={\mathcal{U}}, + sort={U}, + description={The universal set}} + +\newglossaryentry{card}{% + type=symbols, + name={$|\glsentrytext{set}|$}, + text={|\glsentrytext{set}|}, + sort={|}, + description={cardinality of $\gls{set}$}} + +\newglossaryentry{factorial}{% + type=symbols, + name={$!$}, + text={!}, + sort={!}, + description={factorial}} + + % index entries + +\newterm{seal} + +\newterm{dinosaur} + +\newterm[parent=dinosaur]{ceratopsidae} + +\newterm[parent=dinosaur,plural={stegosauruses}]{stegosaurus} +\newterm[parent=ceratopsidae,plural={triceratopses}]{triceratops} +\newterm[parent=ceratopsidae,plural={styracosauruses}]{styracosaurus} +\newterm[parent=dinosaur,plural={apatosauruses}]{apatosaurus} + +\newterm{Triassic} + +\newterm{Devonian} + +\newterm[see={[see also]seal}]{sea lion} + +\begin{document} + +\chapter{Mathematical Notation} + +The cardinality of a set $\gls{set}$ is denoted $\gls{card}$ +The $\gls{factorial}$ symbol indicates factorial. +$\gls{U}$ is the universal set. + +\glsaddall[types=main] + +\chapter{Dinosaurs} + +\Glspl{dinosaur} are now extinct. They first appeared during the +\gls{Triassic} period. Examples of \glspl{dinosaur} include the +\gls{triceratops}, the \gls{styracosaurus}, the \gls{apatosaurus} and the \gls{stegosaurus}. + +\Glspl{seal} and \glspl{sea lion} are marine mammals. +The \gls{Devonian} period was the age of fish. + +\glsaddall[types=main] + +\chapter{Location Lists} + +Dinosaur: \glsdisplaynumberlist{dinosaur}. + +Set: \glsdisplaynumberlist{set}. + +\Gls{elite}: \glsdisplaynumberlist{elite}. + +\begin{equation} +3\gls[counter=equation]{factorial} = 3 \times 2 \times 1 +\end{equation} + +\newcommand{\myhandler}[4]{% + Prefix: #1. + Counter: #2. + Format: #3. + Value: #4. + Link: \setentrycounter[#1]{#2}% + \csuse{#3}{#4}. + \par +} +\newcommand{\myxrhandler}[2][]{XR (#1): #2. } + +Factorial locations: +\glsnumberlistloop{factorial}{\myhandler}{\myxrhandler} + +Sea lion locations: +\glsnumberlistloop{sea lion}{\myhandler}{\myxrhandler} + +\printnoidxglossary[type=main,sort=word] + +\printnoidxglossary[type=symbols,sort=use] + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\printnoidxglossary[type=index,style=mcolindexgroup,sort=word] + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-noidxapp.pdf b/macros/latex/contrib/glossaries/samples/sample-noidxapp.pdf new file mode 100644 index 0000000000..9ed8e6191a Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-noidxapp.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-noidxapp.tex b/macros/latex/contrib/glossaries/samples/sample-noidxapp.tex new file mode 100644 index 0000000000..d2891729d3 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-noidxapp.tex @@ -0,0 +1,145 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[index,symbols,nohypertypes={index}]{glossaries} +\usepackage{glossary-mcols} + +\makenoidxglossaries + +\renewcommand{\theHequation}{\theequation} + + % main entries + +\newglossaryentry{elite}{% + name={{\'e}lite}, + description={select group of people} +} + +\newglossaryentry{elephant}{% + name={elephant}, + description={very large mammal with tusks} +} + +\newglossaryentry{elk}{% + name={elk}, + description={large northern deer} +} + +\newglossaryentry{emigre}{% + name={{\'e}migr\'e}, + description={person who has emigrated to another country, + especially for political reasons} +} + + % Symbols + +\newglossaryentry{set}{% + type=symbols, + name={$\mathcal{S}$}, + text={\mathcal{S}}, + sort={S}, + description={A set}} + +\newglossaryentry{U}{% + type=symbols, + name={$\mathcal{U}$}, + text={\mathcal{U}}, + sort={U}, + description={The universal set}} + +\newglossaryentry{card}{% + type=symbols, + name={$|\glsentrytext{set}|$}, + text={|\glsentrytext{set}|}, + sort={|}, + description={cardinality of $\gls{set}$}} + +\newglossaryentry{factorial}{% + type=symbols, + name={$!$}, + text={!}, + sort={!}, + description={factorial}} + + % index entries + +\newterm{seal} + +\newterm{dinosaur} + +\newterm[parent=dinosaur]{ceratopsidae} + +\newterm[parent=dinosaur,plural={stegosauruses}]{stegosaurus} +\newterm[parent=ceratopsidae,plural={triceratopses}]{triceratops} +\newterm[parent=ceratopsidae,plural={styracosauruses}]{styracosaurus} +\newterm[parent=dinosaur,plural={apatosauruses}]{apatosaurus} + +\newterm{Triassic} + +\newterm{Devonian} + +\newterm[see={[see also]seal}]{sea lion} + +\begin{document} + +\chapter{Mathematical Notation} + +The cardinality of a set $\gls{set}$ is denoted $\gls{card}$ +The $\gls{factorial}$ symbol indicates factorial. +$\gls{U}$ is the universal set. + +\glsaddall[types=main] + +\chapter{Dinosaurs} + +\Glspl{dinosaur} are now extinct. They first appeared during the +\gls{Triassic} period. Examples of \glspl{dinosaur} include the +\gls{triceratops}, the \gls{styracosaurus}, the \gls{apatosaurus} and the \gls{stegosaurus}. + +\Glspl{seal} and \glspl{sea lion} are marine mammals. +The \gls{Devonian} period was the age of fish. + +\glsaddall[types=main] + +\chapter{Location Lists} + +Dinosaur: \glsdisplaynumberlist{dinosaur}. + +Set: \glsdisplaynumberlist{set}. + +\Gls{elite}: \glsdisplaynumberlist{elite}. + +\begin{equation} +3\gls[counter=equation]{factorial} = 3 \times 2 \times 1 +\end{equation} + +\newcommand{\myhandler}[4]{% + Prefix: #1. + Counter: #2. + Format: #3. + Value: #4. + Link: \setentrycounter[#1]{#2}% + \csuse{#3}{#4}. + \par +} +\newcommand{\myxrhandler}[2][]{XR (#1): #2. } + +Factorial locations: +\glsnumberlistloop{factorial}{\myhandler}{\myxrhandler} + +Sea lion locations: +\glsnumberlistloop{sea lion}{\myhandler}{\myxrhandler} + +\printnoidxglossary[type=main,sort=word] + +\printnoidxglossary[type=symbols,sort=use] + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\printnoidxglossary[type=index,style=mcolindexgroup,sort=letter] + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-nomathhyper.pdf b/macros/latex/contrib/glossaries/samples/sample-nomathhyper.pdf new file mode 100644 index 0000000000..68f48c57ab Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-nomathhyper.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-nomathhyper.tex b/macros/latex/contrib/glossaries/samples/sample-nomathhyper.tex new file mode 100644 index 0000000000..16cc511eee --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-nomathhyper.tex @@ -0,0 +1,42 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\GlsDeclareNoHyperList{main} + +\makeglossaries + + % redefine \glsentryfmt so that it adds a hyperlink + % if not in math mode and the hyperlinks haven't been forced on +\renewcommand*{\glsentryfmt}{% + \ifmmode + \glsgenentryfmt + \else + \glsifhyperon + {\glsgenentryfmt}% hyperlink already on + {\glshyperlink[\glsgenentryfmt]{\glslabel}}% + \fi +} + + % define a sample entry: +\newglossaryentry{x}{name={x},description={sample entry}} + +\begin{document} +\chapter{Sample} +In text mode: \gls{x}. Inline maths: $\gls{x}$. Displayed +maths: +\[ + \gls{x} +\] + +Back to text mode again: \gls{x}. Don't check the first use flag: +\glstext{x}. Force on the hyperlink: \glstext+{x}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-numberlist.pdf b/macros/latex/contrib/glossaries/samples/sample-numberlist.pdf new file mode 100644 index 0000000000..b9a77de1ad Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-numberlist.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-numberlist.tex b/macros/latex/contrib/glossaries/samples/sample-numberlist.tex new file mode 100644 index 0000000000..24b93edb49 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-numberlist.tex @@ -0,0 +1,40 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[savenumberlist,counter=chapter]{glossaries} + +\makeglossaries + +\newglossaryentry{sample}{name=sample,description=an example} + +\begin{document} +\chapter{Introduction} + +This is a \glsentryname{sample} document. \Glsentryplural{sample} +are discussed in chapters~\glsdisplaynumberlist{sample}. + +\chapter{Sample Documents} + +\Gls{sample} documents are provided for testing and illustration +purposes. + +\chapter{More About Samples} + +Here's more information about \glspl{sample}. + +\chapter{Another chapter} + +A chapter about something else. + +\chapter{Another About Samples} + +Here's some more information about \glspl{sample}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-prefix.pdf b/macros/latex/contrib/glossaries/samples/sample-prefix.pdf new file mode 100644 index 0000000000..661bdee4eb Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-prefix.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-prefix.tex b/macros/latex/contrib/glossaries/samples/sample-prefix.tex new file mode 100644 index 0000000000..ab1260cc72 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-prefix.tex @@ -0,0 +1,73 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } + +\documentclass{article} + +\usepackage[colorlinks]{hyperref} +\usepackage[toc,acronym]{glossaries-prefix} + +\makeglossaries + +\newglossaryentry{sample}{name={sample}, + description={an example}, + prefix={a~}, + prefixplural={the\space}% +} + +\newglossaryentry{oeil}{name={oeil}, + plural={yeux}, + description={eye}, + prefix={l'}, + prefixplural={les\space}} + +\newacronym + [% + prefix={an\space},prefixfirst={a~}% + ]{svm}{SVM}{support vector machine} + +\newglossarystyle{plist}{% + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \Glsentryprefix{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \glossentrydesc{##1}\glspostdescription\space ##2}% +} + +\begin{document} + +\tableofcontents + +\section{Sample} + +First use: \pgls{sample}, \pgls{svm}, \pgls{oeil}. Next use: \pgls{sample}, \pgls{svm}, \pgls{oeil}. + +Reset. \glsresetall + +First use: \pglspl{sample}, \pglspl{svm}, \pglspl{oeil}. Next use: +\pglspl{sample}, \pglspl{svm}, \pglspl{oeil}. + +Reset. \glsresetall + +First use: \Pgls{sample}, \Pgls{svm}. Next use: \Pgls{sample}, \Pgls{svm}. + +Reset. \glsresetall + +First use: \Pglspl{sample}, \Pglspl{svm}. Next use: \Pglspl{sample}, \Pglspl{svm}. + +Reset. \glsresetall + +First use: \PGLS{sample}, \PGLS{svm}. Next use: \PGLS{sample}, \PGLS{svm}. + +Reset. \glsresetall + +First use: \PGLSpl{sample}, \PGLSpl{svm}. Next use: \PGLSpl{sample}, \PGLSpl{svm}. + +\printglossary[style=plist] + +\printacronyms +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-si.pdf b/macros/latex/contrib/glossaries/samples/sample-si.pdf new file mode 100644 index 0000000000..f8214a62e4 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-si.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-si.tex b/macros/latex/contrib/glossaries/samples/sample-si.tex new file mode 100644 index 0000000000..f304dab711 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-si.tex @@ -0,0 +1,22 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} +\usepackage{siunitx} +\usepackage[style=long4col]{glossaries} + +\makeglossaries + +\newglossaryentry{ohm}{% + name=ohm, + symbol={\si{\ohm}}, + description=unit of electrical resistance% +} + +\begin{document} +\glsaddallunused + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.pdf b/macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.pdf new file mode 100644 index 0000000000..85f8fdb628 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.tex b/macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.tex new file mode 100644 index 0000000000..cccfad6397 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-storage-abbr-desc.tex @@ -0,0 +1,147 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey + {abbrtype}% key/field name + {acronym}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required + +\newacronymstyle + {mystyle}% style name + {% Use the generic display + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + } + {% User needs to explicitly set the description + \renewcommand*{\GenericAcronymFields}{}% + % For the full format, test the value of the "abbrtype" key. + % If it's set to "acronym" put the short form first with + % the long form in brackets. + \renewcommand*{\genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % first letter upper case version: + \renewcommand*{\Genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % plural + \renewcommand*{\genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % plural and first letter upper case + \renewcommand*{\Genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % Just use the short form as the name part in the glossary: + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + % Sort by the short form: + \renewcommand*{\acronymsort}[2]{##1}% + % Just use the surrounding font for the short form: + \renewcommand*{\acronymfont}[1]{##1}% + % Same for first use: + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + % Default plural suffix if the plural isn't explicitly set + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + } + +\setacronymstyle{mystyle} + + % The default for "abbrtype" is "acronym" so we don't need + % this new key for acronyms: +\newacronym[description={system for detecting the position and +speed of aircraft, ships, etc}]{radar}{radar}{radio detecting +and ranging} + +\newacronym[description={device that creates a narrow beam +of intense light}]{laser}{laser}{light amplification by +stimulated emission of radiation} + +\newacronym[description={portable breathing device for +divers}]{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\newcommand*{\newinitialism}[4][]{% + \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% +} + +\newinitialism[description={mathematical manipulation of an +information signal}]{dsp}{DSP}{digital signal processing} +\newinitialism[description={device that allows customers of +financial institutions to perform transactions, such as +cash withdrawal, without the need for a teller}]{atm}{ATM} +{automated teller machine} + +\newcommand*{\newcontraction}[4][]{% + \newacronym[abbrtype=contraction,#1]{#2}{#3}{#4}% +} + +\newcontraction[description={front part of a ship below the +deck}]{focsle}{fo'c's'le}{forecastle} + +\newglossaryentry{apple}{name={apple},description={a fruit}} + +\newglossarystyle + {mystyle}% style name + {% base it on the "list" style + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \ifglshaslong{##1}% + { (\abbrtype{##1}: \glsentrylong{##1})\space}{}% + \glossentrydesc{##1}\glspostdescription\space ##2}% + } + +\setglossarystyle{mystyle} + +\begin{document} + +First use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}, \gls{focsle}. + +Next use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}, \gls{focsle}. + +Regular term: \gls{apple}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample-storage-abbr.pdf b/macros/latex/contrib/glossaries/samples/sample-storage-abbr.pdf new file mode 100644 index 0000000000..8b5d4e4ff9 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample-storage-abbr.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample-storage-abbr.tex b/macros/latex/contrib/glossaries/samples/sample-storage-abbr.tex new file mode 100644 index 0000000000..36949a2a6c --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample-storage-abbr.tex @@ -0,0 +1,112 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey + {abbrtype}% key/field name + {word}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required + +\newacronymstyle + {mystyle}% style name + {% Use the generic display + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + } + {% Put the long form in the description + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + % For the full format, test the value of the "abbrtype" key. + % If it's set to "word" put the short form first with + % the long form in brackets. + \renewcommand*{\genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % first letter upper case version: + \renewcommand*{\Genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % plural + \renewcommand*{\genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % plural and first letter upper case + \renewcommand*{\Genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % Just use the short form as the name part in the glossary: + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + % Sort by the short form: + \renewcommand*{\acronymsort}[2]{##1}% + % Just use the surrounding font for the short form: + \renewcommand*{\acronymfont}[1]{##1}% + % Same for first use: + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + % Default plural suffix if the plural isn't explicitly set + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + } + +\setacronymstyle{mystyle} + + % The default for "abbrtype" is "acronym" so we don't need + % this new key for acronyms: +\newacronym{radar}{radar}{radio detecting and ranging} +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} +\newacronym{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\newcommand*{\newinitialism}[4][]{% + \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% +} + +\newinitialism{dsp}{DSP}{digital signal processing} +\newinitialism{atm}{ATM}{automated teller machine} + +\begin{document} + +First use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}. + +Next use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample.pdf b/macros/latex/contrib/glossaries/samples/sample.pdf new file mode 100644 index 0000000000..9b1748e0da Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample.tex b/macros/latex/contrib/glossaries/samples/sample.tex new file mode 100644 index 0000000000..282eb7912b --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample.tex @@ -0,0 +1,166 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[toc,style=treenoname,order=word,subentrycounter]{glossaries} + +\makeglossaries + +\newglossaryentry{Perl}{name=\texttt{Perl}, +sort=Perl, % need a sort key because name contains a command +description=A scripting language} + +\newglossaryentry{glossary}{name=glossary, +description={\nopostdesc}, +plural={glossaries}} + +\newglossaryentry{glossarycol}{ +description={collection of glosses}, +sort={2}, +parent={glossary}} + +\newglossaryentry{glossarylist}{ +description={list of technical words}, +sort={1}, +parent={glossary}} + +\newglossaryentry{pagelist}{name=page list, + % description value has to be enclosed in braces + % because it contains commas +description={a list of individual pages or page ranges +(e.g.\ 1,2,4,7-9)}} + +\newglossaryentry{mtrx}{name=matrix, +description={rectangular array of quantities}, + % plural is not simply obtained by appending an s, so specify +plural=matrices} + + % Entry with a paragraph break in the description: + % (If you use \newglossaryentry, the paragraph break + % must be identified with \glspar not with \par or a blank line. + % It's easier to use \longnewglossaryentry.) + +\longnewglossaryentry{par}% label +{name=paragraph}% options +{% multi-paragraph description +distinct section of a piece of writing. + +Beginning on new, usually indented, line} + + % entry with two types of plural. Set the plural form to the + % form most likely to be used. If you want to use a different + % plural, you will need to explicity specify it in \glslink +\newglossaryentry{cow}{name=cow, + % this isn't necessary, as this form (appending an s) is + % the default +plural=cows, + % description: +description={(\emph{pl.}\ cows, \emph{archaic} kine) an adult +female of any bovine animal}} + +\newglossaryentry{bravo}{name={bravo}, +description={\nopostdesc}} + +\newglossaryentry{bravo1}{description={cry of approval (pl.\ bravos)}, +sort={1}, +plural={bravos}, +parent=bravo} + +\newglossaryentry{bravo2}{description={hired ruffian or killer (pl.\ bravoes)}, +sort={2}, +plural={bravoes}, +parent=bravo} + +\newglossaryentry{seal}{% + name=seal,% + description={sea mammal with flippers that eats fish} +} + +\newglossaryentry{sealion}{% + name={sea lion},% + description={large seal}% +} + + % If a value contains a comma, you must use braces to hide + % it from the key=value list parser. Take care to avoid + % accidentally introducing unwanted space as leading and trailing + % spaces within the braces aren't stripped. For example, + % text={ spurious space } will result in extra space appearing + % when the entry is referenced. +\newglossaryentry{spuriousspace}{% + name={space, spurious}, + text={spurious space}, + description={unwanted spaces accidentally introduced by +uncommented line breaks or attempts to pretty-print the \LaTeX\ code} +} + +\begin{document} + +\title{Sample Document Using the glossaries Package} +\author{Nicola Talbot} +\pagenumbering{alph}% prevent duplicate page link names if using PDF +\maketitle + +\pagenumbering{roman} +\tableofcontents + +\chapter{Introduction} +\pagenumbering{arabic} + +A \gls{glossarylist} (definition~\glsrefentry{glossarylist}) is a +very useful addition to any technical document, although a +\gls{glossarycol} (definition~\glsrefentry{glossarycol}) can also +simply be a collection of glosses, which is another thing entirely. +Some documents have multiple \glspl{glossarylist}. + +Once you have run your document through \LaTeX, you will then need +to run the \texttt{.glo} file through \texttt{makeindex} (default) +or \texttt{xindy}. You will need to set the output file so that the +indexing application +creates a \texttt{.gls} file instead of an \texttt{.ind} file, and +change the name of the log file so that it doesn't overwrite the +index log file (if you have an index for your document). Rather +than having to remember all the command line switches, you can call +the \gls{Perl} script \texttt{makeglossaries} which provides a +convenient wrapper. See +\href{https://www.dickimaw-books.com/latex/buildglossaries}{Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build} for help. + +If a comma appears within the name or description, grouping +must be used, e.g.\ in the description of \gls{pagelist}. +Be careful about \glspl{spuriousspace} appearing in your code. + +\chapter{Plurals and Paragraphs} + +Plurals are assumed to have the letter s appended, but if this is +not the case, as in \glspl{mtrx}, then you need to specify the +plural when you define the entry. If a term may have multiple +plurals (for example \glspl{cow}/\glslink{cow}{kine}) then +define the entry with the plural form most likely to be used and +explicitly specify the alternative form using \verb|\glslink| +(e.g.\ \glslink{cow}{kine}) +or \verb|\glsdisp| (e.g.\ \glsdisp{cow}{kine}). +\Glspl{seal} and \glspl{sealion} have regular plural forms. + +\Gls{bravo} is a homograph, but the plural forms are spelt +differently. The plural of \gls{bravo1}, a cry of approval +(definition~\glsrefentry{bravo1}), is \glspl{bravo1}, whereas the +plural of \gls{bravo2}, a hired ruffian or killer +(definition~\glsrefentry{bravo2}), is \glspl{bravo2}. + +\Glspl{par} can cause a problem in commands, so care is needed +when having a paragraph break in a \gls{glossarylist} entry. + +\chapter{Ordering} + +There are two types of ordering: word ordering (which places +``\gls{sealion}'' before ``\gls{seal}'') and letter ordering +(which places ``\gls{seal}'' before ``\gls{sealion}''). + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sample4col.pdf b/macros/latex/contrib/glossaries/samples/sample4col.pdf new file mode 100644 index 0000000000..be3e4a1b2a Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sample4col.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sample4col.tex b/macros/latex/contrib/glossaries/samples/sample4col.tex new file mode 100644 index 0000000000..1f6125dc1d --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sample4col.tex @@ -0,0 +1,29 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{article} + +\usepackage[style=long4colheaderborder]{glossaries} + +\makeglossaries + +\newglossaryentry{w}{name={$w$}, +sort=w, +description={width}, +symbol=m} + +\newglossaryentry{M}{name={$M$}, +sort=M, +description={mass}, +symbol=kg} + +\begin{document} + +\printglossaries + +The width, \gls{w}, is measured in meters. The mass, \gls{M} is +measured in kilograms. + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleAcr.pdf b/macros/latex/contrib/glossaries/samples/sampleAcr.pdf new file mode 100644 index 0000000000..94e1cad38a Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleAcr.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleAcr.tex b/macros/latex/contrib/glossaries/samples/sampleAcr.tex new file mode 100644 index 0000000000..41ae5fab96 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleAcr.tex @@ -0,0 +1,88 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[style=long,% use 'long' style for the glossary + toc,% add glossary to table of contents + ]{glossaries} + +\makeglossaries + + % Set the acronym style +\setacronymstyle{long-sc-short} + +\newacronym{svm}% label +{svm}% abbreviation +{support vector machine}% long form + +\newacronym{ksvm}{ksvm}{kernel support vector machine} + +\newacronym{rna}{rna}{ribonukleins\"aure} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +\Glspl{svm} are used widely in the area of pattern recognition. +Subsequent use: \gls{svm}. + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. Plural: \glspl{ksvm}. Resetting +acronyms. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{ksvm}. + +\chapter{Short, Long and Full Forms} + +These commands don't affect the first use flag: + +\begin{center} +\begin{tabular}{lll} + & Unstarred & Starred\\ +acrshort & \acrshort{svm} & \acrshort*{svm}\\ +Acrshort & \Acrshort{svm} & \Acrshort*{svm}\\ +ACRshort & \ACRshort{svm} & \ACRshort*{svm}\\ +acrlong & \acrlong{svm} & \acrlong*{svm}\\ +Acrlong & \Acrlong{svm} & \Acrlong*{svm}\\ +ACRlong & \ACRlong{svm} & \ACRlong*{svm}\\ +acrfull & \acrfull{svm} & \acrfull*{svm}\\ +Acrfull & \Acrfull{svm} & \Acrfull*{svm}\\ +ACRfull & \ACRfull{svm} & \ACRfull*{svm}\\ +\\ +& Insert Unstarred & Insert Starred\\ +acrshort & \acrshort{svm}['s] & \acrshort*{svm}['s]\\ +Acrshort & \Acrshort{svm}['s] & \Acrshort*{svm}['s]\\ +ACRshort & \ACRshort{svm}['s] & \ACRshort*{svm}['s]\\ +acrlong & \acrlong{svm}['s] & \acrlong*{svm}['s]\\ +Acrlong & \Acrlong{svm}['s] & \Acrlong*{svm}['s]\\ +ACRlong & \ACRlong{svm}['s] & \ACRlong*{svm}['s]\\ +acrfull & \acrfull{svm}['s] & \acrfull*{svm}['s]\\ +Acrfull & \Acrfull{svm}['s] & \Acrfull*{svm}['s]\\ +ACRfull & \ACRfull{svm}['s] & \ACRfull*{svm}['s] +\end{tabular} +\end{center} + +\chapter{Another chapter} + +You don't need to worry about makeindex's special characters: +\gls{rna}. + +\printglossary[title={List of Acronyms}] + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleAcrDesc.pdf b/macros/latex/contrib/glossaries/samples/sampleAcrDesc.pdf new file mode 100644 index 0000000000..e5e2bc6c4a Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleAcrDesc.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleAcrDesc.tex b/macros/latex/contrib/glossaries/samples/sampleAcrDesc.tex new file mode 100644 index 0000000000..896bbbb1fb --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleAcrDesc.tex @@ -0,0 +1,76 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[acronym,% create 'acronym' glossary type + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain,% + style=altlist, % use altlist style + toc, % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + + % Change the acronym style to long-sc-short-desc: +\setacronymstyle{long-sc-short-desc} + + % Change the "see" items so that they use \acronymfont: +\renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} + + % Not using a font that supports bold smallcaps so change the way + % the name is formatted in the glossary: + +\renewcommand*{\glsnamefont}[1]{\textmd{#1}} + +\newacronym[description={Statistical pattern recognition +technique~\protect\cite{svm}}, % acronym's description +]{svm}{svm}{support vector machine} + +\newacronym + [description={Statistical pattern recognition technique + using the ``kernel trick''},% acronym's description + see={[see also]{svm}}, +] +{ksvm}{ksvm}{kernel support vector machine} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots\ (but beware, converting the initial letter to +upper case for a small caps acronym is sometimes considered +poor style). + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. This is the entry's description without +a link: \glsentrydesc{ksvm}. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleCustomAcr.pdf b/macros/latex/contrib/glossaries/samples/sampleCustomAcr.pdf new file mode 100644 index 0000000000..04654f3a9e Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleCustomAcr.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleCustomAcr.tex b/macros/latex/contrib/glossaries/samples/sampleCustomAcr.tex new file mode 100644 index 0000000000..084f5b7c98 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleCustomAcr.tex @@ -0,0 +1,115 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[acronym,% create 'acronym' glossary type + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain, + style=altlist, % use altlist style + toc, % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + + % Define a new acronym style called "altfn" that's based on the + % footnote-sc-desc style + +\newacronymstyle + {altfn}% style name + {% Inherit display style from "footnote-sc-desc" + \GlsUseAcrEntryDispStyle{footnote-sc-desc}% + }% + {% Inherit definitions from "footnote-sc-desc" + \GlsUseAcrStyleDefs{footnote-sc-desc}% + % Modify the first use display styles so they put the long form + % followed by the description in the footnote: + % + % First use of \gls: + \renewcommand*{\genacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshort{##1}}##2% + \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + % First use of \Gls: + \renewcommand*{\Genacrfullformat}[2]{% + \firstacronymfont{\Glsentryshort{##1}}##2% + \protect\footnote{\glsentrylong{##1}: \glsentrydesc{##1}}% + }% + % First use of \glspl: + \renewcommand*{\genplacrfullformat}[2]{% + \protect\firstacronymfont{\glsentryshortpl{##1}}##2% + \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + % First use of \Glspl: + \renewcommand*{\Genplacrfullformat}[2]{% + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2% + \protect\footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}% + }% + % Sort according to long form: + \renewcommand*{\acronymsort}[2]{##2}% + % Set the name (as displayed in the glossary) to long (short) + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1} (\acronymfont{\glsentryshort{##1}})}% + % Since bold small caps isn't supported with this document's + % fonts, adjust \acronymfont so that it switches to medium + % small caps: + \renewcommand{\acronymfont}[1]{\textmd{\scshape ##1}}% + } + + % Now use this new style: +\setacronymstyle{altfn} + + % Change the "see" items so that they use \acronymfont: +\renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} + +\newacronym[description={Statistical pattern recognition +technique~\protect\cite{svm}}, % acronym's description +]{svm}{svm}{support vector machine} + +\newacronym[description={Statistical pattern recognition technique +using the ``kernel trick''},% acronym's description +see={[see also]{svm}}, +]{ksvm}{ksvm}{kernel +support vector machine} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots\ (but beware, converting the initial letter to +upper case for a small caps acronym is sometimes considered +poor style). + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. This is the entry's description without +a link: \glsentrydesc{ksvm}. + +\glsresetall +(Reset all.) +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleDB.pdf b/macros/latex/contrib/glossaries/samples/sampleDB.pdf new file mode 100644 index 0000000000..6845e69aca Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleDB.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleDB.tex b/macros/latex/contrib/glossaries/samples/sampleDB.tex new file mode 100644 index 0000000000..cbcd1723b9 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleDB.tex @@ -0,0 +1,24 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[nonumberlist]{glossaries} + +\newglossary[nlg]{symbols}{not}{ntn}{Symbols} + +\makeglossaries + +\loadglsentries{database1} +\loadglsentries[symbols]{database2} + +\begin{document} + +\glsaddall + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleDesc.pdf b/macros/latex/contrib/glossaries/samples/sampleDesc.pdf new file mode 100644 index 0000000000..e7c833d7a2 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleDesc.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleDesc.tex b/macros/latex/contrib/glossaries/samples/sampleDesc.tex new file mode 100644 index 0000000000..4f69d980a0 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleDesc.tex @@ -0,0 +1,71 @@ + % This file is public domain + % + % See also sampleAcrDesc.tex + % + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} + +\usepackage[style=altlist, % use altlist style + toc % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + +\newglossaryentry{svm}{ + % how the entry name should appear in the glossary +name={Support vector machine (SVM)}, + % how the description should appear in the glossary +description={Statistical pattern recognition +technique~\cite{svm}}, + % how the entry should appear in the document text +text={svm}, + % how the entry should appear the first time it is + % used in the document text +first={support vector machine (svm)}} + +\newglossaryentry{ksvm}{ +name={Kernel support vector machine (KSVM)}, +description={Statistical pattern recognition technique +using the ``kernel trick'' (see also SVM)}, +text={ksvm}, +first={kernel support vector machine}} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots + +This is the text produced without a link: \glsentrytext{svm}. +This is the text produced on first use without a link: +\glsentryfirst{svm}. This is the entry's description without +a link: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary[title={Acronyms}] + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleEq.pdf b/macros/latex/contrib/glossaries/samples/sampleEq.pdf new file mode 100644 index 0000000000..37a7d5cfe8 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleEq.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleEq.tex b/macros/latex/contrib/glossaries/samples/sampleEq.tex new file mode 100644 index 0000000000..9fb85acaad --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleEq.tex @@ -0,0 +1,239 @@ + % This file is public domain +\documentclass[a4paper,12pt]{report} + +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[xindy,toc,ucmark,style=long3colheader,counter=equation]{glossaries} + +\makeglossaries + +\newcommand{\erf}{\operatorname{erf}} +\newcommand{\erfc}{\operatorname{erfc}} + +\pagestyle{headings} + + % redefine the way hyperref creates the target for equations + % so that the glossary links to equation numbers work + + \renewcommand*\theHequation{\theHchapter.\arabic{equation}} + + % Change the glossary headings + +\renewcommand{\entryname}{Notation} +\renewcommand{\descriptionname}{Function Name} +\renewcommand{\pagelistname}{Number of Formula} + + % define glossary entries + +\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)}, +description=Gamma function, +sort=Gamma} + +\newglossaryentry{gamma}{name={\ensuremath{\gamma(\alpha,x)}}, +description=Incomplete gamma function, +sort=gamma1} + +\newglossaryentry{iGamma}{name={\ensuremath{\Gamma(\alpha,x)}}, +description=Incomplete gamma function, +sort=Gamma2} + +\newglossaryentry{psi}{name=\ensuremath{\psi(x)}, +description=Psi function,sort=psi} + +\newglossaryentry{erf}{name=\ensuremath{\erf(x)}, +description=Error function,sort=erf} + +\newglossaryentry{erfc}{name=\ensuremath{\erfc}, +description=Complementary error function,sort=erfc} + +\newglossaryentry{B}{name={\ensuremath{B(x,y)}}, +description=Beta function,sort=B} + +\newglossaryentry{Bx}{name={\ensuremath{B_x(p,q)}}, +description=Incomplete beta function,sort=Bx} + +\newglossaryentry{Tn}{name=\ensuremath{T_n(x)}, +description=Chebyshev's polynomials of the first kind,sort=Tn} + +\newglossaryentry{Un}{name=\ensuremath{U_n(x)}, +description=Chebyshev's polynomials of the second kind,sort=Un} + +\newglossaryentry{Hn}{name=\ensuremath{H_n(x)}, +description=Hermite polynomials,sort=Hn} + +\newglossaryentry{Ln}{name=\ensuremath{L_n^\alpha(x)}, +description=Laguerre polynomials,sort=Lna} + +\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)}, +description=Bessel functions,sort=Z} + +\newglossaryentry{Phi}{name={\ensuremath{\Phi(\alpha,\gamma;z)}}, +description=confluent hypergeometric function,sort=Pagz} + +\newglossaryentry{knu}{name=\ensuremath{k_\nu(x)}, +description=Bateman's function,sort=kv} + +\newglossaryentry{Dp}{name=\ensuremath{D_p(z)}, +description=Parabolic cylinder functions,sort=Dp} + +\newglossaryentry{F}{name={\ensuremath{F(\phi,k)}}, +description=Elliptical integral of the first kind,sort=Fpk} + +\newglossaryentry{C}{name=\ensuremath{C}, +description=Euler's constant,sort=C} + +\newglossaryentry{G}{name=\ensuremath{G}, +description=Catalan's constant,sort=G} + +\begin{document} +\title{A Sample Document Using glossaries.sty} +\author{Nicola Talbot} +\maketitle + +\begin{abstract} +This is a sample document illustrating the use of the \textsf{glossaries} +package. The functions here have been taken from ``Tables of +Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. +The glossary is a list of special functions, so +the equation number has been used rather than the page number. This +can be done using the \texttt{counter=equation} package +option. +\end{abstract} + +\printglossary[title={Index of Special Functions and Notations}] + +\chapter{Gamma Functions} + +\begin{equation} +\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt +\end{equation} + +\verb|\ensuremath| is only required here if using +hyperlinks. +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x) +\end{equation} + +\begin{equation} +\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\begin{equation} +\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\newpage + +\begin{equation} +\gls{Gamma} = \Gamma(\alpha, x) + \gamma(\alpha, x) +\end{equation} + +\begin{equation} +\gls{psi} = \frac{d}{dx}\ln\Gamma(x) +\end{equation} + +\chapter{Error Functions} + +\begin{equation} +\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt +\end{equation} + +\begin{equation} +\gls{erfc} = 1 - \erf(x) +\end{equation} + +\chapter{Beta Function} + +\begin{equation} +\gls{B} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt +\end{equation} +Alternatively: +\begin{equation} +\gls{B} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi +\end{equation} + +\begin{equation} +\gls{B} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) +\end{equation} + +\begin{equation} +\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt +\end{equation} + +\chapter{Polynomials} + +\section{Chebyshev's polynomials} + +\begin{equation} +\gls{Tn} = \cos(n\arccos x) +\end{equation} + +\begin{equation} +\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} +\end{equation} + +\section{Hermite polynomials} + +\begin{equation} +\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) +\end{equation} + +\section{Laguerre polynomials} + +\begin{equation} +L_n^{\alpha} (x) = \frac{1}{n!}e^x x^{-\alpha} +\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) +\end{equation} + +\chapter{Bessel Functions} + +Bessel functions $Z_\nu$ are solutions of +\begin{equation} +\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} ++ \frac{1}{z}\,\frac{dZ_\nu}{dz} + +\left( 1-\frac{\nu^2}{z^2}Z_\nu = 0 \right) +\end{equation} + +\chapter{Confluent hypergeometric function} + +\begin{equation} +\gls{Phi} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} ++ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} ++\frac{\alpha(\alpha+1)(\alpha+2)}{\gamma(\gamma+1)(\gamma+2)}\, +\frac{z^3}{3!} + \cdots +\end{equation} + +\begin{equation} +\gls{knu} = \frac{2}{\pi}\int_0^{\pi/2} +\cos(x \tan\theta - \nu\theta)\,d\theta +\end{equation} + +\chapter{Parabolic cylinder functions} + +\begin{equation} +\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} +\left\{ +\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} +\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) +-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} +\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) +\right\} +\end{equation} + +\chapter{Elliptical Integral of the First Kind} + +\begin{equation} +\gls{F} = \int_0^\phi \frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} +\end{equation} + +\chapter{Constants} + +\begin{equation} +\gls{C} = 0.577\,215\,664\,901\ldots +\end{equation} + +\begin{equation} +\gls{G} = 0.915\,965\,594\ldots +\end{equation} + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleEqPg.pdf b/macros/latex/contrib/glossaries/samples/sampleEqPg.pdf new file mode 100644 index 0000000000..48cf778f0a Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleEqPg.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleEqPg.tex b/macros/latex/contrib/glossaries/samples/sampleEqPg.tex new file mode 100644 index 0000000000..d00d89ccaf --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleEqPg.tex @@ -0,0 +1,295 @@ + % This file is public domain + % + % To ensure that the page numbers are up-to-date: + % + % latex sampleEqPg + % makeglossaries sampleEqPg + % latex sampleEqPg + % makeglossaries sampleEqPg + % latex sampleEqPg + % + % The extra makeglossaries run is required because adding the + % glossary in the second LaTeX run shifts the page numbers on + % which means that the glossary needs to be updated again. + % (Note that this problem is avoided if the page numbering is + % reset after the glossary. For example, if the glossary has + % roman numbering and the subsequent pages have arabic numbering) + % + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass[a4paper,12pt]{report} + +\usepackage{amsmath} +\usepackage[colorlinks]{hyperref} +\usepackage[style=long3colheader,toc, + counter=equation]{glossaries} + +\newcommand{\erf}{\operatorname{erf}} +\newcommand{\erfc}{\operatorname{erfc}} + + % redefine the way hyperref creates the target for equations + % so that the glossary links to equation numbers work + +\renewcommand*\theHequation{\thechapter.\arabic{equation}} + +\renewcommand{\glossaryname}{Index of Special Functions and Notations} + +\renewcommand{\glossarypreamble}{Numbers in italic indicate the equation number, +numbers in bold indicate page numbers where the main definition occurs.\par} + + % set the glossary number style to italic + % hyperit is used instead of textit because + % the hyperref package is being used. +\renewcommand{\glsnumberformat}[1]{\hyperit{#1}} + + % 1st column heading +\renewcommand{\entryname}{Notation} + + % 2nd column heading +\renewcommand{\descriptionname}{Function Name} + + % 3rd column heading +\renewcommand{\pagelistname}{} + + % Redefine header row so that it + % adds a blank row after the title row +\renewcommand{\glossaryheader}{\bfseries\entryname & +\bfseries\descriptionname&\bfseries\pagelistname\\ +& & \\\endhead} + + % Define glossary entries + +\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)}, +description=Gamma function,sort=Gamma} + +\newglossaryentry{gamma}{name=\ensuremath{\gamma(\alpha,x)}, +description=Incomplete gamma function,sort=gamma} + +\newglossaryentry{iGamma}{name=\ensuremath{\Gamma(\alpha,x)}, +description=Incomplete gamma function,sort=Gamma} + +\newglossaryentry{psi}{name=\ensuremath{\psi(x)}, +description=Psi function,sort=psi} + +\newglossaryentry{erf}{name=\ensuremath{\erf(x)}, +description=Error function,sort=erf} + +\newglossaryentry{erfc}{name=\ensuremath{\erfc(x)}, +description=Complementary error function,sort=erfc} + +\newglossaryentry{beta}{name=\ensuremath{B(x,y)}, +description=Beta function,sort=B} + +\newglossaryentry{Bx}{name=\ensuremath{B_x(p,q)}, +description=Incomplete beta function,sort=Bx} + +\newglossaryentry{Tn}{name=\ensuremath{T_n(x)}, +description=Chebyshev's polynomials of the first kind, +sort=Tn} + +\newglossaryentry{Un}{name=\ensuremath{U_n(x)}, +description=Chebyshev's polynomials of the second kind, +sort=Un} + +\newglossaryentry{Hn}{name=\ensuremath{H_n(x)}, +description=Hermite polynomials,sort=Hn} + +\newglossaryentry{Lna}{name=\ensuremath{L_n^\alpha(x)}, +description=Laguerre polynomials,sort=Lna} + +\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)}, +description=Bessel functions,sort=Z} + +\newglossaryentry{Pagz}{name=\ensuremath{\Phi(\alpha,\gamma;z)}, +description=confluent hypergeometric function,sort=Pagz} + +\newglossaryentry{kv}{name=\ensuremath{k_\nu(x)}, +description=Bateman's function,sort=kv} + +\newglossaryentry{Dp}{name=\ensuremath{D_p(z)}, +description=Parabolic cylinder functions,sort=Dp} + +\newglossaryentry{Fpk}{name=\ensuremath{F(\phi,k)}, +description=Elliptical integral of the first kind,sort=Fpk} + +\newglossaryentry{C}{name=\ensuremath{C}, +description=Euler's constant,sort=C} + +\newglossaryentry{G}{name=\ensuremath{G}, +description=Catalan's constant,sort=G} + +\makeglossaries + +\pagestyle{headings} + +\begin{document} + +\title{Sample Document Using Interchangable Numbering} +\author{Nicola Talbot} +\maketitle + +\begin{abstract} +This is a sample document illustrating the use of the \textsf{glossaries} +package. The functions here have been taken from ``Tables of +Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik. + +The glossary lists both page numbers and equation numbers. +Since the majority of the entries use the equation number, +\texttt{counter=equation} was used as a package option. +Note that this example will only work where the +page number and equation number compositor is the same. So +it won't work if, say, the page numbers are of the form +2-4 and the equation numbers are of the form 4.6. +As most of the glossary entries should have an italic +format, it is easiest to set the default format to +italic. + +\end{abstract} + +\tableofcontents + +\printglossary[toctitle={Special Functions}] + +\chapter{Gamma Functions} + +The \glslink[format=hyperbf,counter=page]{Gamma}{gamma function} is +defined as +\begin{equation} +\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt +\end{equation} + +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x) +\end{equation} + +\begin{equation} +\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\begin{equation} +\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt +\end{equation} + +\newpage + +\begin{equation} +\glslink{Gamma}{\ensuremath{\Gamma(\alpha)}} = +\Gamma(\alpha, x) + \gamma(\alpha, x) +\end{equation} + +\begin{equation} +\gls{psi} = \frac{d}{dx}\ln\Gamma(x) +\end{equation} + +\chapter{Error Functions} + +The \glslink[format=hyperbf,counter=page]{erf}{error function} is defined as: +\begin{equation} +\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt +\end{equation} + +\begin{equation} +\gls{erfc} = 1 - \erf(x) +\end{equation} + +\chapter{Beta Function} + +\begin{equation} +\gls{beta} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt +\end{equation} +Alternatively: +\begin{equation} +\gls{beta} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi +\end{equation} + +\begin{equation} +\gls{beta} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x) +\end{equation} + +\begin{equation} +\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt +\end{equation} + +\chapter{Chebyshev's polynomials} + +\begin{equation} +\gls{Tn} = \cos(n\arccos x) +\end{equation} + +\begin{equation} +\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]} +\end{equation} + +\chapter{Hermite polynomials} + +\begin{equation} +\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) +\end{equation} + +\chapter{Laguerre polynomials} + +\begin{equation} +\gls{Lna} = \frac{1}{n!}e^x x^{-\alpha} +\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha}) +\end{equation} + +\chapter{Bessel Functions} + +Bessel functions $Z_\nu(z)$ are solutions of +\begin{equation} +\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} + \frac{1}{z}\,\frac{dZ_\nu}{dz} + +\left( +1-\frac{\nu^2}{z^2}Z_\nu = 0 +\right) +\end{equation} + +\chapter{Confluent hypergeometric function} + +\begin{equation} +\gls{Pagz} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!} ++ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!} ++\frac{\alpha(\alpha+1)(\alpha+2)} + {\gamma(\gamma+1)(\gamma+2)} +\,\frac{z^3}{3!} ++ \cdots +\end{equation} + +\begin{equation} +\gls{kv} = \frac{2}{\pi}\int_0^{\pi/2} +\cos(x \tan\theta - \nu\theta)\,d\theta +\end{equation} + +\chapter{Parabolic cylinder functions} + +\begin{equation} +\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}} +\left\{ +\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)} +\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right) +-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)} +\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right) +\right\} +\end{equation} + +\chapter{Elliptical Integral of the First Kind} + +\begin{equation} +\gls{Fpk} = \int_0^\phi +\frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}} +\end{equation} + +\chapter{Constants} + +\begin{equation} +\gls{C} = 0.577\,215\,664\,901\ldots +\end{equation} + +\begin{equation} +\gls{G} = 0.915\,965\,594\ldots +\end{equation} + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.pdf b/macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.pdf new file mode 100644 index 0000000000..72b64c8359 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.tex b/macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.tex new file mode 100644 index 0000000000..8ea1f3883c --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleFnAcrDesc.tex @@ -0,0 +1,79 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{report} + +\usepackage[colorlinks,plainpages=false]{hyperref} +\usepackage[acronym,% create 'acronym' glossary type + % The package option "nomain" is used here to suppress the + % main glossary, since this example doesn't use it. If you + % want to use the main glossary, remove the "nomain" option. + nomain, + style=altlist, % use altlist style + toc, % add the glossary to the table of contents + ]{glossaries} + +\makeglossaries + + % Change the acronym style to a small-caps footnote style: +\setacronymstyle{footnote-sc-desc} + + % Make some minor adjustments to the style: +\renewcommand*{\acronymsort}[2]{#1}% sort by short form +\renewcommand*{\acronymentry}[1]{% + \acronymfont{\glsentryshort{#1}}\space (\glsentrylong{#1})} + + % Not using a font that supports bold smallcaps so ensure + % the acronym is always in medium weight. +\renewcommand*{\acronymfont}[1]{\textmd{\scshape #1}} + + % Change the "see" items so that they use \acronymfont: +\renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} + +\newacronym[description={Statistical pattern recognition +technique~\protect\cite{svm}}, % acronym's description +]{svm}{svm}{support vector machine} + +\newacronym[description={Statistical pattern recognition technique +using the ``kernel trick''},% acronym's description +see={[see also]{svm}}, +]{ksvm}{ksvm}{kernel +support vector machine} + +\begin{document} +\tableofcontents + +\chapter{Support Vector Machines} + +The \gls{svm} is used widely in the area of pattern recognition. + % plural form with initial letter in uppercase: +\Glspl{svm} are \ldots\ (but beware, converting the initial letter to +upper case for a small caps acronym is sometimes considered +poor style). + +Short version: \acrshort{svm}. Long version: \acrlong{svm}. Full +version: \acrfull{svm}. Description: \glsentrydesc{svm}. + +This is the entry in uppercase: \GLS{svm}. + +\chapter{Kernel Support Vector Machines} + +The \gls{ksvm} is \ifglsused{svm}{an}{a} \gls{svm} that uses +the so called ``kernel trick''. This is the entry's description without +a link: \glsentrydesc{ksvm}. + +\glsresetall +Possessive: \gls{ksvm}['s]. +Make the glossary entry number bold for this +one \gls[format=hyperbf]{svm}. + +\begin{thebibliography}{1} +\bibitem{svm} \ldots +\end{thebibliography} + +\printglossary + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleNtn.pdf b/macros/latex/contrib/glossaries/samples/sampleNtn.pdf new file mode 100644 index 0000000000..27c58518cc Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleNtn.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleNtn.tex b/macros/latex/contrib/glossaries/samples/sampleNtn.tex new file mode 100644 index 0000000000..639e6d0c7a --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleNtn.tex @@ -0,0 +1,90 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + + % If you want to add babel to this document, you may have to + % replace the : character in the labels if you are using a + % language setting (e.g. french) that makes : active. + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage{html} +\usepackage[toc,xindy]{glossaries} + + % Define a new glossary type called notation +\newglossary[nlg]{notation}{not}{ntn}{Notation} + +\makeglossaries + + % Notation definitions + +\newglossaryentry{not:set}{type=notation, % glossary type +name={$\mathcal{S}$}, +description={A set}, +sort={S}} + +\newglossaryentry{not:U}{type=notation, +name={$\mathcal{U}$}, +description={The universal set}, +sort=U} + +\newglossaryentry{not:card}{type=notation, +name={$|\mathcal{S}|$}, +description={cardinality of $\mathcal{S}$}, +sort=cardinality} + +\newglossaryentry{not:fact}{type=notation, +name={$!$}, +description={factorial}, +sort=factorial} + + % Main glossary definitions + +\newglossaryentry{gls:set}{name=set, +description={A collection of distinct objects}} + +\newglossaryentry{gls:card}{name=cardinality, +description={The number of elements in the specified set}} + +\begin{document} +\title{Sample Document using the glossaries Package} +\author{Nicola Talbot} +\pagenumbering{alph} +\maketitle + +\begin{abstract} + %stop hyperref complaining about duplicate page identifiers: +\pagenumbering{Alph} +This is a sample document illustrating the use of the +\textsf{glossaries} package. In this example, a new glossary type +called \texttt{notation} is defined, so that the document can have a +separate glossary of terms and index of notation. The index of notation +doesn't have associated numbers. +\end{abstract} + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} + +\Glspl{gls:set} are denoted by a calligraphic font +e.g.\ \gls{not:set}. + +Let \gls[format=hyperit]{not:U} denote the universal set. + +The \gls{gls:card} of a set $\mathcal{S}$ is denoted +\gls{not:card}. + +\chapter{Another Chapter} + +Another mention of the universal set \gls{not:U}. + +The factorial symbol: \gls{not:fact}. + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/samplePeople.pdf b/macros/latex/contrib/glossaries/samples/samplePeople.pdf new file mode 100644 index 0000000000..48760f5264 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/samplePeople.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/samplePeople.tex b/macros/latex/contrib/glossaries/samples/samplePeople.tex new file mode 100644 index 0000000000..258dc3e8eb --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/samplePeople.tex @@ -0,0 +1,57 @@ + % This file is public domain + % If you are using arara, you need the following directives: + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[toc,style=listgroup]{glossaries} + +\makeglossaries + +\newcommand{\sortname}[2]{#2, #1} +\newcommand{\textname}[2]{#1 #2} + + % Syntax: \name{first name}{surname} + \let\name\textname + +\renewcommand{\glsprestandardsort}[3]{% + \let\name\sortname + \edef#1{\expandafter\expandonce\expandafter{#1}}% + \let\name\textname + \glsdosanitizesort +} + +\newglossaryentry{joebloggs}{name={\name{Joe}{Bloggs}},description={\nopostdesc}} + +\newglossaryentry{johnsmith}{name={\name{John}{Smith}},description={\nopostdesc}} + +\newglossaryentry{zoeadams}{name={\name{Zo\'e}{Adams}},description={\nopostdesc}} + +\newglossaryentry{maryadams}{name={\name{Mary}{Adams}},description={\nopostdesc}} + +\begin{document} +\tableofcontents + +\chapter{\glsentrytext{joebloggs}} + +\gls{joebloggs} was a fairly ordinary person. + +\chapter{\glsentrytext{johnsmith}} + +\gls{johnsmith} was great friends with \gls{joebloggs}. + +\chapter{\glsentrytext{maryadams}} + +\gls{maryadams} worked with \gls{johnsmith} but never met +\gls{joebloggs}. + +\chapter{\glsentrytext{zoeadams}} + +\gls{zoeadams} was \gls{maryadams}['s] sister. +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleSec.pdf b/macros/latex/contrib/glossaries/samples/sampleSec.pdf new file mode 100644 index 0000000000..cd9ac522fe Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleSec.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleSec.tex b/macros/latex/contrib/glossaries/samples/sampleSec.tex new file mode 100644 index 0000000000..f9e5696671 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleSec.tex @@ -0,0 +1,64 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[style=altlist,toc,counter=section]{glossaries} + +\makeglossaries + +\newglossaryentry{ident}{name=identity matrix, +description=diagonal matrix with 1s along the leading diagonal, +plural=identity matrices} + +\newglossaryentry{diag}{name=diagonal matrix, +description=matrix whose only non-zero entries are along +the leading diagonal, +plural=diagonal matrices} + +\newglossaryentry{sing}{name=singular matrix, +description=matrix with zero determinant, +plural=singular matrices} + +\begin{document} + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} +This is a sample document illustrating the use of the +\textsf{glossaries} package. + +\chapter{Diagonal matrices} + +A \gls[format=hyperit]{diag} is a matrix where all elements not on the +leading diagonal are zero. This is the +primary definition, so an italic font is used for the page number. + +\newpage +\section{Identity matrix} +The \gls[format=hyperit]{ident} is a \gls{diag} whose leading +diagonal elements are all equal to 1. + +Here is another entry for a \gls{diag}. And this is the +plural: \glspl{ident}. + +This adds an entry into the glossary with a bold number, but +it doesn't create a hyperlink: \gls*[format=hyperbf]{ident}. + +\chapter{Singular Matrices} + +A \gls{sing} is a matrix with zero determinant. +\Glspl{sing} are non-invertible. Possessive: +a \gls{sing}['s] dimensions are not necessarily equal. + +Another \gls{ident} entry. + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleSort.pdf b/macros/latex/contrib/glossaries/samples/sampleSort.pdf new file mode 100644 index 0000000000..107107912e Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleSort.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleSort.tex b/macros/latex/contrib/glossaries/samples/sampleSort.tex new file mode 100644 index 0000000000..ee6350a360 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleSort.tex @@ -0,0 +1,105 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } + % arara: pdflatex: { synctex: on } +\documentclass{report} + + % If you want to add babel to this document, you may have to + % replace the : character in the labels if you are using a + % language setting (e.g. french) that makes : active. + +\usepackage[plainpages=false,colorlinks]{hyperref} +\usepackage[toc,acronym]{glossaries} + + % Define a new glossary type called notation +\newglossary[nlg]{notation}{not}{ntn}{Notation} + +\makeglossaries + +\newcounter{sortcount} + +\renewcommand{\glsprestandardsort}[3]{% + \ifdefstring{#2}{notation}% + {% + \stepcounter{sortcount}% + \edef#1{\glssortnumberfmt{\arabic{sortcount}}}% + }% + {% + \glsdosanitizesort + }% +} + + % Notation definitions + +\newglossaryentry{not:set}{type=notation, % glossary type +name={$\mathcal{S}$}, +text={\mathcal{S}}, +description={A set}} + +\newglossaryentry{not:emptyset}{type=notation, +name={$\emptyset$}, +text={\emptyset}, +description={The empty set}} + +\newglossaryentry{not:card}{type=notation, +name={$|\mathcal{S}|$}, +text={|\mathcal{S}|}, +description={cardinality of $\mathcal{S}$}} + + % Main glossary definitions + +\newglossaryentry{gls:set}{name=set, +description={A collection of distinct objects}} + +\newglossaryentry{gls:card}{name=cardinality, +description={The number of elements in the specified set}} + + % Acronym definitions + +\newacronym{zfc}{ZFC}{Zermelo-Fraenkel set theory} + +\newacronym{ad}{AD}{axiom of determinacy} + +\newacronym{nf}{NF}{new foundations} + +\begin{document} +\title{Sample Document using the glossaries Package} +\author{Nicola Talbot} +\pagenumbering{alph} +\maketitle + +\begin{abstract} + %stop hyperref complaining about duplicate page identifiers: +\pagenumbering{Alph} +This is a sample document illustrating the use of the +\textsf{glossaries} package. In this example, a new glossary type +called \texttt{notation} is defined, so that the document can have a +separate glossary of terms, list of acronyms and index of notation. +\end{abstract} + +\pagenumbering{roman} +\tableofcontents + +\printglossaries + +\chapter{Introduction} +\pagenumbering{arabic} + +\Glspl{gls:set} are denoted by a calligraphic font +e.g.\ $\gls{not:set}$. + +The \gls{gls:card} of a set $\mathcal{S}$ is denoted +$\gls{not:card}$. The empty set is denoted +$\gls{not:emptyset}$. + +Here are some acronyms: \gls{nf}, \gls{zfc} and \gls{ad}. + +\chapter{Another Chapter} + +Another mention of the empty set $\gls{not:emptyset}$. + +Here are the acronyms again: \gls{nf}, \gls{zfc} and \gls{ad}. + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleaccsupp.pdf b/macros/latex/contrib/glossaries/samples/sampleaccsupp.pdf new file mode 100644 index 0000000000..13b261d835 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleaccsupp.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleaccsupp.tex b/macros/latex/contrib/glossaries/samples/sampleaccsupp.tex new file mode 100644 index 0000000000..342902d8e5 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleaccsupp.tex @@ -0,0 +1,43 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass[a4paper]{article} + +\usepackage[margin=0.5in]{geometry} +\usepackage{booktabs} +\usepackage[acronym]{glossaries-accsupp} + +\makeglossaries + +\newglossaryentry{dr}{name=Dr,description={Doctor},access={Doctor}} + +\newacronym[shortaccess=S V M]{svm}{svm}{support vector machine} + +\newacronym{eg}{e.g.}{for example} + +\newcommand*{\samplerow}[1]{% + \gls{#1} & \gls{#1} & \acrshort{#1} & \acrlong{#1}\\ + \glsreset{#1}\Gls{#1} & \Gls{#1} & \Acrshort{#1} & \Acrlong{#1}\\ + \glsreset{#1}\GLS{#1} & \GLS{#1} & \ACRshort{#1} & \ACRlong{#1}\\ +} + +\begin{document} + +\begin{center} +\begin{tabular}{lllll} +\toprule +\bfseries First & \bfseries Next & \bfseries Short & \bfseries Long +\\\midrule +\samplerow{dr} +\midrule +\samplerow{eg} +\midrule +\samplerow{svm} +\bottomrule +\end{tabular} +\end{center} + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleacronyms.pdf b/macros/latex/contrib/glossaries/samples/sampleacronyms.pdf new file mode 100644 index 0000000000..3c1aef6115 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleacronyms.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleacronyms.tex b/macros/latex/contrib/glossaries/samples/sampleacronyms.tex new file mode 100644 index 0000000000..f36d71ca1e --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleacronyms.tex @@ -0,0 +1,42 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[acronym,acronymlists={main,acronym2}]{glossaries} + +\newglossary[alg2]{acronym2}{acr2}{acn2}{Statistical Acronyms} + +\makeglossaries + + % Use long (short) acronym style: +\setacronymstyle{long-short} + + % Main glossary is a list of calculus acronyms + +\renewcommand{\glossaryname}{Calculus Acronyms} + +\newacronym[type=main]{vc}{VC}{Vector Calculus} +\newacronym[type=main]{ftoc}{FTOC}{Fundamental Theorem of Calculus} + + % "acronym" glossary is a list of computer related acronyms + +\renewcommand{\acronymname}{Computer Acronyms} + +\newacronym{kb}{kb}{KiloBit} +\newacronym{kB}{kB}{KiloByte} + + % "acronym2" glossary is a list of statistical acronyms + +\newacronym[type=acronym2]{svm}{SVM}{Support Vector Machine} + +\begin{document} +\section{Sample Section} +\gls{kb}. \gls{kB}. \gls{vc}. \gls{ftoc}. \gls{svm}. + +\gls{kb}. \gls{kB}. \gls{vc}. \gls{ftoc}. \gls{svm}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampletree.pdf b/macros/latex/contrib/glossaries/samples/sampletree.pdf new file mode 100644 index 0000000000..ff20680ff1 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampletree.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampletree.tex b/macros/latex/contrib/glossaries/samples/sampletree.tex new file mode 100644 index 0000000000..59f8ecd490 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampletree.tex @@ -0,0 +1,69 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage[style=alttreehypergroup,nolong,nosuper]{glossaries} + + % The alttree type of glossary styles need to know the + % widest entry name for each level +\glssetwidest{Roman letters} % level 0 widest name +\glssetwidest[1]{Sigma} % level 1 widest name + +\makeglossaries + +\newglossaryentry{greekletter}{name={Greek letters}, +text={Greek letter}, +description={\nopostdesc}} + +\newglossaryentry{sigma}{name={Sigma}, +text={\ensuremath{\Sigma}}, +first={\ensuremath{\Sigma} (uppercase sigma)}, +symbol={\ensuremath{\Sigma}}, +description={Used to indicate summation}, +parent=greekletter} + +\newglossaryentry{pi}{name={pi}, +text={\ensuremath{\pi}}, +first={\ensuremath{\pi} (lowercase pi)}, +symbol={\ensuremath{\pi}}, +description={Transcendental number}, +parent=greekletter} + +\newglossaryentry{romanletter}{name={Roman letters}, +text={Roman letter}, +description={\nopostdesc}} + +\newglossaryentry{e}{name={e}, +description={Unique real number such that the derivative of +the function $e^x$ is the function itself}, +parent=romanletter} + +\newglossaryentry{C}{name={C}, +description={Euler's constant}, +parent=romanletter} + +\begin{document} +This is a sample document illustrating hierarchical glossary +entries. + +\chapter{Greek Letters Used in Mathematics} + +Some information about \glspl{greekletter}. +The letter \gls{pi} is used to represent the ratio of a circle's +circumference to its diameter. +The letter \gls{sigma} is used to represent summation. + +\chapter{Roman Letters Used in Mathematics} + +Some information about \glspl{romanletter}. +The letter \gls{e} is the unique real number such that +the derivative of the function $e^x$ is the function itself. +The letter \gls{C} represents Euler's constant. + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/sampleutf8.pdf b/macros/latex/contrib/glossaries/samples/sampleutf8.pdf new file mode 100644 index 0000000000..935922047a Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/sampleutf8.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/sampleutf8.tex b/macros/latex/contrib/glossaries/samples/sampleutf8.tex new file mode 100644 index 0000000000..ae3fea7ed0 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/sampleutf8.tex @@ -0,0 +1,53 @@ + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[xindy,nonumberlist,style=listgroup]{glossaries} + +\makeglossaries + + % Note that because the é is the first letter of the + % name, it needs to be grouped or it will cause a + % problem for \makefirstuc due to expansion issues. +\newglossaryentry{elite}{name={{é}lite}, +description={select group or class}} + +\newglossaryentry{elephant}{name=elephant, +description={large animal with trunk and tusks}} + +\newglossaryentry{elk}{name=elk, +description=large deer} + +\newglossaryentry{mannerly}{name=mannerly, +description=polite} + + % The œ is not the first letter, so it doesn't need to + % be grouped. +\newglossaryentry{manoeuvre}{name={manœuvre}, +description=planned and controlled movement} + +\newglossaryentry{manor}{name=manor, +description=large landed estate or its house} + +\newglossaryentry{odometer}{name=odometer, +description=instrument for measuring distance travelled by +a wheeled vehicle} + +\newglossaryentry{oesophagus}{name={{œ}sophagus}, +plural={{œ}sophagi}, +description={canal from mouth to stomach}} + +\newglossaryentry{ogre}{name=ogre, +description=man-eating giant} + +\begin{document} +\glsaddall + +\printglossaries + +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/samplexdy-mc.xdy b/macros/latex/contrib/glossaries/samples/samplexdy-mc.xdy new file mode 100644 index 0000000000..22f392f9aa --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/samplexdy-mc.xdy @@ -0,0 +1,852 @@ +;; xindy style file for samplexdy.tex that has Mc letter group + +(define-letter-group "A" :prefixes ("€")) +(define-letter-group "B" :after "A" :prefixes ("„")) +(define-letter-group "C" :after "B" :prefixes ("†")) +(define-letter-group "D" :after "C" :prefixes ("")) +(define-letter-group "E" :after "D" :prefixes ("—")) +(define-letter-group "F" :after "E" :prefixes ("œ")) +(define-letter-group "G" :after "F" :prefixes ("")) +(define-letter-group "H" :after "G" :prefixes ("¤")) +(define-letter-group "I" :after "H" :prefixes ("¨")) +(define-letter-group "J" :after "I" :prefixes ("¬")) +(define-letter-group "K" :after "J" :prefixes ("®")) +(define-letter-group "L" :after "K" :prefixes ("´")) +(define-letter-group "Mc" :after "L" :prefixes ("»†")) +(define-letter-group "M" :after "Mc" :prefixes ("»")) +(define-letter-group "N" :after "M" :prefixes ("¼")) +(define-letter-group "O" :after "N" :prefixes ("Ã")) +(define-letter-group "P" :after "O" :prefixes ("È")) +(define-letter-group "Q" :after "P" :prefixes ("Ê")) +(define-letter-group "R" :after "Q" :prefixes ("Ë")) +(define-letter-group "S" :after "R" :prefixes ("Ð")) +(define-letter-group "T" :after "S" :prefixes ("Ú")) +(define-letter-group "U" :after "T" :prefixes ("à")) +(define-letter-group "V" :after "U" :prefixes ("å")) +(define-letter-group "W" :after "V" :prefixes ("æ")) +(define-letter-group "X" :after "W" :prefixes ("ë")) +(define-letter-group "Y" :after "X" :prefixes ("í")) +(define-letter-group "Ȝ" :after "Y" :prefixes ("ï")) +(define-letter-group "Z" :after "Ȝ" :prefixes ("ð")) +(define-letter-group "Þ" :after "Z" :prefixes ("ö")) +(define-letter-group "Æ¿" :after "Þ" :prefixes ("÷")) + +(define-rule-set "en-alphabetize" + + :rules (("à" "€" :string) + ("À" "€" :string) + ("Æ" "€—" :string) + ("æ" "€—" :string) + ("Ç" "†" :string) + ("ç" "†" :string) + ("ð" "" :string) + ("Ð" "" :string) + ("É" "—" :string) + ("Ê" "—" :string) + ("È" "—" :string) + ("Ë" "—" :string) + ("è" "—" :string) + ("ë" "—" :string) + ("ê" "—" :string) + ("é" "—" :string) + ("Ï" "¨" :string) + ("ï" "¨" :string) + ("Ñ" "¼" :string) + ("ñ" "¼" :string) + ("Ö" "Ã" :string) + ("Ô" "Ã" :string) + ("ô" "Ã" :string) + ("ö" "Ã" :string) + ("œ" "×" :string) + ("Œ" "×" :string) + ("ȝ" "ï" :string) + ("Ȝ" "ï" :string) + ("þ" "ö" :string) + ("Þ" "ö" :string) + ("Ç·" "÷" :string) + ("Æ¿" "÷" :string) + ("a" "€" :string) + ("A" "€" :string) + ("b" "„" :string) + ("B" "„" :string) + ("C" "†" :string) + ("c" "†" :string) + ("d" "" :string) + ("D" "" :string) + ("E" "—" :string) + ("e" "—" :string) + ("F" "œ" :string) + ("f" "œ" :string) + ("g" "" :string) + ("G" "" :string) + ("H" "¤" :string) + ("h" "¤" :string) + ("I" "¨" :string) + ("i" "¨" :string) + ("J" "¬" :string) + ("j" "¬" :string) + ("K" "®" :string) + ("k" "®" :string) + ("L" "´" :string) + ("l" "´" :string) + ("Mc" "»†" :string) + ("Mac" "»†" :string) + ("M" "»" :string) + ("m" "»" :string) + ("N" "¼" :string) + ("n" "¼" :string) + ("O" "Ã" :string) + ("o" "Ã" :string) + ("P" "È" :string) + ("p" "È" :string) + ("q" "Ê" :string) + ("Q" "Ê" :string) + ("r" "Ë" :string) + ("R" "Ë" :string) + ("S" "Ð" :string) + ("s" "Ð" :string) + ("T" "Ú" :string) + ("t" "Ú" :string) + ("u" "à" :string) + ("U" "à" :string) + ("v" "å" :string) + ("V" "å" :string) + ("w" "æ" :string) + ("W" "æ" :string) + ("X" "ë" :string) + ("x" "ë" :string) + ("Y" "í" :string) + ("y" "í" :string) + ("z" "ð" :string) + ("Z" "ð" :string) + )) + +(define-rule-set "en-resolve-diacritics" + + :rules (("ȝ" "¢" :string) + ("þ" "¢" :string) + ("Ç·" "¢" :string) + ("Þ" "¢" :string) + ("Ȝ" "¢" :string) + ("Æ¿" "¢" :string) + ("Ö" "£" :string) + ("Ñ" "£" :string) + ("ð" "£" :string) + ("Ç" "£" :string) + ("É" "£" :string) + ("Ï" "£" :string) + ("ï" "£" :string) + ("ö" "£" :string) + ("ñ" "£" :string) + ("ç" "£" :string) + ("à" "£" :string) + ("À" "£" :string) + ("é" "£" :string) + ("Ð" "£" :string) + ("Ô" "¤" :string) + ("ô" "¤" :string) + ("È" "¤" :string) + ("è" "¤" :string) + ("Ë" "¥" :string) + ("ë" "¥" :string) + ("Ê" "¦" :string) + ("ê" "¦" :string) + ("œ" "ÿ" :string) + ("Æ" "ÿ" :string) + ("Œ" "ÿ" :string) + ("æ" "ÿ" :string) + ("S" "¢" :string) + ("K" "¢" :string) + ("d" "¢" :string) + ("Y" "¢" :string) + ("E" "¢" :string) + ("y" "¢" :string) + ("g" "¢" :string) + ("e" "¢" :string) + ("J" "¢" :string) + ("q" "¢" :string) + ("D" "¢" :string) + ("b" "¢" :string) + ("z" "¢" :string) + ("w" "¢" :string) + ("Q" "¢" :string) + ("M" "¢" :string) + ("C" "¢" :string) + ("L" "¢" :string) + ("X" "¢" :string) + ("P" "¢" :string) + ("T" "¢" :string) + ("a" "¢" :string) + ("N" "¢" :string) + ("j" "¢" :string) + ("Z" "¢" :string) + ("u" "¢" :string) + ("k" "¢" :string) + ("t" "¢" :string) + ("W" "¢" :string) + ("v" "¢" :string) + ("s" "¢" :string) + ("B" "¢" :string) + ("H" "¢" :string) + ("c" "¢" :string) + ("I" "¢" :string) + ("G" "¢" :string) + ("U" "¢" :string) + ("F" "¢" :string) + ("r" "¢" :string) + ("x" "¢" :string) + ("V" "¢" :string) + ("h" "¢" :string) + ("f" "¢" :string) + ("i" "¢" :string) + ("A" "¢" :string) + ("O" "¢" :string) + ("n" "¢" :string) + ("m" "¢" :string) + ("l" "¢" :string) + ("p" "¢" :string) + ("R" "¢" :string) + ("o" "¢" :string) + )) + +(define-rule-set "en-resolve-case" + + :rules (("Ö" "8" :string) + ("Ñ" "8" :string) + ("Ô" "8" :string) + ("Ç" "8" :string) + ("É" "8" :string) + ("Ï" "8" :string) + ("Ê" "8" :string) + ("È" "8" :string) + ("Ë" "8" :string) + ("Ç·" "8" :string) + ("À" "8" :string) + ("Þ" "8" :string) + ("Ȝ" "8" :string) + ("Ð" "8" :string) + ("Æ" "89" :string) + ("Œ" "89" :string) + ("ð" "9" :string) + ("ô" "9" :string) + ("ȝ" "9" :string) + ("ï" "9" :string) + ("ö" "9" :string) + ("ñ" "9" :string) + ("ç" "9" :string) + ("à" "9" :string) + ("þ" "9" :string) + ("è" "9" :string) + ("ë" "9" :string) + ("ê" "9" :string) + ("é" "9" :string) + ("Æ¿" "9" :string) + ("œ" "99" :string) + ("æ" "99" :string) + ("S" "8" :string) + ("K" "8" :string) + ("Y" "8" :string) + ("E" "8" :string) + ("J" "8" :string) + ("D" "8" :string) + ("Q" "8" :string) + ("M" "8" :string) + ("C" "8" :string) + ("L" "8" :string) + ("X" "8" :string) + ("P" "8" :string) + ("T" "8" :string) + ("N" "8" :string) + ("Z" "8" :string) + ("W" "8" :string) + ("B" "8" :string) + ("H" "8" :string) + ("I" "8" :string) + ("G" "8" :string) + ("U" "8" :string) + ("F" "8" :string) + ("V" "8" :string) + ("A" "8" :string) + ("O" "8" :string) + ("R" "8" :string) + ("d" "9" :string) + ("y" "9" :string) + ("g" "9" :string) + ("e" "9" :string) + ("q" "9" :string) + ("b" "9" :string) + ("z" "9" :string) + ("w" "9" :string) + ("a" "9" :string) + ("j" "9" :string) + ("u" "9" :string) + ("k" "9" :string) + ("t" "9" :string) + ("v" "9" :string) + ("s" "9" :string) + ("c" "9" :string) + ("r" "9" :string) + ("x" "9" :string) + ("h" "9" :string) + ("f" "9" :string) + ("i" "9" :string) + ("n" "9" :string) + ("m" "9" :string) + ("l" "9" :string) + ("p" "9" :string) + ("o" "9" :string) + )) + +(define-rule-set "en-ignore-special" + + :rules (("-" "" :string) + ("!" "" :string) + ("{" "" :string) + ("'" "" :string) + ("}" "" :string) + ("?" "" :string) + ("." "" :string) + )) + +(define-rule-set "en-resolve-special" + + :rules (("Ö" "¤" :string) + ("Ñ" "¤" :string) + ("ð" "¤" :string) + ("Ô" "¤" :string) + ("Ç" "¤" :string) + ("É" "¤" :string) + ("ô" "¤" :string) + ("Ï" "¤" :string) + ("ȝ" "¤" :string) + ("ï" "¤" :string) + ("Ê" "¤" :string) + ("ö" "¤" :string) + ("ñ" "¤" :string) + ("È" "¤" :string) + ("ç" "¤" :string) + ("Ë" "¤" :string) + ("à" "¤" :string) + ("þ" "¤" :string) + ("Ç·" "¤" :string) + ("è" "¤" :string) + ("À" "¤" :string) + ("ë" "¤" :string) + ("Þ" "¤" :string) + ("ê" "¤" :string) + ("é" "¤" :string) + ("Ȝ" "¤" :string) + ("Æ¿" "¤" :string) + ("Ð" "¤" :string) + ("œ" "¤¤" :string) + ("Æ" "¤¤" :string) + ("Œ" "¤¤" :string) + ("æ" "¤¤" :string) + ("?" "¡" :string) + ("!" "¢" :string) + ("." "£" :string) + ("S" "¤" :string) + ("K" "¤" :string) + ("d" "¤" :string) + ("Y" "¤" :string) + ("E" "¤" :string) + ("y" "¤" :string) + ("g" "¤" :string) + ("e" "¤" :string) + ("J" "¤" :string) + ("q" "¤" :string) + ("D" "¤" :string) + ("b" "¤" :string) + ("z" "¤" :string) + ("w" "¤" :string) + ("Q" "¤" :string) + ("M" "¤" :string) + ("C" "¤" :string) + ("L" "¤" :string) + ("X" "¤" :string) + ("P" "¤" :string) + ("T" "¤" :string) + ("a" "¤" :string) + ("N" "¤" :string) + ("j" "¤" :string) + ("Z" "¤" :string) + ("u" "¤" :string) + ("k" "¤" :string) + ("t" "¤" :string) + ("W" "¤" :string) + ("v" "¤" :string) + ("s" "¤" :string) + ("B" "¤" :string) + ("H" "¤" :string) + ("c" "¤" :string) + ("I" "¤" :string) + ("G" "¤" :string) + ("U" "¤" :string) + ("F" "¤" :string) + ("r" "¤" :string) + ("x" "¤" :string) + ("V" "¤" :string) + ("h" "¤" :string) + ("f" "¤" :string) + ("i" "¤" :string) + ("A" "¤" :string) + ("O" "¤" :string) + ("n" "¤" :string) + ("m" "¤" :string) + ("l" "¤" :string) + ("p" "¤" :string) + ("R" "¤" :string) + ("o" "¤" :string) + ("-" "¥" :string) + ("'" "¦" :string) + ("{" "§" :string) + ("}" "¨" :string) + )) + +; The following section is customised for samplexdy.tex +; (copied from samplexdy.xdy automatically generated by +; samplexdy.tex) + +; required styles + +(require "tex.xdy") + +; list of allowed attributes (number formats) + +(define-attributes (("default" + "hyperbfit" + "pagehyperbfit" + "glsnumberformat" + "pageglsnumberformat" + "textrm" + "pagetextrm" + "textsf" + "pagetextsf" + "texttt" + "pagetexttt" + "textbf" + "pagetextbf" + "textmd" + "pagetextmd" + "textit" + "pagetextit" + "textup" + "pagetextup" + "textsl" + "pagetextsl" + "textsc" + "pagetextsc" + "emph" + "pageemph" + "glshypernumber" + "pageglshypernumber" + "hyperrm" + "pagehyperrm" + "hypersf" + "pagehypersf" + "hypertt" + "pagehypertt" + "hyperbf" + "pagehyperbf" + "hypermd" + "pagehypermd" + "hyperit" + "pagehyperit" + "hyperup" + "pagehyperup" + "hypersl" + "pagehypersl" + "hypersc" + "pagehypersc" + "hyperemph" + "pagehyperemph"))) + +; user defined alphabets + +; location class definitions + +(define-location-class "roman-page-numbers" + ( :sep "{}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-roman-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-roman-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-roman-page-numbers" + ( :sep "{" "alpha" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-roman-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-roman-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-lowercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers" + ( :sep "{}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-Roman-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-Roman-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-Roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-Roman-page-numbers" + ( :sep "{" "alpha" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-Roman-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-Roman-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-Roman-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "roman-numbers-uppercase" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers" + ( :sep "{}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-arabic-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-arabic-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-arabic-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-arabic-page-numbers" + ( :sep "{" "alpha" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-arabic-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-arabic-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-arabic-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers" + ( :sep "{}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-alpha-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-alpha-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-alpha-page-numbers" + ( :sep "{" "alpha" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "alpha" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers" + ( :sep "{}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-Alpha-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-Alpha-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-Alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-Alpha-page-numbers" + ( :sep "{" "alpha" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-Alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-Alpha-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-Alpha-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers" + ( :sep "{}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-Appendix-page-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-Appendix-page-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-Appendix-page-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-Appendix-page-numbers" + ( :sep "{" "alpha" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-Appendix-page-numbers" + ( :sep "{" "ALPHA" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-Appendix-page-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-Appendix-page-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "ALPHA" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers" + ( :sep "{}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "roman-page-numbers-arabic-section-numbers" + ( :sep "{" "roman-numbers-lowercase" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Roman-page-numbers-arabic-section-numbers" + ( :sep "{" "roman-numbers-uppercase" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-page-numbers-arabic-section-numbers" + ( :sep "{" "arabic-numbers" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "alpha-page-numbers-arabic-section-numbers" + ( :sep "{" "alpha" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Alpha-page-numbers-arabic-section-numbers" + ( :sep "{" "ALPHA" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "Appendix-page-numbers-arabic-section-numbers" + ( :sep "{" "ALPHA" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) +(define-location-class "arabic-section-numbers-arabic-section-numbers" + ( :sep "{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}{" "arabic-numbers" :sep "." "arabic-numbers" :sep "}" ) + :min-range-length 2 +) + +; user defined location classes + +(define-location-class "Numberstring" + (:sep "{}{" :sep "\protect \Numberstringnum {" "arabic-numbers" :sep "}" :sep "}")) + +; define cross-reference class + +(define-crossref-class "see" :unverified ) +(markup-crossref-list :class "see" + :open "\glsseeformat" :close "{}") + +; define the order of the location classes +(define-location-class-order ( + "roman-page-numbers" + "arabic-page-numbers" + "arabic-section-numbers" + "alpha-page-numbers" + "Roman-page-numbers" + "Alpha-page-numbers" + "Appendix-page-numbers" + "see" )) + +; define the glossary markup + +(markup-index + :open "\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble +\providecommand*\glsXpageXhyperbfit[2]{\setentrycounter[#1]{page}\hyperbfit{#2}} +\providecommand*\glsXpageXglsnumberformat[2]{\setentrycounter[#1]{page}\glsnumberformat{#2}} +\providecommand*\glsXpageXtextrm[2]{\setentrycounter[#1]{page}\textrm{#2}} +\providecommand*\glsXpageXtextsf[2]{\setentrycounter[#1]{page}\textsf{#2}} +\providecommand*\glsXpageXtexttt[2]{\setentrycounter[#1]{page}\texttt{#2}} +\providecommand*\glsXpageXtextbf[2]{\setentrycounter[#1]{page}\textbf{#2}} +\providecommand*\glsXpageXtextmd[2]{\setentrycounter[#1]{page}\textmd{#2}} +\providecommand*\glsXpageXtextit[2]{\setentrycounter[#1]{page}\textit{#2}} +\providecommand*\glsXpageXtextup[2]{\setentrycounter[#1]{page}\textup{#2}} +\providecommand*\glsXpageXtextsl[2]{\setentrycounter[#1]{page}\textsl{#2}} +\providecommand*\glsXpageXtextsc[2]{\setentrycounter[#1]{page}\textsc{#2}} +\providecommand*\glsXpageXemph[2]{\setentrycounter[#1]{page}\emph{#2}} +\providecommand*\glsXpageXglshypernumber[2]{\setentrycounter[#1]{page}\glshypernumber{#2}} +\providecommand*\glsXpageXhyperrm[2]{\setentrycounter[#1]{page}\hyperrm{#2}} +\providecommand*\glsXpageXhypersf[2]{\setentrycounter[#1]{page}\hypersf{#2}} +\providecommand*\glsXpageXhypertt[2]{\setentrycounter[#1]{page}\hypertt{#2}} +\providecommand*\glsXpageXhyperbf[2]{\setentrycounter[#1]{page}\hyperbf{#2}} +\providecommand*\glsXpageXhypermd[2]{\setentrycounter[#1]{page}\hypermd{#2}} +\providecommand*\glsXpageXhyperit[2]{\setentrycounter[#1]{page}\hyperit{#2}} +\providecommand*\glsXpageXhyperup[2]{\setentrycounter[#1]{page}\hyperup{#2}} +\providecommand*\glsXpageXhypersl[2]{\setentrycounter[#1]{page}\hypersl{#2}} +\providecommand*\glsXpageXhypersc[2]{\setentrycounter[#1]{page}\hypersc{#2}} +\providecommand*\glsXpageXhyperemph[2]{\setentrycounter[#1]{page}\hyperemph{#2}} +\begin{theglossary}\glossaryheader~n" + :close "%~n\end{theglossary}\glossarypostamble~n" + :tree) +(markup-letter-group-list :sep "\glsgroupskip~n") +(markup-indexentry :open "\relax\glsresetentrylist~n") +(markup-locclass-list :open "{\glossaryentrynumbers{\relax " + :sep ", " :close "}}") +(markup-locref-list :sep "\delimN ") +(markup-range :sep "\delimR ") + +; define format to use for locations + +(markup-locref :open "~n\glsXpageXhyperbfit" + :close "" + :attr "pagehyperbfit") +(markup-locref :open "~n\glsXpageXglsnumberformat" + :close "" + :attr "pageglsnumberformat") +(markup-locref :open "~n\glsXpageXtextrm" + :close "" + :attr "pagetextrm") +(markup-locref :open "~n\glsXpageXtextsf" + :close "" + :attr "pagetextsf") +(markup-locref :open "~n\glsXpageXtexttt" + :close "" + :attr "pagetexttt") +(markup-locref :open "~n\glsXpageXtextbf" + :close "" + :attr "pagetextbf") +(markup-locref :open "~n\glsXpageXtextmd" + :close "" + :attr "pagetextmd") +(markup-locref :open "~n\glsXpageXtextit" + :close "" + :attr "pagetextit") +(markup-locref :open "~n\glsXpageXtextup" + :close "" + :attr "pagetextup") +(markup-locref :open "~n\glsXpageXtextsl" + :close "" + :attr "pagetextsl") +(markup-locref :open "~n\glsXpageXtextsc" + :close "" + :attr "pagetextsc") +(markup-locref :open "~n\glsXpageXemph" + :close "" + :attr "pageemph") +(markup-locref :open "~n\glsXpageXglshypernumber" + :close "" + :attr "pageglshypernumber") +(markup-locref :open "~n\glsXpageXhyperrm" + :close "" + :attr "pagehyperrm") +(markup-locref :open "~n\glsXpageXhypersf" + :close "" + :attr "pagehypersf") +(markup-locref :open "~n\glsXpageXhypertt" + :close "" + :attr "pagehypertt") +(markup-locref :open "~n\glsXpageXhyperbf" + :close "" + :attr "pagehyperbf") +(markup-locref :open "~n\glsXpageXhypermd" + :close "" + :attr "pagehypermd") +(markup-locref :open "~n\glsXpageXhyperit" + :close "" + :attr "pagehyperit") +(markup-locref :open "~n\glsXpageXhyperup" + :close "" + :attr "pagehyperup") +(markup-locref :open "~n\glsXpageXhypersl" + :close "" + :attr "pagehypersl") +(markup-locref :open "~n\glsXpageXhypersc" + :close "" + :attr "pagehypersc") +(markup-locref :open "~n\glsXpageXhyperemph" + :close "" + :attr "pagehyperemph") + +; define letter group list format + +(markup-letter-group-list :sep "\glsgroupskip~n") + +; letter group headings + +(markup-letter-group :open-head "\glsgroupheading{" + :close-head "}") + +; additional letter groups + +(define-letter-group "glsnumbers" + :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9") + :before "A") + +; additional sort rules + +; The following is copied from xindy/lang/english/utf8-lang.xdy + +(define-sort-rule-orientations (forward backward forward forward)) +(use-rule-set :run 0 + :rule-set ("en-alphabetize" "en-ignore-special")) +(use-rule-set :run 1 + :rule-set ("en-resolve-diacritics" "en-ignore-special")) +(use-rule-set :run 2 + :rule-set ("en-resolve-case" "en-ignore-special")) +(use-rule-set :run 3 + :rule-set ("en-resolve-special")) + diff --git a/macros/latex/contrib/glossaries/samples/samplexdy-mc207.xdy b/macros/latex/contrib/glossaries/samples/samplexdy-mc207.xdy new file mode 100644 index 0000000000..7c8d2b9e48 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/samplexdy-mc207.xdy @@ -0,0 +1,591 @@ +;; xindy style file for samplexdy.tex that has Mc letter group + +(define-letter-group "A" :prefixes ("€")) +(define-letter-group "B" :after "A" :prefixes ("„")) +(define-letter-group "C" :after "B" :prefixes ("†")) +(define-letter-group "D" :after "C" :prefixes ("")) +(define-letter-group "E" :after "D" :prefixes ("—")) +(define-letter-group "F" :after "E" :prefixes ("œ")) +(define-letter-group "G" :after "F" :prefixes ("")) +(define-letter-group "H" :after "G" :prefixes ("¤")) +(define-letter-group "I" :after "H" :prefixes ("¨")) +(define-letter-group "J" :after "I" :prefixes ("¬")) +(define-letter-group "K" :after "J" :prefixes ("®")) +(define-letter-group "L" :after "K" :prefixes ("´")) +(define-letter-group "Mc" :after "L" :prefixes ("»†")) +(define-letter-group "M" :after "Mc" :prefixes ("»")) +(define-letter-group "N" :after "M" :prefixes ("¼")) +(define-letter-group "O" :after "N" :prefixes ("Ã")) +(define-letter-group "P" :after "O" :prefixes ("È")) +(define-letter-group "Q" :after "P" :prefixes ("Ê")) +(define-letter-group "R" :after "Q" :prefixes ("Ë")) +(define-letter-group "S" :after "R" :prefixes ("Ð")) +(define-letter-group "T" :after "S" :prefixes ("Ú")) +(define-letter-group "U" :after "T" :prefixes ("à")) +(define-letter-group "V" :after "U" :prefixes ("å")) +(define-letter-group "W" :after "V" :prefixes ("æ")) +(define-letter-group "X" :after "W" :prefixes ("ë")) +(define-letter-group "Y" :after "X" :prefixes ("í")) +(define-letter-group "Ȝ" :after "Y" :prefixes ("ï")) +(define-letter-group "Z" :after "Ȝ" :prefixes ("ð")) +(define-letter-group "Þ" :after "Z" :prefixes ("ö")) +(define-letter-group "Æ¿" :after "Þ" :prefixes ("÷")) + +(define-rule-set "en-alphabetize" + + :rules (("à" "€" :string) + ("À" "€" :string) + ("Æ" "€—" :string) + ("æ" "€—" :string) + ("Ç" "†" :string) + ("ç" "†" :string) + ("ð" "" :string) + ("Ð" "" :string) + ("É" "—" :string) + ("Ê" "—" :string) + ("È" "—" :string) + ("Ë" "—" :string) + ("è" "—" :string) + ("ë" "—" :string) + ("ê" "—" :string) + ("é" "—" :string) + ("Ï" "¨" :string) + ("ï" "¨" :string) + ("Ñ" "¼" :string) + ("ñ" "¼" :string) + ("Ö" "Ã" :string) + ("Ô" "Ã" :string) + ("ô" "Ã" :string) + ("ö" "Ã" :string) + ("œ" "×" :string) + ("Œ" "×" :string) + ("ȝ" "ï" :string) + ("Ȝ" "ï" :string) + ("þ" "ö" :string) + ("Þ" "ö" :string) + ("Ç·" "÷" :string) + ("Æ¿" "÷" :string) + ("a" "€" :string) + ("A" "€" :string) + ("b" "„" :string) + ("B" "„" :string) + ("C" "†" :string) + ("c" "†" :string) + ("d" "" :string) + ("D" "" :string) + ("E" "—" :string) + ("e" "—" :string) + ("F" "œ" :string) + ("f" "œ" :string) + ("g" "" :string) + ("G" "" :string) + ("H" "¤" :string) + ("h" "¤" :string) + ("I" "¨" :string) + ("i" "¨" :string) + ("J" "¬" :string) + ("j" "¬" :string) + ("K" "®" :string) + ("k" "®" :string) + ("L" "´" :string) + ("l" "´" :string) + ("Mc" "»†" :string) + ("Mac" "»†" :string) + ("M" "»" :string) + ("m" "»" :string) + ("N" "¼" :string) + ("n" "¼" :string) + ("O" "Ã" :string) + ("o" "Ã" :string) + ("P" "È" :string) + ("p" "È" :string) + ("q" "Ê" :string) + ("Q" "Ê" :string) + ("r" "Ë" :string) + ("R" "Ë" :string) + ("S" "Ð" :string) + ("s" "Ð" :string) + ("T" "Ú" :string) + ("t" "Ú" :string) + ("u" "à" :string) + ("U" "à" :string) + ("v" "å" :string) + ("V" "å" :string) + ("w" "æ" :string) + ("W" "æ" :string) + ("X" "ë" :string) + ("x" "ë" :string) + ("Y" "í" :string) + ("y" "í" :string) + ("z" "ð" :string) + ("Z" "ð" :string) + )) + +(define-rule-set "en-resolve-diacritics" + + :rules (("ȝ" "¢" :string) + ("þ" "¢" :string) + ("Ç·" "¢" :string) + ("Þ" "¢" :string) + ("Ȝ" "¢" :string) + ("Æ¿" "¢" :string) + ("Ö" "£" :string) + ("Ñ" "£" :string) + ("ð" "£" :string) + ("Ç" "£" :string) + ("É" "£" :string) + ("Ï" "£" :string) + ("ï" "£" :string) + ("ö" "£" :string) + ("ñ" "£" :string) + ("ç" "£" :string) + ("à" "£" :string) + ("À" "£" :string) + ("é" "£" :string) + ("Ð" "£" :string) + ("Ô" "¤" :string) + ("ô" "¤" :string) + ("È" "¤" :string) + ("è" "¤" :string) + ("Ë" "¥" :string) + ("ë" "¥" :string) + ("Ê" "¦" :string) + ("ê" "¦" :string) + ("œ" "ÿ" :string) + ("Æ" "ÿ" :string) + ("Œ" "ÿ" :string) + ("æ" "ÿ" :string) + ("S" "¢" :string) + ("K" "¢" :string) + ("d" "¢" :string) + ("Y" "¢" :string) + ("E" "¢" :string) + ("y" "¢" :string) + ("g" "¢" :string) + ("e" "¢" :string) + ("J" "¢" :string) + ("q" "¢" :string) + ("D" "¢" :string) + ("b" "¢" :string) + ("z" "¢" :string) + ("w" "¢" :string) + ("Q" "¢" :string) + ("M" "¢" :string) + ("C" "¢" :string) + ("L" "¢" :string) + ("X" "¢" :string) + ("P" "¢" :string) + ("T" "¢" :string) + ("a" "¢" :string) + ("N" "¢" :string) + ("j" "¢" :string) + ("Z" "¢" :string) + ("u" "¢" :string) + ("k" "¢" :string) + ("t" "¢" :string) + ("W" "¢" :string) + ("v" "¢" :string) + ("s" "¢" :string) + ("B" "¢" :string) + ("H" "¢" :string) + ("c" "¢" :string) + ("I" "¢" :string) + ("G" "¢" :string) + ("U" "¢" :string) + ("F" "¢" :string) + ("r" "¢" :string) + ("x" "¢" :string) + ("V" "¢" :string) + ("h" "¢" :string) + ("f" "¢" :string) + ("i" "¢" :string) + ("A" "¢" :string) + ("O" "¢" :string) + ("n" "¢" :string) + ("m" "¢" :string) + ("l" "¢" :string) + ("p" "¢" :string) + ("R" "¢" :string) + ("o" "¢" :string) + )) + +(define-rule-set "en-resolve-case" + + :rules (("Ö" "8" :string) + ("Ñ" "8" :string) + ("Ô" "8" :string) + ("Ç" "8" :string) + ("É" "8" :string) + ("Ï" "8" :string) + ("Ê" "8" :string) + ("È" "8" :string) + ("Ë" "8" :string) + ("Ç·" "8" :string) + ("À" "8" :string) + ("Þ" "8" :string) + ("Ȝ" "8" :string) + ("Ð" "8" :string) + ("Æ" "89" :string) + ("Œ" "89" :string) + ("ð" "9" :string) + ("ô" "9" :string) + ("ȝ" "9" :string) + ("ï" "9" :string) + ("ö" "9" :string) + ("ñ" "9" :string) + ("ç" "9" :string) + ("à" "9" :string) + ("þ" "9" :string) + ("è" "9" :string) + ("ë" "9" :string) + ("ê" "9" :string) + ("é" "9" :string) + ("Æ¿" "9" :string) + ("œ" "99" :string) + ("æ" "99" :string) + ("S" "8" :string) + ("K" "8" :string) + ("Y" "8" :string) + ("E" "8" :string) + ("J" "8" :string) + ("D" "8" :string) + ("Q" "8" :string) + ("M" "8" :string) + ("C" "8" :string) + ("L" "8" :string) + ("X" "8" :string) + ("P" "8" :string) + ("T" "8" :string) + ("N" "8" :string) + ("Z" "8" :string) + ("W" "8" :string) + ("B" "8" :string) + ("H" "8" :string) + ("I" "8" :string) + ("G" "8" :string) + ("U" "8" :string) + ("F" "8" :string) + ("V" "8" :string) + ("A" "8" :string) + ("O" "8" :string) + ("R" "8" :string) + ("d" "9" :string) + ("y" "9" :string) + ("g" "9" :string) + ("e" "9" :string) + ("q" "9" :string) + ("b" "9" :string) + ("z" "9" :string) + ("w" "9" :string) + ("a" "9" :string) + ("j" "9" :string) + ("u" "9" :string) + ("k" "9" :string) + ("t" "9" :string) + ("v" "9" :string) + ("s" "9" :string) + ("c" "9" :string) + ("r" "9" :string) + ("x" "9" :string) + ("h" "9" :string) + ("f" "9" :string) + ("i" "9" :string) + ("n" "9" :string) + ("m" "9" :string) + ("l" "9" :string) + ("p" "9" :string) + ("o" "9" :string) + )) + +(define-rule-set "en-ignore-special" + + :rules (("-" "" :string) + ("!" "" :string) + ("{" "" :string) + ("'" "" :string) + ("}" "" :string) + ("?" "" :string) + ("." "" :string) + )) + +(define-rule-set "en-resolve-special" + + :rules (("Ö" "¤" :string) + ("Ñ" "¤" :string) + ("ð" "¤" :string) + ("Ô" "¤" :string) + ("Ç" "¤" :string) + ("É" "¤" :string) + ("ô" "¤" :string) + ("Ï" "¤" :string) + ("ȝ" "¤" :string) + ("ï" "¤" :string) + ("Ê" "¤" :string) + ("ö" "¤" :string) + ("ñ" "¤" :string) + ("È" "¤" :string) + ("ç" "¤" :string) + ("Ë" "¤" :string) + ("à" "¤" :string) + ("þ" "¤" :string) + ("Ç·" "¤" :string) + ("è" "¤" :string) + ("À" "¤" :string) + ("ë" "¤" :string) + ("Þ" "¤" :string) + ("ê" "¤" :string) + ("é" "¤" :string) + ("Ȝ" "¤" :string) + ("Æ¿" "¤" :string) + ("Ð" "¤" :string) + ("œ" "¤¤" :string) + ("Æ" "¤¤" :string) + ("Œ" "¤¤" :string) + ("æ" "¤¤" :string) + ("?" "¡" :string) + ("!" "¢" :string) + ("." "£" :string) + ("S" "¤" :string) + ("K" "¤" :string) + ("d" "¤" :string) + ("Y" "¤" :string) + ("E" "¤" :string) + ("y" "¤" :string) + ("g" "¤" :string) + ("e" "¤" :string) + ("J" "¤" :string) + ("q" "¤" :string) + ("D" "¤" :string) + ("b" "¤" :string) + ("z" "¤" :string) + ("w" "¤" :string) + ("Q" "¤" :string) + ("M" "¤" :string) + ("C" "¤" :string) + ("L" "¤" :string) + ("X" "¤" :string) + ("P" "¤" :string) + ("T" "¤" :string) + ("a" "¤" :string) + ("N" "¤" :string) + ("j" "¤" :string) + ("Z" "¤" :string) + ("u" "¤" :string) + ("k" "¤" :string) + ("t" "¤" :string) + ("W" "¤" :string) + ("v" "¤" :string) + ("s" "¤" :string) + ("B" "¤" :string) + ("H" "¤" :string) + ("c" "¤" :string) + ("I" "¤" :string) + ("G" "¤" :string) + ("U" "¤" :string) + ("F" "¤" :string) + ("r" "¤" :string) + ("x" "¤" :string) + ("V" "¤" :string) + ("h" "¤" :string) + ("f" "¤" :string) + ("i" "¤" :string) + ("A" "¤" :string) + ("O" "¤" :string) + ("n" "¤" :string) + ("m" "¤" :string) + ("l" "¤" :string) + ("p" "¤" :string) + ("R" "¤" :string) + ("o" "¤" :string) + ("-" "¥" :string) + ("'" "¦" :string) + ("{" "§" :string) + ("}" "¨" :string) + )) + +; The following section is customised for samplexdy.tex +; (copied from samplexdy.xdy automatically generated by +; samplexdy.tex) + +; required styles + +(require "tex.xdy") + +; list of allowed attributes (number formats) + +(define-attributes (("default" + "glsnumberformat" + "textrm" + "textsf" + "texttt" + "textbf" + "textmd" + "textit" + "textup" + "textsl" + "textsc" + "emph" + "glshypernumber" + "hyperrm" + "hypersf" + "hypertt" + "hyperbf" + "hypermd" + "hyperit" + "hyperup" + "hypersl" + "hypersc" + "hyperemph" + "hyperbfit"))) + +; user defined alphabets + +; location class definitions + +(define-location-class "roman-page-numbers" + ("roman-numbers-lowercase")) +(define-location-class "Roman-page-numbers" + ("roman-numbers-uppercase")) +(define-location-class "arabic-page-numbers" + ("arabic-numbers")) +(define-location-class "alpha-page-numbers" + ("alpha")) +(define-location-class "Alpha-page-numbers" + ("ALPHA")) +(define-location-class "Appendix-page-numbers" + ("ALPHA" :sep "." "arabic-numbers")) +(define-location-class "arabic-section-numbers" + ("arabic-numbers" :sep "." "arabic-numbers")) + +; user defined location classes + +(define-location-class "Numberstring" + (:sep "\protect \Numberstringnum {" "arabic-numbers" :sep "}")) + +; define cross-reference class + +(define-crossref-class "see" :unverified ) +(markup-crossref-list :class "see" + :open "\glsseeformat" :close "{}") + +; define the order of the location classes +(define-location-class-order ( + "roman-page-numbers" + "arabic-page-numbers" + "arabic-section-numbers" + "alpha-page-numbers" + "Roman-page-numbers" + "Alpha-page-numbers" + "Appendix-page-numbers" + "see" )) + +; define the glossary markup + +(markup-index + :open "\glossarysection[\glossarytoctitle]{\glossarytitle}\glossarypreamble~n\begin{theglossary}\glossaryheader~n" + :close "~n\end{theglossary}~n\glossarypostamble~n" + :tree) +(markup-letter-group-list :sep "\glsgroupskip~n") +(markup-indexentry :open "~n" :depth 0) +(markup-locclass-list :open "{\glossaryentrynumbers{\relax " + :sep ", " :close "}}") +(markup-locref-list :sep "\delimN ") +(markup-range :sep "\delimR ") + +; define format to use for locations + +(markup-locref :open "~n\setentrycounter{page}\glsnumberformat{" + :close "}" + :attr "glsnumberformat") +(markup-locref :open "~n\setentrycounter{page}\textrm{" + :close "}" + :attr "textrm") +(markup-locref :open "~n\setentrycounter{page}\textsf{" + :close "}" + :attr "textsf") +(markup-locref :open "~n\setentrycounter{page}\texttt{" + :close "}" + :attr "texttt") +(markup-locref :open "~n\setentrycounter{page}\textbf{" + :close "}" + :attr "textbf") +(markup-locref :open "~n\setentrycounter{page}\textmd{" + :close "}" + :attr "textmd") +(markup-locref :open "~n\setentrycounter{page}\textit{" + :close "}" + :attr "textit") +(markup-locref :open "~n\setentrycounter{page}\textup{" + :close "}" + :attr "textup") +(markup-locref :open "~n\setentrycounter{page}\textsl{" + :close "}" + :attr "textsl") +(markup-locref :open "~n\setentrycounter{page}\textsc{" + :close "}" + :attr "textsc") +(markup-locref :open "~n\setentrycounter{page}\emph{" + :close "}" + :attr "emph") +(markup-locref :open "~n\setentrycounter{page}\glshypernumber{" + :close "}" + :attr "glshypernumber") +(markup-locref :open "~n\setentrycounter{page}\hyperrm{" + :close "}" + :attr "hyperrm") +(markup-locref :open "~n\setentrycounter{page}\hypersf{" + :close "}" + :attr "hypersf") +(markup-locref :open "~n\setentrycounter{page}\hypertt{" + :close "}" + :attr "hypertt") +(markup-locref :open "~n\setentrycounter{page}\hyperbf{" + :close "}" + :attr "hyperbf") +(markup-locref :open "~n\setentrycounter{page}\hypermd{" + :close "}" + :attr "hypermd") +(markup-locref :open "~n\setentrycounter{page}\hyperit{" + :close "}" + :attr "hyperit") +(markup-locref :open "~n\setentrycounter{page}\hyperup{" + :close "}" + :attr "hyperup") +(markup-locref :open "~n\setentrycounter{page}\hypersl{" + :close "}" + :attr "hypersl") +(markup-locref :open "~n\setentrycounter{page}\hypersc{" + :close "}" + :attr "hypersc") +(markup-locref :open "~n\setentrycounter{page}\hyperemph{" + :close "}" + :attr "hyperemph") +(markup-locref :open "~n\setentrycounter{page}\hyperbfit{" + :close "}" + :attr "hyperbfit") + +; define letter group list format + +(markup-letter-group-list :sep "\glsgroupskip~n") + +; letter group headings + +(markup-letter-group :open-head "\glsgroupheading{" + :close-head "}") + +(define-letter-group "glsnumbers" + :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9") + :before "A") + +; The following is copied from xindy/lang/english/utf8-lang.xdy + +(define-sort-rule-orientations (forward backward forward forward)) +(use-rule-set :run 0 + :rule-set ("en-alphabetize" "en-ignore-special")) +(use-rule-set :run 1 + :rule-set ("en-resolve-diacritics" "en-ignore-special")) +(use-rule-set :run 2 + :rule-set ("en-resolve-case" "en-ignore-special")) +(use-rule-set :run 3 + :rule-set ("en-resolve-special")) + diff --git a/macros/latex/contrib/glossaries/samples/samplexdy.pdf b/macros/latex/contrib/glossaries/samples/samplexdy.pdf new file mode 100644 index 0000000000..09ed5d568e Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/samplexdy.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/samplexdy.tex b/macros/latex/contrib/glossaries/samples/samplexdy.tex new file mode 100644 index 0000000000..808a1ac5ee --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/samplexdy.tex @@ -0,0 +1,300 @@ +% This file is public domain. +% +% This is a sample document illustrating how to use the +% glossaries package with xindy. To create the document: +% +% latex samplexdy +% makeglossaries samplexdy +% latex samplexdy +% +% If you don't have Perl installed, then use one of the +% following instead of makeglossaries: +% +% If you want to have a separate "Mc" letter group do: +% +% xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo +% +% Otherwise do: +% +% xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo +% +% If you want to use arara, you need the following directives: +% arara: pdflatex: { synctex: on } +% arara: makeglossaries +% arara: pdflatex: { synctex: on } +\documentclass{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[notext,notextcomp]{stix} + +\usepackage[colorlinks,plainpages]{hyperref} +\usepackage[xindy,style=altlistgroup]{glossaries} + +% Define a new command to do bold italic: + +\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}} + +% Need to add this to the list of attributes in order +% to use it with xindy: +% (This command will have no effect if \noist is used) + +\GlsAddXdyAttribute{hyperbfit} + +% Redefine the page numbers to a custom format (requires stix +% package for the dice commands): + +% \tallynum{n} displays a die or dice where the dots add up to n +\newrobustcmd{\tallynum}[1]{% + \ifnum\number#1<7 + $\csname dice\romannumeral#1\endcsname$% + \else + $\dicevi$% + \expandafter\tallynum\expandafter{\numexpr#1-6}% + \fi +} + +% \tally{counter} expands to \tallynum{n} where n is the counter +% value. In order to work with glossaries and xindy this requires +% a very specific format. (See the glossaries user manual for more +% details.) + +\newcommand{\tally}[1]{\tallynum{\arabic{page}}} + +% Now redefine \thepage +% (\texorpdfstring is used in case the page number ends up in a PDF +% bookmark, although this is unlikely) +\renewcommand*{\thepage}{\texorpdfstring{\tally{page}}{\arabic{page}}} + +% Need to add this to the list of location styles. +% This requires knowing how \thepage expands when written to a file. +% You can check by inspecting the ':locref' attributes in the .glo +% file. In this case, \thepage expands to \tallynum {n} +% (the space is significant) where n is an arabic number. +% (This command will have no effect if \noist is used) + +\GlsAddXdyLocation{tally}{% tally location format + :sep "\string\tallynum\space\glsopenbrace" % -> \tallynum { + "arabic-numbers" % -> arabic number (0, 1, 2, etc) + :sep "\glsclosebrace" % -> } +} + +% If the definition of \tally changes so that it expands to +% something slightly different then the above will have to be +% changed accordingly. + +% (Need to redefine \glsXpageXhyperbfit and +% \glsXpageXglsnumberformat after \makeglossaries to get the +% hyperlinks working correctly.) + +% To have Mc as a separate group uncomment the following three +% lines: + +%\setStyleFile{samplexdy-mc} % note no extension +%\noist +%\GlsSetXdyLanguage{} + +% The above three lines specify to use samplexdy-mc.xdy (supplied +% with this file) and don't overwrite it. The language is +% unset using \GlsSetXdyLanguage{} as all the language +% dependent information is contained in samplexdy-mc.xdy +% Note that using \noist means that commands like +% \GlsAddXdyAttribute and \GlsAddXdyLocation will no longer have +% an effect. + +% Write the style file (if \noist isn't used) +% and activate glossary entries + +\makeglossaries + +% Each page location will be specified in the form: +% +% "\glsXpageXglsnumberformat{}{\tallynum {" number "}}" +% or +% "\glsXpageXhyperbfit{}{\tallynum {" number "}}" +% +% Knowing this, we can redefine \glsXpageXglsnumberformat +% and \glsXpageXhyperbfit to grab the number part to work out the +% location's numeric value. If the definition of \tally changes +% so that it expands to something slightly different then this +% code will no longer work. +% +% Redefine to allow hyperlinks: + +\renewcommand{\glsXpageXglsnumberformat}[2]{% + % remember that #2 is in the form \tallynum {n} + % so this does \linkpagenumber\tallynum{n} + \linkpagenumber#2% +} + +\renewcommand{\glsXpageXhyperbfit}[2]{% + \textbf{\em\linkpagenumber#2}% +} + +% Syntax: \linkpagenumber\tallynum{page number} +% This creates hyperlink to the given page. +\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} + +% Define glossary entries +% \glshyperlink is used instead of \gls to prevent the glossary +% page numbers also appear in the locations, however I need +% to ensure that the referenced entries are added to the +% glossary via commands that use \glslink, \glsadd or \glssee + +\newglossaryentry{mcadam}{name={McAdam, John Loudon}, +first={John Loudon McAdam},text={McAdam}, +description={Scottish engineer}} + +\newglossaryentry{maclaurin}{name={Maclaurin, Colin}, +first={Colin Maclaurin},text={Maclaurin}, +description={Scottish mathematician best known for the +\gls{maclaurinseries}}} + +\newglossaryentry{maclaurinseries}{name={Maclaurin series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylorstheorem}{name={Taylor's theorem}, +description={Theorem expressing a function $f(x)$ as the sum of +a polynomial and a remainder: +\[f(x) = f(a)+f'(a)(x-a)+f''(a)(x-a^2)/2!+\cdots+R_n\] +If $n\to\infty$ the expansion is a \glshyperlink{taylorseries} +and if $a=0$, the series is called a +\gls{maclaurinseries}}} + +\newglossaryentry{taylorseries}{name={Taylor series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylor}{name={Taylor, Brook}, +first={Brook Taylor},text={Taylor}, +description={English mathematician}} + +\newglossaryentry{mcnemar}{name={McNemar, Quinn}, +first={Quinn McNemar},text={McNemar}, +description={Mathematician who introduced +\gls{mcnemarstest}. This entry has the number list +suppressed},nonumberlist} + +\newglossaryentry{mcnemarstest}{name={McNemar's test}, +description={A nonparametric test introduced by +\gls{mcnemar} in 1947}} + +\newglossaryentry{mach}{name={Mach, Ernst}, +first={Ernst Mach},text={Mach}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach, Ernst}, +description={Czech/Austrian physicist and philosopher}} + +\newglossaryentry{machnumber}{name={Mach number}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach number}, +description={Ratio of the speed of a body in a fluid to the +speed of sound in that fluid named after \gls{mach}}} + +\newglossaryentry{malthus}{name={Malthus, Thomas Robert}, +first={Thomas Robert Malthus},text={Malthus}, +description={English mathematician, sociologist and classicist}} + +\newglossaryentry{ampereandre}{name={Ampère, André-Marie}, +first={André-Marie Ampère},text={Ampère}, +description={French mathematician and physicist}} + +\newglossaryentry{ampere}{name={ampere}, +description={SI unit of electric current named after +\gls{ampereandre}}} + +\newglossaryentry{archimedes}{name={Archimedes of Syracuse}, +first={Archimedes of Syracuse},text={Archimedes}, +description={Greek mathematician}} + +\newglossaryentry{archimedesprinciple}{name={Archimedes' principle}, +description={Principle that if a body is submerged in a fluid +it experiences upthrust equal to the weight of the displaced +fluid. Named after \gls{archimedes}}} + +\newglossaryentry{galton}{name={Galton, Sir Francis}, +first={Sir Francis Galton},text={Galton}, +description={English anthropologist}} + +\newglossaryentry{gauss}{name={Gauss, Karl Friedrich}, +first={Karl Friedrich Gauss},text={Gauss}, +description={German mathematician}} + +\newglossaryentry{gaussianint}{name={Gaussian integer}, +description={Complex number where both real and imaginary +parts are integers}} + +\newglossaryentry{gaussianfn}{name={Gaussian function}, + description={A function of the form: + \[f(x) = a \exp\left(-\frac{(x-b)^2}{2c^2}\right)\] + for some constants $a$, $b$ and $c$}} + +\newglossaryentry{peano}{name={Peano, Giuseppe}, +first={Giuseppe Peano},text={Peano}, +description={Italian mathematician}} + +\newglossaryentry{peanoscurve}{name={Peano's curve}, +description={A space-filling curve discovered by +\gls{peano}}} + +\newglossaryentry{pearson}{name={Pearson, Karl}, +first={Karl Pearson},text={Pearson}, +description={English mathematician}} + +\newglossaryentry{pearspmcc}{name={Pearson's product moment +correlation coefficient},description={Product moment correlation +coefficient named after \gls{pearson}}} + +\begin{document} +\title{Sample Document Using the Glossaries Package With Xindy} +\author{Nicola Talbot} +\maketitle + +\section{\glsentryfirst{gauss}} + +This is a section on \gls[format=(]{gauss}. This section spans +several pages. + +\rule{1pt}{0.6\textheight} + +This paragraph has been shoved to the bottom of the page using a rule. +This paragraph spans a page break for testing purposes to ensure the +glossary entry in this paragraph has the correct location. Here's +the glossary entry: \gls{gaussianfn}. Check that the location is +correct. + +This page talks about \glspl[format=hyperbfit]{gaussianint}. Since +it's the principle definition, the user-defined hyperbfit format is +used. + +\newpage + +The section on \gls[format=)]{gauss} ends here. + +\section{Series Expansions} + +This section is about series expansions. It mentions +\gls{maclaurin} and \gls{taylor}. It also discusses +\gls{taylorstheorem} which is related to the \gls{taylorseries}. +The \gls{maclaurinseries} is a special case of the +\gls{taylorseries}. + +\section{\glsentryname{archimedesprinciple}} + +This section discusses \gls{archimedesprinciple} which was +introduced by \gls{archimedes}. + +\section{Another section} + +This section covers \gls{mach} who introduced the \gls{machnumber}. +It also mentions \gls{ampereandre} after whom the +SI unit \gls{ampere} is named. It then discusses \gls{galton} +and \gls{malthus}. Finally it mentions \gls{mcadam}. + +\newpage +This page discusses \gls{mcnemar} who introduced +\gls{mcnemarstest} and \gls{peano} who discovered \gls{peanoscurve}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/samplexdy2.pdf b/macros/latex/contrib/glossaries/samples/samplexdy2.pdf new file mode 100644 index 0000000000..029f4bfb79 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/samplexdy2.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/samplexdy2.tex b/macros/latex/contrib/glossaries/samples/samplexdy2.tex new file mode 100644 index 0000000000..4ed7bd7244 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/samplexdy2.tex @@ -0,0 +1,73 @@ + % This file is public domain + % + % This is a sample document illustrating how to use the + % glossaries package with xindy. To create the document: + % + % pdflatex samplexdy2 + % makeglossaries samplexdy2 + % pdflatex samplexdy2 + % + % This sample file won't work with makeindex + % + % If you want to use arara, you need the following directives: + % arara: pdflatex: { synctex: on } + % arara: makeglossaries + % arara: pdflatex: { synctex: on } +\documentclass{report} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[colorlinks]{hyperref} +\usepackage[xindy,counter=section]{glossaries} + + % Set up somewhat eccentric section numbering system: + +\renewcommand*{\thesection}{[\thechapter]\arabic{section}} + +\renewcommand*{\theHsection}{\thepart.\thesection} +\renewcommand*{\thepart}{\Roman{part}} + +\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "[" + "arabic-numbers" :sep "]" "arabic-numbers" +} + + % If part is 0, then \thepart will be empty, so add an extra + % case to catch this: + +\GlsAddXdyLocation{zero.section}{:sep "[" + "arabic-numbers" :sep "]" "arabic-numbers" +} + + % (Note that the above will stop xindy giving a warning, but the + % location hyper links will be invalid if no \part is used.) + +\makeglossaries + +\newglossaryentry{sample}{name=sample,description={an example}} +\newglossaryentry{sample2}{name=sample2,description={another example}} + +\begin{document} +This is a sample document illustrating Xindy specific commands in +the glossaries package. + +\part{First Part} + +\chapter{Sample Chapter} +This example document has an eccentric section numbering system +where the section number is prefixed by the chapter number in square +brackets. + +\section{First Section} + +\gls{sample}. \gls{sample2}. + +\section{Second Section} + +\gls{sample2}. + +\section{Third Section} + +\gls{sample}. \gls{sample2}. + +\printglossaries +\end{document} diff --git a/macros/latex/contrib/glossaries/samples/samplexdy3.pdf b/macros/latex/contrib/glossaries/samples/samplexdy3.pdf new file mode 100644 index 0000000000..14c420dcf3 Binary files /dev/null and b/macros/latex/contrib/glossaries/samples/samplexdy3.pdf differ diff --git a/macros/latex/contrib/glossaries/samples/samplexdy3.tex b/macros/latex/contrib/glossaries/samples/samplexdy3.tex new file mode 100644 index 0000000000..dcdc327b37 --- /dev/null +++ b/macros/latex/contrib/glossaries/samples/samplexdy3.tex @@ -0,0 +1,269 @@ +% This file is public domain. +% +% This is a sample document illustrating how to use the +% glossaries package with xindy. To create the document: +% +% latex samplexdy +% makeglossaries samplexdy +% latex samplexdy +% +% If you don't have Perl installed, then use one of the +% following instead of makeglossaries: +% +% If you want to have a separate "Mc" letter group do: +% +% xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo +% +% Otherwise do: +% +% xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo +% +% If you want to use arara, you need the following directives: +% arara: pdflatex: { synctex: on } +% arara: makeglossaries +% arara: pdflatex: { synctex: on } + \documentclass{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{fmtcount} + +\usepackage[colorlinks,plainpages]{hyperref} +\usepackage[xindy,style=altlistgroup]{glossaries} + +% Define a new command to do bold italic: + +\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}} + +% Need to add this to the list of attributes in order +% to use it with xindy: +% (This command will have no effect if \noist is used) + +\GlsAddXdyAttribute{hyperbfit} + +% Redefine the page numbers so that they appear as a word: + +\renewcommand*{\thepage}{\texorpdfstring{\customfmt{page}}{\arabic{page}}} + +\newcommand{\customfmt}[1]{\customfmtnum{\arabic{#1}}} +\newrobustcmd{\customfmtnum}[1]{\Numberstringnum{#1}} + +% Need to add this to the list of location styles. +% \customfmt{page} gets expanded to +% \custommfmtnum {} (where is the page number) +% so need to define the location in that format: +% (This command will have no effect if \noist is used) + +\GlsAddXdyLocation{customfmt}{:sep "\string\customfmtnum\space\glsopenbrace" + "arabic-numbers" :sep "\glsclosebrace"} + +% (Need to redefine \glsXpageXhyperbfit and +% \glsXpageXglsnumberformat after \makeglossaries to get the +% hyperlinks working correctly.) + +% To have Mc as a separate group uncomment the following three +% lines: + +%\setStyleFile{samplexdy-mc} % note no extension +%\noist +%\GlsSetXdyLanguage{} + +% The above three lines specify to use samplexdy-mc.xdy (supplied +% with this file) and don't overwrite it. The language is +% unset using \GlsSetXdyLanguage{} as all the language +% dependent information is contained in samplexdy-mc.xdy +% Note that using \noist means that commands like +% \GlsAddXdyAttribute and \GlsAddXdyLocation will no longer have +% an effect. + +% Write the style file (if \noist isn't used) +% and activate glossary entries + +\makeglossaries + +% Each page location will be specified in the form: +% +% "\glsXpageXglsnumberformat{}{\customfmtnum "\marg{n}"}" +% or +% "\glsXpageXhyperbfit{}{\customfmtnum "\marg{n}"}" +% +% Redefine to allow hyperlinks: + +\renewcommand{\glsXpageXglsnumberformat}[2]{% + \linkpagenumber#2% +} + +\renewcommand{\glsXpageXhyperbfit}[2]{% + \textbf{\em\linkpagenumber#2}% +} + +% The arguments of \linkpagenumber will be +% #1 -> \customfmtnum +% #2 -> n +% This means that the page number (n) can be used to +% form the hyperlink target. +\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}} + +% Define glossary entries +% \glshyperlink is used instead of \gls to prevent the glossary +% page numbers also appear in the locations, however I need +% to ensure that the referenced entries are added to the +% glossary via commands that use \glslink, \glsadd or \glssee + +\newglossaryentry{mcadam}{name={McAdam, John Loudon}, +first={John Loudon McAdam},text={McAdam}, +description={Scottish engineer}} + +\newglossaryentry{maclaurin}{name={Maclaurin, Colin}, +first={Colin Maclaurin},text={Maclaurin}, +description={Scottish mathematician best known for the +\gls{maclaurinseries}}} + +\newglossaryentry{maclaurinseries}{name={Maclaurin series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylorstheorem}{name={Taylor's theorem}, +description={Theorem expressing a function $f(x)$ as the sum of +a polynomial and a remainder: +\[f(x) = f(a)+f'(a)(x-a)+f''(a)(x-a^2)/2!+\cdots+R_n\] +If $n\to\infty$ the expansion is a \glshyperlink{taylorseries} +and if $a=0$, the series is called a +\gls{maclaurinseries}}} + +\newglossaryentry{taylorseries}{name={Taylor series}, +description={Series expansion},see={taylorstheorem}} + +\newglossaryentry{taylor}{name={Taylor, Brook}, +first={Brook Taylor},text={Taylor}, +description={English mathematician}} + +\newglossaryentry{mcnemar}{name={McNemar, Quinn}, +first={Quinn McNemar},text={McNemar}, +description={Mathematician who introduced +\gls{mcnemarstest}. This entry has the number list +suppressed},nonumberlist} + +\newglossaryentry{mcnemarstest}{name={McNemar's test}, +description={A nonparametric test introduced by +\gls{mcnemar} in 1947}} + +\newglossaryentry{mach}{name={Mach, Ernst}, +first={Ernst Mach},text={Mach}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach, Ernst}, +description={Czech/Austrian physicist and philosopher}} + +\newglossaryentry{machnumber}{name={Mach number}, +% if using samplexdy-mc.xdy, the following line is needed +% to prevent this entry being put in the "Mc" group +sort={mach number}, +description={Ratio of the speed of a body in a fluid to the +speed of sound in that fluid named after \gls{mach}}} + +\newglossaryentry{malthus}{name={Malthus, Thomas Robert}, +first={Thomas Robert Malthus},text={Malthus}, +description={English mathematician, sociologist and classicist}} + +\newglossaryentry{ampereandre}{name={Ampère, André-Marie}, +first={André-Marie Ampère},text={Ampère}, +description={French mathematician and physicist}} + +\newglossaryentry{ampere}{name={ampere}, +description={SI unit of electric current named after +\gls{ampereandre}}} + +\newglossaryentry{archimedes}{name={Archimedes of Syracuse}, +first={Archimedes of Syracuse},text={Archimedes}, +description={Greek mathematician}} + +\newglossaryentry{archimedesprinciple}{name={Archimedes' principle}, +description={Principle that if a body is submerged in a fluid +it experiences upthrust equal to the weight of the displaced +fluid. Named after \gls{archimedes}}} + +\newglossaryentry{galton}{name={Galton, Sir Francis}, +first={Sir Francis Galton},text={Galton}, +description={English anthropologist}} + +\newglossaryentry{gauss}{name={Gauss, Karl Friedrich}, +first={Karl Friedrich Gauss},text={Gauss}, +description={German mathematician}} + +\newglossaryentry{gaussianint}{name={Gaussian integer}, +description={Complex number where both real and imaginary +parts are integers}} + +\newglossaryentry{gaussianfn}{name={Gaussian function}, + description={A function of the form: + \[f(x) = a \exp\left(-\frac{(x-b)^2}{2c^2}\right)\] + for some constants $a$, $b$ and $c$}} + +\newglossaryentry{peano}{name={Peano, Giuseppe}, +first={Giuseppe Peano},text={Peano}, +description={Italian mathematician}} + +\newglossaryentry{peanoscurve}{name={Peano's curve}, +description={A space-filling curve discovered by +\gls{peano}}} + +\newglossaryentry{pearson}{name={Pearson, Karl}, +first={Karl Pearson},text={Pearson}, +description={English mathematician}} + +\newglossaryentry{pearspmcc}{name={Pearson's product moment +correlation coefficient},description={Product moment correlation +coefficient named after \gls{pearson}}} + +\begin{document} +\title{Sample Document Using the Glossaries Package With Xindy} +\author{Nicola Talbot} +\maketitle + +\section{\glsentryfirst{gauss}} + +This is a section on +\gls[format=(]{gauss}. This section spans +several pages. + +\rule{1pt}{0.6\textheight} + +This paragraph has been shoved to the bottom of the page using a rule. +This paragraph spans a page break for testing purposes to ensure the +glossary entry in this paragraph has the correct location. Here's +the glossary entry: \gls{gaussianfn}. + +This page talks about \glspl[format=hyperbfit]{gaussianint}. Since +it's the principle definition, the user-defined hyperbfit format is +used. + +\newpage + +The section on \gls[format=)]{gauss} ends here. + +\section{Series Expansions} + +This section is about series expansions. It mentions +\gls{maclaurin} and \gls{taylor}. It also discusses +\gls{taylorstheorem} which is related to the \gls{taylorseries}. +The \gls{maclaurinseries} is a special case of the +\gls{taylorseries}. + +\section{\glsentryname{archimedesprinciple}} + +This section discusses \gls{archimedesprinciple} which was +introduced by \gls{archimedes}. + +\section{Another section} + +This section covers \gls{mach} who introduced the \gls{machnumber}. +It also mentions \gls{ampereandre} after whom the +SI unit \gls{ampere} is named. It then discusses \gls{galton} +and \gls{malthus}. Finally it mentions \gls{mcadam}. + +\newpage +This page discusses \gls{mcnemar} who introduced +\gls{mcnemarstest} and \gls{peano} who discovered \gls{peanoscurve}. + +\printglossaries +\end{document} -- cgit v1.2.3