From 8d88e6714a570bf2b598132718ae2beb4641c80b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 26 Jan 2016 22:52:39 +0000 Subject: glossaries-extra (24jan15) git-svn-id: svn://tug.org/texlive/trunk@39487 c570f23f-e606-0410-a88d-b1316a301751 --- .../latex/glossaries-extra/glossaries-extra.dtx | 9943 ++++++++++++++++++++ .../latex/glossaries-extra/glossaries-extra.ins | 31 + 2 files changed, 9974 insertions(+) create mode 100644 Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx create mode 100644 Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins (limited to 'Master/texmf-dist/source/latex/glossaries-extra') diff --git a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx new file mode 100644 index 00000000000..79b243129a4 --- /dev/null +++ b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.dtx @@ -0,0 +1,9943 @@ +%\iffalse +% glossaries-extra.dtx generated using makedtx version 1.1 (c) Nicola Talbot +% Command line args: +% -author "Nicola Talbot" +% -doc "glossaries-extra-codedoc.tex" +% -codetitle "Main Package Code" +% -src "glossaries-extra.sty\Z=>glossaries-extra.sty" +% -section "chapter" +% glossaries-extra +% Created on 2016/1/24 16:56 +%\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) 2016 Nicola Talbot, all rights reserved. +% \fi +% \iffalse +%<*driver> +\documentclass[report,widecs]{nlctdoc} + +\iffalse +glossaries-extra-codedoc.tex is a stub file used by makedtx to create +glossaries-extra.dtx +\fi + +\usepackage{alltt} +\usepackage{pifont} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[colorlinks, + bookmarks, + hyperindex=false, + pdfauthor={Nicola L.C. Talbot}, + pdftitle={glossaries-extra.sty: an extension to the glossaries +package}, + pdfkeywords={LaTeX,package,glossary,abbreviations}]{hyperref} +\usepackage{glossaries-extra} + +\RecordChanges + +\makeglossaries + +\renewcommand*{\main}[1]{\hyperpage{#1}} +\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}} +\newcommand*{\itermdef}[1]{\index{#1|htextbf}} + +\newglossaryentry{xindy}{ + name={\appfmt{xindy}\index{xindy|htextbf}}, + sort={xindy}, + text={\protect\app{xindy}}, + description={An flexible indexing application with multilingual + support written in Perl} +} + +\newglossaryentry{makeindex}{% + name={\appfmt{makeindex}\index{makeindex|htextbf}},% + sort={makeindex},% + text={\protect\app{makeindex}},% + description={An indexing application}, +} + +\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{Counter}{counter}{glossary counters} +\doxitem{AbbrvStyle}{abbrvstyle}{abbreviation styles} + +\setcounter{IndexColumns}{2} + +\CheckSum{6805} + +\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\sffamily#1}|main}} + +\newcommand*{\acrstyle}[1]{\textsf{#1}\index{acronym +styles (glossaries):>#1={\protect\ttfamily#1}|main}} + +\newcommand*{\abbrstyle}[1]{\textsf{#1}\index{abbreviation styles:>#1={\protect\sffamily#1}|main}} + +\newcommand*{\category}[1]{\textsf{#1}\index{entry categories:>#1={\protect\sffamily#1}|main}} + +\newcommand*{\catattr}[1]{\textsf{#1}\index{category attributes:>#1={\protect\sffamily#1}|main}} + +\GlossaryPrologue{% + \chapter*{{Change History}}% + \markboth{{Change History}}{{Change History}}% + \phantomsection + \addcontentsline{toc}{chapter}{Change History}% + \raggedright +} + +\title{glossaries-extra.sty v1.0: + documented code} +\author{Nicola L.C. Talbot\\[10pt] +Dickimaw Books\\ +\url{http://www.dickimaw-books.com/}} + +\date{2016-01-24} + +\begin{document} +\DocInput{glossaries-extra.dtx} +\end{document} +% +%\fi +%\MakeShortVerb{"} +%\DeleteShortVerb{\|} +% +% \maketitle +% +%\begin{abstract} +%This is the documented code for the \sty{glossaries-extra} package. +%See glossaries-extra-manual.pdf for the user manual. +% +%\begin{important} +%This package is experimental and not stable. It's provided for +%testing purposes only. Future versions may not be compatible with +%this version. Once it has stabilised I'll add it to CTAN, at which +%point compatibility with the first stable version will be +%maintained. +%\end{important} +%\end{abstract} +% +%\tableofcontents +% +%\StopEventually{% +% \printglossaries +% \PrintChanges +% \PrintIndex +%} +% +% +% +%\chapter{Main Package Code} +%\iffalse +% \begin{macrocode} +%<*glossaries-extra.sty> +% \end{macrocode} +%\fi +%\changes{0.1}{2015-11-22}{Initial experimental release} +%\section{Package Initialisation and Options} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{glossaries-extra}[2016/01/24 v1.0 (NLCT)] +% \end{macrocode} +% Requires \sty{xkeyval} to define package options. +% \begin{macrocode} +\RequirePackage{xkeyval} +% \end{macrocode} +% Requires \sty{etoolbox} package. +% \begin{macrocode} +\RequirePackage{etoolbox} +% \end{macrocode} +% Has \sty{glossaries} already been loaded? +% \begin{macrocode} +\@ifpackageloaded{glossaries} +{% +% \end{macrocode} +% Already loaded so pass any options to \cs{setupglossaries}. +% This means that the options that can only be set when +% \sty{glossaries} is loaded can't be used. +% \begin{macrocode} + \newcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}% + \let\@glsxtr@declareoption\@gls@declareoption +} +{% +% \end{macrocode} +% Not already loaded, so pass options to \sty{glossaries}. +% \begin{macrocode} + \newcommand{\glsxtr@dooption}[1]{% + \PassOptionsToPackage{#1}{glossaries}% + }% +% \end{macrocode} +% Set the defaults. +% \begin{macrocode} + \PassOptionsToPackage{toc}{glossaries} + \PassOptionsToPackage{nopostdot}{glossaries} + \PassOptionsToPackage{noredefwarn}{glossaries} + \@ifpackageloaded{polyglossia}% + {}% + {% + \@ifpackageloaded{babel}% + {\PassOptionsToPackage{translate=babel}{glossaries}}% + {}% + }% + \newcommand*{\@glsxtr@declareoption}[2]{% + \DeclareOptionX{#1}{#2}% + \DeclareOption{#1}{#2}% + } +} +% \end{macrocode} +% Declare package options. +%\begin{macro}{\glsxtrundefaction} +% Determines what to do if an entry hasn't been defined. +% The two arguments are the error or warning message and the help +% message if an error should be produced. +% \begin{macrocode} +\newcommand*{\glsxtrundefaction}[2]{% + \@glsxtrundeftag\PackageError{glossaries-extra}{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtr@warnonexistsordo} +% If user wants \pkgopt[warn]{undefaction}, then \sty{glossaries} +% v4.19 is required. +% \begin{macrocode} +\newcommand*{\glsxtr@warnonexistsordo}[1]{} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrundeftag} +% Text to display when an entry doesn't exist. +% \begin{macrocode} +\newcommand*{\glsxtrundeftag}{??} +\newcommand*{\@glsxtrundeftag}{} +% \end{macrocode} +% This text is switched on at the start of the document to prevent +% unwanted text inserted into the preamble if any tests are made +% before the start of the document. +%\end{macro} +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{undefaction}[\val\nr]% + {warn,error}% + {% + \ifcase\nr\relax + \renewcommand*{\glsxtrundefaction}[2]{% + \@glsxtrundeftag\GlossariesExtraWarning{##1}% + }% + \renewcommand*{\glsxtr@warnonexistsordo}[1]{% + \GlossariesExtraWarning{glossaries-extra}{% + \string##1\space hasn't been defined, so + some errors won't be converted to warnings. + (This most likely means your version of + glossaries.sty is below version 4.19.)}% + }% + \or + \renewcommand*{\glsxtrundefaction}[2]{% + \@glsxtrundeftag\PackageError{glossaries-extra}{##1}{##2}% + }% + \renewcommand*{\glsxtr@warnonexistsordo}[1]{}% + \fi + } +% \end{macrocode} +% +% By default don't allow entries to be defined in the document to +% encourage the user to define them in the preamble, but if the user +% is really determined to define them in the document allow them to +% request this. +% \begin{macrocode} +\define@boolkey{glossaries-extra.sty}[@glsxtr]{docdef}[true]{} +% \end{macrocode} +% +%\begin{option}{indexcrossrefs} +% Automatically index cross references at the end of the document +% \begin{macrocode} +\define@boolkey{glossaries-extra.sty}[@glsxtr]{indexcrossrefs}[true]{% + \if@glsxtrindexcrossrefs + \else + \renewcommand*{\@glsxtr@autoindexcrossrefs}{}% + \fi +} +% \end{macrocode} +%\end{option} +% Switch off since this can increase the build time. +% \begin{macrocode} +\@glsxtrindexcrossrefsfalse +% \end{macrocode} +% But allow \gloskey{see} key to switch it on automatically. +%\begin{macro}{\@glsxtr@autoindexcrossrefs} +%\changes{1.0}{2016-01-24}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindexcrossrefs}{\@glsxtrindexcrossrefstrue} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlossariesExtraWarning} +%Allow users to suppress warnings. +% \begin{macrocode} +\newcommand*{\GlossariesExtraWarning}[1]{\PackageWarning{glossaries-extra}{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlossariesExtraWarningNoLine} +%Allow users to suppress warnings. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\GlossariesExtraWarningNoLine}[1]{% + \PackageWarningNoLine{glossaries-extra}{#1}} +% \end{macrocode} +%\end{macro} +% +% \begin{macrocode} +\@glsxtr@declareoption{nowarn}{% + \let\GlossariesExtraWarning\@gobble + \let\GlossariesExtraWarningNoLine\@gobble + \glsxtr@dooption{nowarn}% +} +% \end{macrocode} +% +%\begin{macro}{\glsxtrabbrvtype} +% Glossary type for abbreviations. +% \begin{macrocode} +\newcommand*{\glsxtrabbrvtype}{\glsdefaulttype} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@abbreviationsdef} +% Set by \pkgopt{abbreviations} option. +% \begin{macrocode} +\newcommand*{\@glsxtr@abbreviationsdef}{} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\@glsxtr@doabbreviationsdef} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@doabbreviationsdef}{% + \@ifpackageloaded{babel}% + {\providecommand{\abbreviationsname}{\acronymname}}% + {\providecommand{\abbreviationsname}{Abbreviations}}% + \newglossary[glg-abr]{abbreviations}{gls-abr}{glo-abr}{\abbreviationsname}% + \renewcommand*{\glsxtrabbrvtype}{abbreviations}% + \newcommand*{\printabbreviations}[1][]{% + \printglossary[type=\glsxtrabbrvtype,##1]% + }% + \disable@keys{glossaries-extra.sty}{abbreviations}% +% \end{macrocode} +% If the \pkgopt{acronym} option hasn't been used, change +% \ics{acronymtype} to \ics{glsxtrabbrvtype}. +%\changes{0.4}{2015-12-03}{added redefinition of \cs{acronymtype}} +% \begin{macrocode} + \ifglsacronym + \else + \renewcommand*{\acronymtype}{\glsxtrabbrvtype}% + \fi +}% +% \end{macrocode} +%\end{macro} +% +%\begin{option}{abbreviations} +% If \pkgopt{abbreviations}, create a new glossary type for abbreviations. +% \begin{macrocode} +\@glsxtr@declareoption{abbreviations}{% + \let\@glsxtr@abbreviationsdef\@glsxtr@doabbreviationsdef +} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\GlsXtrDefineAbbreviationShortcuts} +% Enable shortcut commands for the abbreviations. Unlike the analogous +% command provided by \sty{glossaries}, this uses \cs{newcommand} +% instead of \cs{let} as a safety feature. +% \begin{macrocode} +\newcommand*{\GlsXtrDefineAbbreviationShortcuts}{% + \newcommand*{\ab}{\cgls}% + \newcommand*{\abp}{\cglspl}% + \newcommand*{\as}{\glsxtrshort}% + \newcommand*{\asp}{\glsxtrshortpl}% + \newcommand*{\al}{\glsxtrlong}% + \newcommand*{\alp}{\glsxtrlongpl}% + \newcommand*{\af}{\glsxtrfull}% + \newcommand*{\afp}{\glsxtrfullpl}% + \newcommand*{\Ab}{\cGls}% + \newcommand*{\Abp}{\cGlspl}% + \newcommand*{\As}{\Glsxtrshort}% + \newcommand*{\Asp}{\Glsxtrshortpl}% + \newcommand*{\Al}{\Glsxtrlong}% + \newcommand*{\Alp}{\Glsxtrlongpl}% + \newcommand*{\Af}{\Glsxtrfull}% + \newcommand*{\Afp}{\Glsxtrfullpl}% + \newcommand*{\AB}{\cGLS}% + \newcommand*{\ABP}{\cGLSpl}% + \newcommand*{\AS}{\GLSxtrshort}% + \newcommand*{\ASP}{\GLSxtrshortpl}% + \newcommand*{\AL}{\GLSxtrlong}% + \newcommand*{\ALP}{\GLSxtrlongpl}% + \newcommand*{\AF}{\GLSxtrfull}% + \newcommand*{\AFP}{\GLSxtrfullpl}% + \newcommand*{\newabbr}{\newabbreviation}% +% \end{macrocode} +% Disable this command after it's been used. +% \begin{macrocode} + \let\GlsXtrDefineAbbreviationShortcuts\relax +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrDefineOtherShortcuts} +% Similarly provide shortcut versions for the commands provided by +% the \pkgopt{symbols} and \pkgopt{numbers} options. +% \begin{macrocode} +\newcommand*{\GlsXtrDefineOtherShortcuts}{% + \newcommand*{\newentry}{\newglossaryentry}% + \ifdef\printsymbols + {% + \newcommand*{\newsym}{\glsxtrnewsymbol}% + }{}% + \ifdef\printnumbers + {% + \newcommand*{\newnum}{\glsxtrnewnumber}% + }{}% + \let\GlsXtrDefineOtherShortcuts\relax +} +% \end{macrocode} +%\end{macro} +% +% Always use the long forms, not the shortcuts, where portablity is +% an issue. (For example, when defining entries in a file that may +% be input by multiple documents.) +% +%\begin{macro}{\@glsxtr@setupshortcuts} +% Command used to set the shortcuts option. +% \begin{macrocode} +\newcommand*{\@glsxtr@setupshortcuts}{} +% \end{macrocode} +%\end{macro} +% +%Provide \pkgopt{shortcuts} option. Unlike the \sty{glossaries} +%version, this is a choice rather than a boolean key but it also provides +%\pkgopt[true]{shortcuts} and \pkgopt[false]{shortcuts}, which are +%equivalent to \pkgopt[all]{shortcuts} and +%\pkgopt[none]{shortcuts}. Multiple use of this option in the +%\emph{same} option list will override each other. +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{shortcuts}[\val\nr]% + {acronyms,acro,abbreviations,abbr,other,all,true,none,false}[true]{% + \ifcase\nr\relax % acronyms + \renewcommand*{\@glsxtr@setupshortcuts}{% + \glsacrshortcutstrue + \DefineAcronymSynonyms + }% + \or % acro + \renewcommand*{\@glsxtr@setupshortcuts}{% + \glsacrshortcutstrue + \DefineAcronymSynonyms + }% + \or % abbreviations + \renewcommand*{\@glsxtr@setupshortcuts}{% + \GlsXtrDefineAbbreviationShortcuts + }% + \or % abbr + \renewcommand*{\@glsxtr@setupshortcuts}{% + \GlsXtrDefineAbbreviationShortcuts + }% + \or % other + \renewcommand*{\@glsxtr@setupshortcuts}{% + \GlsXtrDefineOtherShortcuts + }% + \or % all + \renewcommand*{\@glsxtr@setupshortcuts}{% + \glsacrshortcutstrue + \DefineAcronymSynonyms + \GlsXtrDefineAbbreviationShortcuts + \GlsXtrDefineOtherShortcuts + }% + \or % true + \renewcommand*{\@glsxtr@setupshortcuts}{% + \glsacrshortcutstrue + \DefineAcronymSynonyms + \GlsXtrDefineAbbreviationShortcuts + \GlsXtrDefineOtherShortcuts + }% + \else % none, false + \renewcommand*{\@glsxtr@setupshortcuts}{}% + \fi + } +% \end{macrocode} +% +%\begin{macro}{\@glsxtr@doaccsupp} +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@doaccsupp}{} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{accsupp} +% If \pkgopt{accsupp}, load \sty{glossaries-accsupp} package. +% \begin{macrocode} +\@glsxtr@declareoption{accsupp}{% + \renewcommand*{\@glsxtr@doaccsupp}{\RequirePackage{glossaries-accsupp}}} +% \end{macrocode} +%\end{option} +% +%\begin{macro}{\glsxtrNoGlossaryWarning} +%\changes{0.3}{2015-12-02}{new} +% Warning text displayed in document if the external glossary file +% given by the argument is missing. +% \begin{macrocode} +\newcommand{\glsxtrNoGlossaryWarning}[1]{% + \@glsxtr@defaultnoglossarywarning{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{option}{nomissingglstext} +% If true, suppress the text produced if the external glossary file +% is missing. +% \begin{macrocode} +\define@choicekey{glossaries-extra.sty}{nomissingglstext}[\val\nr]% + {true,false}[true]{% + \ifcase\nr\relax % true + \renewcommand{\glsxtrNoGlossaryWarning}[1]{% + \null + }% + \else % false + \renewcommand{\glsxtrNoGlossaryWarning}[1]{% + \@glsxtr@defaultnoglossarywarning{#1}% + }% + \fi + } +% \end{macrocode} +%\end{option} +% +% Pass all other options to \sty{glossaries}. +% \begin{macrocode} +\DeclareOptionX*{% + \expandafter\glsxtr@dooption\expandafter{\CurrentOption}} +% \end{macrocode} +% Process options. +% \begin{macrocode} +\ProcessOptionsX +% \end{macrocode} +% Load \sty{glossaries} if not already loaded. +% \begin{macrocode} +\RequirePackage{glossaries} +% \end{macrocode} +% Load the \sty{glossaries-accsupp} package if required. +% \begin{macrocode} +\@glsxtr@doaccsupp +% \end{macrocode} +% +% Define abbreviations glossaries if required. +% \begin{macrocode} +\@glsxtr@abbreviationsdef +\let\@glsxtr@abbreviationsdef\relax +% \end{macrocode} +% Setup shortcuts if required. +% \begin{macrocode} +\@glsxtr@setupshortcuts +% \end{macrocode} +% +%\begin{macro}{\glossariesextrasetup} +%Allow user to set options after the package has been loaded. +% First modify \cs{glsxtr@dooption} so that it now uses +% \cs{setupglossaries}: +% \begin{macrocode} +\renewcommand{\glsxtr@dooption}[1]{\setupglossaries{#1}}% +% \end{macrocode} +% Now define the user command: +% \begin{macrocode} +\newcommand*{\glossariesextrasetup}[1]{% + \let\@glsxtr@setupshortcuts\relax + \setkeys{glossaries-extra.sty}{#1}% + \@glsxtr@abbreviationsdef + \let\@glsxtr@abbreviationsdef\relax + \@glsxtr@setupshortcuts +} +% \end{macrocode} +%\end{macro} +% +% Disable preamble-only options and switch on the undefined tag at +% the start of the document. +% \begin{macrocode} +\AtBeginDocument{% + \disable@keys{glossaries-extra.sty}{abbreviations}% + \def\@glsxtrundeftag{\glsxtrundeftag}% +} +% \end{macrocode} +% +%\section{Extra Utilities} +%\begin{macro}{\glsxtrifemptyglossary} +%\begin{definition} +%\cs{glsxtrifemptyglossary}\marg{type}\marg{true}\marg{false} +%\end{definition} +% Provide command to determine if any entries have been added to the +% glossary (where the glossary label is provided in the first +% argument). The entries are stored in the comma-separated list +% \cs{glolist@\meta{type}}. If this hasn't been defined, the glosary +% doesn't exist. If it has been defined and is simply a comma, the +% glossary exists and is empty. (It's initialised to a comma.) +%\changes{0.4}{2015-12-03}{new} +% \begin{macrocode} +\newcommand{\glsxtrifemptyglossary}[3]{% + \ifglossaryexists{#1}% + {% + \ifcsstring{glolist@#1}{,}{#2}{#3}% + }% + {% + \glsxtrundefaction{Glossary type `#1' doesn't exist}{}% + #2% + }% +} +% \end{macrocode} +%\end{macro} +% +%\section{Modifications to Commands Provided by \sty{glossaries}} +% Some of the commands provided by \sty{glossaries} are modified +% to take into account new options or to change default behaviour. +% +%\subsection{Existence Checks} +%\begin{macro}{\glsdoifexists} +% Modify \cs{glsdoifexists} to take account of the +% \pkgopt{undefaction} setting. +% \begin{macrocode} +\renewcommand{\glsdoifexists}[2]{% + \ifglsentryexists{#1}{#2}% + {% + \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' + has not been defined}{You need to define a glossary entry before + you can reference it.}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoifnoexists} +% Modify \cs{glsdoifnoexists} to take account of the +% \pkgopt{undefaction} setting. +% \begin{macrocode} +\renewcommand{\glsdoifnoexists}[2]{% + \ifglsentryexists{#1}{% + \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' + has already been defined}{}}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdoifexistsordo} +% Modify \cs{glsdoifexistsordo} to take account of the +% \pkgopt{undefaction} setting. This command was introduced in +% \sty{glossaries} version 4.19, so check if it has been defined first. +% \begin{macrocode} +\ifdef\glsdoifexistsordo +{% + \renewcommand{\glsdoifexistsordo}[3]{% + \ifglsentryexists{#1}{#2}% + {% + \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' + has not been defined}{You need to define a glossary entry + before you can use it.}% + #3% + }% + }% +} +{% + \glsxtr@warnonexistsordo\glsdoifexistsordo + \newcommand{\glsdoifexistsordo}[3]{% + \ifglsentryexists{#1}{#2}% + {% + \glsxtrundefaction{Glossary entry `\glsdetoklabel{#1}' + has not been defined}{You need to define a glossary entry + before you can use it.}% + #3% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\doifglossarynoexistsordo} +% Similarly for \cs{doifglossarynoexistsordo}. +% \begin{macrocode} +\ifdef\doifglossarynoexistsordo +{% + \renewcommand{\doifglossarynoexistsordo}[3]{% + \ifglossaryexists{#1}% + {% + \glsxtrundefaction{Glossary type `#1' already exists}{}% + #3% + }% + {#2}% + }% +} +{% + \glsxtr@warnonexistsordo\doifglossarynoexistsordo + \newcommand{\doifglossarynoexistsordo}[3]{% + \ifglossaryexists{#1}% + {% + \glsxtrundefaction{Glossary type `#1' already exists}{}% + #3% + }% + {#2}% + }% +} + +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@newglossaryentryposthook} +% Hook into end of \cs{newglossaryentry} to add \qt{see} value as a +% field. +%\changes{0.5.4}{2015-12-15}{added empty see value if not set and added +% `see' to field key map} +% \begin{macrocode} +\appto\@newglossaryentryposthook{% + \ifdefvoid\@glo@see + {\csxdef{glo@\@glo@label @see}{}}% + {% + \csxdef{glo@\@glo@label @see}{\@glo@see}% + \@glsxtr@autoindexcrossrefs + }% +} +\appto\@gls@keymap{,{see}{see}} +% \end{macrocode} +%\end{macro} +% +% Add all unused cross-references at the end of the document. +% \begin{macrocode} +\AtEndDocument{\if@glsxtrindexcrossrefs\glsxtraddallcrossrefs\fi} +% \end{macrocode} +% +%\begin{macro}{\glsxtraddallcrossrefs} +% Iterate through all used entries and if they have a +% cross-reference, make sure the cross-reference has been added. +% \begin{macrocode} +\newcommand*{\glsxtraddallcrossrefs}{% + \forallglossaries{\@glo@type}% + {% + \forglsentries[\@glo@type]{\@glo@label}% + {% + \ifglsused{\@glo@label}{\@glsxtr@addunusedxrefs{\@glo@label}}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@addunusedxrefs} +% If the given entry has a see field add all unused +% cross-references. +% \begin{macrocode} +\newcommand*{\@glsxtr@addunusedxrefs}[1]{% + \letcs{\@glo@see}{glo@\glsdetoklabel{#1}@see}% + \ifdefvoid\@glo@see + {}% + {% + \expandafter\glsxtr@addunused\@glo@see\@end@glsxtr@addunused + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@addunused} +% Adds all the entries if they haven't been used. +% \begin{macrocode} +\newcommand*{\glsxtr@addunused}[1][]{% + \@glsxtr@addunused +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@addunused} +% Adds all the entries if they haven't been used. +% \begin{macrocode} +\def\@glsxtr@addunused#1\@end@glsxtr@addunused{% + \@for\@glsxtr@label:=#1\do + {% + \ifglsused{\@glsxtr@label}{}% + {% + \glsadd[format=glsxtrunusedformat]{\@glsxtr@label}% + \glsunset{\@glsxtr@label}% + \@glsxtr@addunusedxrefs{\@glsxtr@label}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrunusedformat} +% \begin{macrocode} +\newcommand*{\glsxtrunusedformat}[1]{\unskip} +% \end{macrocode} +%\end{macro} +% +%\subsection{Document Definitions} +% +%\begin{macro}{\makenoidxglossaries} +%Modify \cs{makenoidxglossaries} so that it automatically switches +%off and disables the \pkgopt{docdef} key. +% \begin{macrocode} +\let\glsxtr@orgmakenoidxglossaries\makenoidxglossaries +\renewcommand{\makenoidxglossaries}{% + \glsxtr@orgmakenoidxglossaries + \@glsxtrdocdeffalse + \disable@keys{glossaries-extra.sty}{docdef}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@defdocnewglossaryentry} +% Modify \cs{gls@defdocnewglossaryentry} so that it checks +% the \pkgopt{docdef} value. +% \begin{macrocode} +\renewcommand*{\gls@defdocnewglossaryentry}{% + \if@glsxtrdocdef +% \end{macrocode} +% Since the \gloskey{see} value is now saved in a field, it +% can be used by entries that have been defined in the document. +% \begin{macrocode} + \let\gls@checkseeallowed\relax + \let\newglossaryentry\new@glossaryentry + \else + \renewcommand*{\newglossaryentry}[2]{% + \PackageError{glossaries-extra}{Glossary entries must + be \MessageBreak defined in the preamble with \MessageBreak + package option `docdef=false'}{Move your glossary definitions to + the preamble. You can also put them in a \MessageBreak separate file + and load them with \string\loadglsentries.}% + }% + \fi +}% +% \end{macrocode} +%\end{macro} +% +% Permit a special form of document definition, but only allow +% it if the glossaries come at the end of the document. These +% commands behave a little like a combination of \cs{newterm} +% and \cs{gls}. This must be explicitly enabled with +% the following. +% +%\begin{macro}{\GlsXtrEnableOnTheFly} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableOnTheFly}{% + \@ifstar\@sGlsXtrEnableOnTheFly\@GlsXtrEnableOnTheFly +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@sGlsXtrEnableOnTheFly} +%\changes{0.5.4}{2015-12-15}{new} +% The starred version attempts to allow UTF8 characters in the +% label, but this may break! (Formatting commands mustn't be used in the +% label, but the label may be a command whose replacement text is the +% actual label. This doesn't take into account a command that's +% defined in terms of another command that may eventually expand to +% the label text.) +% \begin{macrocode} +\newcommand*{\@sGlsXtrEnableOnTheFly}{% + \renewcommand*{\glsdetoklabel}[1]{% + \expandafter\@glsxtr@ifcsstart\string##1 \@glsxtr@end@ + {% + \expandafter\detokenize\expandafter{##1}% + }% + {\detokenize{##1}}% + }% + \@GlsXtrEnableOnTheFly +} +\def\@glsxtr@ifcsstart#1#2\@glsxtr@end@#3#4{% + \expandafter\if\glsbackslash#1% + #3% + \else + #4% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrstarflywarn} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrstarflywarn}{% + \GlossariesExtraWarning{Experimental starred version of + \string\GlsXtrEnableOnTheFly\space in use (please ensure you have + read the warnings in the glossaries-extra user manual)}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GlsXtrEnableOnTheFly} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@GlsXtrEnableOnTheFly}{% +% \end{macrocode} +%\end{macro} +% Don't redefine \cs{glsdetoklabel} if LuaTeX or XeTeX is being +% used, since it's mainly to allow accented characters in the +% label. +% +% These definitions are all assigned the category given by: +%\begin{macro}{\glsxtrcat} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\glsxtrcat}{general} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\glsxtr}[1][]{% + \def\glsxtr@keylist{##1}% + \@glsxtr + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@glsxtr}[2][]{% + \ifglsentryexists{##2}% + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\gls\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\Glsxtr}[1][]{% + \def\glsxtr@keylist{##1}% + \@Glsxtr + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@Glsxtr}[2][]{% + \ifglsentryexists{##2}% + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\Gls\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\glsxtrpl}[1][]{% + \def\glsxtr@keylist{##1}% + \@glsxtrpl + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@glsxtrpl}[2][]{% + \ifglsentryexists{##2}% + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\glspl\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\Glsxtrpl}[1][]{% + \def\glsxtr@keylist{##1}% + \@Glsxtrpl + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtrpl} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\@Glsxtrpl}[2][]{% + \ifglsentryexists{##2} + {% + \ifblank{##1}{}{\GlsXtrWarning{##1}{##2}}% + }% + {% + \gls@defglossaryentry{##2}{name={##2},category=\glsxtrcat, + description={\nopostdesc},##1}% + }% + \expandafter\Glspl\expandafter[\glsxtr@keylist]{##2}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrWarning} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} + \newcommand*{\GlsXtrWarning}[2]{% + \def\@glsxtr@optlist{##1}% + \@onelevel@sanitize\@glsxtr@optlist + \GlossariesExtraWarning{The options `\@glsxtr@optlist' have + been ignored for entry `##2' as it has already been defined}% + } +% \end{macrocode} +%\end{macro} +% Disable commands after the glossary: +% \begin{macrocode} + \let\@glsxtr@orgprintglossary\@printglossary + \renewcommand\@printglossary[2]{% + \@glsxtr@orgprintglossary{##1}{##2}% + \def\@glsxtr{\@glsxtr@disabledflycommand\glsxtr}% + \def\@glsxtrpl{\@glsxtr@disabledflycommand\glsxtrpl}% + \def\@Glsxtr{\@glsxtr@disabledflycommand\Glsxtr}% + \def\@Glsxtrpl{\@glsxtr@disabledflycommand\Glsxtrpl}% + } +% \end{macrocode} +% +%\begin{macro}{\@glsxtr@disabledflycommand} +% \begin{macrocode} + \newcommand*{\@glsxtr@disabledflycommand}[1]{% + \PackageError{glossaries-extra}% + {\string##1\space can't be used after any of the \MessageBreak + glossaries have been displayed}% + {The on-the-fly commands enabled by + \string\GlsXtrEnableOnTheFly\space may only be used \MessageBreak + before the glossaries. If you want to use any entries \MessageBreak + after any of the glossaries, you must use the standard \MessageBreak + method of first defining the entry and then using the \MessageBreak + entry with commands like \string\gls}% + \@@glsxtr@disabledflycommand + }% + \newcommand*{\@@glsxtr@disabledflycommand}[2][]{##2} +% \end{macrocode} +%\end{macro} +% +% End of \cs{GlsXtrEnableOnTheFly}. Disable since it can only +% be used once. +% \begin{macrocode} + \let\GlsXtrEnableOnTheFly\relax +} +\@onlypreamble\GlsXtrEnableOnTheFly +% \end{macrocode} +% +%\subsection{Existing Glossary Style Modifications} +% +%\begin{macro}{\glslistdottedwidth} +%If \cs{glslistdottedwidth} has been defined and is currently equal +%to \verb|.5\hsize| then make the modification suggested in +%\href{http://www.dickimaw-books.com/cgi-bin/bugtracker.cgi?action=view&key=92}{bug report \#92} +% \begin{macrocode} +\ifdef\glslistdottedwidth +{% + \ifdim\glslistdottedwidth=.5\hsize + \setlength{\glslistdottedwidth}{-\dimexpr\maxdimen-1sp\relax} + \AtBeginDocument{% + \ifdim\glslistdottedwidth=-\dimexpr\maxdimen-1sp\relax + \setlength{\glslistdottedwidth}{.5\columnwidth}% + \fi + }% + \fi +} +{}% +% \end{macrocode} +%\end{macro} +% +%Similarly for \cs{glsdescwidth}: +%\begin{macro}{\glsdescwidth} +%\changes{0.5.3}{2015-12-09}{added} +% \begin{macrocode} +\ifdef\glsdescwidth +{% + \ifdim\glsdescwidth=.6\hsize + \setlength{\glsdescwidth}{-\dimexpr\maxdimen-1sp\relax} + \AtBeginDocument{% + \ifdim\glsdescwidth=-\dimexpr\maxdimen-1sp\relax + \setlength{\glsdescwidth}{.6\columnwidth}% + \fi + }% + \fi +} +{}% +% \end{macrocode} +%\end{macro} +%and for \cs{glspagelistwidth}: +%\begin{macro}{\glspagelistwidth} +%\changes{0.5.3}{2015-12-09}{added} +% \begin{macrocode} +\ifdef\glspagelistwidth +{% + \ifdim\glspagelistwidth=.1\hsize + \setlength{\glspagelistwidth}{-\dimexpr\maxdimen-1sp\relax} + \AtBeginDocument{% + \ifdim\glspagelistwidth=-\dimexpr\maxdimen-1sp\relax + \setlength{\glspagelistwidth}{.1\columnwidth}% + \fi + }% + \fi +} +{}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossaryentrynumbers} +% Has the \pkgopt{nonumberlist} option been used? +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} + \def\org@glossaryentrynumbers#1{#1\gls@save@numberlist{#1}}% + \ifx\org@glossaryentrynumbers\glossaryentrynumbers + \glsnonumberlistfalse + \renewcommand*{\glossaryentrynumbers}[1]{% + \GlsXtrFormatLocationList{#1}\gls@save@numberlist{#1}}% + \else + \glsnonumberlisttrue + \renewcommand*{\glossaryentrynumbers}[1]{\gls@save@numberlist{#1}}% + \fi +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrFormatLocationList} +%\changes{0.5.2}{2015-12-08}{new} +% Provide an easy interface to change the format of the location +% list without removing the save number list stuff. +% \begin{macrocode} +\newcommand*{\GlsXtrFormatLocationList}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\KV@printgloss@nonumberlist} +% Modify the \gloskey[printglossary]{nonumberlist} key to +% use \cs{GlsXtrFormatLocationList} (and also save the number list): +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\KV@printgloss@nonumberlist}[1]{% + \XKV@plfalse + \XKV@sttrue + \XKV@checkchoice[\XKV@resa]{#1}{true,false}% + {% + \csname glsnonumberlist\XKV@resa\endcsname + \ifglsnonumberlist + \def\glossaryentrynumbers##1{\gls@save@numberlist{##1}}% + \else + \def\glossaryentrynumbers##1{% + \GlsXtrFormatLocationList{##1}% + \gls@save@numberlist{##1}}% + \fi + }% +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Entry Formatting, Hyperlinks and Indexing} +% +%\begin{macro}{\glsentryfmt} +% Change default entry format. Use the generic format for regular +% terms (that is, entries that have a category with the \catattr{regular} +% attribute set) or non-regular terms without a short value and use the abbreviation format for non-regular +% terms that have a short value. If further attributes need to be checked, then +% \cs{glsentryfmt} will need redefining as appropriate (or use +% \cs{defglsentryfmt}). +%\changes{0.3}{2015-12-02}{added check for short} +% The abbreviation format is set here for entries that have a short +% form, even if they are regular entries to ensure the abbreviation +% fonts are correct. +%\changes{0.5.2}{2015-12-08}{moved \cs{glssetabbrvfmt} from +%\cs{glsxtrabbrvfmt} to here} +% \begin{macrocode} +\renewcommand*{\glsentryfmt}{% + \ifglshasshort{\glslabel}{\glssetabbrvfmt{\glscategory{\glslabel}}}{}% + \glsifregular{\glslabel}% + {\glsgenentryfmt}% + {\ifglshasshort{\glslabel}{\glsxtrgenabbrvfmt}{\glsgenentryfmt}}% +} +% \end{macrocode} +%\end{macro} +% +% Commands like \cs{glsifplural} are only used by the \cs{gls}-like +% commands in the \sty{glossaries} package, but it might be useful +% for the postlink hook to know if the user has used, say, +% \cs{glsfirst} or \cs{glsplural}. This can provide better +% consistency with the formatting of the \cs{gls}-like commands, +% even though they don't use \cs{glsentryfmt}. +% +%\begin{macro}{\@gls@field@link} +% Redefine \cs{@gls@field@link} so that commands like \cs{glsfirst} +% can setup \cs{glsxtrifwasfirstuse} etc to allow the postlink hook +% to work better. This now has an optional argument that sets up the +% defaults. +%\changes{0.3}{2015-12-02}{added optional argument} +% \begin{macrocode} +\renewcommand{\@gls@field@link}[4][]{% + \glsdoifexists{#3}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \def\glscustomtext{#4}% + \@glsxtr@field@linkdefs + #1% + \@gls@link[#2]{#3}{#4}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@field@linkdefs} +% Default settings for \cs{@gls@field@link} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@field@linkdefs}{% + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty +} +% \end{macrocode} +%\end{macro} +% +%Redefine the field link commands that need to modify the above. +%\begin{macro}{\@GLStext@} +% All uppercase version of \cs{glstext}. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLStext@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdofthree]{#1}{#2}% + {\mfirstucMakeUppercase{\glsentrytext{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glstext@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glstext@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@secondofthree]{#1}{#2}% + {\Glsentrytext{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsfirst@} +% No case changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@glsfirst@#1#2[#3]{% + \@gls@field@link[\let\glsxtrifwasfirstuse\@firstoftwo]{#1}{#2}% + {\glsentryfirst{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsfirst@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsfirst@#1#2[#3]{% + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glscapscase\@secondofthree + ]% + {#1}{#2}{\Glsentryfirst{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSfirst@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSfirst@#1#2[#3]{% + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glscapscase\@thirdofthree + ]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryfirst{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsplural} +% No case changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@glsplural#1#2[#3]{% + \@gls@field@link[\let\glsifplural\@firstoftwo]{#1}{#2}% + {\glsentryplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsplural} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsplural#1#2[#3]{% + \@gls@field@link + [\let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + ]% + {#1}{#2}{\Glsentryplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSplural} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSplural#1#2[#3]{% + \@gls@field@link + [\let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + ]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsfirstplural@} +% No case changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@glsfirstplural@#1#2[#3]{% + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glsifplural\@firstoftwo + ]% + {#1}{#2}{\glsentryfirstplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsfirstplural@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@glsfirstplural@#1#2[#3]{% + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + ]% + {#1}{#2}{\Glsentryfirstplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsfirstplural@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@glsfirstplural@#1#2[#3]{% + \@gls@field@link + [\let\glsxtrifwasfirstuse\@firstoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + ]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryfirstplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsname@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsname@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentryname{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSname@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSname@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryname{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsdesc@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsdesc@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentrydesc{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSdesc@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSdesc@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentrydesc{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdescplural@} +% No case-changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@glsdescplural@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\glsentrydescplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsdescplural@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsdescplural@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\Glsentrydescplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSdescplural@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSdesc@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@thirdoftwo + \let\glsifplural\@firstoftwo + ]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentrydescplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glssymbol@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glssymbol@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentrysymbol{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSsymbol@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSsymbol@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbol{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glssymbolplural@} +% No case-changing version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@glssymbolplural@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\glsentrysymbolplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glssymbolplural@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glssymbolplural@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo + \let\glsifplural\@firstoftwo + ]{#1}{#2}{\Glsentrysymbolplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSsymbolplural@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSsymbol@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@thirdoftwo + \let\glsifplural\@firstoftwo + ]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentrysymbolplural{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuseri@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsuseri@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentryuseri{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuseri@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSuseri@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryuseri{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuserii@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsuserii@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentryuserii{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuserii@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSuserii@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryuserii{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuseriii@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsuseriii@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentryuseriii{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuseriii@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSuseriii@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriii{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuseriv@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsuseriv@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentryuseriv{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuseriv@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSuseriv@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryuseriv{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuserv@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsuserv@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentryuserv{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuserv@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSuserv@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryuserv{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsuservi@} +% First letter uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@Glsuservi@#1#2[#3]{% + \@gls@field@link + [\let\glscapscase\@secondoftwo]{#1}{#2}{\Glsentryuservi{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSuservi@} +% All uppercase version. +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\def\@GLSuservi@#1#2[#3]{% + \@gls@field@link[\let\glscapscase\@thirdoftwo]% + {#1}{#2}{\mfirstucMakeUppercase{\glsentryuservi{#2}#3}}% +} +% \end{macrocode} +%\end{macro} +% +%Commands like \cs{acrshort} already set \cs{glsifplural}, but they +%don't set \cs{glsxtrifwasfirstuse} so they need adjusting. +% +%\begin{macro}{\@acrshort} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccessshort{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrshort} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccessshort{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRshort} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccessshort{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrshortpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccessshortpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrshortpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccessshortpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRshortpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccessshortpl{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrlong} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccesslong{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrlong} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccesslong{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRlong} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccesslong{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@acrlongpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% No case change. +% \begin{macrocode} +\def\@acrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\glsaccesslongpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Acrlongpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% First letter uppercase. +% \begin{macrocode} +\def\@Acrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \acronymfont{\Glsaccesslongpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@ACRlongpl} +%\changes{0.3}{2015-12-02}{added redefinition} +% All uppercase. +% \begin{macrocode} +\def\@ACRlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\acronymfont{\glsaccesslongpl{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%Modify \cs{@glsaddkey} so additional keys provided by the user can +%be treated in a similar way. +%\begin{macro}{\@glsaddkey} +% \begin{macrocode} +\renewcommand*{\@glsaddkey}[7]{% + \key@ifundefined{glossentry}{#1}% + {% + \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}% + \appto\@gls@keymap{,{#1}{#1}}% + \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}% + \appto\@newglossaryentryposthook{% + \letcs{\@glo@tmp}{@glo@#1}% + \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}% + }% + \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}% + \newcommand*{#4}[1]{\@Gls@entry@field{##1}{#1}}% +% \end{macrocode} +% Now for the commands with links. First the version with no case +% change (same as before): +% \begin{macrocode} + \ifcsdef{@gls@user@#1@}% + {% + \PackageError{glossaries}% + {Can't define `\string#5' as helper command + `\expandafter\string\csname @gls@user@#1@\endcsname' already + exists}% + {}% + }% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname @gls@user@#1\endcsname}[2][]{% + \new@ifnextchar[% + {\csuse{@gls@user@#1@}{##1}{##2}}% + {\csuse{@gls@user@#1@}{##1}{##2}[]}}% + \csdef{@gls@user@#1@}##1##2[##3]{% + \@gls@field@link{##1}{##2}{#3{##2}##3}% + }% + \newrobustcmd*{#5}{% + \expandafter\@gls@hyp@opt\csname @gls@user@#1\endcsname}% + }% +% \end{macrocode} +% Next the version with the first letter converted to upper case +% (modified): +% \begin{macrocode} + \ifcsdef{@Gls@user@#1@}% + {% + \PackageError{glossaries}% + {Can't define `\string#6' as helper command + `\expandafter\string\csname @Gls@user@#1@\endcsname' already + exists}% + {}% + }% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname @Gls@user@#1\endcsname}[2][]{% + \new@ifnextchar[% + {\csuse{@Gls@user@#1@}{##1}{##2}}% + {\csuse{@Gls@user@#1@}{##1}{##2}[]}}% + \csdef{@Gls@user@#1@}##1##2[##3]{% + \@gls@field@link[\let\glscapscase\@secondofthree]% + {##1}{##2}{#4{##2}##3}% + }% + \newrobustcmd*{#6}{% + \expandafter\@gls@hyp@opt\csname @Gls@user@#1\endcsname}% + }% +% \end{macrocode} +% Finally the all caps version (modified): +% \begin{macrocode} + \ifcsdef{@GLS@user@#1@}% + {% + \PackageError{glossaries}% + {Can't define `\string#7' as helper command + `\expandafter\string\csname @GLS@user@#1@\endcsname' already + exists}% + {}% + }% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname @GLS@user@#1\endcsname}[2][]{% + \new@ifnextchar[% + {\csuse{@GLS@user@#1@}{##1}{##2}}% + {\csuse{@GLS@user@#1@}{##1}{##2}[]}}% + \csdef{@GLS@user@#1@}##1##2[##3]{% + \@gls@field@link[\let\glscapscase\@thirdofthree]% + {##1}{##2}{\mfirstucMakeUppercase{#3{##2}##3}}% + }% + \newrobustcmd*{#7}{% + \expandafter\@gls@hyp@opt\csname @GLS@user@#1\endcsname}% + }% + }% + {% + \PackageError{glossaries-extra}{Key `#1' already exists}{}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@link@nocheckfirsthyper} +% Old versions of \sty{glossaries} don't define +% this, so provide it just in case it hasn't been defined. +% \begin{macrocode} +\providecommand*{\@gls@link@nocheckfirsthyper}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@link@checkfirsthyper} +% Modify check to determine if the hyperlink should be automatically +% suppressed, but save the original in case the acronyms are restored. +% \begin{macrocode} +\let\@glsxtr@org@checkfirsthyper\@gls@link@checkfirsthyper +\renewcommand*{\@gls@link@checkfirsthyper}{% +% \end{macrocode} +% \cs{ifglsused} isn't useful in the post link hook as it's already +% been unset by then, so define a command that can be used in the +% post link hook. Since \cs{@gls@link@checkfirsthyper} is only used +% by commands like \cs{gls} but not by other commands, this seems +% the best place to put it. +% \begin{macrocode} + \ifglsused{\glslabel}% + {\let\glsxtrifwasfirstuse\@secondoftwo} + {\let\glsxtrifwasfirstuse\@firstoftwo}% +% \end{macrocode} +% Store the category label for convenience. +% \begin{macrocode} + \edef\glscategorylabel{\glscategory{\glslabel}}% + \ifglsused{\glslabel}% + {% + \glsifcategoryattribute{\glscategorylabel}{nohypernext}{true}% + {\KV@glslink@hyperfalse}{}% + }% + {% + \glsifcategoryattribute{\glscategorylabel}{nohyperfirst}{true}% + {\KV@glslink@hyperfalse}{}% + }% + \glslinkcheckfirsthyperhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\do@glsdisablehyperinlist} +% This command was introduced in \sty{glossaries} v4.19. If it +% hasn't been defined, we're using an earlier version, in which case +% the \catattr{nohyper} attribute can't be implemented. +% \begin{macrocode} +\ifdef\do@glsdisablehyperinlist +{% + \let\@glsxtr@do@glsdisablehyperinlist\do@glsdisablehyperinlist + \renewcommand*{\do@glsdisablehyperinlist}{% + \@glsxtr@do@glsdisablehyperinlist + \glsifattribute{\glslabel}{nohyper}{true}{\KV@glslink@hyperfalse}{}% + } +} +{} +% \end{macrocode} +%\end{macro} +% +% Define a \gloskey[glslink]{noindex} key to prevent writing information to the +% external file. +% \begin{macrocode} +\define@boolkey{glslink}{noindex}[true]{} +\KV@glslink@noindexfalse +% \end{macrocode} +% +%If \cs{@gls@setdefault@glslink@opts} has been defined +%(\sty{glossaries} v4.20) use it to set the default keys in +%\cs{@glslink}. +%\begin{macro}{\@gls@setdefault@glslink@opts} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\ifdef\@gls@setdefault@glslink@opts +{ + \renewcommand*{\@gls@setdefault@glslink@opts}{% + \KV@glslink@noindexfalse + } +} +{ +% \end{macrocode} +% Not defined so prepend it to \cs{do@glsdisablehyperinlist} to +% achieve the same effect. +% \begin{macrocode} + \newcommand*{\@gls@setdefault@glslink@opts}{% + \KV@glslink@noindexfalse + } + \preto\do@glsdisablehyperinlist{\@gls@setdefault@glslink@opts} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetDefaultGlsOpts} +%\changes{0.5.4}{2015-12-15}{new} +% Set the default options for \cs{glslink} etc. +% \begin{macrocode} +\newcommand*{\GlsXtrSetDefaultGlsOpts}[1]{% + \renewcommand*{\@gls@setdefault@glslink@opts}{\setkeys{glslink}{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifindexing} +% Provide user level command to access it in \cs{glswriteentry}. +% \begin{macrocode} +\newcommand*{\glsxtrifindexing}[2]{% + \ifKV@glslink@noindex #2\else #1\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glswriteentry} +% Redefine to test for \catattr{indexonlyfirst} category attribute. +% \begin{macrocode} +\renewcommand*{\glswriteentry}[2]{% + \glsxtrifindexing + {% + \ifglsindexonlyfirst + \ifglsused{#1} + {\glsxtrdoautoindexname{#1}{dualindex}}% + {#2}% + \else + \glsifattribute{#1}{indexonlyfirst}{true}% + {\ifglsused{#1} + {\glsxtrdoautoindexname{#1}{dualindex}}% + {#2}}% + {#2}% + \fi + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@do@@wrglossary} +% Hook into glossary indexing command so that it can also use +% \ics{index} at the same time if required and add user hook. +% \begin{macrocode} +\appto\@@do@@wrglossary{\@glsxtr@do@@wrindex + \glsxtrdowrglossaryhook{\@gls@label}% +} +% \end{macrocode} +% (The label can be obtained from \cs{@gls@label} at this point.) +%\end{macro} +% Similarly for the \qt{noidx} version: +%\begin{macro}{\gls@noidxglossary} +% \begin{macrocode} +\appto\gls@noidxglossary{\@glsxtr@do@@wrindex + \glsxtrdowrglossaryhook{\@gls@label}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@do@@wrindex} +% \begin{macrocode} +\newcommand*{\@glsxtr@do@@wrindex}{% + \glsxtrdoautoindexname{\@gls@label}{dualindex}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdowrglossaryhook} +% Allow user to hook into indexing code. (Always used by +% \cs{glsadd}. Used by \cs{gls} when indexing, which may or may not occur +% depending on the indexing settings.) +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrdowrglossaryhook}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@alt@hyp@opt} +%\changes{0.5.4}{2015-12-15}{new} +% Commands like \cs{gls} have a star or plus version. Provide a +% third symbol that the user can adapt for convenience. +% \begin{macrocode} +\newcommand*{\@gls@alt@hyp@opt}[1]{% + \let\glslinkvar\@firstofthree + \let\@gls@hyp@opt@cs#1\relax + \@ifstar{\s@gls@hyp@opt}% + {\@ifnextchar+% + {\@firstoftwo{\p@gls@hyp@opt}}% + {% + \expandafter\@ifnextchar\@gls@alt@hyp@opt@char + {\@firstoftwo{\@alt@gls@hyp@opt}}% + {#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@alt@gls@hyp@opt} +% User version +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@alt@gls@hyp@opt}[1][]{% + \let\glslinkvar\@firstofthree + \expandafter\@gls@hyp@opt@cs\expandafter[\@gls@alt@hyp@opt@keys,#1]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@alt@hyp@opt@char} +%\changes{0.5.4}{2015-12-15}{new} +%Contains the character used as the command modifier. +% \begin{macrocode} +\newcommand*{\@gls@alt@hyp@opt@char}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@alt@hyp@opt@keys} +%\changes{0.5.4}{2015-12-15}{new} +%Contains the option list used as the command modifier. +% \begin{macrocode} +\newcommand*{\@gls@alt@hyp@opt@keys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetAltModifier} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrSetAltModifier}[2]{% + \let\@gls@hyp@opt\@gls@alt@hyp@opt + \def\@gls@alt@hyp@opt@char{#1}% + \def\@gls@alt@hyp@opt@keys{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdohyperlink} +% Unpleasant complications can occur if the \gloskey{text} or +% \gloskey{first} key etc contains \cs{gls}, particularly if there +% are hyperlinks. To get around this problem, patch +% \cs{glsdohyperlink} so that it temporarily makes \ics{gls} behave +% like \ics{glstext}\oarg{hyper=false,noindex}. (This will be +% overridden if the user explicitly cancels either of those options +% in the optional argument of \cs{gls} or using the plus version.) +% This also patches the short form commands like \cs{acrshort} +% and \cs{glsxtrshort} to use \cs{glsentryshort} and, similarly, the +% long form commands like \cs{acrlong} and \cs{glsxtrlong} to use +% \cs{glsentrylong}. +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\glsdohyperlink}[2]{% + \hyperlink{#1}{{\glsxtrprotectlinks#2}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdisablehyper} +%\changes{0.5.4}{2015-12-15}{added} +% Redefine in case we have an old version of \sty{glossaries}. +% \begin{macrocode} +\ifundef\glsdonohyperlink +{% + \renewcommand{\glsdisablehyper}{% + \KV@glslink@hyperfalse + \let\@glslink\glsdonohyperlink + \let\@glstarget\@secondoftwo + } +} +{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsdonohyperlink} +% This command was only introduced in \sty{glossaries} v4.20, so it may +% not be defined. For older \sty{glossaries} versions, this won't be +% used if \sty{hyperref} hasn't been loaded, which means the +% indexing will still take place. +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\def\glsdonohyperlink#1#2{{\glsxtrprotectlinks #2}} +% \end{macrocode} +%\end{macro} +% +% Reset \cs{@glslink} with patched versions: +% \begin{macrocode} +\ifcsundef{hyperlink}% +{% + \let\@glslink\glsdonohyperlink +}% +{% + \let\@glslink\glsdohyperlink +} +% \end{macrocode} +% +%\begin{macro}{\glsxtrprotectlinks} +%\changes{0.5.4}{2015-12-15}{new} +% Make \cs{gls} (and variants) behave like the corresponding +% \cs{glstext} (and variants) with hyperlinking and indexing off. +% \begin{macrocode} +\newcommand*{\glsxtrprotectlinks}{% + \KV@glslink@hyperfalse + \KV@glslink@noindextrue + \let\@gls@\@glsxtr@p@text@ + \let\@Gls@\@Glsxtr@p@text@ + \let\@GLS@\@GLSxtr@p@text@ + \let\@glspl@\@glsxtr@p@plural@ + \let\@Glspl@\@Glsxtr@p@plural@ + \let\@GLSpl@\@GLSxtr@p@plural@ + \let\@glsxtrshort\@glsxtr@p@short@ + \let\@Glsxtrshort\@Glsxtr@p@short@ + \let\@GLSxtrshort\@GLSxtr@p@short@ + \let\@glsxtrlong\@glsxtr@p@long@ + \let\@Glsxtrlong\@Glsxtr@p@long@ + \let\@GLSxtrlong\@GLSxtr@p@long@ + \let\@glsxtrshortpl\@glsxtr@p@shortpl@ + \let\@Glsxtrshortpl\@Glsxtr@p@shortpl@ + \let\@GLSxtrshortpl\@GLSxtr@p@shortpl@ + \let\@glsxtrlongpl\@glsxtr@p@longpl@ + \let\@Glsxtrlongpl\@Glsxtr@p@longpl@ + \let\@GLSxtrlongpl\@GLSxtr@p@longpl@ + \let\@acrshort\@glsxtr@p@acrshort@ + \let\@Acrshort\@Glsxtr@p@acrshort@ + \let\@ACRshort\@GLSxtr@p@acrshort@ + \let\@acrshortpl\@glsxtr@p@acrshortpl@ + \let\@Acrshortpl\@Glsxtr@p@acrshortpl@ + \let\@ACRshortpl\@GLSxtr@p@acrshortpl@ + \let\@acrlong\@glsxtr@p@acrlong@ + \let\@Acrlong\@Glsxtr@p@acrlong@ + \let\@ACRlong\@GLSxtr@p@acrlong@ + \let\@acrlongpl\@glsxtr@p@acrlongpl@ + \let\@Acrlongpl\@Glsxtr@p@acrlongpl@ + \let\@ACRlongpl\@GLSxtr@p@acrlongpl@ +} +% \end{macrocode} +%\end{macro} +% +% These protected versions need grouping to prevent the label from +% getting confused. +%\begin{macro}{\@glsxtr@p@text@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@text@#1#2[#3]{{\@glstext@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@text@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@text@#1#2[#3]{{\@Glstext@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@text@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@text@#1#2[#3]{{\@GLStext@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@plural@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@plural@#1#2[#3]{{\@glsplural@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@plural@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@plural@#1#2[#3]{{\@Glsplural@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@plural@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@plural@#1#2[#3]{{\@GLSplural@{#1}{#2}[#3]}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@short@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@short@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\glsentryshort{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@short@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@short@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\Glsentryshort{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@short@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@short@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \mfirstucMakeUppercase{\glsabbrvfont{\glsentryshort{#2}}#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@shortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@shortpl@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\glsentryshortpl{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@shortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@shortpl@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \glsabbrvfont{\Glsentryshortpl{#2}}#3% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@shortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@shortpl@#1#2[#3]{% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \mfirstucMakeUppercase{\glsabbrvfont{\glsentryshortpl{#2}}#3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@long@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@long@#1#2[#3]{{\glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@long@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@long@#1#2[#3]{{\Glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@long@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@long@#1#2[#3]{% + {\mfirstucMakeUppercase{\glsentrylong{#2}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@longpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@longpl@#1#2[#3]{{\glsentrylongpl{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@longpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@longpl@#1#2[#3]{{\Glsentrylongpl{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@longpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@longpl@#1#2[#3]{% + {\mfirstucMakeUppercase{\glsentrylongpl{#2}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrshort@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrshort@#1#2[#3]{{\acronymfont{\glsentryshort{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrshort@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrshort@#1#2[#3]{{\acronymfont{\Glsentryshort{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrshort@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrshort@#1#2[#3]{% + {\mfirstucMakeUppercase{\acronymfont{\glsentryshort{#2}}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrshortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrshortpl@#1#2[#3]{{\acronymfont{\glsentryshortpl{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrshortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrshortpl@#1#2[#3]{{\acronymfont{\Glsentryshortpl{#2}}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrshortpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrshortpl@#1#2[#3]{% + {\mfirstucMakeUppercase{\acronymfont{\glsentryshortpl{#2}}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrlong@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrlong@#1#2[#3]{{\glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrlong@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrlong@#1#2[#3]{{\Glsentrylong{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrlong@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrlong@#1#2[#3]{% + {\mfirstucMakeUppercase{\glsentrylong{#2}#3}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@p@acrlongpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@glsxtr@p@acrlongpl@#1#2[#3]{{\glsentrylongpl{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsxtr@p@acrlongpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@Glsxtr@p@acrlongpl@#1#2[#3]{{\Glsentrylongpl{#2}#3}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSxtr@p@acrlongpl@} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\def\@GLSxtr@p@acrlongpl@#1#2[#3]{% + {\mfirstucMakeUppercase{\glsentrylongpl{#2}#3}}} +% \end{macrocode} +%\end{macro} +% +%\subsection{Entry Counting} +% +% The entry counting mechanism from \sty{glossaries} is adjusted +% here to work with category attributes. Provide a convenient +% command to enable entry counting, set the \catattr{entrycount} +% attribute for given categories and redefine \ics{gls} etc to +% use \cs{cgls} instead. +% +% First adjust definitions of the unset and reset commands to +% provide a hook. +% +%\begin{macro}{\@glsunset} +% Global unset. +% \begin{macrocode} +\renewcommand*{\@glsunset}[1]{% + \@@glsunset{#1}% + \glsxtrpostunset{#1}% +}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostunset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostunset}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslocalunset} +% Local unset. +% \begin{macrocode} + \renewcommand*{\@glslocalunset}[1]{% + \@@glslocalunset{#1}% + \glsxtrpostlocalunset{#1}% + }% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostlocalunset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostlocalunset}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsreset} +% Global reset. +% \begin{macrocode} +\renewcommand*{\@glsreset}[1]{% + \@@glsreset{#1}% + \glsxtrpostreset{#1}% +}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostreset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostreset}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glslocalreset} +% Local reset. +% \begin{macrocode} +\renewcommand*{\@glslocalreset}[1]{% + \@@glslocalreset{#1}% + \glsxtrpostlocalreset{#1}% +}% +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsxtrpostlocalreset} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsxtrpostlocalreset}[1]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrEnableEntryCounting} +% The first argument is the list of categories and the second +% argument is the value of the \catattr{entrycount} attribute. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableEntryCounting}[2]{% +% \end{macrocode} +% Enable entry counting: +% \begin{macrocode} + \glsenableentrycount +% \end{macrocode} +% Redefine \cs{gls} etc: +% \begin{macrocode} + \renewcommand*{\gls}{\cgls}% + \renewcommand*{\Gls}{\cGls}% + \renewcommand*{\glspl}{\cglspl}% + \renewcommand*{\Glspl}{\cGlspl}% + \renewcommand*{\GLS}{\cGLS}% + \renewcommand*{\GLSpl}{\cGLSpl}% +% \end{macrocode} +% Set the \catattr{entrycount} attribute: +% \begin{macrocode} + \@glsxtr@setentrycountunsetattr{#1}{#2}% +% \end{macrocode} +% In case this command is used again: +% \begin{macrocode} + \let\GlsXtrEnableEntryCounting\@glsxtr@setentrycountunsetattr + \renewcommand*{\GlsXtrEnableEntryUnitCounting}[3]{% + \PackageError{glossaries-extra}{\string\GlsXtrEnableEntryUnitCounting\space + can't be used with \string\GlsXtrEnableEntryCounting}% + {Use one or other but not both commands}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@setentrycountunsetattr} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@setentrycountunsetattr}[2]{% + \@for\@glsxtr@cat:=#1\do + {% + \ifdefempty{\@glsxtr@cat}{}% + {% + \glssetcategoryattribute{\@glsxtr@cat}{entrycount}{#2}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% Redefine the entry counting commands to take into account the +%\catattr{entrycount} attribute. +%\begin{macro}{\glsenableentrycount} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\renewcommand*{\glsenableentrycount}{% +% \end{macrocode} +% Enable new fields: +% \begin{macrocode} + \appto\@newglossaryentry@defcounters{\@@newglossaryentry@defcounters}% +% \end{macrocode} +% Just in case the user has switched on the \pkgopt{docdef} option. +% \begin{macrocode} + \renewcommand*{\gls@defdocnewglossaryentry}{% + \renewcommand*\newglossaryentry[2]{% + \PackageError{glossaries}{\string\newglossaryentry\space + may only be used in the preamble when entry counting has + been activated}{If you use \string\glsenableentrycount\space + you must place all entry definitions in the preamble not in + the document environment}% + }% + }% +% \end{macrocode} +% New commands to access new fields: +% \begin{macrocode} + \newcommand*{\glsentrycurrcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@currcount}% + {0}{\@gls@entry@field{##1}{currcount}}% + }% + \newcommand*{\glsentryprevcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@prevcount}% + {0}{\@gls@entry@field{##1}{prevcount}}% + }% +% \end{macrocode} +% Adjust post unset and reset: +% \begin{macrocode} + \let\@glsxtr@entrycount@org@unset\glsxtrpostunset + \renewcommand*{\glsxtrpostunset}[1]{% + \@glsxtr@entrycount@org@unset{##1}% + \@gls@increment@currcount{##1}% + }% + \let\@glsxtr@entrycount@org@localunset\glsxtrpostlocalunset + \renewcommand*{\glsxtrpostlocalunset}[1]{% + \@glsxtr@entrycount@org@localunset{##1}% + \@gls@local@increment@currcount{##1}% + }% + \let\@glsxtr@entrycount@org@reset\glsxtrpostreset + \renewcommand*{\glsxtrpostreset}[1]{% + \@glsxtr@entrycount@org@reset{##1}% + \csgdef{glo@\glsdetoklabel{##1}@currcount}{0}% + }% + \let\@glsxtr@entrycount@org@localreset\glsxtrpostlocalreset + \renewcommand*{\glsxtrpostlocalreset}[1]{% + \@glsxtr@entrycount@org@localreset{##1}% + \csdef{glo@\glsdetoklabel{##1}@currcount}{0}% + }% +% \end{macrocode} +% Modifications to take into account the attributes that govern +% whether the entry should be unset. +% \begin{macrocode} + \let\@cgls@\@@cgls@ + \let\@cglspl@\@@cglspl@ + \let\@cGLS@\@@cGLS@ + \let\@cGlspl@\@@cGlspl@ + \let\@cGLS@\@@cGLS@ + \let\@cGLSpl@\@@cGLSpl@ +% \end{macrocode} +% The rest is as the original definition. +% \begin{macrocode} + \AtEndDocument{\@gls@write@entrycounts}% + \renewcommand*{\@gls@entry@count}[2]{% + \csgdef{glo@\glsdetoklabel{##1}@prevcount}{##2}% + }% + \let\glsenableentrycount\relax + \renewcommand*{\glsenableentryunitcount}{% + \PackageError{glossaries-extra}{\string\glsenableentryunitcount\space + can't be used with \string\glsenableentrycount}% + {Use one or other but not both commands}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@write@entrycounts} +% Modify this command so that it only writes the information for +% entries with the \catattr{entrycount} attribute and issue +% warning if no entries have this attribute set. +% \begin{macrocode} +\renewcommand*{\@gls@write@entrycounts}{% + \immediate\write\@auxout + {\string\providecommand*{\string\@gls@entry@count}[2]{}}% + \count@=0\relax + \forallglsentries{\@glsentry}{% + \glshasattribute{\@glsentry}{entrycount}% + {% + \ifglsused{\@glsentry}% + {% + \immediate\write\@auxout + {\string\@gls@entry@count{\@glsentry}{\glsentrycurrcount{\@glsentry}}}% + }% + {}% + \advance\count@ by \@ne + }% + {}% + }% + \ifnum\count@=0 + \GlossariesExtraWarningNoLine{Entry counting has been enabled + \MessageBreak with \string\glsenableentrycount\space but the + \MessageBreak attribute `entrycount' hasn't + \MessageBreak been assigned to any of the defined + \MessageBreak entries}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifcounttrigger} +%\begin{definition} +%\cs{glsxtrifcounttrigger}\marg{label}\marg{trigger format}\marg{normal} +%\end{definition} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrifcounttrigger}[3]{% + \glshasattribute{#1}{entrycount}% + {% + \ifnum\glsentryprevcount{#1}>\glsgetattribute{#1}{entrycount}\relax + #3% + \else + #2% + \fi + }% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +% Actual internal definitions of \cs{cgls} used when entry counting +% is enabled. +% +%\begin{macro}{\@@cgls@} +% \begin{macrocode} +\def\@@cgls@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cglsformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@gls@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cgls@} +% \begin{macrocode} +\def\@@cglspl@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cglsplformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@glspl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGls@} +% \begin{macrocode} +\def\@@cGls@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGlsformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@Gls@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGlspl@} +% \begin{macrocode} +\def\@@cGlspl@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGlsplformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@Glspl@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGLS@} +% \begin{macrocode} +\def\@@cGLS@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGLSformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@GLS@{#1}{#2}[#3]% + }% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@cGLSpl@} +% \begin{macrocode} +\def\@@cGLSpl@#1#2[#3]{% + \glsxtrifcounttrigger{#2}% + {% + \cGLSplformat{#2}{#3}% + \glsunset{#2}% + }% + {% + \@GLSpl@{#1}{#2}[#3]% + }% +}% +% +% Remove default warnings from \cs{cgls} etc so that it can be used +% interchangeable with \cs{gls} etc. +%\begin{macro}{\@cgls@} +% \begin{macrocode} +\def\@cgls@#1#2[#3]{\@gls@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@cGls@} +% \begin{macrocode} +\def\@cGls@#1#2[#3]{\@Gls@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@cglspl@} +% \begin{macrocode} +\def\@cglspl@#1#2[#3]{\@glspl@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@cGlspl@} +% \begin{macrocode} +\def\@cGlspl@#1#2[#3]{\@Glspl@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +% Add all upper case versions not provided by \sty{glossaries}. +%\begin{macro}{\cGLS} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newrobustcmd*{\cGLS}{\@gls@hyp@opt\@cGLS} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLS} +%\changes{0.5}{2015-12-07}{new} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@cGLS}[2][]{% + \new@ifnextchar[{\@cGLS@{#1}{#2}}{\@cGLS@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLS@} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\def\@cGLS@#1#2[#3]{\@GLS@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGLSformat} +%\changes{0.5}{2015-12-07}{new} +% Format used by \cs{cGLS} if entry only used once on previous run. +% The first argument is the label, the second argument is the insert +% text. +% \begin{macrocode} +\newcommand*{\cGLSformat}[2]{% + \expandafter\mfirstucMakeUppercase\expandafter{\cglsformat{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGLSpl} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newrobustcmd*{\cGLSpl}{\@gls@hyp@opt\@cGLSpl} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLSpl} +%\changes{0.5}{2015-12-07}{new} +% Defined the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\@cGLSpl}[2][]{% + \new@ifnextchar[{\@cGLSpl@{#1}{#2}}{\@cGLSpl@{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@cGLSpl@} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\def\@cGLSpl@#1#2[#3]{\@GLSpl@{#1}{#2}[#3]} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGLSplformat} +%\changes{0.5}{2015-12-07}{new} +% Format used by \cs{cGLSpl} if entry only used once on previous run. +% The first argument is the label, the second argument is the insert +% text. +% \begin{macrocode} +\newcommand*{\cGLSplformat}[2]{% + \expandafter\mfirstucMakeUppercase\expandafter{\cglsplformat{#1}{#2}}% +} +% \end{macrocode} +%\end{macro} +% +% Modify the trigger formats to check for the \catattr{regular} attribute. +%\begin{macro}{\cglsformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cglsformat}[2]{% + \glsifregular{#1} + {\glsentryfirst{#1}}% + {\ifglshaslong{#1}{\glsentrylong{#1}}{\glsentryfirst{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGlsformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cGlsformat}[2]{% + \glsifregular{#1} + {\Glsentryfirst{#1}}% + {\ifglshaslong{#1}{\Glsentrylong{#1}}{\Glsentryfirst{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cglsplformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cglsplformat}[2]{% + \glsifregular{#1} + {\glsentryfirstplural{#1}}% + {\ifglshaslong{#1}{\glsentrylongpl{#1}}{\glsentryfirstplural{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\cGlsplformat} +%\changes{0.5.4}{2015-12-15}{added} +% \begin{macrocode} +\renewcommand*{\cGlsplformat}[2]{% + \glsifregular{#1} + {\Glsentryfirstplural{#1}}% + {\ifglshaslong{#1}{\Glsentrylongpl{#1}}{\Glsentryfirstplural{#1}}}#2% +} +% \end{macrocode} +%\end{macro} +% +%New code similar to above for unit counting. +% +%\begin{macro}{\@@newglossaryentry@defunitcounters} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@@newglossaryentry@defunitcounters}{% + \edef\@glo@countunit{\csuse{@glsxtr@categoryattr@@\@glo@category @unitcount}}% + \ifdefvoid\@glo@countunit + {}% + {% + \@glsxtr@ifunitcounter{\@glo@countunit}% + {}% + {\expandafter\@glsxtr@addunitcounter\expandafter{\@glo@countunit}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@unitcountlist} +%\changes{0.5.4}{2015-12-15}{new} +% List to keep track of which counters are being used by the entry +% unit count facility. +% \begin{macrocode} +\newcommand*{\@glsxtr@unitcountlist}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@addunitcounter} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@addunitcounter}[1]{% + \listadd{\@glsxtr@unitcountlist}{#1}% + \ifcsundef{glsxtr@theunit@#1} + {% + \ifcsdef{theH#1}% + {\csdef{glsxtr@theunit@#1}{\csuse{theH#1}}}% + {\csdef{glsxtr@theunit@#1}{\csuse{the#1}}}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@ifunitcounter} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@ifunitcounter}[3]{% + \xifinlist{#1}{\@glsxtr@unitcountlist}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@currentunitcount} +% \begin{macrocode} +\newcommand*\@glsxtr@currentunitcount[1]{% + glo@\glsdetoklabel{#1}@currunit@\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@previousunitcount} +% \begin{macrocode} +\newcommand*\@glsxtr@previousunitcount[1]{% + glo@\glsdetoklabel{#1}@prevunit@\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@increment@currunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@gls@increment@currunitcount}[1]{% + \glshasattribute{#1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{#1}}% + \ifcsundef{\@glsxtr@csname}% + {% + \csgdef{\@glsxtr@csname}{1}% + \listcsxadd + {glo@\glsdetoklabel{#1}@unitlist}% + {\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% + }% + }% + {% + \csxdef{\@glsxtr@csname}% + {\number\numexpr\csname\@glsxtr@csname\endcsname+1}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@local@increment@currunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@gls@local@increment@currunitcount}[1]{% + \glshasattribute{#1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{#1}}% + \ifcsundef{\@glsxtr@csname}% + {% + \csdef{\@glsxtr@csname}{1}% + \listcseadd + {glo@\glsdetoklabel{#1}@unitlist}% + {\glsgetattribute{#1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{#1}{unitcount}}% + }% + }% + {% + \csedef{\@glsxtr@csname}% + {\number\numexpr\csname\@glsxtr@csname\endcsname+1}% + }% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@currunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@currunitcount}[2]{% + \ifcsundef + {glo@\glsdetoklabel{#1}@currunit@#2}% + {0}% + {\csuse{glo@\glsdetoklabel{#1}@currunit@#2}}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@prevunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@prevunitcount}[2]{% + \ifcsundef + {glo@\glsdetoklabel{#1}@prevunit@#2}% + {0}% + {\csuse{glo@\glsdetoklabel{#1}@prevunit@#2}}% +}% +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsenableentryunitcount} +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\glsenableentryunitcount}{% +% \end{macrocode} +% Enable new fields: +% \begin{macrocode} + \appto\@newglossaryentry@defcounters{\@@newglossaryentry@defunitcounters}% +% \end{macrocode} +% Just in case the user has switched on the \pkgopt{docdef} option. +% \begin{macrocode} + \renewcommand*{\gls@defdocnewglossaryentry}{% + \renewcommand*\newglossaryentry[2]{% + \PackageError{glossaries}{\string\newglossaryentry\space + may only be used in the preamble when entry counting has + been activated}{If you use \string\glsenableentryunitcount\space + you must place all entry definitions in the preamble not in + the document environment}% + }% + }% +% \end{macrocode} +% New commands to access new fields: +% \begin{macrocode} + \newcommand*{\glsentrycurrcount}[1]{% + \@glsxtr@currunitcount{##1}{\glsgetattribute{##1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{##1}{unitcount}}}% + }% + \newcommand*{\glsentryprevcount}[1]{% + \@glsxtr@prevunitcount{##1}{\glsgetattribute{##1}{unitcount}.% + \csuse{glsxtr@theunit@\glsgetattribute{##1}{unitcount}}}% + }% +% \end{macrocode} +% Access total count: +% \begin{macrocode} + \newcommand*{\glsentryprevtotalcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunittotal}% + {0}% + {% + \number\csuse{glo@\glsdetoklabel{##1}@prevunittotal} + }% + }% +% \end{macrocode} +% Access max value: +% \begin{macrocode} + \newcommand*{\glsentryprevmaxcount}[1]{% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunitmax}% + {0}% + {% + \number\csuse{glo@\glsdetoklabel{##1}@prevunitmax} + }% + }% +% \end{macrocode} +% Adjust post unset and reset: +% \begin{macrocode} + \let\@glsxtr@entryunitcount@org@unset\glsxtrpostunset + \renewcommand*{\glsxtrpostunset}[1]{% + \@glsxtr@entryunitcount@org@unset{##1}% + \@gls@increment@currunitcount{##1}% + }% + \let\@glsxtr@entryunitcount@org@localunset\glsxtrpostlocalunset + \renewcommand*{\glsxtrpostlocalunset}[1]{% + \@glsxtr@entryunitcount@org@localunset{##1}% + \@gls@local@increment@currunitcount{##1}% + }% + \let\@glsxtr@entryunitcount@org@reset\glsxtrpostreset + \renewcommand*{\glsxtrpostreset}[1]{% + \glshasattribute{##1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{##1}}% + \ifcsundef{\@glsxtr@csname}% + {}% + {\csgdef{\@glsxtr@csname}{0}}% + }% + {}% + }% + \let\@glsxtr@entryunitcount@org@localreset\glsxtrpostlocalreset + \renewcommand*{\glsxtrpostlocalreset}[1]{% + \@glsxtr@entryunitcount@org@localreset{##1}% + \glshasattribute{##1}{unitcount}% + {% + \edef\@glsxtr@csname{\@glsxtr@currentunitcount{##1}}% + \ifcsundef{\@glsxtr@csname}% + {}% + {\csdef{\@glsxtr@csname}{0}}% + }% + {}% + }% +% \end{macrocode} +% Modifications to take into account the attributes that govern +% whether the entry should be unset. +% \begin{macrocode} + \let\@cgls@\@@cgls@ + \let\@cglspl@\@@cglspl@ + \let\@cGLS@\@@cGLS@ + \let\@cGlspl@\@@cGlspl@ + \let\@cGLS@\@@cGLS@ + \let\@cGLSpl@\@@cGLSpl@ +% \end{macrocode} +% Write information to the aux file. +% \begin{macrocode} + \AtEndDocument{\@gls@write@entryunitcounts}% + \renewcommand*{\@gls@entry@unitcount}[3]{% + \csgdef{glo@\glsdetoklabel{##1}@prevunit@##3}{##2}% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunittotal}% + {\csgdef{glo@\glsdetoklabel{##1}@prevunittotal}{##2}}% + {% + \csxdef{glo@\glsdetoklabel{##1}@prevunittotal}{ + \number\numexpr\csuse{glo@\glsdetoklabel{##1}@prevunittotal}+##2}% + }% + \ifcsundef{glo@\glsdetoklabel{##1}@prevunitmax}% + {\csgdef{glo@\glsdetoklabel{##1}@prevunitmax}{##2}}% + {% + \ifnum\csuse{glo@\glsdetoklabel{##1}@prevunitmax}<##2 + \csgdef{glo@\glsdetoklabel{##1}@prevunitmax}{##2}% + \fi + }% + }% + \let\glsenableentryunitcount\relax + \renewcommand*{\glsenableentrycount}{% + \PackageError{glossaries-extra}{\string\glsenableentrycount\space + can't be used with \string\glsenableentryunitcount}% + {Use one or other but not both commands}% + }% +} +\@onlypreamble\glsenableentryunitcount +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@entry@unitcount} +% \begin{macrocode} +\newcommand*{\@gls@entry@unitcount}[3]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@write@entryunitcounts@do} +% \begin{macrocode} +\newcommand*{\@gls@write@entryunitcounts@do}[1]{% + \immediate\write\@auxout + {\string\@gls@entry@unitcount + {\@glsentry}% + {\@glsxtr@currunitcount{\@glsentry}{#1}% + }% + {#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@write@entryunitcounts} +% \begin{macrocode} +\newcommand*{\@gls@write@entryunitcounts}{% + \immediate\write\@auxout + {\string\providecommand*{\string\@gls@entry@unitcount}[3]{}}% + \count@=0\relax + \forallglsentries{\@glsentry}{% + \glshasattribute{\@glsentry}{unitcount}% + {% + \ifglsused{\@glsentry}% + {% + \forlistcsloop + {\@gls@write@entryunitcounts@do}% + {glo@\glsdetoklabel{\@glsentry}@unitlist}% + }% + {}% + \advance\count@ by \@ne + }% + {}% + }% + \ifnum\count@=0 + \GlossariesExtraWarningNoLine{Entry counting has been enabled + \MessageBreak with \string\glsenableentryunitcount\space but the + \MessageBreak attribute `unitcount' hasn't + \MessageBreak been assigned to any of the defined + \MessageBreak entries}% + \fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrEnableEntryUnitCounting} +% The first argument is the list of categories, the second +% argument is the value of the \catattr{entrycount} attribute +% and the third is the counter name. +%\changes{0.5.4}{2015-12-15}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableEntryUnitCounting}[3]{% +% \end{macrocode} +% Enable entry counting: +% \begin{macrocode} + \glsenableentryunitcount +% \end{macrocode} +% Redefine \cs{gls} etc: +% \begin{macrocode} + \renewcommand*{\gls}{\cgls}% + \renewcommand*{\Gls}{\cGls}% + \renewcommand*{\glspl}{\cglspl}% + \renewcommand*{\Glspl}{\cGlspl}% + \renewcommand*{\GLS}{\cGLS}% + \renewcommand*{\GLSpl}{\cGLSpl}% +% \end{macrocode} +% Set the \catattr{entrycount} attribute: +% \begin{macrocode} + \@glsxtr@setentryunitcountunsetattr{#1}{#2}{#3}% +% \end{macrocode} +% In case this command is used again: +% \begin{macrocode} + \let\GlsXtrEnableEntryUnitCounting\@glsxtr@setentryunitcountunsetattr + \renewcommand*{\GlsXtrEnableEntryCounting}[2]{% + \PackageError{glossaries-extra}{\string\GlsXtrEnableEntryCounting\space + can't be used with \string\GlsXtrEnableEntryUnitCounting}% + {Use one or other but not both commands}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@setentryunitcountunsetattr} +%\changes{0.5.4}{}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@setentryunitcountunsetattr}[3]{% + \@for\@glsxtr@cat:=#1\do + {% + \ifdefempty{\@glsxtr@cat}{}% + {% + \glssetcategoryattribute{\@glsxtr@cat}{entrycount}{#2}% + \glssetcategoryattribute{\@glsxtr@cat}{unitcount}{#3}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% +%\subsection{Acronym Modifications} +% It's more consistent to use the abbreviation code for acronyms, +% but make some adjustments to allow for continued use of the +% \sty{glossaries} package's custom acronym format. (For example, +% user may already have defined some acronym styles with +% \cs{newacronymstyle} which they would like to continue to use.) +% The original \sty{glossaries} acronym code can be restored +% with \cs{RestoreAcronyms}, but adjust \cs{SetGenericNewAcronym} +% so that \cs{newacronym} adds the category. +% +%\begin{macro}{\SetGenericNewAcronym} +% \begin{macrocode} +\renewcommand*{\SetGenericNewAcronym}{% + \let\@Gls@entryname\@Gls@acrentryname + \renewcommand{\newacronym}[4][]{% + \ifdefempty{\@glsacronymlists}% + {% + \def\@glo@type{\acronymtype}% + \setkeys{glossentry}{##1}% + \DeclareAcronymList{\@glo@type}% + }% + {}% + \glskeylisttok{##1}% + \glslabeltok{##2}% + \glsshorttok{##3}% + \glslongtok{##4}% + \newacronymhook + \protected@edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\acronymtype,% + name={\expandonce{\acronymentry{##2}}},% + sort={\acronymsort{\the\glsshorttok}{\the\glslongtok}},% + text={\the\glsshorttok},% + short={\the\glsshorttok},% + shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% + long={\the\glslongtok},% + longplural={\the\glslongtok\noexpand\acrpluralsuffix},% + category=acronym, + \GenericAcronymFields,% + \the\glskeylisttok + }% + }% + \@do@newglossaryentry + }% + \renewcommand*{\acrfullfmt}[3]{% + \glslink[##1]{##2}{\genacrfullformat{##2}{##3}}}% + \renewcommand*{\Acrfullfmt}[3]{% + \glslink[##1]{##2}{\Genacrfullformat{##2}{##3}}}% + \renewcommand*{\ACRfullfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\genacrfullformat{##2}{##3}}}}% + \renewcommand*{\acrfullplfmt}[3]{% + \glslink[##1]{##2}{\genplacrfullformat{##2}{##3}}}% + \renewcommand*{\Acrfullplfmt}[3]{% + \glslink[##1]{##2}{\Genplacrfullformat{##2}{##3}}}% + \renewcommand*{\ACRfullplfmt}[3]{% + \glslink[##1]{##2}{% + \mfirstucMakeUppercase{\genplacrfullformat{##2}{##3}}}}% + \renewcommand*{\glsentryfull}[1]{\genacrfullformat{##1}{}}% + \renewcommand*{\Glsentryfull}[1]{\Genacrfullformat{##1}{}}% + \renewcommand*{\glsentryfullpl}[1]{\genplacrfullformat{##1}{}}% + \renewcommand*{\Glsentryfullpl}[1]{\Genplacrfullformat{##1}{}}% +} +% \end{macrocode} +%\end{macro} +% +% This will cause a problem for glossaries that contain a mixture of +% acronyms and abbreviations, so redefine \cs{newacronym} to use the +% new abbreviation interface. +% +% First save the original definitions: +% \begin{macrocode} +\let\@glsxtr@org@setacronymstyle\setacronymstyle +\let\@glsxtr@org@newacronymstyle\newacronymstyle +% \end{macrocode} +% +%\begin{macro}{\MakeAcronymsAbbreviations} +% Make acronyms use the same interface as abbreviations. +% Note that \cs{newacronymstyle} has a different implementation to +% \cs{newabbrevationstyle} so disable \cs{newacronymstyle} and +% \cs{setacronymstyle}. +%\changes{0.4}{2015-12-03}{set the default type to \cs{acronymtype}} +%\changes{0.5.4}{2015-12-15}{now disables \cs{setacronymstyle}} +% \begin{macrocode} +\newcommand*{\MakeAcronymsAbbreviations}{% + \renewcommand*{\newacronym}[4][]{% + \newabbreviation[type=\acronymtype,category=acronym,##1]{##2}{##3}{##4}% + }% + \renewcommand*{\firstacronymfont}[1]{\glsfirstabbrvfont{##1}}% + \renewcommand*{\acronymfont}[1]{\glsabbrvfont{##1}}% + \renewcommand*{\setacronymstyle}[1]{% + \PackageError{glossaries-extra}{\string\setacronymstyle{##1} + unavailable. + Use \string\setabbreviationstyle\space instead. + The original acronym interface can be restored with + \string\RestoreAcronyms}{}% + }% + \renewcommand*{\newacronymstyle}[1]{% + \GlossariesExtraWarning{New acronym style `##1' won't be + available unless you restore the original acronym interface with + \string\RestoreAcronyms}% + \@glsxtr@org@newacronymstyle{##1}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Switch acronyms to abbreviations: +% \begin{macrocode} +\MakeAcronymsAbbreviations +% \end{macrocode} +% +%\begin{macro}{\RestoreAcronyms} +% Restore acronyms to \sty{glossaries} interface. +% \begin{macrocode} +\newcommand*{\RestoreAcronyms}{% + \SetGenericNewAcronym + \renewcommand{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand{\acronymfont}[1]{##1}% + \let\setacronymstyle\@glsxtr@org@setacronymstyle + \let\newacronymstyle\@glsxtr@org@newacronymstyle + \let\@gls@link@checkfirsthyper\@glsxtr@org@checkfirsthyper + \glssetcategoryattribute{acronym}{regular}{false}% + \setacronymstyle{long-short}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsacspace} +% Allow the user to customise the maximum value. +% \begin{macrocode} +\renewcommand*{\glsacspace}[1]{% + \settowidth{\dimen@}{(\firstacronymfont{\glsentryshort{#1}})}% + \ifdim\dimen@<\glsacspacemax~\else\space\fi +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsacspacemax} +% Value used in the above. +% \begin{macrocode} +\newcommand*{\glsacspacemax}{3em} +% \end{macrocode} +%\end{macro} +% +%\subsection{Indexing and Displaying Glossaries} +%From time-to-time users ask if they can have one glossary sorted +%normally and another sorted by definition or usage. With the +% base \sty{glossaries} package this can only be achieved with the +% \qt{noidx} commands (Option~1). This is an attempt to mix and +% match. +% +%First we need a list of the glossaries that require +%\gls{makeindex}\slash\gls{xindy}. +%\begin{macro}{\@glsxtr@reg@glosslist} +%\changes{0.5.5}{??}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@reg@glosslist}{} +% \end{macrocode} +%\end{macro} +% Save the original definition of \cs{makeglossaries}: +% \begin{macrocode} +\let\@glsxtr@org@makeglossaries\makeglossaries +% \end{macrocode} +% +% Redefine \cs{makeglossaries} to take an optional argument. +% This should be empty for the usual behaviour (all glossaries +% need processing with an indexing application) or a comma-separated +% list of glossary labels indicating those glossaries that should be +% processed with an indexing application. +%\begin{macro}{\makeglossaries} +%\changes{0.5.5}{??}{new} +% \begin{macrocode} +\renewcommand*{\makeglossaries}[1][]{% + \ifblank{#1}% + {\@glsxtr@org@makeglossaries}% + {% + \edef\@glsxtr@reg@glosslist{#1}% + \ifundef{\glswrite}{\newwrite\glswrite}{}% + \protected@write\@auxout{}{\string\providecommand + \string\@glsorder[1]{}} + \protected@write\@auxout{}{\string\providecommand + \string\@istfilename[1]{}} + \protected@write\@auxout{}{\string\@istfilename{\istfilename}}% + \protected@write\@auxout{}{\string\@glsorder{\glsorder}} + \write\@auxout{\string\providecommand\string\@gls@reference[3]{}}% +% \end{macrocode} +% Iterate through each supplied glossary type and activate it. +% \begin{macrocode} + \@for\@glo@type:=#1\do{% + \ifdefempty{\@glo@type}{}{\@makeglossary{\@glo@type}}% + }% +% \end{macrocode} +% New glossaries must be created before \cs{makeglossaries}: +% \begin{macrocode} + \renewcommand*\newglossary[4][]{% + \PackageError{glossaries}{New glossaries + must be created before \string\makeglossaries}{You need + to move \string\makeglossaries\space after all your + \string\newglossary\space commands}}% +% \end{macrocode} +% Any subsequence instances of this command should have no effect +% \begin{macrocode} + \let\@makeglossary\relax + \let\makeglossary\relax + \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 + \def\warn@noprintglossary{% + \GlossariesWarningNoLine{No \string\printglossary\space + or \string\printglossaries\space + found.^^J(Remove \string\makeglossaries\space if you don't +want + any glossaries.)^^JThis document will not have a glossary}% + }% +% \end{macrocode} +% Adjust display number list to check for type: +% \begin{macrocode} + \renewcommand*{\glsdisplaynumberlist}[1]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {\@glsxtr@idx@displaynumberlist{##1}}% + {\@glsxtr@noidx@displaynumberlist{##1}}% + }% +% \end{macrocode} +% Adjust entry list: +% \begin{macrocode} + \renewcommand*{\glsentrynumberlist}[1]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {\@glsxtr@idx@entrynumberlist{##1}}% + {\@glsxtr@noidx@entrynumberlist{##1}}% + }% +% \end{macrocode} +% Adjust number list loop +% \begin{macrocode} + \renewcommand*{\glsnumberlistloop}[2]{% + \expandafter\DTLifinlist\expandafter{##1}{\@glsxtr@reg@glosslist}% + {% + \PackageError{glossaries-extra}{\string\glsnumberlistloop\space + not available for glossary `##1'}{}% + }% + {\@glsxtr@noidx@numberlistloop{##1}{##2}}% + }% +% \end{macrocode} +% Only sanitize sort for normal indexing glossaries. +% \begin{macrocode} + \renewcommand*{\glsprestandardsort}[3]{% + \expandafter\DTLifinlist\expandafter{##2}{\@glsxtr@reg@glosslist}% + {% + \glsdosanitizesort + }% + {% + \ifglssanitizesort + \@gls@noidx@sanitizesort + \else + \@gls@noidx@nosanitizesort + \fi + }% + }% +% \end{macrocode} +% Unlike \cs{makenoidxglossaries} we can't automatically set +% sanitizesort=false. All entries must be defined in the preamble. +% \begin{macrocode} + \renewcommand*\new@glossaryentry[2]{% + \PackageError{glossaries-extra}{Glossary entries must be defined + in the preamble\MessageBreak when you use the optional argument + of \string\makeglossaries}{Either move your definitions to the + preamble or don't use the optional argument of + \string\makeglossaries}% + }% +% \end{macrocode} +% Only activate sort key for glossaries that aren't listed in +% \verb|#1| (glossary label is stored in \cs{@glo@type} but this +% defaults to \cs{glsdefaulttype} so some expansion is required). +% \begin{macrocode} + \renewcommand*{\@printgloss@setsort}{% + \renewcommand*{\@glo@assign@sortkey}{% + \edef\@glo@type{\@glo@type}% + \expandafter\DTLifinlist\expandafter{\@glo@type}{\@glsxtr@reg@glosslist}% + {% + \@@glo@no@assign@sortkey + }% + {% + \@@glo@assign@sortkey + }% + }% + \def\@glo@sorttype{\@glo@default@sorttype}% + }% +% \end{macrocode} +% Check \pkgopt{automake} setting: +% \begin{macrocode} + \ifglsautomake + \renewcommand*{\@gls@doautomake}{% + \@for\@gls@type:=\@glsxtr@reg@glosslist\do{% + \ifdefempty{\@gls@type}{}{\@gls@automake{\@gls@type}}% + }% + }% + \fi + }% +} +% \end{macrocode} +%\end{macro} +% +% Display number list for the regular version: +%\begin{macro}{\@glsxtr@idx@displaynumberlist} +%\changes{0.5.5}{??}{new} +% \begin{macrocode} +\let\@glsxtr@idx@displaynumberlist\glsdisplaynumberlist +% \end{macrocode} +%\end{macro} +% +% Display number list for the \qt{noidx} version: +%\begin{macro}{\@glsxtr@noidx@displaynumberlist} +%\changes{0.5.5}{??}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@noidx@displaynumberlist}[1]{% + \letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}% + \ifdef\@gls@loclist + {% + \def\@gls@noidxloclist@sep{% + \def\@gls@noidxloclist@sep{% + \def\@gls@noidxloclist@sep{% + \glsnumlistsep + }% + \def\@gls@noidxloclist@finalsep{\glsnumlistlastsep}% + }% + }% + \def\@gls@noidxloclist@finalsep{}% + \def\@gls@noidxloclist@prev{}% + \forlistloop{\glsnoidxdisplayloclisthandler}{\@gls@loclist}% + \@gls@noidxloclist@finalsep + \@gls@noidxloclist@prev + }% + {% + ??\glsdoifexists{#1}% + {% + \GlossariesWarning{Missing location list for `#1'. Either + a rerun is required or you haven't referenced the entry.}% + }% + }% +}% + +% \end{macrocode} +%\end{macro} +%And for the number list loop: +%\begin{macro}{\@glsxtr@noidx@numberlistloop} +%\changes{0.5.5}{??}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@noidx@numberlistloop}[3]{% + \letcs{\@gls@loclist}{glo@\glsdetoklabel{#1}@loclist}% + \let\@gls@org@glsnoidxdisplayloc\glsnoidxdisplayloc + \let\@gls@org@glsseeformat\glsseeformat + \let\glsnoidxdisplayloc#2\relax + \let\glsseeformat#3\relax + \ifdef\@gls@loclist + {% + \forlistloop{\glsnoidxnumberlistloophandler}{\@gls@loclist}% + }% + {% + ??\glsdoifexists{#1}% + {% + \GlossariesWarning{Missing location list for `##1'. Either + a rerun is required or you haven't referenced the entry.}% + }% + }% + \let\glsnoidxdisplayloc\@gls@org@glsnoidxdisplayloc + \let\glsseeformat\@gls@org@glsseeformat +}% +% \end{macrocode} +%\end{macro} +% +%Same for entry number list. +%\begin{macro}{\@glsxtr@noidx@entrynumberlist} +%\changes{0.5.5}{??}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@noidx@entrynumberlist}[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} +%\end{macro} +% +%\begin{macro}{\@glsxtr@idx@entrynumberlist} +%\changes{0.5.5}{??}{new} +% \begin{macrocode} +\let\@glsxtr@idx@entrynumberlist\glsentrynumberlist +% \end{macrocode} +%\end{macro} +% +% Give a bit of assistance to new users who are confused and don't +% know how to read transcript messages. +%\begin{macro}{\@print@glossary} +%\changes{0.3}{2015-12-02}{added redefinition} +% \begin{macrocode} +\renewcommand{\@print@glossary}{% + \makeatletter + \@input@{\jobname.\csname @glotype@\@glo@type @in\endcsname}% + \IfFileExists{\jobname.\csname @glotype@\@glo@type @in\endcsname}% + {}% + {\glsxtrNoGlossaryWarning{\@glo@type}}% + \ifglsxindy + \ifcsundef{@xdy@\@glo@type @language}% + {% + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \noexpand\immediate\noexpand\write\@auxout{% + \string\providecommand\string\@xdylanguage[2]{}}% + \noexpand\immediate\noexpand\write\@auxout{% + \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}% + }% + }% + }% + {% + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \noexpand\immediate\noexpand\write\@auxout{% + \string\providecommand\string\@xdylanguage[2]{}}% + \noexpand\immediate\noexpand\write\@auxout{% + \string\@xdylanguage{\@glo@type}{\csname @xdy@\@glo@type + @language\endcsname}}% + }% + }% + }% + \@do@auxoutstuff + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \noexpand\immediate\noexpand\write\@auxout{% + \string\providecommand\string\@gls@codepage[2]{}}% + \noexpand\immediate\noexpand\write\@auxout{% + \string\@gls@codepage{\@glo@type}{\gls@codepage}}% + }% + }% + \@do@auxoutstuff + \fi + \renewcommand*{\@warn@nomakeglossaries}{% + \GlossariesWarningNoLine{\string\makeglossaries\space + hasn't been used,^^Jthe glossaries will not be updated}% + }% +} +% \end{macrocode} +%\end{macro} +% +% Setup the warning text to display if the external file for the given +% glossary is missing. +% +%\begin{macro}{\GlsXtrNoGlsWarningHead} +% Header message. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningHead}[2]{% + This document is incomplete. The external file associated with + the glossary `#1' (which should be called \texttt{#2}) + hasn't been created.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningEmptyStart} +% No entries have been added to the glossary. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningEmptyStart}{% + This has probably happened because there are no entries defined + in this glossary.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningEmptyMain} +% The default \qt{main} glossary is empty. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningEmptyMain}{% + If you don't want this glossary, + add \texttt{nomain} to your package option list when you load + \texttt{glossaries-extra.sty}. For example:% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningEmptyNotMain} +% A glossary that isn't the default \qt{main} glossary is empty. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningEmptyNotMain}[1]{% + Did you forget to use \texttt{type=#1} when you defined your + entries? If you tried to load entries into this glossary with + \texttt{\string\loadglsentries} did you remember to use + \texttt{[#1]} as the optional argument? If you did, check that + the definitions in the file you loaded all had the type set + to \texttt{\string\glsdefaulttype}.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningCheckFile} +% Advisory message to check the file contents. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningCheckFile}[1]{% + Check the contents of the file \texttt{#1}. If + it's empty, that means you haven't indexed any of your entries in this + glossary (using commands like \texttt{\string\gls} or + \texttt{\string\glsadd}) so this list can't be generated. + If the file isn't empty, the document build process hasn't been + completed.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningAutoMake} +% Message when \pkgopt{automake} option has been used. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningAutoMake}[1]{% + You may need to rerun \LaTeX. If you already have, it may be that + \TeX's shell escape doesn't allow you to run + \ifglsxindy xindy\else makeindex\fi. Check the + transcript file \texttt{\jobname.log}. If the shell escape is + disabled, try one of the following: + + \begin{itemize} + \item Run the external (Lua) application: + + \texttt{makeglossaries-lite \string"\jobname\string"} + + \item Run the external (Perl) application: + + \texttt{makeglossaries \string"\jobname\string"} + \end{itemize} + + Then rerun \LaTeX\ on this document. + \GlossariesExtraWarning{Rerun required to build the + glossary `#1' or check TeX's shell escape allows + you to run \ifglsxindy xindy\else makeindex\fi}% +} +% \end{macrocode} +%\end{macro} +% +%\changes{0.5.3}{2015-12-09}{removed \cs{GlsXtrNoGlsWarningNoAutoMakeMain}} +% +%\begin{macro}{\GlsXtrNoGlsWarningMisMatch} +% Mismatching \cs{makenoidxglossaries}. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningMisMatch}{% + You need to either replace \texttt{\string\makenoidxglossaries} + with \texttt{\string\makeglossaries} or replace + \texttt{\string\printglossary} (or \texttt{\string\printglossaries}) with + \texttt{\string\printnoidxglossary} + (or \texttt{\string\printnoidxglossaries}) and then rebuild + this document.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningBuildInfo} +% Build advice. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningBuildInfo}{% + Try one of the following: + \begin{itemize} + \item Add \texttt{automake} to your package option list when you load + \texttt{glossaries-extra.sty}. For example: + + \texttt{\string\usepackage[automake]% + \glsopenbrace glossaries-extra\glsclosebrace} + + \item Run the external (Lua) application: + + \texttt{makeglossaries-lite \string"\jobname\string"} + + \item Run the external (Perl) application: + + \texttt{makeglossaries \string"\jobname\string"} + \end{itemize} + + Then rerun \LaTeX\ on this document.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningTail} +% Final paragraph. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningTail}{% + This message will be removed once the problem has been fixed.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrNoGlsWarningNoOut} +% No out file created. +% Build advice. +% \begin{macrocode} +\newcommand{\GlsXtrNoGlsWarningNoOut}[1]{% + The file \texttt{#1} doesn't exist. This most likely means you haven't used + \texttt{\string\makeglossaries} or you have used + \texttt{\string\nofiles}. If this is just a draft version of the + document, you can suppress this message using the + \texttt{nomissingglstext} package option.% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@defaultnoglossarywarning} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@defaultnoglossarywarning}[1]{% + \glossarysection[\glossarytoctitle]{\glossarytitle} + \GlsXtrNoGlsWarningHead{#1}{\jobname.\csname @glotype@\@glo@type @in\endcsname} + \par + \glsxtrifemptyglossary{#1}% + {% + \GlsXtrNoGlsWarningEmptyStart\space + \ifthenelse{\equal{#1}{main}}{\GlsXtrNoGlsWarningEmptyMain\par + \medskip + \noindent\texttt{\string\usepackage[nomain\ifglsacronym ,acronym\fi]% + \glsopenbrace glossaries-extra\glsclosebrace} + \medskip + }% + {\GlsXtrNoGlsWarningEmptyNotMain{#1}}% + }% + {% + \IfFileExists{\jobname.\csname @glotype@\@glo@type @out\endcsname} + {% + \GlsXtrNoGlsWarningCheckFile + {\jobname.\csname @glotype@\@glo@type @out\endcsname} + + \ifglsautomake + + \GlsXtrNoGlsWarningAutoMake{#1} + + \else + + \ifthenelse{\equal{#1}{main}}% + {% + \GlsXtrNoGlsWarningEmptyMain\par + \medskip + \noindent\texttt{\string\usepackage[nomain]% + \glsopenbrace glossaries-extra\glsclosebrace} + \medskip + }% + {}% + + \ifdefequal\makeglossaries\@no@makeglossaries + {% + \GlsXtrNoGlsWarningMisMatch + }% + {% + \GlsXtrNoGlsWarningBuildInfo + }% + \fi + }% + {% + \GlsXtrNoGlsWarningNoOut + {\jobname.\csname @glotype@\@glo@type @out\endcsname}% + }% + }% + \par + \GlsXtrNoGlsWarningTail +} +% \end{macrocode} +%\end{macro} +% +%\section{Integration with glossaries-accsupp} +% Provide better integration with the \sty{glossaries-accsupp} +% package. (Must be loaded before the main code of +% \sty{glossaries-extra} either explicitly or through the +% \pkgopt{accsupp} package option.) +% +% These commands have their definitions set according to whether +% or not \sty{glossaries-extra} has been loaded. +%\changes{0.5.2}{2015-12-08}{fixed typo in glossaries-accsupp and tidied up code to use +% just one \cs{@ifpackageloaded}} +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ +% \end{macrocode} +% Define (or redefine) commands to use the accessibility +% information. +%\begin{macro}{\glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessname}[1]{% + \glsnameaccessdisplay + {% + \glsentryname{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsname@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glsname@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccessname{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessname}[1]{% + \glsnameaccessdisplay + {% + \Glsentryname{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsname@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glsname@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccessname{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessname} +% Display the \gloskey{name} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessname}[1]{% + \glsnameaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryname{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSname@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSname@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccessname{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesstext}[1]{% + \glstextaccessdisplay + {% + \glsentrytext{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glstext@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glstext@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccesstext{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\Glsaccesstext}[1]{% + \glstextaccessdisplay + {% + \Glsentrytext{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glstext@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glstext@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccesstext{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesstext} +% Display the \gloskey{text} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesstext}[1]{% + \glstextaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrytext{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLStext@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLStext@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccesstext{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessplural}[1]{% + \glspluralaccessdisplay + {% + \glsentryplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glsplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccessplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessplural}[1]{% + \glspluralaccessdisplay + {% + \Glsentryplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glsplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccessplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessplural}[1]{% + \glspluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccessplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessfirst}[1]{% + \glsfirstaccessdisplay + {% + \glsentryfirst{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsfirst@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glsfirst@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccessfirst{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessfirst}[1]{% + \glsfirstaccessdisplay + {% + \Glsentryfirst{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsfirst@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glsfirst@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccessfirst{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirst}[1]{% + \glsfirstaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryfirst{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSfirst@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSfirst@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccessfirst{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessfirstplural}[1]{% + \glsfirstpluralaccessdisplay + {% + \glsentryfirstplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsfirstplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glsfirstplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccessfirstplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessfirstplural}[1]{% + \glsfirstpluralaccessdisplay + {% + \Glsentryfirstplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsfirstplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glsfirstplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccessfirstplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirstplural}[1]{% + \glsfirstpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryfirstplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSfirstplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSfirstplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccessfirstplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesssymbol}[1]{% + \glssymbolaccessdisplay + {% + \glsentrysymbol{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glssymbol@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glssymbol@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccesssymbol{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccesssymbol}[1]{% + \glssymbolaccessdisplay + {% + \Glsentrysymbol{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glssymbol@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glssymbol@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccesssymbol{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbol}[1]{% + \glssymbolaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrysymbol{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSsymbol@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSsymbol@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccesssymbol{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesssymbolplural}[1]{% + \glssymbolpluralaccessdisplay + {% + \glsentrysymbolplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glssymbolplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glssymbolplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccesssymbolplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccesssymbolplural}[1]{% + \glssymbolpluralaccessdisplay + {% + \Glsentrysymbolplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glssymbolplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glssymbolplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccesssymbolplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbolplural}[1]{% + \glssymbolpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrysymbolplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSsymbolplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSsymbolplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccesssymbolplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessdesc}[1]{% + \glsdescriptionaccessdisplay + {% + \glsentrydesc{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdesc@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glsdesc@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccessdesc{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessdesc}[1]{% + \glsdescriptionaccessdisplay + {% + \Glsentrydesc{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsdesc@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glsdesc@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccessdesc{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdesc}[1]{% + \glsdescriptionaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrydesc{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSdesc@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSdesc@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccessdesc{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessdescplural}[1]{% + \glsdescriptionpluralaccessdisplay + {% + \glsentrydescplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsdescplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@glsdescplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\glsaccessdescplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence) +% with the first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessdescplural}[1]{% + \glsdescriptionpluralaccessdisplay + {% + \Glsentrydescplural{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@Glsdescplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@Glsdescplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\Glsaccessdescplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdescplural}[1]{% + \glsdescriptionpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrydescplural{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@GLSdescplural@} +% Redefine to use accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\def\@GLSdescplural@#1#2[#3]{% + \@gls@field@link{#1}{#2}{\GLSaccessdescplural{#2}#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshort} +% Display the short form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessshort}[1]{% + \glsshortaccessdisplay + {% + \glsentryshort{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshort} +% Display the short form with first letter converted to uppercase +% (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessshort}[1]{% + \glsshortaccessdisplay + {% + \Glsentryshort{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshort} +% Display the \gloskey{short} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshort}[1]{% + \glsshortaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryshort{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshortpl} +% Display the short plural form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccessshortpl}[1]{% + \glsshortpluralaccessdisplay + {% + \glsentryshortpl{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshortpl} +% Display the short plural form with first letter converted to +% uppercase (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\Glsaccessshortpl}[1]{% + \glsshortpluralaccessdisplay + {% + \Glsentryshortpl{#1}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshortpl} +% Display the \gloskey{shortplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshortpl}[1]{% + \glsshortpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentryshortpl{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslong} +% Display the long form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + \newcommand*{\glsaccesslong}[1]{% + \glslongaccessdisplay{\glsentrylong{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslong} +% Display the long form (no link and no check for existence). +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} + + \newcommand*{\Glsaccesslong}[1]{% + \glslongaccessdisplay{\Glsentrylong{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslong} +% Display the \gloskey{long} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslong}[1]{% + \glslongaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrylong{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\glsaccesslongpl}[1]{% + \glslongpluralaccessdisplay{\glsentrylongpl{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + + \newcommand*{\Glsaccesslongpl}[1]{% + \glslongpluralaccessdisplay{\Glsentrylongpl{#1}}{#1}% + } +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslongpl} +% Display the \gloskey{longplural} value (no link and no check for existence) +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslongpl}[1]{% + \glslongpluralaccessdisplay + {% + \mfirstucMakeUppercase{\glsentrylongpl{#1}}% + }% + {#1}% + } +% \end{macrocode} +%\end{macro} +% +% End of if part +% \begin{macrocode} +} +{ +% \end{macrocode} +% No accessibility support. Just define these commands to do +% \cs{glsentry}\meta{xxx} +%\begin{macro}{\glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessname}[1]{\glsentryname{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessname} +% Display the \gloskey{name} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessname}[1]{\Glsentryname{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessname} +% Display the \gloskey{name} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessname}[1]{% + \protect\mfirstucMakeUppercase{\glsentryname{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesstext}[1]{\glsentrytext{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesstext} +% Display the \gloskey{text} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccesstext}[1]{\Glsentrytext{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesstext} +% Display the \gloskey{text} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesstext}[1]{% + \protect\mfirstucMakeUppercase{\glsentrytext{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessplural}[1]{\glsentryplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessplural}[1]{\Glsentryplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessplural} +% Display the \gloskey{plural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentryplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessfirst}[1]{\glsentryfirst{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessfirst}[1]{\Glsentryfirst{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirst} +% Display the \gloskey{first} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirst}[1]{% + \protect\mfirstucMakeUppercase{\glsentryfirst{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessfirstplural}[1]{\glsentryfirstplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessfirstplural}[1]{\Glsentryfirstplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessfirstplural} +% Display the \gloskey{firstplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessfirstplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentryfirstplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesssymbol}[1]{\glsentrysymbol{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccesssymbol}[1]{\Glsentrysymbol{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbol} +% Display the \gloskey{symbol} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbol}[1]{% + \protect\mfirstucMakeUppercase{\glsentrysymbol{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesssymbolplural}[1]{\glsentrysymbolplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccesssymbolplural}[1]{\Glsentrysymbolplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesssymbolplural} +% Display the \gloskey{symbolplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesssymbolplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentrysymbolplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessdesc}[1]{\glsentrydesc{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessdesc}[1]{\Glsentrydesc{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdesc} +% Display the \gloskey{desc} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdesc}[1]{% + \protect\mfirstucMakeUppercase{\glsentrydesc{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessdescplural}[1]{\glsentrydescplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence) +% with the first letter converted to upper case. +% \begin{macrocode} + \newcommand*{\Glsaccessdescplural}[1]{\Glsentrydescplural{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessdescplural} +% Display the \gloskey{descplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessdescplural}[1]{% + \protect\mfirstucMakeUppercase{\glsentrydescplural{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshort} +% Display the short form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessshort}[1]{\glsentryshort{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshort} +% Display the short form with first letter converted to uppercase +% (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccessshort}[1]{\Glsentryshort{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshort} +% Display the \gloskey{short} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshort}[1]{% + \protect\mfirstucMakeUppercase{\glsentryshort{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccessshortpl} +% Display the short plural form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccessshortpl}[1]{\glsentryshortpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccessshortpl} +% Display the short plural form with first letter converted to +% uppercase (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccessshortpl}[1]{\Glsentryshortpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccessshortpl} +% Display the \gloskey{shortplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccessshortpl}[1]{% + \protect\mfirstucMakeUppercase{\glsentryshortpl{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslong} +% Display the long form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesslong}[1]{\glsentrylong{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslong} +% Display the long form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccesslong}[1]{\Glsentrylong{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslong} +% Display the \gloskey{long} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslong}[1]{% + \protect\mfirstucMakeUppercase{\glsentrylong{#1}}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\glsaccesslongpl}[1]{\glsentrylongpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsaccesslongpl} +% Display the long plural form (no link and no check for existence). +% \begin{macrocode} + \newcommand*{\Glsaccesslongpl}[1]{\Glsentrylongpl{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSaccesslongpl} +% Display the \gloskey{longplural} value (no link and no check for existence). +% converted to upper case. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} + \newcommand*{\GLSaccesslongpl}[1]{% + \protect\mfirstucMakeUppercase{\glsentrylongpl{#1}}} +% \end{macrocode} +%\end{macro} +% +% End of else part +% \begin{macrocode} +} +% \end{macrocode} +% +%\section{Categories} +%\begin{macro}{\glscategory} +% Add a new storage key that can be used to indicate a category. The +% default category is \category{general}. +% \begin{macrocode} +\glsaddstoragekey{category}{general}{\glscategory} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifcategory} +% Convenient shortcut to determine if an entry has the given +% category. +% \begin{macrocode} +\newcommand{\glsifcategory}[4]{% + \ifglsfieldeq{#1}{category}{#2}{#3}{#4}% +} +% \end{macrocode} +%\end{macro} +% +% Categories can have attributes. +%\begin{macro}{\glssetcategoryattribute} +%\begin{definition} +%\cs{glssetcategoryattribute}\marg{category}\marg{attribute-label}\marg{value} +%\end{definition} +% Set (or override if already set) an attribute for the given +% category. +% \begin{macrocode} +\newcommand*{\glssetcategoryattribute}[3]{% + \csdef{@glsxtr@categoryattr@@#1@#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgetcategoryattribute} +%\begin{definition} +%\cs{glsgetcategoryattribute}\marg{category}\marg{attribute-label} +%\end{definition} +% Get the value of the given attribute for the given +% category. Does nothing if the attribute isn't defined. +% \begin{macrocode} +\newcommand*{\glsgetcategoryattribute}[2]{% + \csuse{@glsxtr@categoryattr@@#1@#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glshascategoryattribute} +%\begin{definition} +%\cs{glshascategoryattribute}\marg{category}\marg{attribute-label}\marg{true}\marg{false} +%\end{definition} +%\changes{0.5}{2015-12-07}{new} +% Tests if the category has the given attribute set. +% \begin{macrocode} +\newcommand*{\glshascategoryattribute}[4]{% + \ifcsvoid{@glsxtr@categoryattr@@#1@#2}{#4}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssetattribute} +%\begin{definition} +%\cs{glssetattribute}\marg{entry label}\marg{attribute-label}\marg{value} +%\end{definition} +% Short cut where the category label is obtained from the entry +% information. +% \begin{macrocode} +\newcommand*{\glssetattribute}[3]{% + \glssetcategoryattribute{\glscategory{#1}}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsgetattribute} +%\begin{definition} +%\cs{glsgetattribute}\marg{entry label}\marg{attribute-label} +%\end{definition} +% Short cut where the category label is obtained from the entry +% information. +% \begin{macrocode} +\newcommand*{\glsgetattribute}[2]{% + \glsgetcategoryattribute{\glscategory{#1}}{#2}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glshasattribute} +%\begin{definition} +%\cs{glshasattribute}\marg{entry +%label}\marg{attribute-label}\marg{true}\marg{false} +%\end{definition} +%\changes{0.5}{2015-12-07}{new} +%\changes{0.5.4}{2015-12-15}{added check for entry's existence} +% Short cut to test if the given attribute has been set where the +% category label is obtained from the entry information. +% \begin{macrocode} +\newcommand*{\glshasattribute}[4]{% + \ifglsentryexists{#1}% + {\glshascategoryattribute{\glscategory{#1}}{#2}{#3}{#4}}% + {#4}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifcategoryattribute} +%\begin{definition} +%\cs{glsifcategoryattribute}\marg{category}\marg{attribute-label}\marg{value}\marg{true +%part}\marg{false part} +%\end{definition} +% True if category has the attribute with the given value. +% \begin{macrocode} +\newcommand{\glsifcategoryattribute}[5]{% + \ifcsundef{@glsxtr@categoryattr@@#1@#2}% + {#5}% + {\ifcsstring{@glsxtr@categoryattr@@#1@#2}{#3}{#4}{#5}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifattribute} +%\begin{definition} +%\cs{glsifattribute}\marg{entry label}\marg{attribute-label}\marg{value}\marg{true +%part}\marg{false part} +%\end{definition} +%Short cut to determine if the given entry has a category with the +%given attribute set. +%\changes{0.5.4}{2015-12-15}{added check for entry's existence} +% \begin{macrocode} +\newcommand{\glsifattribute}[5]{% + \ifglsentryexists{#1}% + {\glsifcategoryattribute{\glscategory{#1}}{#2}{#3}{#4}{#5}}% + {#5}% +} +% \end{macrocode} +%\end{macro} +% +% Set attributes for the default \category{general} category: +% \begin{macrocode} +\glssetcategoryattribute{general}{regular}{true} +% \end{macrocode} +% Acronyms are regular by default, since they're typically just +% treated like normal words. +% \begin{macrocode} +\glssetcategoryattribute{acronym}{regular}{true} +% \end{macrocode} +% +%\begin{macro}{\glssetregularcategory} +%Convenient shortcut to create add the regular attribute. +% \begin{macrocode} +\newcommand*{\glssetregularcategory}[1]{% + \glssetcategoryattribute{#1}{regular}{true}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifregularcategory} +%\begin{definition} +%\cs{glsifregularcategory}\marg{category}\marg{true part}\marg{false part} +%\end{definition} +% Short cut to determine if a category has the regular attribute. +% \begin{macrocode} +\newcommand{\glsifregularcategory}[3]{% + \glsifcategoryattribute{#1}{regular}{true}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifregular} +%\begin{definition} +%\cs{glsifregular}\marg{entry label}\marg{true part}\marg{false part} +%\end{definition} +% Short cut to determine if an entry has a regular category. +% \begin{macrocode} +\newcommand{\glsifregular}[3]{% + \glsifregularcategory{\glscategory{#1}}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsforeachincategory} +%\begin{definition} +%\cs{glsforeachincategory}\oarg{glossary +%labels}\marg{category-label}\marg{glossary-cs}\marg{label-cs}\marg{body} +%\end{definition} +% Iterates through all entries in all the glossaries (or just those +% listed in \meta{glossary labels}) and does \meta{body} if the +% category matches \meta{category-label}. The control sequences +% \meta{glossary-cs} and \meta{label-cs} may be used in \meta{body} +% to access the glossary label and entry label for the current +% iteration. +% \begin{macrocode} +\newcommand{\glsforeachincategory}[5][\@glo@types]{% + \forallglossaries[#1]{#3}% + {% + \forglsentries[#3]{#4}% + {% + \glsifcategory{#4}{#2}{#5}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsforeachwithattribute} +%\begin{definition} +%\cs{glsforeachwithattribute}\oarg{glossary +%labels}\marg{attribute-label}\marg{attribute-value}\marg{glossary-cs}\marg{label-cs}\marg{body} +%\end{definition} +% Iterates through all entries in all the glossaries (or just those +% listed in \meta{glossary labels}) and does \meta{body} if the +% category attribute \meta{attribute-label} matches +% \meta{attribute-value}. The control sequences +% \meta{glossary-cs} and \meta{label-cs} may be used in \meta{body} +% to access the glossary label and entry label for the current +% iteration. +% \begin{macrocode} +\newcommand{\glsforeachwithattribute}[6][\@glo@types]{% + \forallglossaries[#1]{#4}% + {% + \forglsentries[#4]{#5}% + {% + \glsifattribute{#5}{#2}{#3}{#6}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +% If \cs{newterm} has been defined, redefine it so that it +% automatically sets the category label to \category{index} and add +% \cs{glsxtrpostdescription}. +% \begin{macrocode} +\ifdef\newterm +{% +% \end{macrocode} +%\begin{macro}{\newterm} +%\changes{0.4}{2015-12-03}{fixed name argument} +% \begin{macrocode} + \renewcommand*{\newterm}[2][]{% + \newglossaryentry{#2}% + {type={index},category=index,name={#2},% + description={\glsxtrpostdescription\nopostdesc},#1}% + } +% \end{macrocode} +%\end{macro} +% Indexed terms are regular by default. +% \begin{macrocode} + \glssetcategoryattribute{index}{regular}{true} +% \end{macrocode} +%\begin{macro}{\glsxtrpostdescindex} +% \begin{macrocode} + \newcommand*{\glsxtrpostdescindex}{} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} +% +%If the \pkgopt{symbols} package option was used, define a similar +%command for symbols, but set the default sort to the label rather +%than the name as the symbols will typically contain commands that +%will confuse makeindex and xindy. +% \begin{macrocode} +\ifdef\printsymbols +{% +% \end{macrocode} +%\begin{macro}{\glsxtrnewsymbol} +%\changes{0.4}{2015-12-03}{added extra argument} +% Unlike \cs{newterm}, this has a separate argument for the label +% (since the symbol will likely contain commands). +% \begin{macrocode} + \newcommand*{\glsxtrnewsymbol}[3][]{% + \newglossaryentry{#2}{name={#3},sort={#2},type=symbols,category=symbol,#1}% + } +% \end{macrocode} +%\end{macro} +% Symbols are regular by default. +% \begin{macrocode} + \glssetcategoryattribute{symbol}{regular}{true} +% \end{macrocode} +%\begin{macro}{\glsxtrpostdescsymbol} +% \begin{macrocode} + \newcommand*{\glsxtrpostdescsymbol}{} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} +% +% Similar for the numbers option. +% \begin{macrocode} +\ifdef\printnumbers +{% +% \end{macrocode} +%\begin{macro}{\glsxtrnewnumber} +%\changes{0.4}{2015-12-03}{added extra argument} +% \begin{macrocode} +\ifdef\printnumbers + \newcommand*{\glsxtrnewnumber}[3][]{% + \newglossaryentry{#2}{name={#3},sort={#2},type=numbers,category=number,#1}% + } +% \end{macrocode} +%\end{macro} +% Numbers are regular by default. +% \begin{macrocode} + \glssetcategoryattribute{number}{regular}{true} +% \end{macrocode} +%\begin{macro}{\glsxtrpostdescnumber} +% \begin{macrocode} + \newcommand*{\glsxtrpostdescnumber}{} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +} +{} +% \end{macrocode} +% +%\begin{macro}{\glsxtrsetcategory} +% Set the category for all listed labels. The first argument is the +% list of entry labels and the second argument is the category label. +% \begin{macrocode} +\newcommand*{\glsxtrsetcategory}[2]{% + \@for\@glsxtr@label:=#1\do + {% + \glsfieldxdef{\@glsxtr@label}{category}{#2}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetcategoryforall} +% Set the category for all entries in the listed glossaries. The first argument +% is the list of glossary labels and the second argument is the category label. +% \begin{macrocode} +\newcommand*{\glsxtrsetcategoryforall}[2]{% + \forallglossaries[#1]{\@glsxtr@type}{% + \forglsentries[\@glsxtr@type]{\@glsxtr@label}% + {% + \glsfieldxdef{\@glsxtr@label}{category}{#2}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfieldtitlecase} +%\begin{definition} +%\cs{glsxtrfieldtitlecase}\marg{label}\marg{field} +%\end{definition} +% Apply title casing to the contents of the given field. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\glsxtrfieldtitlecase}[2]{% + \expandafter\xcapitalisewords\expandafter + {\csname glo@\glsdetoklabel{#1}@#2\endcsname}% +} +% \end{macrocode} +%\end{macro} +% +% Provide a convenient way to modify glossary styles without having +% to define a new style just to convert the first letter of fields +% to upper case. +%\begin{macro}{\glossentrydesc} +% If the \catattr{glossdesc} attribute is \qt{firstuc} convert first +% letter to upper case. If the attribute is \qt{title} use title +% case. +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ + \renewcommand*{\glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsifattribute{#1}{glossdesc}{firstuc}% + {% + \Glsaccessdesc{#1}% + }% + {% + \glsifattribute{#1}{glossdesc}{title}% + {% + \@glsxtr@do@titlecaps@warn + \glsdescriptionaccessdisplay + {% + \glsxtrfieldtitlecase{#1}{desc}% + }% + {#1}% + }% + {% + \glsaccessdesc{#1}% + }% + }% + }% + } +} +{ + \renewcommand*{\glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsifattribute{#1}{glossdesc}{firstuc}% + {% + \Glsentrydesc{#1}% + }% + {% + \glsifattribute{#1}{glossdesc}{title}% + {% + \@glsxtr@do@titlecaps@warn + \glsxtrfieldtitlecase{#1}{desc}% + }% + {% + \glsentrydesc{#1}% + }% + }% + }% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentryname} +% If the \catattr{glossname} attribute is \qt{firstuc} convert first +% letter to upper case. If the attribute is \qt{title} use title +% case. +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ + \renewcommand*{\glossentryname}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsifattribute{#1}{glossname}{firstuc}% + {% + \glsnameaccessdisplay + {% + \glsnamefont{\Glsentryname{#1}}% + }% + {#1}% + }% + {% + \glsifattribute{#1}{glossname}{title}% + {% + \@glsxtr@do@titlecaps@warn + \glsnameaccessdisplay + {% + \glsnamefont{\glsxtrfieldtitlecase{#1}{name}}% + }% + {#1}% + }% + {% + \glsifattribute{#1}{glossname}{uc}% + {% + \glsnameaccessdisplay + {% +% \end{macrocode} +% Hide the label from the upper-casing command. +% \begin{macrocode} + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \glsnamefont{\mfirstucMakeUppercase{\glo@name}}% + }% + {#1}% + }% + {% + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \glsnameaccessdisplay + {% + \expandafter\glsnamefont\expandafter{\glo@name}% + }% + {#1}% + }% + }% + }% +% \end{macrocode} +% Do post-name hook: +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% + } +} +{ + \renewcommand*{\glossentryname}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsifattribute{#1}{glossname}{firstuc}% + {% + \glsnamefont{\Glsentryname{#1}}% + }% + {% + \glsifattribute{#1}{glossname}{title}% + {% + \@glsxtr@do@titlecaps@warn + \glsnamefont{\glsxtrfieldtitlecase{#1}{name}}% + }% + {% + \glsifattribute{#1}{glossname}{uc}% + {% +% \end{macrocode} +% Hide the label from the upper-casing command. +% \begin{macrocode} + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \glsnamefont{\mfirstucMakeUppercase{\glo@name}}% + }% + {% +% \end{macrocode} +% This little trick is used by \sty{glossaries} to allow the user to +% redefine \ics{glsnamefont} to use \cs{makefirstuc}. Support it +% even though they can now use the \catattr{firstuc} attribute. +% \begin{macrocode} + \letcs{\glo@name}{glo@\glsdetoklabel{#1}@name}% + \expandafter\glsnamefont\expandafter{\glo@name}% + }% + }% + }% + }% +% \end{macrocode} +% Do post-name hook: +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + } +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentryname} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\@ifpackageloaded{glossaries-accsupp} +{ + \renewcommand*{\Glossentryname}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsnameaccessdisplay + {% + \glsnamefont{\Glsentryname{#1}}% + }% + {#1}% +% \end{macrocode} +% Do post-name hook: +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% + } +} +{ + \renewcommand*{\Glossentryname}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsnamefont{\Glsentryname{#1}}% +% \end{macrocode} +% Do post-name hook: +% \begin{macrocode} + \glsxtrpostnamehook{#1}% + }% + } +} +% \end{macrocode} +%\end{macro} +% +% Provide a convenient way to also index the entries using the +% standard \ics{index} mechanism. This may use different actual, +% encap and escape characters to those used for the glossaries. +% +%\begin{macro}{\glsxtrpostnamehook} +%\changes{0.5.3}{2015-12-09}{new} +% Hook to append stuff after the name is displayed in the glossary. +% The argument is the entry's label. +% \begin{macrocode} +\newcommand*{\glsxtrpostnamehook}[1]{% + \def\@glsnumberformat{glsnumberformat}% + \glsxtrdoautoindexname{#1}{indexname}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\if@glsxtr@format@override} +%\changes{0.5.3}{2015-12-09}{new} +% Determines if the \gloskey[glslink]{format} key should override +% the indexing attribute value. +% \begin{macrocode} +\newif\if@glsxtr@format@override +\@glsxtr@format@overridefalse +% \end{macrocode} +%\end{macro} +% +%If overriding is enabled, the \ics{glshypernumber} command will have to +%be redefined in the index to use \cs{hyperpage} instead. +%\begin{macro}{\GlsXtrEnableIndexFormatOverride} +% \begin{macrocode} +\@ifpackageloaded{hyperref} +{ +% \end{macrocode} +% If \sty{hyperref}'s \pkgoptfmt{hyperindex} option is on, then +% \sty{hyperref} will automatically add \cs{hyperpage}, so don't +% add it. +% \begin{macrocode} + \ifHy@hyperindex + \newcommand*{\GlsXtrEnableIndexFormatOverride}{% + \@glsxtr@format@overridetrue + \appto\theindex{\let\glshypernumber\@firstofone}% + } + \else + \newcommand*{\GlsXtrEnableIndexFormatOverride}{% + \@glsxtr@format@overridetrue + \appto\theindex{\let\glshypernumber\hyperpage}% + } + \fi +} +{ + \newcommand*{\GlsXtrEnableIndexFormatOverride}{% + \@glsxtr@format@overridetrue + } +} +\@onlypreamble\GlsXtrEnableIndexFormatOverride +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdoautoindexname} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\newcommand*{\glsxtrdoautoindexname}[2]{% + \glshasattribute{#1}{#2}% + {% +% \end{macrocode} +% Escape any makeindex/xindy characters in the value of the \gloskey{name} +% field. Take care with \sty{babel} as this won't work if the +% category code has changed for those characters. +% \begin{macrocode} + \@glsxtr@autoindex@setname{#1}% +% \end{macrocode} +% If the attribute value is simply \qt{true} don't add an encap, +% otherwise use the value as the encap. +% \begin{macrocode} + \protected@edef\@glsxtr@attrval{\glsgetattribute{#1}{#2}}% + \if@glsxtr@format@override + \ifdefstring{\@glsnumberformat}{glsnumberformat}{}% + {\let\@glsxtr@attrval\@glsnumberformat}% + \fi + \ifdefstring{\@glsxtr@attrval}{true}% + {}% + {\eappto\@glo@name{\@glsxtr@autoindex@encap\@glsxtr@attrval}}% + \expandafter\index\expandafter{\@glo@name}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@setname} +%\changes{0.5.3}{2015-12-09}{new} +% Assign \cs{@glo@name} for use with \catattr{indexname} attribute. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@setname}[1]{% + \def\@glo@name{\string\glsentryname{#1}}% + \glsletentryfield{\@glo@sort}{#1}{sort}% + \@gls@checkmkidxchars\@glo@sort + \@glsxtr@autoindex@doextra@esc\@glo@sort + \epreto\@glo@name{\@glo@sort\@glsxtr@autoindex@at}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@doextra@esc} +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@doextra@esc}[1]{% +% \end{macrocode} +% Escape the escape character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@esc\@gls@quotechar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@escquote\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@esc\noexpand\@nnil + \@glsxtr@autoindex@esc\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +% \end{macrocode} +% Escape actual character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@at\@gls@actualchar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@escat\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@at\noexpand\@nnil + \@glsxtr@autoindex@at\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +% \end{macrocode} +% Escape level character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@level\@gls@levelchar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@esclevel\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@level\noexpand\@nnil + \@glsxtr@autoindex@level\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +% \end{macrocode} +% Escape encap character unless it has already been escaped. +% \begin{macrocode} + \ifx\@glsxtr@autoindex@encap\@gls@encapchar + \else + \def\@gls@checkedmkidx{}% + \edef\@@glsxtr@checkspch{% + \noexpand\@glsxtr@autoindex@escencap\expandonce{#1}% + \noexpand\@empty\@glsxtr@autoindex@encap\noexpand\@nnil + \@glsxtr@autoindex@encap\noexpand\@empty\noexpand\@glsxtr@endescspch}% + \@@glsxtr@checkspch + \let#1\@gls@checkedmkidx\relax + \fi +} +% \end{macrocode} +%\end{macro} +% +% The user commands here have a preamble-only restriction to ensure +% they are set before required and also to reduce the chances of +% complications caused by \sty{babel}'s shorthands. +% +%\begin{macro}{\@glsxtr@autoindex@at} +%\changes{0.5.3}{2015-12-09}{new} +% Actual character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@at}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetActualChar} +% Set the actual character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetActualChar}[1]{% + \gdef\@glsxtr@autoindex@at{#1}% + \def\@glsxtr@autoindex@escat##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escat}{##1}{##2}{##3}% + }% +} +\@onlypreamble\GlsXtrSetActualChar +\makeatother +\GlsXtrSetActualChar{@} +\makeatletter +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@encap} +%\changes{0.5.3}{2015-12-09}{new} +% Encap character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@encap}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetEncapChar} +% Set the encap character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetEncapChar}[1]{% + \gdef\@glsxtr@autoindex@encap{#1}% + \def\@glsxtr@autoindex@escencap##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escencap}{##1}{##2}{##3}% + }% +} +\GlsXtrSetEncapChar{|} +\@onlypreamble\GlsXtrSetEncapChar +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@level} +%\changes{0.5.3}{2015-12-09}{new} +% Level character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@level}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetLevelChar} +% Set the encap character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetLevelChar}[1]{% + \gdef\@glsxtr@autoindex@level{#1}% + \def\@glsxtr@autoindex@esclevel##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@esclevel}{##1}{##2}{##3}% + }% +} +\GlsXtrSetLevelChar{!} +\@onlypreamble\GlsXtrSetLevelChar +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@autoindex@esc} +%\changes{0.5.3}{2015-12-09}{new} +% Escape character for use with \cs{index}. +% \begin{macrocode} +\newcommand*{\@glsxtr@autoindex@esc}{"} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrSetEscChar} +% Set the escape character. +% \begin{macrocode} +\newcommand*{\GlsXtrSetEscChar}[1]{% + \gdef\@glsxtr@autoindex@esc{#1}% + \def\@glsxtr@autoindex@escquote##1#1##2#1##3\@glsxtr@endescspch{% + \@@glsxtr@autoindex@escspch{#1}{\@glsxtr@autoindex@escquote}{##1}{##2}{##3}% + }% +} +\GlsXtrSetEscChar{"} +\@onlypreamble\GlsXtrSetEscChar +% \end{macrocode} +%\end{macro} +% +% Set if defined. (For example, if \sty{doc} package has been +% loaded.) Actual character \ics{actualchar}: +% \begin{macrocode} +\ifdef\actualchar + {\expandafter\GlsXtrSetActualChar\expandafter{\actualchar}} + {} +% \end{macrocode} +% Quote character \ics{quotechar}: +% \begin{macrocode} +\ifdef\quotechar + {\expandafter\GlsXtrSetEscChar\expandafter{\quotechar}} + {} +% \end{macrocode} +% Level character \ics{levelchar}: +% \begin{macrocode} +\ifdef\levelchar + {\expandafter\GlsXtrSetLevelChar\expandafter{\levelchar}} + {} +% \end{macrocode} +% Encap character \ics{encapchar}: +% \begin{macrocode} +\ifdef\encapchar + {\expandafter\GlsXtrSetEncapChar\expandafter{\encapchar}} + {} +% \end{macrocode} +% +%\begin{macro}{\@glsxtr@gobbleto@endescspch} +% \begin{macrocode} +\def\@glsxtr@gobbleto@endescspch#1\@glsxtr@endescspch{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@@glsxtr@autoindex@esc@spch} +%\begin{definition} +%\cs{@@glsxtr@autoindex@escspch}\marg{char}\marg{cs}\marg{pre}\marg{mid}\marg{post} +%\end{definition} +% \begin{macrocode} +\newcommand*{\@@glsxtr@autoindex@escspch}[5]{% + \@gls@tmpb=\expandafter{\@gls@checkedmkidx}% + \toks@={#3}% + \ifx\@nnil#3\relax + \def\@@glsxtr@checkspch{\@glsxtr@gobbleto@endescspch#5\@glsxtr@endescspch}% + \else + \ifx\@nnil#4\relax + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@}% + \def\@@glsxtr@checkspch{\@glsxtr@gobbleto@endescspch + #4#5\@glsxtr@endescspch}% + \else + \edef\@gls@checkedmkidx{\the\@gls@tmpb\the\toks@ + \@glsxtr@autoindex@esc#1}% + \def\@@glsxtr@checkspch{#2#5#1\@nnil#1\@glsxtr@endescspch}% + \fi + \fi + \@@glsxtr@checkspch +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentrydesc} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\Glossentrydesc}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \Glsaccessdesc{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glossentrysymbol} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\glossentrysymbol}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \glsaccesssymbol{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glossentrysymbol} +% Redefine to set the abbreviation format and accessibility support. +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\renewcommand*{\Glossentrysymbol}[1]{% + \glsdoifexistsorwarn{#1}% + {% + \glssetabbrvfmt{\glscategory{#1}}% + \Glsaccesssymbol{#1}% + }% +} +% \end{macrocode} +%\end{macro} +% +%Allow initials to be marked but only use the formatting for the +%tag in the glossary. +%\begin{macro}{\GlsXtrEnableInitialTagging} +% Allow initial tagging. The first argument is a list of categories +% to apply this to. The second argument is the name of the command to +% use to tag the initials. This can't already be defined for safety +% unless the starred version is used. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\GlsXtrEnableInitialTagging}{% + \@ifstar\s@glsxtr@enabletagging\@glsxtr@enabletagging +} +\@onlypreamble\GlsXtrEnableInitialTagging +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@enabletagging} +% Starred version undefines command. +% \begin{macrocode} +\newcommand*{\s@glsxtr@enabletagging}[2]{% + \undef#2% + \@glsxtr@enabletagging{#1}{#2}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@enabletagging} +% Internal command. +% \begin{macrocode} +\newcommand*{\@glsxtr@enabletagging}[2]{% +% \end{macrocode} +% Set attributes for categories given in the first argument. +% \begin{macrocode} + \@for\@glsxtr@cat:=#1\do + {% + \ifdefempty\@glsxtr@cat + {}% + {\glssetcategoryattribute{\@glsxtr@cat}{tagging}{true}}% + }% + \newrobustcmd*#2[1]{##1}% + \def\@glsxtr@taggingcs{#2}% + \renewcommand*\@glsxtr@activate@initialtagging{% + \let#2\@glsxtr@tag + }% + \ifundef\@gls@preglossaryhook + {\GlossariesExtraWarning{Initial tagging requires at least + glossaries.sty v4.19 to work correctly}}% + {}% +} +% \end{macrocode} +%\end{macro} +% +%Are we using an old version of \sty{mfirstuc} that has a bug in +%\cs{capitalisewords}? If so, patch it so we don't have a problem +% with a combination of tagging and title case. +%\begin{macro}{\mfu@checkword@do} +%If this command hasn't been defined, then we have pre v2.02 of +%\sty{mfirstuc} +%\changes{0.5.2}{2015-12-08}{added} +% \begin{macrocode} +\ifundef\mfu@checkword@do +{ + \newcommand*{\mfu@checkword@do}[1]{% + \ifdefstring{\mfu@checkword@arg}{#1}% + {% + \let\@mfu@domakefirstuc\@firstofone + \listbreak + }% + {}% + } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\mfu@checkword} +% \cs{capitalisewords} was introduced in \sty{mfirstuc} v1.06. +% If \cs{mfu@checkword} hasn't been defined \sty{mfirstuc} is too +% old to support the title case attribute. +% \begin{macrocode} + \ifundef\mfu@checkword + { + \newcommand{\@glsxtr@do@titlecaps@warn}{% + \GlossariesExtraWarning{mfirstuc.sty too old. Title Caps + support not available}% +% \end{macrocode} +% One warning should suffice. +% \begin{macrocode} + \let\@glsxtr@do@titlecaps@warn\relax + } + } + { + \renewcommand*{\mfu@checkword}[1]{% + \def\mfu@checkword@arg{#1}% + \let\@mfu@domakefirstuc\makefirstuc + \forlistloop\mfu@checkword@do\@mfu@nocaplist + } + } +} +{}% no patch required +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@do@titlecaps@warn} +% Do warning if title case not supported. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\@glsxtr@do@titlecaps@warn}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@activate@initialtagging} +% Used in \cs{printglossary} but at least v4.19 of \sty{glossaries} +% required. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*\@glsxtr@activate@initialtagging{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@tag} +%\changes{0.5.2}{2015-12-08}{new} +% Definition of tagging command when used in glossary. +% \begin{macrocode} +\newrobustcmd*{\@glsxtr@tag}[1]{% + \glsifattribute{\glscurrententrylabel}{tagging}{true}% + {\glsxtrtagfont{#1}}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtagfont} +% Used in the glossary. +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\glsxtrtagfont}[1]{\underline{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@gls@preglossaryhook} +% This macro was introduced in \sty{glossaries} version 4.19, so it +% may not be defined. If it hasn't been defined this feature is +% unavailable. +% \begin{macrocode} +\ifdef\@gls@preglossaryhook +{ + \renewcommand*{\@gls@preglossaryhook}{% + \@glsxtr@activate@initialtagging + \let\@glsxtr@org@postdescription\glspostdescription + \renewcommand*{\glspostdescription}{% + \glsxtrpostdescription + \@glsxtr@org@postdescription + }% + }% +} +{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescription} +%This command will only be used if \cs{@gls@preglossaryhook} is +%available \emph{and} the glossary style uses +%\cs{glspostdescription} without modifying it. (The nopostdesc +%option will suppress this.) +% \begin{macrocode} +\newcommand*{\glsxtrpostdescription}{% + \csuse{glsxtrpostdesc\glscategory{\glscurrententrylabel}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescgeneral} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescgeneral}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescterm} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescterm}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescacronym} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescacronym}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostdescabbreviation} +% \begin{macrocode} +\newcommand*{\glsxtrpostdescabbreviation}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glspostlinkhook} +% Redefine the post link hook used by commands like \cs{gls} to +% make it easier for categories or attributes to modify this action. +% Since this hook occurs outside the existence check of commands like +% \cs{gls}, this needs to be checked again here. Do nothing if the +% entry hasn't been defined. +%\changes{0.5.4}{2015-12-15}{added existence check} +% \begin{macrocode} +\renewcommand*{\glspostlinkhook}{% + \ifglsentryexists{\glslabel}{\glsxtrpostlinkhook}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkhook} +% The entry label should already be stored in \cs{glslabel} by +% \cs{@gls@link}. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkhook}{% + \glsxtrdiscardperiod{\glslabel}% + {\glsxtrpostlinkendsentence}% + {\glsxtrpostlink}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlink} +% \begin{macrocode} +\newcommand*{\glsxtrpostlink}{% + \csuse{glsxtrpostlink\glscategory{\glslabel}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkendsentence} +%\changes{0.3}{2015-12-02}{new} +% Done by \cs{glsxtrpostlinkhook} if a full stop is discarded. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkendsentence}{% + \ifcsdef{glsxtrpostlink\glscategory{\glslabel}} + {% + \csuse{glsxtrpostlink\glscategory{\glslabel}}% +% \end{macrocode} +% Put the full stop back. +% \begin{macrocode} + .\spacefactor\sfcode`\. \relax + }% + {% +% \end{macrocode} +% Assume the full stop was discarded because the entry ends with a +% period, so adjust the spacefactor. +% \begin{macrocode} + \spacefactor\sfcode`\. \relax + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkAddDescOnFirstUse} +%\changes{0.3}{2015-12-02}{new} +% Provide a command for appending the description in parentheses on +% first use, for the convenience of users wanting to add this to the +% post link hook. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkAddDescOnFirstUse}{% + \glsxtrifwasfirstuse{\space(\glsaccessdesc{\glslabel})}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrpostlinkAddSymbolOnFirstUse} +%\changes{0.3}{2015-12-02}{new} +% Provide a command for appending the symbol (if defined) in parentheses on +% first use, for the convenience of users wanting to add this to the +% post link hook. +% \begin{macrocode} +\newcommand*{\glsxtrpostlinkAddSymbolOnFirstUse}{% + \glsxtrifwasfirstuse + {% + \ifglshassymbol{\glslabel}{\space(\glsaccesssymbol{\glslabel})}{}% + }% + {}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdiscardperiod} +% Discard following period (if present) if the +% \catattr{discardperiod} attribute is true. If a period is +% discarded, do the second argument otherwise do the third +% argument. The entry label is in the first argument. +% Since this is designed for abbreviations that end with a period, +% check if the plural form was used (which typically won't end with +% a period). +%\changes{0.3}{2015-12-02}{added check for plural} +% \begin{macrocode} +\newcommand*{\glsxtrdiscardperiod}[3]{% + \glsifattribute{#1}{discardperiod}{true}% + {% + \glsifplural + {% + \glsifattribute{#1}{pluraldiscardperiod}{true}% + {\glsxtrifperiod{#2}{#3}}% + {#3}% + }% + {% + \glsxtrifperiod{#2}{#3}% + }% + }% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifperiod} +% Make a convenient user command to check if the next character is a +% full stop (period). Works like \cs{@ifstar} but uses +% \cs{new@ifnextchar} rather than \cs{@ifnextchar} +% \begin{macrocode} +\newcommand*{\glsxtrifperiod}[1]{\new@ifnextchar.{\@firstoftwo{#1}}} +% \end{macrocode} +%\end{macro} +% +% Sometimes it's useful to test if there's a punctuation character +% following the glossary entry. +%\begin{macro}{\glsxtr@punclist} +% List of characters identified as punctuation marks. (Be careful of +% \sty{babel} shorthands!) This doesn't allow for punctuation marks +% made up from multiple characters (such as \verb|''|). +% \begin{macrocode} +\newcommand*{\glsxtr@punclist}{.,:;?!} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtraddpunctuationmark} +% Add character to punctuation list. +% \begin{macrocode} +\newcommand*{\glsxtraddpunctuationmark}[1]{\appto\glsxtr@punclist{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetpunctuationmarks} +% Reset the punctuation list. +% \begin{macrocode} +\newcommand*{\glsxtrsetpunctuationmarks}[1]{\def\glsxtr@punclist{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrifpunc} +%\begin{definition} +%\cs{glsxtrifnextpunc}\marg{true part}\marg{false part} +%\end{definition} +%Test if this is followed by a punctuation mark. (Adapted from +%\cs{new@ifnextchar}.) +% \begin{macrocode} +\newcommand*{\glsxtrifnextpunc}[2]{% + \def\reserved@a{#1}% + \def\reserved@b{#2}% + \futurelet\@glspunc@token\glsxtr@ifnextpunc +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@ifnextpunc} +% \begin{macrocode} +\newcommand*{\glsxtr@ifnextpunc}{% + \glsxtr@ifpunctoken{\@glspunc@token}{\let\reserved@b\reserved@a}{}% + \reserved@b +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@ifpunctoken} +% Test if the token given in the first argument is in the +% punctuation list. +% \begin{macrocode} +\newcommand*{\glsxtr@ifpunctoken}[1]{% + \expandafter\@glsxtr@ifpunctoken\expandafter#1\glsxtr@punclist\@nnil +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@ifpunctoken} +% \begin{macrocode} +\def\@glsxtr@ifpunctoken#1#2{% + \let\reserved@d=#2% + \ifx\reserved@d\@nnil + \let\glsxtr@next\@glsxtr@notfoundinlist + \else + \ifx#1\reserved@d + \let\glsxtr@next\@glsxtr@foundinlist + \else + \let\glsxtr@next\@glsxtr@ifpunctoken + \fi + \fi + \glsxtr@next#1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@foundinlist} +% \begin{macrocode} +\def\@glsxtr@foundinlist#1\@nnil{\@firstoftwo} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@notfoundinlist} +% \begin{macrocode} +\def\@glsxtr@notfoundinlist#1{\@secondoftwo} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrdopostpunc} +%\begin{definition} +%\cs{glsxtrdopostpunc}\marg{code} +%\end{definition} +% If this is followed be a punctuation character, do \meta{code} +% after the character otherwise do \meta{code} before whatever comes +% next. +% \begin{macrocode} +\newcommand{\glsxtrdopostpunc}[1]{% + \glsxtrifnextpunc{\@glsxtr@swaptwo{#1}}{#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@swaptwo} +% \begin{macrocode} +\newcommand{\@glsxtr@swaptwo}[2]{#2#1} +% \end{macrocode} +%\end{macro} +% +%\section{Abbreviations} +% +%The \qt{acronym} code from \sty{glossaries} is misnamed as it's more +%often used for other forms of abbreviations. This code corrects +%this inconsistency, but rather than just having synonyms, provide +% commands for abbreviations that have a similar, but not identical, +% underlying mechanism to acronyms. +% +% If there's a style for the given category, apply it. +% \begin{macrocode} +\define@key{glsxtrabbrv}{category}{% + \edef\glscategorylabel{#1}% + \ifcsdef{@glsabbrv@current@#1}% + {% + \glsxtr@applyabbrvstyle{\csname @glsabbrv@current@#1\endcsname}% + }% + {}% +} +% \end{macrocode} +% Save the short plural form. This may be needed before the entry is +% defined. +% \begin{macrocode} +\define@key{glsxtrabbrv}{shortplural}{% + \def\@gls@shortpl{#1}% +} +% \end{macrocode} +% Similarly for the long plural form. +% \begin{macrocode} +\define@key{glsxtrabbrv}{longplural}{% + \def\@gls@longpl{#1}% +} +% \end{macrocode} +% +% Token registers for the short plural and long plural, provided for +% use in the abbreviation style definitions. +%\begin{macro}{\glsshortpltok} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newtoks\glsshortpltok +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glslongpltok} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newtoks\glslongpltok +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@insertdots} +%\changes{0.3}{2015-12-02}{new} +% Provided in case user wants to automatically insert dots between +% each letter of the abbreviation. This should be applied before +% defining the abbreviation to optimise the document build. +% (Otherwise, it would have to be done each time the short form is +% required, which is an unnecessary waste of time.) For this to work +% the short form must be expanded when passed to +% \cs{newabbreviation}. Note that explicitly using the +% \gloskey{short} or \gloskey{shortplural} keys will override this. +% \begin{macrocode} +\newcommand*{\@glsxtr@insertdots}[2]{% + \def#1{}% + \@glsxtr@insert@dots#1#2\@nnil +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@glsxtr@insert@dots} +% \begin{macrocode} +\newcommand*{\@glsxtr@insert@dots}[2]{% + \ifx\@nnil#2\relax + \let\@glsxtr@insert@dots@next\@gobble + \else + \ifx\relax#2\relax + \else + \appto#1{#2.}% + \fi + \let\@glsxtr@insert@dots@next\@glsxtr@insert@dots + \fi + \@glsxtr@insert@dots@next#1% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newabbreviation} +% Define a new generic abbreviation. +% \begin{macrocode} +\newcommand*{\newabbreviation}[4][]{% + \glskeylisttok{#1}% + \glslabeltok{#2}% + \glsshorttok{#3}% + \glslongtok{#4}% +% \end{macrocode} +% Get the category. +%\changes{0.3}{2015-12-02}{fixed family name in \cs{setkeys}} +% \begin{macrocode} + \def\glscategorylabel{abbreviation}% + \glsxtr@applyabbrvstyle{\@glsabbrv@current@abbreviation}% + \setkeys*{glsxtrabbrv}[shortplural,longplural]{#1}% +% \end{macrocode} +% Set the default long plural +% \begin{macrocode} + \def\@gls@longpl{#4\glspluralsuffix}% +% \end{macrocode} +% Has the \catattr{insertdots} attribute been set? +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{insertdots}{true}% + {% + \@glsxtr@insertdots\@gls@short{#3}% + \expandafter\glsshorttok\expandafter{\@gls@short\spacefactor1000 \relax}% + \glsifcategoryattribute{\glscategorylabel}{aposplural}{true}% + {% + \expandafter\def\expandafter\@gls@shortpl\expandafter{\@gls@short + '\abbrvpluralsuffix}% + }% + {% + \glsifcategoryattribute{\glscategorylabel}{noshortplural}{true}% + {% + \let\@gls@shortpl\@gls@short + }% + {% + \expandafter\def\expandafter\@gls@shortpl\expandafter{\@gls@short + \abbrvpluralsuffix}% + }% + }% + }% + {% +% \end{macrocode} +% \catattr{insertdots} not true. +% \begin{macrocode} + \glsifcategoryattribute{\glscategorylabel}{aposplural}{true}% + {% + \def\@gls@shortpl{#3'\abbrvpluralsuffix}% + }% + {% + \glsifcategoryattribute{\glscategorylabel}{noshortplural}{true}% + {% + \def\@gls@shortpl{#3}% + }% + {% + \def\@gls@shortpl{#3\abbrvpluralsuffix}% + }% + }% + }% +% \end{macrocode} +% Hook for further customisation if required: +% \begin{macrocode} + \glsxtrnewabbrevpresetkeyhook{#1}{#2}{#3}% +% \end{macrocode} +% Get the short and long plurals provided by user in optional +% argument to override defaults, if necessary. +% \begin{macrocode} + \setkeys*{glsxtrabbrv}[category]{#1}% +% \end{macrocode} +% Set the plural token registers so the values can be accessed by +% the abbreviation styles. +% \begin{macrocode} + \expandafter\glsshortpltok\expandafter{\@gls@shortpl}% + \expandafter\glslongpltok\expandafter{\@gls@longpl}% +% \end{macrocode} +% Do any extra setup provided by hook: +% \begin{macrocode} + \newabbreviationhook +% \end{macrocode} +% Define this entry: +% \begin{macrocode} + \protected@edef\@do@newglossaryentry{% + \noexpand\newglossaryentry{\the\glslabeltok}% + {% + type=\glsxtrabbrvtype,% + category=abbreviation,% + short={\the\glsshorttok},% + shortplural={\the\glsshortpltok},% + long={\the\glslongtok},% + longplural={\the\glslongpltok},% + name={\the\glsshorttok},% + \CustomAbbreviationFields,% + \the\glskeylisttok + }% + }% + \@do@newglossaryentry + \GlsXtrPostNewAbbreviation +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrnewabbrevpresetkeyhook} +% Hook for extra stuff in \cs{newabbreviation} +%\changes{0.5.2}{2015-12-08}{new} +% \begin{macrocode} +\newcommand*{\glsxtrnewabbrevpresetkeyhook}[3]{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrPostNewAbbreviation} +% Hook used by abbreviation styles. +% \begin{macrocode} +\newcommand*{\GlsXtrPostNewAbbreviation}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newabbreviationhook} +% Hook for use with \cs{newabbreviation}. +% \begin{macrocode} +\newcommand*{\newabbreviationhook}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\CustomAbbreviationFields} +% \begin{macrocode} +\newcommand*{\CustomAbbreviationFields}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullformat} +% Full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{#1}}#2\glsxtrfullsep{#1}% + (\protect\glsfirstabbrvfont{\glsaccessshort{#1}})% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfullformat} +% Full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongfont{\Glsaccesslong{#1}}#2\glsxtrfullsep{#1}% + (\protect\glsfirstabbrvfont{\glsaccessshort{#1}})% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullplformat} +% Plural full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{#1}}#2\glsxtrfullsep{#1}% + (\protect\glsfirstabbrvfont{\glsaccessshortpl{#1}})% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfullplformat} +% Plural full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongfont{\Glsaccesslongpl{#1}}#2\glsxtrfullsep{#1}% + (\protect\glsfirstabbrvfont{\glsaccessshortpl{#1}})% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullsep} +% Separator used by full format is a space by default. The argument +% is the entry's label. +% \begin{macrocode} +\newcommand*{\glsxtrfullsep}[1]{\space} +% \end{macrocode} +%\end{macro} +% +% In-line formats in case first use isn't compatible with +% \cs{glsentryfull} (for example, first use suppresses the long form +% or uses a footnote). +%\begin{macro}{\glsxtrinlinefullformat} +% Full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrinlinefullformat} +% Full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullplformat} +% Plural full format without case change. +% \begin{macrocode} +\newcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrinlinefullplformat} +% Plural full format with case change. +% \begin{macrocode} +\newcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat} +% \end{macrocode} +%\end{macro} +% +% Redefine \cs{glsentryfull} etc to use the inline format. +% Since these commands as supposed to be expandable, they can only +% use the currently applied style. If there are mixed styles, you'll +% need to use the \cs{glsxtrfull} set of commands instead. +%\begin{macro}{\glsentryfull} +% \begin{macrocode} +\renewcommand*{\glsentryfull}[1]{\glsxtrinlinefullformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsentryfull} +% \begin{macrocode} +\renewcommand*{\Glsentryfull}[1]{\Glsxtrinlinefullformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsentryfullpl} +% \begin{macrocode} +\renewcommand*{\glsentryfullpl}[1]{\glsxtrinlinefullplformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsentryfullpl} +% \begin{macrocode} +\renewcommand*{\Glsentryfullpl}[1]{\Glsxtrinlinefullplformat{#1}{}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstabbrvfont} +% Font changing command used for the abbreviation on first use or in +% the full format. +% \begin{macrocode} +\newcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstabbrvdefaultfont} +% Font changing command used for the abbreviation on first use or in +% the full format. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsfirstabbrvdefaultfont}[1]{\glsabbrvfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsabbrvfont} +% Font changing command used for the abbreviation on subsequent use. +% \begin{macrocode} +\newcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsabbrvdefaultfont} +%\changes{0.3}{2015-12-02}{renamed from \cs{abbrvdefaultfont}} +% \begin{macrocode} +\newcommand*{\glsabbrvdefaultfont}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstlongfont} +% Font changing command used for the long form on first use or in +% the full format. +% \begin{macrocode} +\newcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{#1}} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfirstlongdefaultfont} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsfirstlongdefaultfont}[1]{#1} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\abbrvpluralsuffix} +% Default plural suffix. +% \begin{macrocode} +\newcommand*{\abbrvpluralsuffix}{\glspluralsuffix} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfull} +% Full form (no case-change). +% \begin{macrocode} +\newrobustcmd*{\glsxtrfull}{\@gls@hyp@opt\ns@glsxtrfull} +\newcommand*\ns@glsxtrfull[2][]{% + \new@ifnextchar[{\@glsxtr@full{#1}{#2}}% + {\@glsxtr@full{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@full} +% Low-level macro: +% \begin{macrocode} +\def\@glsxtr@full#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{\glsxtrinlinefullformat{#2}{#3}}% +% \end{macrocode} +% What should \cs{glsxtrifwasfirstuse} be set to here? Where the inline +% and display full forms are the same, this is essentially emulating +% first use, to it make sense for the postlink hook to pretend it +% was a first use instance. It makes less sense if the inline and +% display forms are different. Provide a hook to make it easier to +% reconfigure. +% \begin{macrocode} + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrsetupfulldefs} +% \begin{macrocode} +\newcommand*{\glsxtrsetupfulldefs}{% + \let\glsxtrifwasfirstuse\@firstoftwo +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfull} +% Full form (first letter uppercase). +% \begin{macrocode} +\newrobustcmd*{\Glsxtrfull}{\@gls@hyp@opt\ns@Glsxtrfull} +\newcommand*\ns@Glsxtrfull[2][]{% + \new@ifnextchar[{\@Glsxtr@full{#1}{#2}}% + {\@Glsxtr@full{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@Glsxtr@full} +% Low-level macro: +% \begin{macrocode} +\def\@Glsxtr@full#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{\Glsxtrinlinefullformat{#2}{#3}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrfull} +% Full form (all uppercase). +% \begin{macrocode} +\newrobustcmd*{\GLSxtrfull}{\@gls@hyp@opt\ns@GLSxtrfull} +\newcommand*\ns@GLSxtrfull[2][]{% + \new@ifnextchar[{\@GLSxtr@full{#1}{#2}}% + {\@GLSxtr@full{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@GLSxtr@full} +% Low-level macro: +% \begin{macrocode} +\def\@GLSxtr@full#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{\mfirstucMakeUppercase{\glsxtrinlinefullformat{#2}{#3}}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrfullpl} +% Plural full form (no case-change). +% \begin{macrocode} +\newrobustcmd*{\glsxtrfullpl}{\@gls@hyp@opt\ns@glsxtrfullpl} +\newcommand*\ns@glsxtrfullpl[2][]{% + \new@ifnextchar[{\@glsxtr@fullpl{#1}{#2}}% + {\@glsxtr@fullpl{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@glsxtr@fullpl} +% Low-level macro: +% \begin{macrocode} +\def\@glsxtr@fullpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{\glsxtrinlinefullplformat{#2}{#3}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrfullpl} +% Plural full form (first letter uppercase). +% \begin{macrocode} +\newrobustcmd*{\Glsxtrfullpl}{\@gls@hyp@opt\ns@Glsxtrfullpl} +\newcommand*\ns@Glsxtrfullpl[2][]{% + \new@ifnextchar[{\@Glsxtr@fullpl{#1}{#2}}% + {\@Glsxtr@fullpl{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@Glsxtr@fullpl} +% Low-level macro: +% \begin{macrocode} +\def\@Glsxtr@fullpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{\Glsxtrinlinefullplformat{#2}{#3}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrfullpl} +% Plural full form (all upper case). +% \begin{macrocode} +\newrobustcmd*{\GLSxtrfullpl}{\@gls@hyp@opt\ns@GLSxtrfullpl} +\newcommand*\ns@GLSxtrfullpl[2][]{% + \new@ifnextchar[{\@GLSxtr@fullpl{#1}{#2}}% + {\@GLSxtr@fullpl{#1}{#2}[]}% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@GLSxtr@fullpl} +% Low-level macro: +% \begin{macrocode} +\def\@GLSxtr@fullpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\glsxtrinlinefullplformat{#2}{#3}}}% + \glsxtrsetupfulldefs + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% The short and long forms work in a similar way to acronyms. +%\begin{macro}{\glsxtrshort} +% \begin{macrocode} +\newrobustcmd*{\glsxtrshort}{\@gls@hyp@opt\ns@glsxtrshort} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrshort}[2][]{% + \new@ifnextchar[{\@glsxtrshort{#1}{#2}}{\@glsxtrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% +% \end{macrocode} +% Need to make sure \cs{glsabbrvfont} is set correctly. +% \begin{macrocode} + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\glsaccessshort{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrshort} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrshort}{\@gls@hyp@opt\ns@Glsxtrshort} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrshort}[2][]{% + \new@ifnextchar[{\@Glsxtrshort{#1}{#2}}{\@Glsxtrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\Glsaccessshort{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrshort} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrshort}{\@gls@hyp@opt\ns@GLSxtrshort} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrshort}[2][]{% + \new@ifnextchar[{\@GLSxtrshort{#1}{#2}}{\@GLSxtrshort{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrshort#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\glsabbrvfont{\glsaccessshort{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrlong} +% \begin{macrocode} +\newrobustcmd*{\glsxtrlong}{\@gls@hyp@opt\ns@glsxtrlong} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrlong}[2][]{% + \new@ifnextchar[{\@glsxtrlong{#1}{#2}}{\@glsxtrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{\glsaccesslong{#2}#3}% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrlong} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrlong}{\@gls@hyp@opt\ns@Glsxtrlong} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrlong}[2][]{% + \new@ifnextchar[{\@Glsxtrlong{#1}{#2}}{\@Glsxtrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{\Glsaccesslong{#2}#3}% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrlong} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrlong}{\@gls@hyp@opt\ns@GLSxtrlong} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrlong}[2][]{% + \new@ifnextchar[{\@GLSxtrlong{#1}{#2}}{\@GLSxtrlong{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrlong#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@secondoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{\mfirstucMakeUppercase{\glsaccesslong{#2}#3}}% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% Plural short forms: +%\begin{macro}{\glsxtrshortpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrshortpl}{\@gls@hyp@opt\ns@glsxtrshortpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrshortpl}[2][]{% + \new@ifnextchar[{\@glsxtrshortpl{#1}{#2}}{\@glsxtrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\glsaccessshortpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrshortpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrshortpl}{\@gls@hyp@opt\ns@Glsxtrshortpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrshortpl}[2][]{% + \new@ifnextchar[{\@Glsxtrshortpl{#1}{#2}}{\@Glsxtrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \glsabbrvfont{\Glsaccessshortpl{#2}}#3% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrshortpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrshortpl}{\@gls@hyp@opt\ns@GLSxtrshortpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrshortpl}[2][]{% + \new@ifnextchar[{\@GLSxtrshortpl{#1}{#2}}{\@GLSxtrshortpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrshortpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \glssetabbrvfmt{\glscategory{#2}}% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{% + \mfirstucMakeUppercase{\glsabbrvfont{\glsaccessshortpl{#2}}#3}% + }% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +% Plural long forms: +%\begin{macro}{\glsxtrlongpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\glsxtrlongpl}{\@gls@hyp@opt\ns@glsxtrlongpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@glsxtrlongpl}[2][]{% + \new@ifnextchar[{\@glsxtrlongpl{#1}{#2}}{\@glsxtrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@glsxtrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@firstofthree + \let\glsinsert\@empty + \def\glscustomtext{\glsaccesslongpl{#2}#3}% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrlongpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\Glsxtrlongpl}{\@gls@hyp@opt\ns@Glsxtrlongpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@Glsxtrlongpl}[2][]{% + \new@ifnextchar[{\@Glsxtrlongpl{#1}{#2}}{\@Glsxtrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@Glsxtrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@secondofthree + \let\glsinsert\@empty + \def\glscustomtext{\Glsaccesslongpl{#2}#3}% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GLSxtrlongpl} +%\changes{0.3}{2015-12-02}{new} +% \begin{macrocode} +\newrobustcmd*{\GLSxtrlongpl}{\@gls@hyp@opt\ns@GLSxtrlongpl} +% \end{macrocode} +% Define the un-starred form. Need to determine if there is +% a final optional argument +% \begin{macrocode} +\newcommand*{\ns@GLSxtrlongpl}[2][]{% + \new@ifnextchar[{\@GLSxtrlongpl{#1}{#2}}{\@GLSxtrlongpl{#1}{#2}[]}% +} +% \end{macrocode} +% Read in the final optional argument: +% \begin{macrocode} +\def\@GLSxtrlongpl#1#2[#3]{% + \glsdoifexists{#2}% + {% + \let\do@gls@link@checkfirsthyper\@gls@link@nocheckfirsthyper + \let\glsxtrifwasfirstuse\@secondoftwo + \let\glsifplural\@firstoftwo + \let\glscapscase\@thirdofthree + \let\glsinsert\@empty + \def\glscustomtext{\mfirstucMakeUppercase{\glsaccesslongpl{#2}#3}}% + \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% + }% + \glspostlinkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glssetabbrvfmt} +% Set the current format for the given category (or the +% \category{abbreviation} category if unset). +% \begin{macrocode} +\newcommand*{\glssetabbrvfmt}[1]{% + \ifcsdef{@glsabbrv@current@#1}% + {\glsxtr@applyabbrvfmt{\csname @glsabbrv@current@#1\endcsname}}% + {\glsxtr@applyabbrvfmt{\@glsabbrv@current@abbreviation}}% +} +% \end{macrocode} +%\end{macro} +% +%\changes{0.5.2}{2015-12-08}{removed \cs{glsxtrabbrvfmt}} +%\begin{macro}{\glsxtrgenabbrvfmt} +% Similar to \cs{glsgenacfmt}, but for abbreviations. +% \begin{macrocode} +\newcommand*{\glsxtrgenabbrvfmt}{% + \ifdefempty\glscustomtext + {% + \ifglsused\glslabel + {% +% \end{macrocode} +% Subsequent use: +% \begin{macrocode} + \glsifplural + {% +% \end{macrocode} +% Subsequent plural form: +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Subsequent plural form, don't adjust case: +% \begin{macrocode} + \glsabbrvfont{\glsaccessshortpl{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent plural form, make first letter upper case: +% \begin{macrocode} + \glsabbrvfont{\Glsaccessshortpl{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsabbrvfont{\glsaccessshortpl{\glslabel}}\glsinsert}% + }% + }% + {% +% \end{macrocode} +% Subsequent singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% Subsequent singular form, don't adjust case: +% \begin{macrocode} + \glsabbrvfont{\glsaccessshort{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, make first letter upper case: +% \begin{macrocode} + \glsabbrvfont{\Glsaccessshort{\glslabel}}\glsinsert + }% + {% +% \end{macrocode} +% Subsequent singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsabbrvfont{\glsaccessshort{\glslabel}}\glsinsert}% + }% + }% + }% + {% +% \end{macrocode} +% First use: +% \begin{macrocode} + \glsifplural + {% +% \end{macrocode} +% First use plural form: +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% First use plural form, don't adjust case: +% \begin{macrocode} + \glsxtrfullplformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, make first letter upper case: +% \begin{macrocode} + \Glsxtrfullplformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use plural form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsxtrfullplformat{\glslabel}{\glsinsert}}% + }% + }% + {% +% \end{macrocode} +% First use singular form +% \begin{macrocode} + \glscapscase + {% +% \end{macrocode} +% First use singular form, don't adjust case: +% \begin{macrocode} + \glsxtrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, make first letter upper case: +% \begin{macrocode} + \Glsxtrfullformat{\glslabel}{\glsinsert}% + }% + {% +% \end{macrocode} +% First use singular form, all caps: +% \begin{macrocode} + \mfirstucMakeUppercase + {\glsxtrfullformat{\glslabel}{\glsinsert}}% + }% + }% + }% + }% + {% +% \end{macrocode} +% User supplied text. +% \begin{macrocode} + \glscustomtext + }% +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Abbreviation Styles Setup} +% +%\begin{macro}{\setabbreviationstyle} +% \begin{macrocode} +\newcommand*{\setabbreviationstyle}[2][abbreviation]{% + \ifcsundef{@glsabbrv@dispstyle@setup@#2} + {% + \PackageError{glossaries-extra}{Undefined abbreviation style `#2'}{}% + }% + {% +% \end{macrocode} +% Have abbreviations already been defined for this category? +%\changes{0.5.2}{2015-12-08}{added check for post-definition style switch} +% \begin{macrocode} + \ifcsstring{@glsabbrv@current@#1}{#2}% + {% +% \end{macrocode} +% Style already set. +% \begin{macrocode} + }% + {% + \def\@glsxtr@dostylewarn{}% + \glsforeachincategory{#1}{\@gls@type}{\@gls@label}% + {% + \def\@glsxtr@dostylewarn{\GlossariesWarning{Abbreviation + style has been switched \MessageBreak + for category `#1', \MessageBreak + but there have already been entries \MessageBreak + defined for this category. Unwanted \MessageBreak + side-effects may result}}% + \@endfortrue + }% + \@glsxtr@dostylewarn +% \end{macrocode} +% Set up the style for the given category. +% \begin{macrocode} + \csdef{@glsabbrv@current@#1}{#2}% + \glsxtr@applyabbrvstyle{#2}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@applyabbrvstyle} +% Apply the abbreviation style without existence check. +% \begin{macrocode} +\newcommand*{\glsxtr@applyabbrvstyle}[1]{% + \csuse{@glsabbrv@dispstyle@setup@#1}% + \csuse{@glsabbrv@dispstyle@fmts@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtr@applyabbrvfmt} +% Only apply the style formats. +% \begin{macrocode} +\newcommand*{\glsxtr@applyabbrvfmt}[1]{% + \csuse{@glsabbrv@dispstyle@fmts@#1}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\newabbreviationstyle} +% This is different from \cs{newacronymstyle}. The first argument is +% the label, the second argument sets the information required when +% defining the new abbreviation and the third argument sets the +% commands used to display the full format. +% \begin{macrocode} +\newcommand*{\newabbreviationstyle}[3]{% + \ifcsdef{@glsabbrv@dispstyle@#1} + {% + \PackageError{glossaries-extra}{Abbreviation style `#1' already + defined}{}% + }% + {% + \csdef{@glsabbrv@dispstyle@setup@#1}{% +% \end{macrocode} +% Initialise hook to do nothing. The style may change this. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{}% + #2}% + \csdef{@glsabbrv@dispstyle@fmts@#1}{% +% \end{macrocode} +% Assume in-line form is the same as first use. The style may change +% this. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}{\glsxtrfullformat}% + \renewcommand*{\Glsxtrinlinefullformat}{\Glsxtrfullformat}% + \renewcommand*{\glsxtrinlinefullplformat}{\glsxtrfullplformat}% + \renewcommand*{\Glsxtrinlinefullplformat}{\Glsxtrfullplformat}% + #3}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrUseAbbrStyleSetup} +% \begin{macrocode} +\newcommand*{\GlsXtrUseAbbrStyleSetup}[1]{% + \ifcsundef{@glsabbrv@dispstyle@setup@#1}% + {% + \PackageError{glossaries-extra}% + {Unknown abbreviation style definitions `#1'}{}% + }% + {% + \csname @glsabbrv@dispstyle@setup@#1\endcsname + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\GlsXtrUseAbbrStyleFmts} +% \begin{macrocode} +\newcommand*{\GlsXtrUseAbbrStyleFmts}[1]{% + \ifcsundef{@glsabbrv@dispstyle@fmts@#1}% + {% + \PackageError{glossaries-extra}% + {Unknown abbreviation style formats `#1'}{}% + }% + {% + \csname @glsabbrv@dispstyle@fmts@#1\endcsname + }% +} +% \end{macrocode} +%\end{macro} +% +%\subsection{Predefined Styles (Default Font)} +% Define some common styles. These will set the \gloskey{first}, +% \gloskey{firstplural}, \gloskey{text} and \gloskey{plural} +% keys, even if the \catattr{regular} attribute isn't set to +% \qt{true}. If this attribute is set, commands like \cs{gls} will +% use them as per a regular entry, otherwise those keys will be +% ignored unless explicitly invoked by the user with commands like +% \cs{glsfirst}. In order for the first letter uppercase versions to +% work correctly, \cs{glsxtrfullformat} needs to be expanded when +% those keys are set. The final optional argument of \cs{glsfirst} +% will behave differently to the final optional argument of \cs{gls} +% with some styles. +%\begin{abbrvstyle}{long-short} +% \begin{macrocode} +\newabbreviationstyle{long-short}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsabbrvfont{\the\glsshorttok}}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstabbrvfont{\the\glsshorttok})},% + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstabbrvfont{\the\glsshortpltok})},% + plural={\protect\glsabbvfont{\the\glsshortpltok}},% + description={\the\glslongtok}}% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% + \renewcommand*{\glsabbrvfont}[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstabbrvfont{\glsaccessshort{##1}})% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstabbrvfont{\glsaccessshortpl{##1}})% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongfont{\Glsaccesslong{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstabbrvfont{\glsaccessshort{##1}})% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongfont{\Glsaccesslongpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstabbrvfont{\glsaccessshortpl{##1}})% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +% Set this as the default style for general abbreviations: +% \begin{macrocode} +\setabbreviationstyle{long-short} +% \end{macrocode} +% +%\begin{abbrvstyle}{long-short-desc} +% User supplies description. The long form is included in the name. +%\changes{0.3}{2015-12-02}{fixed name to use \cs{glslabeltok}} +% \begin{macrocode} +\newabbreviationstyle{long-short-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsxtrfullformat{\the\glslabeltok}{}}, + sort={\the\glsshorttok},% + first={\protect\glsfirstlongfont{\the\glslongtok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstabbrvfont{\the\glsshorttok})},% + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstabbrvfont{\the\glsshortpltok})},% + plural={\protect\glsabbvfont{\the\glsshortpltok}}}% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-short}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-long} +% Short form followed by long form in parenthesis on first use. +% \begin{macrocode} +\newabbreviationstyle{short-long}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsabbrvfont{\the\glsshorttok}}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstlongfont{\the\glslongtok})},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstlongfont{\the\glslongpltok})},% + plural={\protect\glsabbvfont{\the\glsshortpltok}}}% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% +% \end{macrocode} +% The first use full form and the inline full form are the same for +% this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-long-desc} +% User supplies description. The long form is included in the name. +%\changes{0.3}{2015-12-02}{fixed name to use \cs{glslabeltok}} +% \begin{macrocode} +\newabbreviationstyle{short-long-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsxtrfullformat{\the\glslabeltok}{}}, + sort={\the\glsshorttok},% + first={\protect\glsfirstabbrvfont{\the\glsshorttok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstlongfont{\the\glslongtok})},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}% + \protect\glsxtrfullsep{\the\glslabeltok}% + (\protect\glsfirstlongfont{\the\glslongpltok})},% + plural={\protect\glsabbvfont{\the\glsshortpltok}}}% +% \end{macrocode} +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% Unset the \catattr{regular} attribute if it has been set. +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% + \GlsXtrUseAbbrStyleFmts{short-long}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{footnote} +% Short form followed by long form in footnote on first use. +% Take care about using \cs{glsfirst} as this won't suppress the +% hyperlink. (Perhaps modify \cs{glsfirst} to reflect +% \catattr{nohyperfirst} attribute?) +% \begin{macrocode} +\newabbreviationstyle{footnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsabbrvfont{\the\glsshorttok}}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvfont{\the\glsshorttok}% + \protect\footnote{\protect\glsfirstlongfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}% + \protect\footnote{\protect\glsfirstlongfont{\the\glslongpltok}}},% + plural={\protect\glsabbvfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Switch off hyperlinks on first use to prevent nested hyperlinks, +% and unset the \catattr{regular} attribute if it has been set. +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{nohyperfirst}{true}% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% +% \end{macrocode} +% The full format displays the short form followed by the long form +% as a footnote. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2% + \protect\footnote{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2% + \protect\footnote{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}}##2% + \protect\footnote{\glsfirstlongfont{\glsaccesslong{##1}}}% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}}##2% + \protect\footnote{\glsfirstlongfont{\glsaccesslongpl{##1}}}% + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{postfootnote} +% Similar to the above but the footnote is placed afterwards, +% outside the link. This avoids nested links and can also move the +% footnote marker after any following punctuation mark. +% This deferment won't occur with \cs{glsfirst}. +% \begin{macrocode} +\newabbreviationstyle{postfootnote}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsabbrvfont{\the\glsshorttok}}, + sort={\the\glsshorttok}, + description={\the\glslongtok},% + first={\protect\glsfirstabbrvfont{\the\glsshorttok}% + \protect\footnote{\protect\glsfirstlongfont{\the\glslongtok}}},% + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}% + \protect\footnote{\protect\glsfirstlongfont{\the\glslongpltok}}},% + plural={\protect\glsabbvfont{\the\glsshortpltok}}}% +% \end{macrocode} +% Make this category insert a footnote after the link if this was +% the first use, and +% unset the \catattr{regular} attribute if it has been set. +%\changes{0.5.1}{2015-12-07}{switch off regular attribute if set} +% \begin{macrocode} + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \csdef{glsxtrpostlink\glscategorylabel}{% + \glsxtrifwasfirstuse{\glsxtrdopostpunc{\protect\footnote + {\glsfirstlongfont{\glsentrylong{\glslabel}}}}}{}% + }% + \glshasattribute{\the\glslabeltok}{regular}% + {% + \glssetattribute{\the\glslabeltok}{regular}{false}% + }% + {}% + }% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% +% \end{macrocode} +% The full format displays the short form. The long form is +% deferred. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}}##2% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}}##2% + }% +% \end{macrocode} +% The first use full form and the inline full form use the short +% (long) style. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +% +%\begin{abbrvstyle}{short} +% Provide a style that only displays the short form on first use, +% but the short and long form can be displayed with the \qt{full} +% commands that use the inline format. If the user supplies a +% description, the long form won't be displayed in the predefined +% glossary styles, but the post description hook can be employed to +% automatically insert it. +% \begin{macrocode} +\newabbreviationstyle{short}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsabbrvfont{\the\glsshorttok}}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}}, + text={\protect\glsabbrvfont{\the\glsshorttok}}, + plural={\protect\glsabbrvfont{\the\glsshortpltok}}, + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short form followed by the +% long form in parentheses. +%\changes{0.2}{2015-11-30}{switched inline full form to short (long)} +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\Glsaccesslong{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \protect\glsfirstabbrvfont{\glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\Glsaccesslongpl{##1}})% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% Set this as the default style for acronyms: +% \begin{macrocode} +\setabbreviationstyle[acronym]{short} +% \end{macrocode} +% +%\begin{abbrvstyle}{short-desc} +% The user must supply the description in this style. The long form +% is added to the name. The \abbrstyle{short} style (possibly with the +% post-description hooks set) might be a better option. +% \begin{macrocode} +\newabbreviationstyle{short-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsextrinlinefullformat{\the\glslabeltok}}, + sort={\the\glsshorttok}, + first={\protect\glsfirstabbrvfont{\the\glsshorttok}}, + firstplural={\protect\glsfirstabbrvfont{\the\glsshortpltok}}, + text={\protect\glsabbrvfont{\the\glsshorttok}}, + plural={\protect\glsabbrvfont{\the\glsshortpltok}}, + description={\the\glslongtok}}% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the short format followed by the +% long form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshort{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslong{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstabbrvfont{\Glsaccessshortpl{##1}}##2\glsxtrfullsep{##1}% + (\glsfirstlongfont{\glsaccesslongpl{##1}})% + }% +% \end{macrocode} +% The first use full form only displays the short form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstabbrvfont{\glsaccessshort{##1}}##2% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstabbrvfont{\glsaccessshortpl{##1}}##2% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-desc} +% Provide a style that only displays the long form, +% but the long and short form can be displayed with the \qt{full} +% commands that use the inline format. The predefined glossary styles +% won't show the short form. The user must supply a description for +% this style. +% \begin{macrocode} +\newabbreviationstyle{long-desc}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\protect\glsfirstlongfont{\the\glslongtok}}, + sort={\the\glslongtok}, + first={\protect\glsfirstlongfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}}, + text={\the\glslongtok}, + plural={\the\glslongpltok}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% +% \end{macrocode} +% In case the user wants to mix and match font styles, these are +% redefined here. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\glspluralsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstabbrvfont}[1]{\glsfirstabbrvdefaultfont{##1}}% + \renewcommand*{\glsfirstlongfont}[1]{\glsfirstlongdefaultfont{##1}}% +% \end{macrocode} +% The inline full form displays the long format followed by the +% short form in parentheses. +% \begin{macrocode} + \renewcommand*{\glsxtrinlinefullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}}##2\glsxtrfullsep{##1}% + (\protect\glsfirstabbrvfont{\glsaccessshort{##1}})% + }% + \renewcommand*{\glsxtrinlinefullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}}##2\glsxtrfullsep{##1}% + (\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullformat}[2]{% + \glsfirstlongfont{\Glsaccesslong{##1}}##2\glsxtrfullsep{##1}% + (\protect\glsfirstabbrvfont{\glsaccessshort{##1}})% + }% + \renewcommand*{\Glsxtrinlinefullplformat}[2]{% + \glsfirstlongfont{\Glsaccesslongpl{##1}}##2\glsxtrfullsep{##1}% + (\protect\glsfirstabbrvfont{\glsaccessshortpl{##1}})% + }% +% \end{macrocode} +% The first use full form only displays the long form, but it +% typically won't be used as the \catattr{regular} attribute is set by this style. +% \begin{macrocode} + \renewcommand*{\glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}}##2% + }% + \renewcommand*{\glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}}##2% + }% + \renewcommand*{\Glsxtrfullformat}[2]{% + \glsfirstlongfont{\glsaccesslong{##1}}##2% + }% + \renewcommand*{\Glsxtrfullplformat}[2]{% + \glsfirstlongfont{\glsaccesslongpl{##1}}##2% + }% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long} +% It doesn't really make a great deal of sense to have a long-only +% style that doesn't have a description, but the best course of +% action here is to use the short form as the name and the long +% form as the description. +% \begin{macrocode} +\newabbreviationstyle{long}% +{% + \renewcommand*{\CustomAbbreviationFields}{% + name={\protect\glsabbrvfont{\the\glsshorttok}}, + sort={\the\glsshorttok}, + first={\protect\glsfirstlongfont{\the\glslongtok}}, + firstplural={\protect\glsfirstlongfont{\the\glslongpltok}}, + text={\the\glslongtok}, + plural={\the\glslongpltok},% + description={\the\glslongtok}% + }% + \renewcommand*{\GlsXtrPostNewAbbreviation}{% + \glssetattribute{\the\glslabeltok}{regular}{true}}% +}% +{% + \GlsXtrUseAbbrStyleFmts{long-desc}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (Small Capitals)} +%These styles use: +%\begin{macro}{\glsxtrscfont} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrscfont}[1]{\textsc{#1}} +% \end{macrocode} +%\end{macro} +% and for the default short form suffix: +%\begin{macro}{\glsxtrscsuffix} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrscsuffix}{\glstextup{\glspluralsuffix}} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-short-sc} +% \begin{macrocode} +\newabbreviationstyle{long-short-sc}% +{% + \GlsXtrUseAbbrStyleSetup{long-short}% +}% +{% +% \end{macrocode} +% Mostly as long-short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +% +%\begin{abbrvstyle}{long-short-sc-desc} +% \begin{macrocode} +\newabbreviationstyle{long-short-sc-desc}% +{% + \GlsXtrUseAbbrStyleSetup{long-short-desc}% +}% +{% +% \end{macrocode} +% Mostly as long-short-desc style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short-desc}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +% +% Now the short (long) version +% \begin{macrocode} +\newabbreviationstyle{short-sc-long}% +{% + \GlsXtrUseAbbrStyleSetup{short-long}% +}% +{% +% \end{macrocode} +% Mostly as short-long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-long}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +% As before but user provides description +% \begin{macrocode} +\newabbreviationstyle{short-sc-long-desc}% +{% + \GlsXtrUseAbbrStyleSetup{short-long-desc}% +}% +{% +% \end{macrocode} +% Mostly as short-long-desc style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-long-desc}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sc} +% \begin{macrocode} +\newabbreviationstyle{short-sc}% +{% + \GlsXtrUseAbbrStyleSetup{short}% +}% +{% +% \end{macrocode} +% Mostly as short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sc-desc} +% \begin{macrocode} +\newabbreviationstyle{short-sc-desc}% +{% + \GlsXtrUseAbbrStyleSetup{short-desc}% +}% +{% +% \end{macrocode} +% Mostly as short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-desc}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-sc} +% The smallcaps font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-sc}% +{% + \GlsXtrUseAbbrStyleSetup{long}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-desc-sc} +% The smallcaps font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-desc-sc}% +{% + \GlsXtrUseAbbrStyleSetup{long-desc}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-desc}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{footnote-sc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{footnote-sc}% +{% + \GlsXtrUseAbbrStyleSetup{footnote}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{footnote}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{postfootnote-sc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{postfootnote-sc}% +{% + \GlsXtrUseAbbrStyleSetup{postfootnote}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{postfootnote}% +% \end{macrocode} +% Use smallcaps and adjust the plural suffix to revert to upright. +% \begin{macrocode} + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}% + \renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (Fake Small Capitals)} +% These styles require the \sty{relsize} package, which must be +% loaded by the user. These styles all use: +%\begin{macro}{\glsxtrsmfont} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrsmfont}[1]{\textsmaller{#1}} +% \end{macrocode} +%\end{macro} +% and for the default short form suffix: +%\begin{macro}{\glsxtrsmsuffix} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newcommand*{\glsxtrsmsuffix}{\glspluralsuffix} +% \end{macrocode} +%\end{macro} +% +%\begin{abbrvstyle}{long-short-sm} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-sm}% +{% + \GlsXtrUseAbbrStyleSetup{long-short}% +}% +{% +% \end{macrocode} +% Mostly as long-short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-short-sm-desc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-sm-desc}% +{% + \GlsXtrUseAbbrStyleSetup{long-short-desc}% +}% +{% +% \end{macrocode} +% Mostly as long-short-desc style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short-desc}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-long} +% Now the short (long) version +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-sm-long}% +{% + \GlsXtrUseAbbrStyleSetup{short-long}% +}% +{% +% \end{macrocode} +% Mostly as short-long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-long}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-long-desc} +% As before but user provides description +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-sm-long-desc}% +{% + \GlsXtrUseAbbrStyleSetup{short-long-desc}% +}% +{% +% \end{macrocode} +% Mostly as short-long-desc style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-long-desc}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-sm}% +{% + \GlsXtrUseAbbrStyleSetup{short}% +}% +{% +% \end{macrocode} +% Mostly as short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-sm-desc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-sm-desc}% +{% + \GlsXtrUseAbbrStyleSetup{short-desc}% +}% +{% +% \end{macrocode} +% Mostly as short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-desc}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-sm} +%\changes{0.5}{2015-12-07}{new} +% The smallcaps font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-sm}% +{% + \GlsXtrUseAbbrStyleSetup{long}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-desc-sm} +%\changes{0.5}{2015-12-07}{new} +% The smaller font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-desc-sm}% +{% + \GlsXtrUseAbbrStyleSetup{long-desc}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-desc}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{footnote-sm} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{footnote-sm}% +{% + \GlsXtrUseAbbrStyleSetup{footnote}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{footnote}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{postfootnote-sm} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{postfootnote-sm}% +{% + \GlsXtrUseAbbrStyleSetup{postfootnote}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{postfootnote}% + \renewcommand*\glsabbrvfont[1]{\glsxtrsmfont{##1}}% + \renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrsmsuffix}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\subsection{Predefined Styles (Emphasized)} +% These styles use \ics{emph} for the short form. +% +%\begin{abbrvstyle}{long-short-em} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-em}% +{% + \GlsXtrUseAbbrStyleSetup{long-short}% +}% +{% +% \end{macrocode} +% Mostly as long-short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-short-em-desc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{long-short-em-desc}% +{% + \GlsXtrUseAbbrStyleSetup{long-short-desc}% +}% +{% +% \end{macrocode} +% Mostly as long-short-desc style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-short-desc}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-long} +% Now the short (long) version +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em-long}% +{% + \GlsXtrUseAbbrStyleSetup{short-long}% +}% +{% +% \end{macrocode} +% Mostly as short-long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-long}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-long-desc} +% As before but user provides description +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em-long-desc}% +{% + \GlsXtrUseAbbrStyleSetup{short-long-desc}% +}% +{% +% \end{macrocode} +% Mostly as short-long-desc style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-long-desc}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em}% +{% + \GlsXtrUseAbbrStyleSetup{short}% +}% +{% +% \end{macrocode} +% Mostly as short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{short-em-desc} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{short-em-desc}% +{% + \GlsXtrUseAbbrStyleSetup{short-desc}% +}% +{% +% \end{macrocode} +% Mostly as short style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{short-desc}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-em} +%\changes{0.5}{2015-12-07}{new} +% The emphasized font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-em}% +{% + \GlsXtrUseAbbrStyleSetup{long}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{long-desc-em} +%\changes{0.5}{2015-12-07}{new} +% The emphasized font will only be used if +% the short form is explicitly invoked through commands like +% \cs{glsshort}. +% \begin{macrocode} +\newabbreviationstyle{long-desc-em}% +{% + \GlsXtrUseAbbrStyleSetup{long-desc}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{long-desc}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{footnote-em} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{footnote-em}% +{% + \GlsXtrUseAbbrStyleSetup{footnote}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{footnote}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\begin{abbrvstyle}{postfootnote-em} +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\newabbreviationstyle{postfootnote-em}% +{% + \GlsXtrUseAbbrStyleSetup{postfootnote}% +}% +{% +% \end{macrocode} +% Mostly as long style: +% \begin{macrocode} + \GlsXtrUseAbbrStyleFmts{postfootnote}% + \renewcommand*\glsabbrvfont[1]{\emph{##1}}% +} +% \end{macrocode} +%\end{abbrvstyle} +% +%\section{Using Entries in Headings} +% +% There are four main problems with using entries in sectioning +% commands: they can mess with the first use flag if they end up in +% the table of contents, they can add unwanted numbers to the +% entry's location list, the label is corrupted if used inside +% \ics{MakeUppercase} (which is used by the default headings style) +% and they need to be expandable for PDF bookmarks. The +% \sty{glossaries} package therefore recommends the use of the +% expandable commands, such as \cs{glsentryshort}, instead but this +% doesn't reflect the formatting since it doesn't include +% \cs{glsabbrvfont}. The commands below are an attempt to get around +% these problems. +% +% The PDF bookmark issue can easily be fixed with \sty{hyperref}'s +% \cs{texorpdfstring} which can simply use the expandable command +% in the PDF string case. The \TeX\ string case can now use +% \cs{glsxtrshort} with the \gloskey{noindex} key set, which +% prevents the unwanted additions to the location list, and the +% \gloskey{hyper} key set to false, which prevents the problem of +% nested links. This just leaves one thing left that needs to be +% dealt with, and that's what to do if the heading style +% uses \cs{MakeUppercase}. +% +% Note that \sty{glossaries} automatically loads \sty{textcase}, so +% the label can be protected from case change with \sty{textcase}'s +% \cs{NoCaseChange}. This means that we don't have a problem +% provided the page style uses \cs{MakeTextUppercase}, but the +% default heading page style uses \cs{MakeUppercase}. +% +% To get around this, save the original definition of \cs{markboth} +% and \cs{markright} and adjust it so that \cs{MakeUppercase} is +% temporarily redefined to \cs{MakeTextUppercase}. Some packages or +% classes redefine these commands, so we can't just assume they +% still have the original kernel definition. +% +%\begin{macro}{\markright} +% Save original definition: +% \begin{macrocode} +\let\@glsxtr@org@markright\markright +% \end{macrocode} +% Redefine (grouping not added in case it interferes with the +% original code): +% \begin{macrocode} +\renewcommand*{\markright}[1]{% + \glsxtrmarkhook + \@glsxtr@org@markright{#1}% + \glsxtrrestoremarkhook +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\markboth} +% Save original definition: +% \begin{macrocode} +\let\@glsxtr@org@markboth\markboth +% \end{macrocode} +% Redefine (grouping not added in case it interferes with the +% original code): +% \begin{macrocode} +\renewcommand*{\markboth}[2]{% + \glsxtrmarkhook + \@glsxtr@org@markboth{#1}{#2}% + \glsxtrrestoremarkhook +} +% \end{macrocode} +%\end{macro} +% +% If this causes a problem provide a simple way of switching back to +% the original definitions: +%\begin{macro}{\glsxtrRevertMarks} +% \begin{macrocode} +\newcommand*{\glsxtrRevertMarks}{% + \let\markright\@glsxtr@org@markright + \let\markboth\@glsxtr@org@markboth +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrmarkhook} +% Hook used in new definition of \cs{markboth} and \cs{markright} +% to make some changes to apply to the marks: +% \begin{macrocode} +\newcommand*{\glsxtrmarkhook}{% +% \end{macrocode} +% Save current definitions: +% \begin{macrocode} + \let\@glsxtr@org@MakeUppercase\MakeUppercase + \let\@glsxtr@org@glsxtrtitleshort\glsxtrtitleshort + \let\@glsxtr@org@glsxtrtitleshortpl\glsxtrtitleshortpl + \let\@glsxtr@org@Glsxtrtitleshort\Glsxtrtitleshort + \let\@glsxtr@org@Glsxtrtitleshortpl\Glsxtrtitleshortpl + \let\@glsxtr@org@glsxtrtitletext\glsxtrtitletext + \let\@glsxtr@org@Glsxtrtitletext\Glsxtrtitletext + \let\@glsxtr@org@glsxtrtitleplural\glsxtrtitleplural + \let\@glsxtr@org@Glsxtrtitleplural\Glsxtrtitleplural + \let\@glsxtr@org@glsxtrtitlefirst\glsxtrtitlefirst + \let\@glsxtr@org@Glsxtrtitlefirst\Glsxtrtitlefirst + \let\@glsxtr@org@glsxtrtitlefirstplural\glsxtrtitlefirstplural + \let\@glsxtr@org@Glsxtrtitlefirstplural\Glsxtrtitlefirstplural +% \end{macrocode} +% New definitions +% \begin{macrocode} + \let\MakeUppercase\MakeTextUppercase + \let\glsxtrtitleshort\glsxtrheadshort + \let\glsxtrtitleshortpl\glsxtrheadshortpl + \let\Glsxtrtitleshort\Glsxtrheadshort + \let\Glsxtrtitleshortpl\Glsxtrheadshortpl + \let\glsxtrtitletext\glsxtrheadtext + \let\Glsxtrtitletext\Glsxtrheadtext + \let\glsxtrtitleplural\glsxtrheadplural + \let\Glsxtrtitleplural\Glsxtrheadplural + \let\glsxtrtitlefirst\glsxtrheadfirst + \let\Glsxtrtitlefirst\Glsxtrheadfirst + \let\glsxtrtitlefirstplural\glsxtrheadfirstplural + \let\Glsxtrtitlefirstplural\Glsxtrheadfirstplural +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrrestoremarkhook} +% Hook used in new definition of \cs{markboth} and \cs{markright} +% to restore the modified definitions. (This is in case the original +% \cs{markboth} and \cs{markright} shouldn't be grouped for some +% reason. There already is some grouping within those original +% definitions, but some of the code lies outside that grouping, and +% possibly there's a reason for it.) +% \begin{macrocode} +\newcommand*{\glsxtrrestoremarkhook}{% + \let\MakeUppercase\@glsxtr@org@MakeUppercase + \let\glsxtrtitleshort\@glsxtr@org@glsxtrtitleshort + \let\glsxtrtitleshortpl\@glsxtr@org@glsxtrtitleshortpl + \let\Glsxtrtitleshort\@glsxtr@org@Glsxtrtitleshort + \let\Glsxtrtitleshortpl\@glsxtr@org@Glsxtrtitleshortpl + \let\glsxtrtitletext\@glsxtr@org@glsxtrtitletext + \let\Glsxtrtitletext\@glsxtr@org@Glsxtrtitletext + \let\glsxtrtitleplural\@glsxtr@org@glsxtrtitleplural + \let\Glsxtrtitleplural\@glsxtr@org@Glsxtrtitleplural + \let\glsxtrtitlefirst\@glsxtr@org@glsxtrtitlefirst + \let\Glsxtrtitlefirst\@glsxtr@org@Glsxtrtitlefirst + \let\glsxtrtitlefirstplural\@glsxtr@org@glsxtrtitlefirstplural + \let\Glsxtrtitlefirstplural\@glsxtr@org@Glsxtrtitlefirstplural +} +% \end{macrocode} +%\end{macro} +% +%\changes{0.5.1}{2015-12-07}{removed \cs{ifglsxtruseuchead}} +% Instead of using one document-wide conditional, use +% \catattr{headuc} attribute to determine whether or not to use the +% all upper case form. +% +%\begin{macro}{\glsxtrheadshort} +% Command used to display short form in the page header. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadshort}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshort[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrshort[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitleshort} +% Command to display short form of abbreviation in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitleshort}[1]{% + \glsxtrshort[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadshortpl} +% Command used to display plural short form in the page header. +% If you want the text converted to upper case, this needs to be +% redefined to use \cs{GLSxtrshortpl} instead. If you are using a +% smallcaps style, the default fonts don't provide italic smallcaps. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadshortpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshortpl[noindex,hyper=false]{#1}[]% + }% + {% + \glsxtrshortpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitleshortpl} +% Command to display plural short form of abbreviation in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitleshortpl}[1]{% + \glsxtrshort[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadshort} +% Command used to display short form in the page header with the +% first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadshort}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshort[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrshort[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitleshort} +% Command to display short form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitleshort}[1]{% + \Glsxtrshort[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadshortpl} +% Command used to display plural short form in the page header with the +% first letter converted to upper case. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadshortpl}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSxtrshortpl[noindex,hyper=false]{#1}[]% + }% + {% + \Glsxtrshortpl[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitleshortpl} +% Command to display plural short form of abbreviation in section title and +% table of contents with the first letter converted to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitleshortpl}[1]{% + \Glsxtrshortpl[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadtext} +% As above but for the \gloskey{text} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadtext}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLStext[noindex,hyper=false]{#1}[]% + }% + {% + \glstext[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitletext} +% Command to display \gloskey{text} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitletext}[1]{% + \glstext[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +% +%\begin{macro}{\Glsxtrheadtext} +% First letter converted to upper case +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadtext}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLStext[noindex,hyper=false]{#1}[]% + }% + {% + \Glstext[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitletext} +% Command to display \gloskey{text} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitletext}[1]{% + \Glstext[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadplural} +% As above but for the \gloskey{plural} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSplural[noindex,hyper=false]{#1}[]% + }% + {% + \glsplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitleplural} +% Command to display \gloskey{plural} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitleplural}[1]{% + \glsplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadplural} +% Convert first letter to upper case. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSplural[noindex,hyper=false]{#1}[]% + }% + {% + \Glsplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitleplural} +% Command to display \gloskey{plural} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitleplural}[1]{% + \Glsplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadfirst} +% As above but for the \gloskey{first} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadfirst}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirst[noindex,hyper=false]{#1}[]% + }% + {% + \glsfirst[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlefirst} +% Command to display \gloskey{first} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlefirst}[1]{% + \glsfirst[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadfirst} +% First letter converted to upper case +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadfirst}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirst[noindex,hyper=false]{#1}[]% + }% + {% + \Glsfirst[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlefirst} +% Command to display \gloskey{first} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlefirst}[1]{% + \Glsfirst[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrheadfirstplural} +% As above but for the \gloskey{firstplural} value. +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\glsxtrheadfirstplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirstplural[noindex,hyper=false]{#1}[]% + }% + {% + \glsfirstplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsxtrtitlefirstplural} +% Command to display \gloskey{firstplural} value in section title and +% table of contents. +% \begin{macrocode} +\newrobustcmd*{\glsxtrtitlefirstplural}[1]{% + \glsfirstplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrheadfirstplural} +% First letter converted to upper case +%\changes{0.5.1}{2015-12-07}{now uses headuc attribute} +% \begin{macrocode} +\newcommand*{\Glsxtrheadfirstplural}[1]{% + \protect\NoCaseChange + {% + \glsifattribute{#1}{headuc}{true}% + {% + \GLSfirstplural[noindex,hyper=false]{#1}[]% + }% + {% + \Glsfirstplural[noindex,hyper=false]{#1}[]% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsxtrtitlefirstplural} +% Command to display \gloskey{first} value in section title and +% table of contents with the first letter changed to upper case. +% \begin{macrocode} +\newrobustcmd*{\Glsxtrtitlefirstplural}[1]{% + \Glsfirstplural[noindex,hyper=false]{#1}[]% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtshort} +% Provide a way of using the formatted short form in section +% headings. If \sty{hyperref} has been loaded, use +% \cs{texorpdfstring} for convenience in PDF bookmarks. +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshort}} +%\changes{0.5}{2015-12-07}{changed to use \cs{glsxtrtitleshort}} +%\changes{0.5}{2015-12-07}{renamed from \cs{glsentryfmtshort}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtshort}[1]{% + \texorpdfstring + {\glsxtrtitleshort{#1}}% + {\glsentryshort{#1}}% + } +} +{ + \newcommand*{\glsfmtshort}[1]{% + \glsxtrtitleshort{#1}} +} +% \end{macrocode} +%\end{macro} +%Similarly for the plural version. +%\begin{macro}{\glsfmtshortpl} +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshortpl}} +%\changes{0.5}{2015-12-07}{changed to use \cs{glsxtrtitleshortpl}} +%\changes{0.5}{2015-12-07}{renamed from \cs{glsentryfmtshortpl}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtshortpl}[1]{% + \texorpdfstring + {\glsxtrtitleshortpl{#1}}% + {\glsentryshortpl{#1}}% + } +} +{ + \newcommand*{\glsfmtshortpl}[1]{% + \glsxtrtitleshortpl{#1}} +} +% \end{macrocode} +%\end{macro} +% The case-changing version isn't suitable for PDF bookmarks, so the +% PDF alternative uses the non-case-changing version. +%\begin{macro}{\Glsfmtshort} +% Singular form (first letter uppercase). +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{Glsxtrshort}} +%\changes{0.5}{2015-12-07}{changed to use \cs{Glsxtrtitleshort}} +%\changes{0.5}{2015-12-07}{renamed from \cs{Glsentryfmtshort}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtshort}[1]{% + \texorpdfstring + {\Glsxtrtitleshort{#1}}% + {\glsentryshort{#1}}% + } +} +{ + \newcommand*{\Glsfmtshort}[1]{% + \Glsxtrtitleshort{#1}} +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\Glsfmtshortpl} +%Plural form (first letter uppercase). +%\changes{0.2}{2015-11-30}{new} +%\changes{0.4}{2015-12-03}{changed to use \cs{glsxtrshortpl}} +%\changes{0.5}{2015-12-07}{changed to use \cs{Glsxtrtitleshortpl}} +%\changes{0.5}{2015-12-07}{renamed from \cs{Glsentryfmtshortpl}} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtshortpl}[1]{% + \texorpdfstring + {\Glsxtrtitleshortpl{#1}}% + {\glsentryshortpl{#1}}% + } +} +{ + \newcommand*{\Glsfmtshortpl}[1]{% + \Glsxtrtitleshortpl{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmttext} +%As above but for the \gloskey{text} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmttext}[1]{% + \texorpdfstring + {\glsxtrtitletext{#1}}% + {\glsentrytext{#1}}% + } +} +{ + \newcommand*{\glsfmttext}[1]{% + \glsxtrtitletext{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmttext} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmttext}[1]{% + \texorpdfstring + {\Glsxtrtitletext{#1}}% + {\glsentrytext{#1}}% + } +} +{ + \newcommand*{\Glsfmttext}[1]{% + \Glsxtrtitletext{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtplural} +%As above but for the \gloskey{plural} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtplural}[1]{% + \texorpdfstring + {\glsxtrtitleplural{#1}}% + {\glsentryplural{#1}}% + } +} +{ + \newcommand*{\glsfmtplural}[1]{% + \glsxtrtitleplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtplural} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtplural}[1]{% + \texorpdfstring + {\Glsxtrtitleplural{#1}}% + {\glsentryplural{#1}}% + } +} +{ + \newcommand*{\Glsfmtplural}[1]{% + \Glsxtrtitleplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtfirst} +%As above but for the \gloskey{first} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtfirst}[1]{% + \texorpdfstring + {\glsxtrtitlefirst{#1}}% + {\glsentryfirst{#1}}% + } +} +{ + \newcommand*{\glsfmtfirst}[1]{% + \glsxtrtitlefirst{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtfirst} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtfirst}[1]{% + \texorpdfstring + {\Glsxtrtitlefirst{#1}}% + {\glsentryfirst{#1}}% + } +} +{ + \newcommand*{\Glsfmtfirst}[1]{% + \Glsxtrtitlefirst{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfmtfirstpl} +%As above but for the \gloskey{firstplural} value. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\glsfmtfirstpl}[1]{% + \texorpdfstring + {\glsxtrtitlefirstplural{#1}}% + {\glsentryfirstplural{#1}}% + } +} +{ + \newcommand*{\glsfmtfirstpl}[1]{% + \glsxtrtitlefirstplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\Glsfmtfirstpl} +%First letter converted to upper case. +%\changes{0.5}{2015-12-07}{new} +% \begin{macrocode} +\ifdef\texorpdfstring +{ + \newcommand*{\Glsfmtfirstpl}[1]{% + \texorpdfstring + {\Glsxtrtitlefirstplural{#1}}% + {\glsentryfirstplural{#1}}% + } +} +{ + \newcommand*{\Glsfmtfirstpl}[1]{% + \Glsxtrtitlefirstplural{#1}} +} +% \end{macrocode} +%\end{macro} +% +%\section{Multi-Lingual Support} +% Add the facility to load language modules, if they are installed, +% but none are provided with this package. +% +%\begin{macro}{\RequireGlossariesExtraLang} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\newcommand*{\RequireGlossariesExtraLang}[1]{% + \@ifundefined{ver@glossariesxtr-#1.ldf}{\input{glossariesxtr-#1.ldf}}{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ProvidesGlossariesExtraLang} +%\changes{0.5.3}{2015-12-09}{new} +% \begin{macrocode} +\newcommand*{\ProvidesGlossariesExtraLang}[1]{% + \ProvidesFile{glossariesxtr-#1.ldf}% +} +% \end{macrocode} +%\end{macro} +% +% Load any required language modules that are available. This +% doesn't generate any warning if none are found, since they're not +% essential. (The only command that really needs defining for the +% document is \ics{abbreviationsname}, which can simply be redefined.) +% \begin{macrocode} +\@ifpackageloaded{tracklang} +{% + \AnyTrackedLanguages + {% + \ForEachTrackedDialect{\this@dialect}{% + \IfTrackedLanguageFileExists{\this@dialect}% + {glossariesxtr-}% prefix + {.ldf}% + {% + \RequireGlossariesExtraLang{\CurrentTrackedTag}% + }% + {% + }% + }% + }% + {}% +} +{} +% \end{macrocode} +%\iffalse +% \begin{macrocode} +% +% \end{macrocode} +%\fi +%\Finale +\endinput diff --git a/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins new file mode 100644 index 00000000000..989d375febe --- /dev/null +++ b/Master/texmf-dist/source/latex/glossaries-extra/glossaries-extra.ins @@ -0,0 +1,31 @@ +% glossaries-extra.ins generated using makedtx version 1.1 2016/1/24 16:56 +\input docstrip + +\preamble + + glossaries-extra.dtx + Copyright 2016 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 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-extra.dtx and glossaries-extra.ins and the derived file glossaries-extra.sty. + +\endpreamble + +\askforoverwritefalse + +\generate{\file{glossaries-extra.sty}{\usepreamble\defaultpreamble +\usepostamble\defaultpostamble\from{glossaries-extra.dtx}{glossaries-extra.sty,package}} +} + +\endbatchfile -- cgit v1.2.3