diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-08 22:32:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-08 22:32:47 +0000 |
commit | e1218e4d5ddcb68ac921c718bbe7a537af862583 (patch) | |
tree | b77730b9572c833245ca5b3a0f4389e16dd72fa3 /Master/texmf-dist/source/latex/glossaries/glossaries.dtx | |
parent | 4cc63125c198c95120c614619f6adca51ed8b7e3 (diff) |
glossaries (8jul15)
git-svn-id: svn://tug.org/texlive/trunk@37808 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/glossaries/glossaries.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/glossaries/glossaries.dtx | 1234 |
1 files changed, 1184 insertions, 50 deletions
diff --git a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx index ef5d791e9f3..f3f02b9cbcb 100644 --- a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx +++ b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx @@ -1,13 +1,11 @@ %\iffalse % glossaries.dtx generated using makedtx version 1.1 (c) Nicola Talbot % Command line args: -% -macrocode ".*\.perl" -% -macrocode ".*\.tex" -% -macrocode ".*\.xdy" -% -author "Nicola Talbot" +% -codetitle "Main Package Code" % -comment ".*\.perl" % -comment ".*\.tex" % -comment ".*\.xdy" +% -doc "glossaries-manual.tex" % -src "glossaries.sty\Z=>glossaries.sty" % -src "glossaries-prefix.sty\Z=>glossaries-prefix.sty" % -src "mfirstuc.sty\Z=>mfirstuc.sty" @@ -21,16 +19,19 @@ % -src "(glossary-lipsum-examples\.tex)\Z=>\1" % -src "(example-glossaries-.*\.tex)\Z=>\1" % -src "(sample.*\.tex)\Z=>\1" +% -src "(mwe.*\.tex)\Z=>\1" % -src "(samplexdy-mc.*\.xdy)\Z=>\1" % -src "(database.*\.tex)\Z=>\1" % -src "(.*\.perl)\Z=>\1" -% -codetitle "Main Package Code" +% -author "Nicola Talbot" % -setambles ".*\.perl=>\nopreamble\nopostamble" % -setambles ".*\.tex=>\nopreamble\nopostamble" % -setambles ".*\.xdy=>\nopreamble\nopostamble" -% -doc "glossaries-manual.tex" +% -macrocode ".*\.perl" +% -macrocode ".*\.tex" +% -macrocode ".*\.xdy" % glossaries -% Created on 2015/3/16 18:44 +% Created on 2015/7/8 13:23 %\fi %\iffalse %<*package> @@ -140,7 +141,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of \setcounter{IndexColumns}{2} -\CheckSum{18045} +\CheckSum{18302} \newcommand*{\ifirstuse}{\iterm{first use}} \newcommand*{\firstuse}{\gls{firstuse}} @@ -168,12 +169,12 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of %\MakeShortVerb{"} %\DeleteShortVerb{\|} % -% \title{Documented Code For glossaries v4.15} +% \title{Documented Code For glossaries v4.16} % \author{Nicola L.C. Talbot\\[10pt] %Dickimaw Books\\ %\url{http://www.dickimaw-books.com/}} % -% \date{2015-03-16} +% \date{2015-07-08} % \maketitle % %This is the documented code for the \styfmt{glossaries} package. @@ -189,7 +190,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of %glossaries package}. % %\item[\url{glossaries-user.pdf}] -%For the main user guide, read \qt{glossaries.sty v4.15: +%For the main user guide, read \qt{glossaries.sty v4.16: %\LaTeX2e\ Package to Assist Generating Glossaries}. % %\item[\url{mfirstuc-manual.pdf}] @@ -248,7 +249,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of % This package requires \LaTeXe. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries}[2015/03/16 v4.15 (NLCT)] +\ProvidesPackage{glossaries}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Required packages: % \begin{macrocode} @@ -1241,7 +1242,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % glossary files are the label and sort values. Therefore, now, the % only sanitize option that makes sense is the one for the sort key. % so the sanitize option is now deprecated and there is only a -% sanitizesort option. +% \pkgopt{sanitizesort} option. % %\begin{macro}{\@gls@sanitizedesc} % \begin{macrocode} @@ -4928,6 +4929,67 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsaddstoragekey} +%\begin{definition} +%\cs{glsaddstoragekey}\marg{key}\marg{default value}\marg{no link cs} +%\end{definition} +%\changes{4.16}{2015-06-18}{new} +% Similar to \cs{glsaddkey} but intended for keys whose values +% aren't explicitly used in the document, but might be required +% behind the scenes by other commands. +% \begin{macrocode} +\newcommand*{\glsaddstoragekey}{\@ifstar\@sglsaddstoragekey\@glsaddstoragekey} +% \end{macrocode} +% Starred version switches on expansion for this key. +% \begin{macrocode} +\newcommand*{\@sglsaddstoragekey}[1]{% + \key@ifundefined{glossentry}{#1}% + {% + \expandafter\newcommand\expandafter*\expandafter + {\csname gls@assign@#1@field\endcsname}[2]{% + \@@gls@expand@field{##1}{#1}{##2}% + }% + }% + {}% + \@glsaddstoragekey{#1}% +} +% \end{macrocode} +% Unstarred version doesn't override default expansion. +% \begin{macrocode} +\newcommand*{\@glsaddstoragekey}[3]{% +% \end{macrocode} +% Check the specified key doesn't already exist. +% \begin{macrocode} + \key@ifundefined{glossentry}{#1}% + {% +% \end{macrocode} +% Set up the key. +% \begin{macrocode} + \define@key{glossentry}{#1}{\csdef{@glo@#1}{##1}}% + \appto\@gls@keymap{,{#1}{#1}}% +% \end{macrocode} +% Set the default value. +% \begin{macrocode} + \appto\@newglossaryentryprehook{\csdef{@glo@#1}{#2}}% +% \end{macrocode} +% Assignment code. +% \begin{macrocode} + \appto\@newglossaryentryposthook{% + \letcs{\@glo@tmp}{@glo@#1}% + \gls@assign@field{#2}{\@glo@label}{#1}{\@glo@tmp}% + }% +% \end{macrocode} +% Define the no-link commands. +% \begin{macrocode} + \newcommand*{#3}[1]{\@gls@entry@field{##1}{#1}}% + }% + {% + \PackageError{glossaries}{Key `#1' already exists}{}% + }% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsaddkey} %\begin{definition} %\cs{glsaddkey}\marg{key}\marg{default value}\marg{no link cs}\marg{no link ucfirst @@ -5070,6 +5132,190 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \end{macrocode} %\end{macro} % +%\begin{macro}{\glsfieldxdef} +%\begin{definition} +%\cs{glsfieldxdef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand{\glsfieldxdef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\xdef\csname glo@\@glo@label @#2\endcsname{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfieldedef} +%\begin{definition} +%\cs{glsfieldedef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand{\glsfieldedef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\edef\csname glo@\@glo@label @#2\endcsname{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfieldgdef} +%\begin{definition} +%\cs{glsfieldgdef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand{\glsfieldgdef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\gdef\csname glo@\@glo@label @#2\endcsname{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfielddef} +%\begin{definition} +%\cs{glsfielddef}\marg{label}\marg{field}\marg{definition} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand{\glsfielddef}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\def\csname glo@\@glo@label @#2\endcsname{#3}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsfieldfetch} +%\begin{definition} +%\cs{glsfieldfetch}\marg{label}\marg{field}\marg{cs} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% Fetches the value of the given field and stores in the given +% control sequence. +% \begin{macrocode} +\newcommand{\glsfieldfetch}[3]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \letcs#3{glo@\@glo@label @#2}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsfieldeq} +%\begin{definition} +%\cs{ifglsfieldeq}\marg{label}\marg{field}\marg{string}\marg{true}\marg{false} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% Tests if the value of the given field is equal to the given +% string. +% \begin{macrocode} +\newcommand{\ifglsfieldeq}[5]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \ifcsstring{glo@\@glo@label @#2}{#3}{#4}{#5}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsfielddefeq} +%\begin{definition} +%\cs{ifglsfielddefeq}\marg{label}\marg{field}\marg{command}\marg{true}\marg{false} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +% Tests if the value of the given field is equal to the replacement +% text of the given command. +% \begin{macrocode} +\newcommand{\ifglsfielddefeq}[5]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \expandafter\ifdefstrequal + \csname glo@\@glo@label @#2\endcsname{#3}{#4}{#5}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\ifglsfieldcseq} +%\begin{definition} +%\cs{ifglsfieldcseq}\marg{label}\marg{field}\marg{cs name}\marg{true}\marg{false} +%\end{definition} +%\changes{4.16}{2015-07-08}{new} +%As above but uses \cs{ifcsstrequal} instead of \cs{ifdefstrequal} +% \begin{macrocode} +\newcommand{\ifglsfieldcseq}[5]{% + \glsdoifexists{#1}% + {% + \edef\@glo@label{\glsdetoklabel{#1}}% + \ifcsdef{glo@\@glo@label @#2}% + {% + \ifcsstrequal{glo@\@glo@label @#2}{#3}{#4}{#5}% + }% + {% + \PackageError{glossaries}{Key `#2' doesn't exist}{}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glswritedefhook} %\changes{3.10a}{2013-10-13}{new} % \begin{macrocode} @@ -7147,10 +7393,22 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \glstextformat{#3}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} % +%\begin{macro}{\glspostlinkhook} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand*{\glspostlinkhook}{} +% \end{macrocode} +%\end{macro} +% +% %\begin{macro}{\@gls@link@checkfirsthyper} % Check for first use and switch off \gloskey[glslink]{hyper} key % if hyperlink not wanted. (Should be off if first use and @@ -7185,13 +7443,28 @@ false,nolabel,autolabel,nameref}[nolabel]{% %\end{macro} % %\begin{macro}{\glslinkcheckfirsthyperhook} -% Allow used to hook into the \cs{\@gls@link@checkfirsthyper} macro +% Allow used to hook into the \cs{@gls@link@checkfirsthyper} macro %\changes{4.08}{2014-07-30}{new} % \begin{macrocode} \newcommand*{\glslinkcheckfirsthyperhook}{} % \end{macrocode} %\end{macro} % +%\begin{macro}{\glslinkpostsetkeys} +%\changes{4.16}{2015-07-08}{new} +% \begin{macrocode} +\newcommand*{\glslinkpostsetkeys}{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glsifhyperon} +%\changes{4.16}{2015-07-08}{moved definition of \cs{glsifhyperon}} +% Check the value of the \gloskey[glslink]{hyper} key: +% \begin{macrocode} +\newcommand{\glsifhyperon}[2]{\ifKV@glslink@hyper#1\else#2\fi} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@gls@link} %\changes{1.07}{2007 Sep 13}{fixed bug caused by \cs{theglsentrycounter} setting the page number too soon} %\changes{1.15}{2008 August 15}{added \cs{glslabel}} @@ -7251,14 +7524,13 @@ false,nolabel,autolabel,nameref}[nolabel]{% \do@gls@link@checkfirsthyper \setkeys{glslink}{#1}% % \end{macrocode} -% Define \cs{glsifhyperon} +% Add a hook for the user to customise things after the keys have +% been set. % \begin{macrocode} - \ifKV@glslink@hyper - \let\glsifhyperon\@firstoftwo - \else - \let\glsifhyperon\@secondoftwo - \fi + \glslinkpostsetkeys % \end{macrocode} +%\changes{4.16}{2015-07-08}{moved definition of \cs{glsifhyperon} +%outside of this macro} % Store the entry's counter in \cs{theglsentrycounter} %\changes{3.0}{2011/04/02}{added \cs{@gls@saveentrycounter}} % \begin{macrocode} @@ -7992,6 +8264,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsunset{#2}% \fi }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -8070,6 +8346,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsunset{#2}% \fi }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -8145,6 +8425,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsunset{#2}% \fi }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -8221,6 +8505,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsunset{#2}% \fi }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -8302,6 +8590,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsunset{#2}% \fi }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -8380,6 +8672,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsunset{#2}% \fi }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -8454,6 +8750,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \glsunset{#2}% \fi }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -8468,6 +8768,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% \let\do@gls@link@checkfirsthyper\relax \@gls@link[#1]{#2}{#3}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -9639,6 +9943,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9682,6 +9990,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9725,6 +10037,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9769,6 +10085,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9812,6 +10132,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9855,6 +10179,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9903,6 +10231,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9951,6 +10283,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -9999,6 +10335,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -10048,6 +10388,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -10097,6 +10441,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -10145,6 +10493,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} % @@ -10836,9 +11188,16 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \end{macrocode} % Store the entry's counter in \cs{theglsentrycounter} %\changes{3.0}{2011/04/02}{added \cs{@gls@saveentrycounter}} +%\changes{4.16}{2015-07-08}{changed \cs{@do@wrglossary} to +%\cs{@@do@wrglossary}} % \begin{macrocode} \@gls@saveentrycounter - \@do@wrglossary{#2}% +% \end{macrocode} +% This should use \cs{@@do@wrglossary} rather than +% \cs{@do@wrglossary} since the whole point of \cs{glsadd} is to add +% a line to the glossary. +% \begin{macrocode} + \@@do@wrglossary{#2}% }% } % \end{macrocode} @@ -12060,10 +12419,22 @@ you %into \cs{@@do@wrglossary}} % \begin{macrocode} \newcommand*{\@do@wrglossary}[1]{% + \glswriteentry{#1}{\@@do@wrglossary{#1}}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\glswriteentry} +%\changes{4.16}{2015-07-08}{new} +% Provide a user level command so the user can customize whether or +% not a line should be added to the glossary. The arguments are the +% label and the code that writes to the glossary file. +% \begin{macrocode} +\newcommand*{\glswriteentry}[2]{% \ifglsindexonlyfirst - \ifglsused{#1}{}{\@@do@wrglossary{#1}}% + \ifglsused{#1}{}{#2}% \else - \@@do@wrglossary{#1}% + #2% \fi } % \end{macrocode} @@ -15119,7 +15490,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% \Glsentrylongpl{##1}##2\space (\protect\firstacronymfont{\glsentryshortpl{##1}})% }% - \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}} + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% \renewcommand*{\acronymsort}[2]{##1}% \renewcommand*{\acronymfont}[1]{##1}% \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% @@ -15128,6 +15499,58 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \end{macrocode} %\end{acrstyle} % +%\begin{acrstyle}{long-sp-short} +%\changes{4.16}{2015-07-08}{new} +% Similar to the previous style but allows the space between the +% long and short form to be customized. +% \begin{macrocode} +\newacronymstyle{long-sp-short}% +{% +% \end{macrocode} +% Check for long form in case this is a mixed glossary. +% \begin{macrocode} + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% +}% +{% + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\glsacspace{##1}% + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + \renewcommand*{\acronymsort}[2]{##1}% + \renewcommand*{\acronymfont}[1]{##1}% + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% +} +% \end{macrocode} +%\end{acrstyle} +% +%\begin{macro}{\glsacspace} +%\changes{4.16}{2015-07-08}{new} +% Space between long and short form for the above style. +% This uses a non-breakable space if the short form is less than +% 3em, otherwise it uses a regular space. +% \begin{macrocode} +\newcommand*{\glsacspace}[1]{% + \settowidth{\dimen@}{(\firstacronymfont{\glsentryshort{#1}})}% + \ifdim\dimen@<3em~\else\space\fi +} +% \end{macrocode} +%\end{macro} +% %\begin{acrstyle}{short-long} %\changes{4.02}{2013-12-05}{new} % \meta{short} (\meta{long}) acronym style. @@ -15252,6 +15675,27 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \end{macrocode} %\end{acrstyle} % +%\begin{acrstyle}{long-sp-short-desc} +%\changes{4.02}{2013-12-05}{new} +% \meta{long} (\marg{short}) acronym style that has an +% accompanying description (which the user needs to supply). +% The space between the long and short form is given by +% \cs{glsacspace}. +% \begin{macrocode} +\newacronymstyle{long-sp-short-desc}% +{% + \GlsUseAcrEntryDispStyle{long-sp-short}% +}% +{% + \GlsUseAcrStyleDefs{long-sp-short}% + \renewcommand*{\GenericAcronymFields}{}% + \renewcommand*{\acronymsort}[2]{##2}% + \renewcommand*{\acronymentry}[1]{% + \glsentrylong{##1}\glsacspace{##1}(\acronymfont{\glsentryshort{##1}})}% +} +% \end{macrocode} +%\end{acrstyle} +% %\begin{acrstyle}{long-sc-short-desc} %\changes{4.02}{2013-12-05}{new} % \meta{long} (\cs{textsc}\marg{short}) acronym style that has an @@ -17171,6 +17615,18 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \end{macrocode} %\end{macro} % +%\begin{macro}{\showglofield} +%\changes{4.16}{2015-07-08}{new} +%\begin{definition} +%\cs{showglofield}\marg{label}\marg{field} +%\end{definition} +% \begin{macrocode} +\newcommand*{\showglofield}[2]{% + \csshow{glo@\glsdetoklabel{#1}@#2}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\showacronymlists} %\changes{3.0}{2011/04/02}{new} %\begin{definition} @@ -17305,7 +17761,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \cs{gls}\marg{label}'' on subsequent use. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-prefix}[2014/07/30 v4.08 (NLCT)] +\ProvidesPackage{glossaries-prefix}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Pass all options to \sty{glossaries}: % \begin{macrocode} @@ -18005,7 +18461,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% %\label{sec:code:hypernav} % Package Definition: % \begin{macrocode} -\ProvidesPackage{glossary-hypernav}[2013/11/14 v4.0 (NLCT)] +\ProvidesPackage{glossary-hypernav}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % % The commands defined in this package are provided to @@ -18173,7 +18629,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % This defines an in-line style where the entries are % comma-separated with just the name and description displayed. % \begin{macrocode} -\ProvidesPackage{glossary-inline}[2013/11/14 v4.0 (NLCT)] +\ProvidesPackage{glossary-inline}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % %\begin{style}{inline} @@ -18364,7 +18820,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \ics{item} command, it will appear in a bold font by % default. % \begin{macrocode} -\ProvidesPackage{glossary-list}[2015/02/03 v4.13 (NLCT)] +\ProvidesPackage{glossary-list}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} %\begin{macro}{\indexspace} %\changes{4.13}{2015-02-03}{new} @@ -18618,7 +19074,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % The glossary styles defined in the \isty{glossary-long} package % used the \env{longtable} environment in the glossary. % \begin{macrocode} -\ProvidesPackage{glossary-long}[2013/11/14 v4.0 (NLCT)] +\ProvidesPackage{glossary-long}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Requires the \isty{longtable} package: % \begin{macrocode} @@ -19093,7 +19549,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % used the \env{longtable} environment in the glossary and use % ragged right formatting for the multiline columns. % \begin{macrocode} -\ProvidesPackage{glossary-longragged}[2014/07/30 v4.08 (NLCT)] +\ProvidesPackage{glossary-longragged}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Requires the \isty{array} package: % \begin{macrocode} @@ -19504,7 +19960,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% %use the \sty{multicol} package. These use the tree-like glossary %styles in a multicol environment. % \begin{macrocode} -\ProvidesPackage{glossary-mcols}[2015/02/03 v4.13 (NLCT)] +\ProvidesPackage{glossary-mcols}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Required packages: % \begin{macrocode} @@ -19811,7 +20267,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % The glossary styles defined in the \isty{glossary-super} package % use the \env{supertabular} environment. % \begin{macrocode} -\ProvidesPackage{glossary-super}[2013/11/14 v4.0 (NLCT)] +\ProvidesPackage{glossary-super}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Requires the \isty{supertabular} package: % \begin{macrocode} @@ -20321,7 +20777,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % are like those provided by the \isty{glossary-super} package, % except that the multiline columns have ragged right justification. % \begin{macrocode} -\ProvidesPackage{glossary-superragged}[2013/11/14 v4.0 (NLCT)] +\ProvidesPackage{glossary-superragged}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Requires the \isty{array} package: % \begin{macrocode} @@ -20737,7 +21193,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % that have a tree-like structure. These are designed for % hierarchical glossaries. % \begin{macrocode} -\ProvidesPackage{glossary-tree}[2015/02/03 v4.13 (NLCT)] +\ProvidesPackage{glossary-tree}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % %\begin{macro}{\indexspace} @@ -21336,7 +21792,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % hyperlinks may not work properly. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-compatible-207}[2011/04/02 v1.0 (NLCT)] +\ProvidesPackage{glossaries-compatible-207}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} %\begin{macro}{\GlsAddXdyAttribute} % Adds an attribute in old format. @@ -21697,7 +22153,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % Compatibility macros. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-compatible-307}[2013/11/14 v4.0 (NLCT)] +\ProvidesPackage{glossaries-compatible-307}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % % Compatibility macros for predefined glossary styles: @@ -22507,7 +22963,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % but will only be updated when \texttt{glossaries-accsupp.sty} is % modified. % \begin{macrocode} -\ProvidesPackage{glossaries-accsupp}[2014/07/30 v4.08 (NLCT) +\ProvidesPackage{glossaries-accsupp}[2015/07/08 v4.16 (NLCT) Experimental glossaries accessibility] % \end{macrocode} % Pass all options to \sty{glossaries}: @@ -23697,6 +24153,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -23725,6 +24185,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -23754,6 +24218,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -23782,6 +24250,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -23810,6 +24282,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -23839,6 +24315,10 @@ false,nolabel,autolabel,nameref}[nolabel]{% % \begin{macrocode} \@gls@link[#1]{#2}{\csname gls@\glstype @entryfmt\endcsname}% }% +% \end{macrocode} +%\changes{4.16}{2015-07-08}{added \cs{glspostlinkhook}} +% \begin{macrocode} + \glspostlinkhook } % \end{macrocode} %\end{macro} @@ -24899,7 +25379,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % modules. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-babel}[2014/11/22 v4.12 (NLCT)] +\ProvidesPackage{glossaries-babel}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Load \sty{tracklang} to obtain language settings. % \begin{macrocode} @@ -24943,7 +25423,7 @@ false,nolabel,autolabel,nameref}[nolabel]{% % modules. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries-polyglossia}[2014/11/22 v4.12 (NLCT)] +\ProvidesPackage{glossaries-polyglossia}[2015/07/08 v4.16 (NLCT)] % \end{macrocode} % Load \sty{tracklang} to obtain language settings. % \begin{macrocode} @@ -25087,7 +25567,6 @@ If you want paragraph breaks in the description use \documentclass{report} \usepackage{graphicx} -%\usepackage{scrwfile} \usepackage[colorlinks]{hyperref} \usepackage[savewrites,nopostdot,toc,acronym,symbols]{glossaries} @@ -26562,6 +27041,79 @@ amet, libero}, %\fi %\iffalse % \begin{macrocode} +%<*sample-chap-hyperfirst.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{report} + +\usepackage[colorlinks]{hyperref} +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{chapter}{0}{\glschapnum} + +\loadglsentries{example-glossaries-brief} + +\renewcommand*{\glslinkpostsetkeys}{% + \edef\currentchap{\arabic{chapter}}% + \ifnum\currentchap=\glschapnum{\glslabel}\relax + % Already used this entry in the current chapter, so switch + % off the hyperlink. + \setkeys{glslink}{hyper=false}% + \else + % Hasn't been used in the current chapter. Update the value + % of the "chapter" field unless the hyperlink has been switched + % off. + \glsifhyperon + {% + \glsfieldxdef{\glslabel}{chapter}{\currentchap}% + }% + {}% + \fi +} + +\begin{document} +\chapter{Sample} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Another} + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\chapter{Start with a Star} + +Use all entries but suppress hyperlink: +\forglsentries{\thislabel}{\gls*{\thislabel}. } + +Use all entries: \forglsentries{\thislabel}{\gls{\thislabel}. } + +Use them again: \forglsentries{\thislabel}{\gls{\thislabel}. } + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</sample-chap-hyperfirst.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*sample-crossref.tex> % \end{macrocode} %\fi @@ -26778,6 +27330,106 @@ Linking with insert: \acrfullpl{html}['s], \Acrfullpl{html}['s], %\fi %\iffalse % \begin{macrocode} +%<*sample-dot-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{abbrtype}{word}{\abbrtype} + +\setacronymstyle{long-short} + +\newcommand*{\newabbr}[1][]{% + \newacronym[abbrtype=initials,#1]} + +\newabbr{eg}{e.g.}{exempli gratia} +\newabbr{ie}{i.e.}{id est} +\newabbr{bsc}{B.Sc.}{Bachelor of Science} +\newabbr{ba}{B.A.}{Bachelor of Arts} +\newabbr{agm}{A.G.M.}{annual general meeting} + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + +\makeatletter +\renewcommand{\glspostlinkhook}{% + \ifglsfieldeq{\glslabel}{abbrtype}{initials}% + {\new@ifnextchar.\doendsentence\doendword} + {}% +} +\makeatother + +\newcommand{\doendsentence}[1]{\spacefactor=10000{}} +\newcommand{\doendword}{\spacefactor=1000{}} + +\begin{document} +This is a sample document that illustrates abbreviations with +full stops (periods) and abbreviations that are words (i.e.\ +acronyms). The examples switch to a typewriter font to make it +easier to see the inter-word and inter-sentence spaces. + +First use: \gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} end of +sentence. + +End of sentence use: + +\ttfamily + +\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}. +Done. + +laser. e.g. i.e. B.Sc. B.A\@. A.G.M\@. Done. + +\rmfamily + +Mid-sentence use: + +\ttfamily + +\gls{laser} \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm} Done. + +laser e.g.\ i.e.\ B.Sc.\ B.A. A.G.M. Done. + +\rmfamily + +Check other sentence terminators: + +\ttfamily + +\gls{laser}? \gls{eg}? \gls{ie}? \gls{bsc}! \gls{ba}! \gls{agm}? Done. + +laser? e.g.? i.e.? B.Sc.! B.A.! A.G.M.? Done. + +\rmfamily + +\glsresetall Reset. End of sentence use: + +\ttfamily + +\gls{laser}. \gls{eg}. \gls{ie}. \gls{bsc}. \gls{ba}. \gls{agm}. +Done. + +\rmfamily +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</sample-dot-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*sample-dual.tex> % \end{macrocode} %\fi @@ -26959,6 +27611,83 @@ Next use: \gls{sample}. %\fi %\iffalse % \begin{macrocode} +%<*sample-font-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey{font}{}{\entryfont} + +\newacronymstyle{long-font-short} +{% + \GlsUseAcrEntryDispStyle{long-short}% +} +{% + \GlsUseAcrStyleDefs{long-short}% + \renewcommand*{\genacrfullformat}[2]{% + \glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\Genacrfullformat}[2]{% + \Glsentrylong{##1}##2\space + ({\entryfont{##1}\glsentryshort{##1}})% + }% + \renewcommand*{\genplacrfullformat}[2]{% + \glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\Genplacrfullformat}[2]{% + \Glsentrylongpl{##1}##2\space + ({\entryfont{##1}\glsentryshortpl{##1}})% + }% + \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}% + \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}% +} + +\setacronymstyle{long-font-short} + +\newcommand*{\newitabbr}[1][]{\newacronym[font=\em,#1]} +\newcommand*{\newupabbr}[1][]{\newacronym[#1]} + +\newitabbr{eg}{e.g.}{exempli gratia} +\newitabbr{ie}{i.e.}{id est} + +\newupabbr{bsc}{BSc}{Bachelor of Science} +\newupabbr{ba}{BA}{Bachelor of Arts} +\newupabbr{agm}{AGM}{annual general meeting} + +\begin{document} + +First use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}. + +Next use: \gls{eg} \gls{ie} \gls{bsc} \gls{ba} \gls{agm}. + +Short: \acrshort{eg} \acrshort{ie} \acrshort{bsc} \acrshort{ba} +\acrshort{agm}. + +Full: \acrfull{eg} \acrfull{ie} \acrfull{bsc} \acrfull{ba} +\acrfull{agm}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</sample-font-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*sample-ignored.tex> % \end{macrocode} %\fi @@ -27434,6 +28163,8 @@ All uppercase: \GLSed{jump}, \GLSing{jump}, %\fi %\iffalse % \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: % arara: pdflatex % arara: pdflatex \documentclass{report} @@ -27594,6 +28325,8 @@ Sea lion locations: %\fi %\iffalse % \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: % arara: pdflatex % arara: pdflatex \documentclass{report} @@ -27948,6 +28681,7 @@ First use: \PGLSpl{sample}, \PGLSpl{svm}. Next use: \PGLSpl{sample}, \PGLSpl{svm %\fi %\iffalse % \begin{macrocode} + % This file is public domain % If you want to use arara, you need the following directives: % arara: pdflatex: { synctex: on } % arara: makeglossaries @@ -27955,18 +28689,18 @@ First use: \PGLSpl{sample}, \PGLSpl{svm}. Next use: \PGLSpl{sample}, \PGLSpl{svm \documentclass{article} \usepackage{siunitx} \usepackage[style=long4col]{glossaries} -% + \makeglossaries -% + \newglossaryentry{ohm}{% name=ohm, symbol={\si{\ohm}}, description=unit of electrical resistance% } -% + \begin{document} \glsaddallunused -% + \printglossaries \end{document} % \end{macrocode} @@ -27978,6 +28712,293 @@ First use: \PGLSpl{sample}, \PGLSpl{svm}. Next use: \PGLSpl{sample}, \PGLSpl{svm %\fi %\iffalse % \begin{macrocode} +%<*sample-storage-abbr-desc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey + {abbrtype}% key/field name + {acronym}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required + +\newacronymstyle + {mystyle}% style name + {% Use the generic display + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + } + {% User needs to explicitly set the description + \renewcommand*{\GenericAcronymFields}{}% + % For the full format, test the value of the "abbrtype" key. + % If it's set to "acronym" put the short form first with + % the long form in brackets. + \renewcommand*{\genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % first letter upper case version: + \renewcommand*{\Genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % plural + \renewcommand*{\genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % plural and first letter upper case + \renewcommand*{\Genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{acronym} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % Just use the short form as the name part in the glossary: + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + % Sort by the short form: + \renewcommand*{\acronymsort}[2]{##1}% + % Just use the surrounding font for the short form: + \renewcommand*{\acronymfont}[1]{##1}% + % Same for first use: + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + % Default plural suffix if the plural isn't explicitly set + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + } + +\setacronymstyle{mystyle} + + % The default for "abbrtype" is "acronym" so we don't need + % this new key for acronyms: +\newacronym[description={system for detecting the position and +speed of aircraft, ships, etc}]{radar}{radar}{radio detecting +and ranging} + +\newacronym[description={device that creates a narrow beam +of intense light}]{laser}{laser}{light amplification by +stimulated emission of radiation} + +\newacronym[description={portable breathing device for +divers}]{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\newcommand*{\newinitialism}[4][]{% + \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% +} + +\newinitialism[description={mathematical manipulation of an +information signal}]{dsp}{DSP}{digital signal processing} +\newinitialism[description={device that allows customers of +financial institutions to perform transactions, such as +cash withdrawal, without the need for a teller}]{atm}{ATM} +{automated teller machine} + +\newcommand*{\newcontraction}[4][]{% + \newacronym[abbrtype=contraction,#1]{#2}{#3}{#4}% +} + +\newcontraction[description={front part of a ship below the +deck}]{focsle}{fo'c's'le}{forecastle} + +\newglossaryentry{apple}{name={apple},description={a fruit}} + +\newglossarystyle + {mystyle}% style name + {% base it on the "list" style + \setglossarystyle{list}% + \renewcommand*{\glossentry}[2]{% + \item[\glsentryitem{##1}% + \glstarget{##1}{\glossentryname{##1}}] + \ifglshaslong{##1}% + { (\abbrtype{##1}: \glsentrylong{##1})\space}{}% + \glossentrydesc{##1}\glspostdescription\space ##2}% + } + +\setglossarystyle{mystyle} + +\begin{document} + +First use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}, \gls{focsle}. + +Next use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}, \gls{focsle}. + +Regular term: \gls{apple}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</sample-storage-abbr-desc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*sample-storage-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\glsaddstoragekey + {abbrtype}% key/field name + {word}% default value if not explicitly set + {\abbrtype}% custom command to access the value if required + +\newacronymstyle + {mystyle}% style name + {% Use the generic display + \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}% + } + {% Put the long form in the description + \renewcommand*{\GenericAcronymFields}{description={\the\glslongtok}}% + % For the full format, test the value of the "abbrtype" key. + % If it's set to "word" put the short form first with + % the long form in brackets. + \renewcommand*{\genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % first letter upper case version: + \renewcommand*{\Genacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshort{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylong{##1}##2\space + (\protect\firstacronymfont{\glsentryshort{##1}})% + }% + }% + % plural + \renewcommand*{\genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % plural and first letter upper case + \renewcommand*{\Genplacrfullformat}[2]{% + \ifglsfieldeq{##1}{abbrtype}{word} + {% is a proper acronym + \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space + (\glsentrylong{##1})% + } + {% is another form of abbreviation + \Glsentrylongpl{##1}##2\space + (\protect\firstacronymfont{\glsentryshortpl{##1}})% + }% + }% + % Just use the short form as the name part in the glossary: + \renewcommand*{\acronymentry}[1]{\acronymfont{\glsentryshort{##1}}}% + % Sort by the short form: + \renewcommand*{\acronymsort}[2]{##1}% + % Just use the surrounding font for the short form: + \renewcommand*{\acronymfont}[1]{##1}% + % Same for first use: + \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}% + % Default plural suffix if the plural isn't explicitly set + \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}% + } + +\setacronymstyle{mystyle} + + % The default for "abbrtype" is "acronym" so we don't need + % this new key for acronyms: +\newacronym{radar}{radar}{radio detecting and ranging} +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} +\newacronym{scuba}{scuba}{self-contained underwater breathing +apparatus} + +\newcommand*{\newinitialism}[4][]{% + \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}% +} + +\newinitialism{dsp}{DSP}{digital signal processing} +\newinitialism{atm}{ATM}{automated teller machine} + +\begin{document} + +First use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}. + +Next use: \gls{radar}, \gls{laser}, \gls{scuba}, \gls{dsp}, +\gls{atm}. + +\printglossaries +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</sample-storage-abbr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*sample.tex> % \end{macrocode} %\fi @@ -28364,14 +29385,14 @@ You don't need to worry about makeindex's special characters: \makeglossaries -% Change the acronym style to long-sc-short-desc: + % Change the acronym style to long-sc-short-desc: \setacronymstyle{long-sc-short-desc} -% Change the "see" items so that they use \acronymfont: + % Change the "see" items so that they use \acronymfont: \renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} -% Not using a font that supports bold smallcaps so change the way -% the name is formatted in the glossary: + % Not using a font that supports bold smallcaps so change the way + % the name is formatted in the glossary: \renewcommand*{\glsnamefont}[1]{\textmd{#1}} @@ -28554,10 +29575,10 @@ one \gls[format=hyperbf]{svm}. \renewcommand{\acronymfont}[1]{\textmd{\scshape ##1}}% } -% Now use this new style: + % Now use this new style: \setacronymstyle{altfn} -% Change the "see" items so that they use \acronymfont: + % Change the "see" items so that they use \acronymfont: \renewcommand*{\glsseeitemformat}[1]{\acronymfont{\glsentrytext{#1}}} \newacronym[description={Statistical pattern recognition @@ -30280,6 +31301,119 @@ brackets. %\fi %\iffalse % \begin{macrocode} +%<*mwe-acr-desc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\newacronym[description={a device that emits a narrow beam of +light}]{laser}{laser}{light amplification by stimulated +emission of radiation} + +\setacronymstyle{short-long-desc} + +\begin{document} + +First use: \gls{laser}. + +Next use: \gls{laser} or \glspl{laser}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</mwe-acr-desc.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*mwe-acr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\newacronym{laser}{laser}{light amplification by stimulated +emission of radiation} + +\setacronymstyle{long-short} + +\begin{document} + +First use: \gls{laser}. + +Next use: \gls{laser} or \glspl{laser}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</mwe-acr.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%<*mwe-gls.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} + % This file is public domain + % If you want to use arara, you need the following directives: + % arara: pdflatex + % arara: makeglossaries + % arara: pdflatex +\documentclass{article} + +\usepackage{glossaries} + +\makeglossaries + +\newglossaryentry{apple}{name={apple},description={a fruit}} + +\begin{document} + +\Gls{apple} or \gls{apple} or \glspl{apple}. + +\printglossaries + +\end{document} +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} +%</mwe-gls.tex> +% \end{macrocode} +%\fi +%\iffalse +% \begin{macrocode} %<*samplexdy-mc.xdy> % \end{macrocode} %\fi |