diff options
author | Karl Berry <karl@freefriends.org> | 2012-11-20 01:12:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-11-20 01:12:02 +0000 |
commit | 7c8d0edea78bbaa87a816da41a6351a7cb7edd0f (patch) | |
tree | dbcb453b8c7e4b69ee2b9c4c5d27bf1d80052cbe /Master/texmf-dist/source | |
parent | 6c960e7402ad996080bddee70b48625460f46d8e (diff) |
glossaries (19nov12)
git-svn-id: svn://tug.org/texlive/trunk@28305 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/glossaries/glossaries.dtx | 824 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/glossaries/glossaries.ins | 2 |
2 files changed, 617 insertions, 209 deletions
diff --git a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx index d80ad0b707c..4831d966e79 100644 --- a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx +++ b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx @@ -27,7 +27,7 @@ % -author "Nicola Talbot" % -codetitle "Main Package Code" % glossaries -% Created on 2012/9/21 14:41 +% Created on 2012/11/18 20:04 %\fi %\iffalse %<*package> @@ -61,6 +61,8 @@ glossaries-manual.tex is a stub file used by makedtx to create glossaries.dtx \fi +\RecordChanges + \usepackage{alltt} \usepackage{pifont} \usepackage[utf8]{inputenc} @@ -71,6 +73,61 @@ glossaries.dtx pdfauthor={Nicola L.C. Talbot}, pdftitle={glossaries.sty: LaTeX2e Package to Assist Generating Glossaries}, pdfkeywords={LaTeX,package,glossary,acronyms}]{hyperref} +\usepackage[toc]{glossaries} + +\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{GlsKey}{key}{glossary keys} @@ -79,12 +136,12 @@ glossaries.dtx \setcounter{IndexColumns}{2} -\CheckSum{13761} +\CheckSum{13982} \newcommand*{\ifirstuse}{\iterm{first use}} -\newcommand*{\firstuse}{first use\ifirstuse} -\newcommand*{\firstuseflag}{first use flag\ifirstuseflag} -\newcommand*{\firstusetext}{first use text\ifirstusetext} +\newcommand*{\firstuse}{\gls{firstuse}} +\newcommand*{\firstuseflag}{\gls{firstuseflag}} +\newcommand*{\firstusetext}{\gls{firstusetext}} \newcommand*{\ifirstuseflag}{\iterm{first use>flag}} \newcommand*{\ifirstusetext}{\iterm{first use>text}} @@ -107,15 +164,12 @@ glossaries.dtx %\MakeShortVerb{"} %\DeleteShortVerb{\|} % -% \title{Documented Code For glossaries v3.03} +% \title{Documented Code For glossaries v3.04} % \author{Nicola L.C. Talbot\\[10pt] -%School of Computing Sciences\\ -%University of East Anglia\\ -%Norwich. Norfolk\\ -%NR4 7TJ. United Kingdom.\\ -%\url{http://theoval.cmp.uea.ac.uk/~nlct/}} +%Dickimaw Books\\ +%\url{http://www.dickimaw-books.com/}} % -% \date{2012-09-21} +% \date{2012-11-18} % \maketitle % %This is the documented code for the \styfmt{glossaries} package. @@ -131,7 +185,7 @@ glossaries.dtx %glossaries package}. % %\item[\url{glossaries-user.pdf}] -%For the main user guide, read \qt{glossaries.sty v3.03: +%For the main user guide, read \qt{glossaries.sty v3.04: %\LaTeX2e\ Package to Assist Generating Glossaries}. % %\item[\url{mfirstuc-manual.pdf}] @@ -154,9 +208,12 @@ glossaries.dtx %\tableofcontents % %\StopEventually{% +% \printglossaries +% \phantomsection +% \addcontentsline{toc}{section}{Change History}% +% \PrintChanges % \clearpage\phantomsection % \addcontentsline{toc}{section}{Index}\PrintIndex -% %} % % @@ -172,7 +229,7 @@ glossaries.dtx % This package requires \LaTeXe. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries}[2012/09/21 v3.03 (NLCT)] +\ProvidesPackage{glossaries}[2012/11/18 v3.04 (NLCT)] % \end{macrocode} % Required packages: % \begin{macrocode} @@ -181,6 +238,11 @@ glossaries.dtx \RequirePackage{mfirstuc} \RequirePackage{xfor} % \end{macrocode} +%\changes{3.04}{2012-11-18}{added datatool-base as a required +%package} +% \begin{macrocode} +\RequirePackage{datatool-base} +% \end{macrocode} %\changes{1.1}{2008 Feb 22}{amsgen now loaded (\cs{new@ifnextchar} needed)} % Need to use \cs{new@ifnextchar} instead of \cs{@ifnextchar} in % commands that have a final optional argument (such as \ics{gls}) @@ -195,6 +257,94 @@ glossaries.dtx % \begin{macrocode} \RequirePackage{etoolbox} % \end{macrocode} +%\changes{3.04}{2012-11-18}{Added check for doc package} +% Check if \sty{doc} has been loaded. +%\begin{macro}{\if@gls@docloaded} +% \begin{macrocode} +\newif\if@gls@docloaded +\@ifpackageloaded{doc}% +{% + \@gls@docloadedtrue +}% +{% + \@ifclassloaded{nlctdoc}{\@gls@docloadedtrue}{\@gls@docloadedfalse}% +} +% \end{macrocode} +%\end{macro} +% \begin{macrocode} +\if@gls@docloaded +% \end{macrocode} +% It has been loaded, so some modifications need to be made to +% ensure both packages can work together. +%\begin{macro}{\glsorg@glossary} +%\changes{3.04}{2012-11-18}{new} +% First, save the original behaviour of \cs{glossary} +% \begin{macrocode} + \newcommand{\glsorg@glossary}{% + \@bsphack + \begingroup + \@sanitize \glsorg@wrglossary + } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsorg@wrglossary} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} + \newcommand{\glsorg@wrglossary}[1]{% + \protected@write\@glossaryfile{}{% + \string \glossaryentry{#1}{\thepage}}% + \endgroup + \@esphack + } +% \end{macrocode} +%\end{macro} +%\begin{macro}{\changes} +%\changes{3.04}{2012-11-18}{new} +% Now we need to redefine \cs{changes} so that it uses the original +% definition of \cs{glossary}. +% \begin{macrocode} + \let\glsorg@changes\changes + \renewcommand{\changes}[3]{% + \begingroup + \let\glossary\glsorg@glossary + \glsorg@changes{#1}{#2}{#3}% + \endgroup + } +% \end{macrocode} +%\end{macro} +%\cs{PrintChanges} needs to use \sty{doc}'s version of +%\env{theglossary}, so save that. +%\begin{macro}{\glsorg@theglossary} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} + \let\glsorg@theglossary\theglossary +% \end{macrocode} +%\end{macro} +%\begin{macro}{\glsorg@endtheglossary} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} + \let\glsorg@endtheglossary\endtheglossary +% \end{macrocode} +%\end{macro} +%\begin{macro}{\PrintChanges} +% Now redefine \cs{PrintChanges} so that it uses the original +% \env{theglossary} environment. +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} + \let\glsorg@PrintChanges\PrintChanges + \renewcommand{\PrintChanges}{% + \begingroup + \let\theglossary\glsorg@theglossary + \let\endtheglossary\glsorg@endtheglossary + \glsorg@PrintChanges + \endgroup + } +% \end{macrocode} +%\end{macro} +% End of doc stuff. +% \begin{macrocode} +\fi +% \end{macrocode} % % \subsection{Package Options}\label{sec:pkgopt} %\begin{option}{toc} @@ -684,11 +834,20 @@ false,nolabel,autolabel}[nolabel]{% % %\begin{macro}{\glsdefmain} %\changes{2.01}{2009 May 30}{new} +%\changes{3.04}{2012-11-18}{added check for doc package} % Define the main glossary. This will be the first glossary to -% be displayed when using \ics{printglossaries}. +% be displayed when using \ics{printglossaries}. The default +% extensions conflict if used with \sty{doc}, so provide different +% extensions if \sty{doc} loaded. (If these extensions are +% inappropriate, use \pkgopt{nomain} and manually define the main +% glossary with the desired extensions.) % \begin{macrocode} \newcommand*{\glsdefmain}{% - \newglossary{main}{gls}{glo}{\glossaryname}% + \if@gls@docloaded + \newglossary[glg2]{main}{gls2}{glo2}{\glossaryname}% + \else + \newglossary{main}{gls}{glo}{\glossaryname}% + \fi } % \end{macrocode} %\end{macro} @@ -1095,8 +1254,8 @@ name=true]{% %\changes{1.17}{2008 December 26}{added xindy support} %\begin{macro}{\ifglsxindy} %\changes{1.17}{2008 December 26}{new} -% Provide boolean to determine whether \app{xindy} or -% \app{makeindex} will be used to sort the glossaries. +% Provide boolean to determine whether \gls{xindy} or +% \gls{makeindex} will be used to sort the glossaries. % \begin{macrocode} \newif\ifglsxindy % \end{macrocode} @@ -3994,6 +4153,13 @@ name=true]{% % \begin{macrocode} \define@boolkey{glslink}{hyper}[true]{} % \end{macrocode} +%\changes{3.04}{2012-11-18}{added local key} +% The \gloskey[glslink]{local} key is a boolean key. If true this +% indicates that commands such as \ics{gls} should only do a local +% reset rather than a global one. +% \begin{macrocode} +\define@boolkey{glslink}{local}[true]{} +% \end{macrocode} % %Syntax:\\[10pt] % \cs{glslink}\oarg{options}\marg{label}\marg{text} @@ -4237,6 +4403,26 @@ name=true]{% \def\@gls@checkedmkidx{}% \expandafter\@gls@xdycheckquote\gls@xdystring\@nil""\null \expandafter\@gls@updatechecked\@gls@checkedmkidx{\gls@xdystring}% +% \end{macrocode} +%\changes{3.04}{2012-11-18}{unsanitize \cs{gls@numberpage}, +%\cs{gls@alphpage}, \cs{gls@Alphpage} and \cs{gls@romanpage}} +% Unsanitize \cs{gls@numberpage}, \cs{gls@alphpage}, +% \cs{gls@Alphpage} and \cs{glsromanpage} (thanks to David~Carlise +% for the suggestion.) +% \begin{macrocode} + \@for\@gls@tmp:=\gls@protected@pagefmts\do + {% + \edef\@gls@sanitized@tmp{\expandafter\@gobble\string\\\expandonce\@gls@tmp}% + \@onelevel@sanitize\@gls@sanitized@tmp + \edef\gls@dosubst{% + \noexpand\DTLsubstituteall\noexpand\gls@xdystring + {\@gls@sanitized@tmp}{\expandonce\@gls@tmp}% + }% + \gls@dosubst + }% +% \end{macrocode} +% Assign to required control sequence +% \begin{macrocode} \let#1=\gls@xdystring } % \end{macrocode} @@ -4680,34 +4866,37 @@ name=true]{% %\begin{macro}{\@gls} % \begin{macrocode} \newcommand*{\@gls}[2][]{% -\new@ifnextchar[{\@gls@{#1}{#2}}{\@gls@{#1}{#2}[]}} + \new@ifnextchar[{\@gls@{#1}{#2}}{\@gls@{#1}{#2}[]}% +} % \end{macrocode} %\end{macro} %\begin{macro}{\@gls@} % Read in the final optional argument: % \begin{macrocode} \def\@gls@#1#2[#3]{% -\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}% + \glsdoifexists{#2}% + {% + \edef\@glo@type{\glsentrytype{#2}}% % \end{macrocode} % Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label} % \begin{macrocode} -\def\@gls@link@opts{#1}% -\def\@gls@link@label{#2}% + \def\@gls@link@opts{#1}% + \def\@gls@link@label{#2}% % \end{macrocode} % Determine what the link text should be (this is stored in % \cs{@glo@text}) % \begin{macrocode} -\ifglsused{#2}% -{% - \def\@glo@text{% - \csname gls@\@glo@type @display\endcsname - {\glsentrytext{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}% -}% -{% - \def\@glo@text{% - \csname gls@\@glo@type @displayfirst\endcsname - {\glsentryfirst{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}% -}% + \ifglsused{#2}% + {% + \def\@glo@text{% + \csname gls@\@glo@type @display\endcsname + {\glsentrytext{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}% + }% + {% + \def\@glo@text{% + \csname gls@\@glo@type @displayfirst\endcsname + {\glsentryfirst{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}% + }% % \end{macrocode} % Call \cs{@gls@link}. % If \pkgopt{footnote} package option has been used and the glossary @@ -4720,21 +4909,32 @@ name=true]{% %\changes{2.04}{2009 November 10}{Changed test to check if glossary type %has been identified as a list of acronyms} % \begin{macrocode} -\ifglsused{#2}{% - \@gls@link[#1]{#2}{\@glo@text}% -}{% - \gls@checkisacronymlist\@glo@type - \ifthenelse{\(\boolean{@glsisacronymlist}\AND - \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{% - \@gls@link[#1,hyper=false]{#2}{\@glo@text}% - }{% - \@gls@link[#1]{#2}{\@glo@text}% - }% -}% + \ifglsused{#2}% + {% + \@gls@link[#1]{#2}{\@glo@text}% + }% + {% + \gls@checkisacronymlist\@glo@type + \ifthenelse + {\(\boolean{@glsisacronymlist}\AND \boolean{glsacrfootnote}\) + \OR \NOT\boolean{glshyperfirst} + }% + {% + \@gls@link[#1,hyper=false]{#2}{\@glo@text}% + }% + {% + \@gls@link[#1]{#2}{\@glo@text}% + }% + }% % \end{macrocode} % Indicate that this entry has now been used % \begin{macrocode} -\glsunset{#2}}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% } % \end{macrocode} %\end{macro} @@ -4758,36 +4958,39 @@ name=true]{% % a final optional argument % \begin{macrocode} \newcommand*{\@Gls}[2][]{% -\new@ifnextchar[{\@Gls@{#1}{#2}}{\@Gls@{#1}{#2}[]}} + \new@ifnextchar[{\@Gls@{#1}{#2}}{\@Gls@{#1}{#2}[]}% +} % \end{macrocode} %\begin{macro}{\@Gls@} % Read in the final optional argument: % \begin{macrocode} \def\@Gls@#1#2[#3]{% -\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}% + \glsdoifexists{#2}% + {% + \edef\@glo@type{\glsentrytype{#2}}% % \end{macrocode} % Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label} % \begin{macrocode} -\def\@gls@link@opts{#1}% -\def\@gls@link@label{#2}% -\def\glslabel{#2}% + \def\@gls@link@opts{#1}% + \def\@gls@link@label{#2}% + \def\glslabel{#2}% % \end{macrocode} % Determine what the link text should be (this is stored in % \cs{@glo@text}) % \begin{macrocode} -\ifglsused{#2}% -{% - \protected@edef\@glo@text{% - \csname gls@\@glo@type @display\endcsname - {\glsentrytext{#2}}{\glsentrydesc{#2}}% - {\glsentrysymbol{#2}}{#3}}% -}% -{% - \protected@edef\@glo@text{% - \csname gls@\@glo@type @displayfirst\endcsname - {\glsentryfirst{#2}}{\glsentrydesc{#2}}% - {\glsentrysymbol{#2}}{#3}}% -}% + \ifglsused{#2}% + {% + \protected@edef\@glo@text{% + \csname gls@\@glo@type @display\endcsname + {\glsentrytext{#2}}{\glsentrydesc{#2}}% + {\glsentrysymbol{#2}}{#3}}% + }% + {% + \protected@edef\@glo@text{% + \csname gls@\@glo@type @displayfirst\endcsname + {\glsentryfirst{#2}}{\glsentrydesc{#2}}% + {\glsentrysymbol{#2}}{#3}}% + }% % \end{macrocode} % Call \cs{@gls@link} % If \pkgopt{footnote} package option has been used and the glossary @@ -4800,24 +5003,36 @@ name=true]{% %\changes{2.04}{2009 November 10}{Changed test to check if glossary type %has been identified as a list of acronyms} % \begin{macrocode} -\ifglsused{#2}{% - \@gls@link[#1]{#2}{% - \expandafter\makefirstuc\expandafter{\@glo@text}}% -}{% - \gls@checkisacronymlist\@glo@type - \ifthenelse{\(\boolean{@glsisacronymlist}\AND - \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{% - \@gls@link[#1,hyper=false]{#2}{% - \expandafter\makefirstuc\expandafter{\@glo@text}}% - }{% - \@gls@link[#1]{#2}{% - \expandafter\makefirstuc\expandafter{\@glo@text}}% - }% -}% + \ifglsused{#2}% + {% + \@gls@link[#1]{#2}{% + \expandafter\makefirstuc\expandafter{\@glo@text}}% + }% + {% + \gls@checkisacronymlist\@glo@type + \ifthenelse + {% + \(\boolean{@glsisacronymlist}\AND \boolean{glsacrfootnote}\) + \OR \NOT\boolean{glshyperfirst}% + }% + {% + \@gls@link[#1,hyper=false]{#2}{% + \expandafter\makefirstuc\expandafter{\@glo@text}}% + }% + {% + \@gls@link[#1]{#2}{% + \expandafter\makefirstuc\expandafter{\@glo@text}}% + }% + }% % \end{macrocode} % Indicate that this entry has now been used % \begin{macrocode} -\glsunset{#2}}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% } % \end{macrocode} %\end{macro} @@ -4838,28 +5053,38 @@ name=true]{% % a final optional argument % \begin{macrocode} \newcommand*{\@GLS}[2][]{% -\new@ifnextchar[{\@GLS@{#1}{#2}}{\@GLS@{#1}{#2}[]}} + \new@ifnextchar[{\@GLS@{#1}{#2}}{\@GLS@{#1}{#2}[]}% +} % \end{macrocode} %\begin{macro}{\@GLS@} % Read in the final optional argument: % \begin{macrocode} \def\@GLS@#1#2[#3]{% -\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}% + \glsdoifexists{#2}% + {% + \edef\@glo@type{\glsentrytype{#2}}% % \end{macrocode} % Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label} % \begin{macrocode} -\def\@gls@link@opts{#1}% -\def\@gls@link@label{#2}% + \def\@gls@link@opts{#1}% + \def\@gls@link@label{#2}% % \end{macrocode} % Determine what the link text should be (this is stored in % \cs{@glo@text}). % \begin{macrocode} -\ifglsused{#2}{\def\@glo@text{% -\csname gls@\@glo@type @display\endcsname -{\glsentrytext{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}}{% -\def\@glo@text{% -\csname gls@\@glo@type @displayfirst\endcsname -{\glsentryfirst{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}}}% + \ifglsused{#2}% + {% + \def\@glo@text{% + \csname gls@\@glo@type @display\endcsname + {\glsentrytext{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}% + }% + }% + {% + \def\@glo@text{% + \csname gls@\@glo@type @displayfirst\endcsname + {\glsentryfirst{#2}}{\glsentrydesc{#2}}{\glsentrysymbol{#2}}{#3}% + }% + }% % \end{macrocode} % Call \cs{@gls@link} % If \pkgopt{footnote} package option has been used and the glossary @@ -4872,21 +5097,31 @@ name=true]{% %\changes{2.04}{2009 November 10}{Changed test to check if glossary type %has been identified as a list of acronyms} % \begin{macrocode} -\ifglsused{#2}{% - \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% -}{% - \gls@checkisacronymlist\@glo@type - \ifthenelse{\(\boolean{@glsisacronymlist}\AND - \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{% - \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}% - }{% - \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% - }% -}% + \ifglsused{#2}% + {% + \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% + }% + {% + \gls@checkisacronymlist\@glo@type + \ifthenelse + {% + \(\boolean{@glsisacronymlist}\AND \boolean{glsacrfootnote}\) + \OR \NOT\boolean{glshyperfirst}}{% + \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}% + }% + {% + \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% + }% + }% % \end{macrocode} % Indicate that this entry has now been used % \begin{macrocode} -\glsunset{#2}}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% } % \end{macrocode} %\end{macro} @@ -4907,37 +5142,40 @@ name=true]{% % a final optional argument % \begin{macrocode} \newcommand*{\@glspl}[2][]{% -\new@ifnextchar[{\@glspl@{#1}{#2}}{\@glspl@{#1}{#2}[]}} + \new@ifnextchar[{\@glspl@{#1}{#2}}{\@glspl@{#1}{#2}[]}% +} % \end{macrocode} %\begin{macro}{\@glspl@} % Read in the final optional argument: % \begin{macrocode} \def\@glspl@#1#2[#3]{% -\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}% + \glsdoifexists{#2}% + {% + \edef\@glo@type{\glsentrytype{#2}}% % \end{macrocode} % Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label} % \begin{macrocode} -\def\@gls@link@opts{#1}% -\def\@gls@link@label{#2}% + \def\@gls@link@opts{#1}% + \def\@gls@link@label{#2}% % \end{macrocode} % Determine what the link text should be (this is stored in % \cs{@glo@text}) %\changes{1.12}{2008 Mar 8}{now uses 'glsentrydescplural and % 'glsentrysymbolplural instead of 'glsentrydesc and 'glsentrysymbol} % \begin{macrocode} -\ifglsused{#2}% -{% - \def\@glo@text{% - \csname gls@\@glo@type @display\endcsname - {\glsentryplural{#2}}{\glsentrydescplural{#2}}% - {\glsentrysymbolplural{#2}}{#3}}% -}% -{% - \def\@glo@text{% - \csname gls@\@glo@type @displayfirst\endcsname - {\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}% - {\glsentrysymbolplural{#2}}{#3}}% -}% + \ifglsused{#2}% + {% + \def\@glo@text{% + \csname gls@\@glo@type @display\endcsname + {\glsentryplural{#2}}{\glsentrydescplural{#2}}% + {\glsentrysymbolplural{#2}}{#3}}% + }% + {% + \def\@glo@text{% + \csname gls@\@glo@type @displayfirst\endcsname + {\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}% + {\glsentrysymbolplural{#2}}{#3}}% + }% % \end{macrocode} % Call \cs{@gls@link}. % If \pkgopt{footnote} package option has been used and the glossary @@ -4950,21 +5188,33 @@ name=true]{% %\changes{2.04}{2009 November 10}{Changed test to check if glossary type %has been identified as a list of acronyms} % \begin{macrocode} -\ifglsused{#2}{% - \@gls@link[#1]{#2}{\@glo@text}% -}{% - \gls@checkisacronymlist\@glo@type - \ifthenelse{\(\boolean{@glsisacronymlist}\AND - \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{% - \@gls@link[#1,hyper=false]{#2}{\@glo@text}% - }{% - \@gls@link[#1]{#2}{\@glo@text}% - }% -}% + \ifglsused{#2}% + {% + \@gls@link[#1]{#2}{\@glo@text}% + }% + {% + \gls@checkisacronymlist\@glo@type + \ifthenelse + {% + \(\boolean{@glsisacronymlist}\AND \boolean{glsacrfootnote}\) + \OR \NOT\boolean{glshyperfirst}% + }% + {% + \@gls@link[#1,hyper=false]{#2}{\@glo@text}% + }% + {% + \@gls@link[#1]{#2}{\@glo@text}% + }% + }% % \end{macrocode} % Indicate that this entry has now been used % \begin{macrocode} -\glsunset{#2}}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% } % \end{macrocode} %\end{macro} @@ -4987,19 +5237,22 @@ name=true]{% % a final optional argument % \begin{macrocode} \newcommand*{\@Glspl}[2][]{% -\new@ifnextchar[{\@Glspl@{#1}{#2}}{\@Glspl@{#1}{#2}[]}} + \new@ifnextchar[{\@Glspl@{#1}{#2}}{\@Glspl@{#1}{#2}[]}% +} % \end{macrocode} %\begin{macro}{\@Glspl@} % Read in the final optional argument: % \begin{macrocode} \def\@Glspl@#1#2[#3]{% -\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}% + \glsdoifexists{#2}% + {% + \edef\@glo@type{\glsentrytype{#2}}% % \end{macrocode} % Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label} % \begin{macrocode} -\def\@gls@link@opts{#1}% -\def\@gls@link@label{#2}% -\def\glslabel{#2}% + \def\@gls@link@opts{#1}% + \def\@gls@link@label{#2}% + \def\glslabel{#2}% % \end{macrocode} % Determine what the link text should be (this is stored in % \cs{@glo@text}). This needs to be expanded so that the @@ -5007,19 +5260,19 @@ name=true]{% %\changes{1.12}{2008 Mar 8}{now uses 'glsentrydescplural and % 'glsentrysymbolplural instead of 'glsentrydesc and 'glsentrysymbol} % \begin{macrocode} -\ifglsused{#2}% -{% - \protected@edef\@glo@text{% - \csname gls@\@glo@type @display\endcsname - {\glsentryplural{#2}}{\glsentrydescplural{#2}}% - {\glsentrysymbolplural{#2}}{#3}}% -}% -{% - \protected@edef\@glo@text{% - \csname gls@\@glo@type @displayfirst\endcsname - {\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}% - {\glsentrysymbolplural{#2}}{#3}}% -}% + \ifglsused{#2}% + {% + \protected@edef\@glo@text{% + \csname gls@\@glo@type @display\endcsname + {\glsentryplural{#2}}{\glsentrydescplural{#2}}% + {\glsentrysymbolplural{#2}}{#3}}% + }% + {% + \protected@edef\@glo@text{% + \csname gls@\@glo@type @displayfirst\endcsname + {\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}% + {\glsentrysymbolplural{#2}}{#3}}% + }% % \end{macrocode} % Call \cs{@gls@link}. % If \pkgopt{footnote} package option has been used and the glossary @@ -5032,24 +5285,36 @@ name=true]{% %\changes{2.04}{2009 November 10}{Changed test to check if glossary type %has been identified as a list of acronyms} % \begin{macrocode} -\ifglsused{#2}{% - \@gls@link[#1]{#2}{% - \expandafter\makefirstuc\expandafter{\@glo@text}}% -}{% - \gls@checkisacronymlist\@glo@type - \ifthenelse{\(\boolean{@glsisacronymlist}\AND - \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{% - \@gls@link[#1,hyper=false]{#2}{% - \expandafter\makefirstuc\expandafter{\@glo@text}}% - }{% - \@gls@link[#1]{#2}{% - \expandafter\makefirstuc\expandafter{\@glo@text}}% - }% -}% + \ifglsused{#2}% + {% + \@gls@link[#1]{#2}{% + \expandafter\makefirstuc\expandafter{\@glo@text}}% + }% + {% + \gls@checkisacronymlist\@glo@type + \ifthenelse + {% + \(\boolean{@glsisacronymlist}\AND \boolean{glsacrfootnote}\) + \OR \NOT\boolean{glshyperfirst}% + }% + {% + \@gls@link[#1,hyper=false]{#2}{% + \expandafter\makefirstuc\expandafter{\@glo@text}}% + }% + {% + \@gls@link[#1]{#2}{% + \expandafter\makefirstuc\expandafter{\@glo@text}}% + }% + }% % \end{macrocode} % Indicate that this entry has now been used % \begin{macrocode} -\glsunset{#2}}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% } % \end{macrocode} %\end{macro} @@ -5070,32 +5335,42 @@ name=true]{% % a final optional argument % \begin{macrocode} \newcommand*{\@GLSpl}[2][]{% -\new@ifnextchar[{\@GLSpl@{#1}{#2}}{\@GLSpl@{#1}{#2}[]}} + \new@ifnextchar[{\@GLSpl@{#1}{#2}}{\@GLSpl@{#1}{#2}[]}% +} % \end{macrocode} %\begin{macro}{\@GLSpl} % Read in the final optional argument: % \begin{macrocode} \def\@GLSpl@#1#2[#3]{% -\glsdoifexists{#2}{\edef\@glo@type{\glsentrytype{#2}}% + \glsdoifexists{#2}% + {% + \edef\@glo@type{\glsentrytype{#2}}% % \end{macrocode} % Save options in \cs{@gls@link@opts} and label in \cs{@gls@link@label} % \begin{macrocode} -\def\@gls@link@opts{#1}% -\def\@gls@link@label{#2}% + \def\@gls@link@opts{#1}% + \def\@gls@link@label{#2}% % \end{macrocode} % Determine what the link text should be (this is stored in % \cs{@glo@text}) %\changes{1.12}{2008 Mar 8}{now uses 'glsentrydescplural and % 'glsentrysymbolplural instead of 'glsentrydesc and 'glsentrysymbol} % \begin{macrocode} -\ifglsused{#2}{\def\@glo@text{% -\csname gls@\@glo@type @display\endcsname -{\glsentryplural{#2}}{\glsentrydescplural{#2}}{% -\glsentrysymbolplural{#2}}{#3}}}{% -\def\@glo@text{% -\csname gls@\@glo@type @displayfirst\endcsname -{\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}{% -\glsentrysymbolplural{#2}}{#3}}}% + \ifglsused{#2}% + {% + \def\@glo@text{% + \csname gls@\@glo@type @display\endcsname + {\glsentryplural{#2}}{\glsentrydescplural{#2}}% + {\glsentrysymbolplural{#2}}{#3}% + }% + }% + {% + \def\@glo@text{% + \csname gls@\@glo@type @displayfirst\endcsname + {\glsentryfirstplural{#2}}{\glsentrydescplural{#2}}% + {\glsentrysymbolplural{#2}}{#3}% + }% + }% % \end{macrocode} % Call \cs{@gls@link}. % If \pkgopt{footnote} package option has been used and the glossary @@ -5108,21 +5383,33 @@ name=true]{% %\changes{2.04}{2009 November 10}{Changed test to check if glossary type %has been identified as a list of acronyms} % \begin{macrocode} -\ifglsused{#2}{% - \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% -}{% - \gls@checkisacronymlist\@glo@type - \ifthenelse{\(\boolean{@glsisacronymlist}\AND - \boolean{glsacrfootnote}\) \OR \NOT\boolean{glshyperfirst}}{% - \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}% - }{% - \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% - }% -}% + \ifglsused{#2}% + {% + \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% + }% + {% + \gls@checkisacronymlist\@glo@type + \ifthenelse + {% + \(\boolean{@glsisacronymlist}\AND \boolean{glsacrfootnote}\) + \OR \NOT\boolean{glshyperfirst}% + }% + {% + \@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}% + }% + {% + \@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}% + }% + }% % \end{macrocode} % Indicate that this entry has now been used % \begin{macrocode} -\glsunset{#2}}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi + }% } % \end{macrocode} %\end{macro} @@ -5206,7 +5493,11 @@ name=true]{% % Indicate that this entry has now been used %\changes{2.05}{2010 Feb 6}{Removed spurious brace. Patch provided by Sergiu Dotenco} % \begin{macrocode} - \glsunset{#2}% + \ifKV@glslink@local + \glslocalunset{#2}% + \else + \glsunset{#2}% + \fi }% } % \end{macrocode} @@ -8629,7 +8920,8 @@ you % \begin{macrocode} \ifcsdef{glo@#1@file}% {% - \expandafter\protected@write\csname glo@#1@file\endcsname{}{#2}% + \expandafter\protected@write\csname glo@#1@file\endcsname{% + \gls@disablepagerefexpansion}{#2}% }% {% \GlossariesWarning{No file defined for glossary `#1'}% @@ -8653,6 +8945,51 @@ you \fi } % \end{macrocode} +%\end{macro} +% +%\begin{macro}{\gls@protected@pagefmts} +%\changes{3.04}{2012-11-18}{new} +% List of page formats to be protected against expansion. +% \begin{macrocode} +\newcommand{\gls@protected@pagefmts}{% + \gls@numberpage,\gls@alphpage,\gls@Alphpage,\gls@romanpage +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@disablepagerefexpansion} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@disablepagerefexpansion}{% + \@for\@gls@this:=\gls@protected@pagefmts\do + {% + \expandafter\let\@gls@this\relax + }% +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@alphpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@alphpage}{\@alph\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@Alphpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@Alphpage}{\@Alph\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@numberpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@numberpage}{\number\c@page} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\gls@romanpage} +%\changes{3.04}{2012-11-18}{new} +% \begin{macrocode} +\newcommand*{\gls@romanpage}{\romannumeral\c@page} +% \end{macrocode} %\changes{1.17}{2008 December 26}{new} % Write the glossary entry in the appropriate format. % (Need to set \cs{@glsnumberformat} and \cs{@gls@counter} prior to use.) @@ -8660,10 +8997,41 @@ you %\changes{3.0}{2011/04/02}{modified to use new format} % \begin{macrocode} \newcommand*{\@@do@wrglossary}[1]{% + \begingroup +% First a bit of hackery to prevent premature +% expansion of \cs{c@page}. Store original definitions: +%\changes{3.04}{2012-11-18}{modified to compensate for possible +%incorrect page number} +% \begin{macrocode} + \let\orgnumber\number + \let\orgromannumeral\romannumeral + \let\orgalph\@alph + \let\orgAlph\@Alph % \end{macrocode} -% Get the location and escape any special characters +% Redefine: +% \begin{macrocode} + \def\the##1{% + \ifx##1\c@page \gls@numberpage\else\orgnumber##1\fi}% + \def\number##1{% + \ifx##1\c@page \gls@numberpage\else\orgnumber##1\fi}% + \def\romannumeral##1{% + \ifx##1\c@page \gls@romanpage\else\orgnumber##1\fi}% + \def\@alph##1{% + \ifx##1\c@page \gls@alphpage\else\orgnumber##1\fi}% + \def\@Alph##1{% + \ifx##1\c@page \gls@Alphpage\else\orgnumber##1\fi}% +% \end{macrocode} +% Prevent expansion: +% \begin{macrocode} + \gls@disablepagerefexpansion +% \end{macrocode} +% Now store location in \cs{@glslocref}: +% \begin{macrocode} + \protected@xdef\@glslocref{\theglsentrycounter}% + \endgroup +% \end{macrocode} +% Escape any special characters % \begin{macrocode} - \protected@edef\@glslocref{\theglsentrycounter}% \@gls@checkmkidxchars\@glslocref % \end{macrocode} % Check if the hyper-location is the same as the location and set @@ -8705,8 +9073,9 @@ you (indexentry :tkey (\csname glo@#1@index\endcsname) % \end{macrocode} %\changes{3.02}{2012/05/21}{changed \cs{@glslocref} to \cs{theglsentrycounter}} +%\changes{3.04}{2012-11-18}{changed \cs{theglsentrycounter} back to \cs{@glslocref}} % \begin{macrocode} - :locref \string"{\@glo@counterprefix}{\theglsentrycounter}\string" % + :locref \string"{\@glo@counterprefix}{\@glslocref}\string" % :attr \string"\@gls@counter\@glo@suffix\string" \@glo@range ) @@ -8723,7 +9092,7 @@ you % \begin{macrocode} \glossary[\csname glo@#1@type\endcsname]{% \string\glossaryentry{\csname glo@#1@index\endcsname - \@gls@encapchar\@glo@numfmt}{\theglsentrycounter}}% + \@gls@encapchar\@glo@numfmt}{\@glslocref}}% \fi } % \end{macrocode} @@ -9063,20 +9432,36 @@ you % \app{makeglossaries}. %\changes{3.0}{2011/04/02}{replaced \cs{@ifundefined} with %\cs{ifcsundef}} +%\changes{3.04}{2012-11-18}{Moved aux write to end of document to +%prevent unwanted whatsit occurring here.} % \begin{macrocode} \ifglsxindy \ifcsundef{@xdy@\@glo@type @language}% {% - \protected@write\@auxout{}{% - \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}% + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \noexpand\immediate\noexpand\write\@auxout{% + \string\@xdylanguage{\@glo@type}{\@xdy@main@language}}% + }% + }% }% {% - \protected@write\@auxout{}{% - \string\@xdylanguage{\@glo@type}{\csname @xdy@\@glo@type - @language\endcsname}}% + \edef\@do@auxoutstuff{% + \noexpand\AtEndDocument{% + \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\@gls@codepage{\@glo@type}{\gls@codepage}}% + }% }% - \protected@write\@auxout{}{% - \string\@gls@codepage{\@glo@type}{\gls@codepage}}% + \@do@auxoutstuff \fi \egroup % \end{macrocode} @@ -10647,10 +11032,14 @@ false,nolabel,autolabel}[nolabel]{% name={\noexpand\acronymfont{\the\glsshorttok}},% sort={\the\glsshorttok},% text={\noexpand\@glo@symbol},% - %plural={\noexpand\@glo@symbolplural},% +% \end{macrocode} +% Default to the short plural. +% \begin{macrocode} plural={\noexpand\@glo@shortpl},% first={\the\glslongtok},% - %firstplural={\the\glslongtok\noexpand\acrpluralsuffix},% +% \end{macrocode} +% Default to the long plural. +% \begin{macrocode} firstplural={\noexpand\@glo@longpl},% short={\the\glsshorttok},% shortplural={\the\glsshorttok\noexpand\acrpluralsuffix},% @@ -10659,7 +11048,9 @@ false,nolabel,autolabel}[nolabel]{% description={\noexpand\@glo@first},% descriptionplural={\noexpand\@glo@firstplural},% symbol={\the\glsshorttok},% - %symbolplural={\the\glsshorttok\noexpand\acrpluralsuffix},% +% \end{macrocode} +% Default to the short plural. +% \begin{macrocode} symbolplural={\noexpand\@glo@shortpl},% \the\glskeylisttok }% @@ -11958,7 +12349,7 @@ false,nolabel,autolabel}[nolabel]{% % \ics{item} command, it will appear in a bold font by % default. % \begin{macrocode} -\ProvidesPackage{glossary-list}[2012/09/21 v3.03 (NLCT)] +\ProvidesPackage{glossary-list}[2012/11/11 v3.04 (NLCT)] % \end{macrocode} %\begin{style}{list} % The \glostyle{list} glossary style @@ -12061,7 +12452,14 @@ false,nolabel,autolabel}[nolabel]{% % line break after the entry name: % \begin{macrocode} \renewcommand*{\glossaryentryfield}[5]{% - \item[\glsentryitem{##1}\glstarget{##1}{##2}]\mbox{}\newline + \item[\glsentryitem{##1}\glstarget{##1}{##2}]% +% \end{macrocode} +%\changes{3.04}{2012-11-11}{replaced \cs{newline} with paragraph break} +% Version 3.04 changed \cs{newline} to the following paragraph break +% stuff (thanks to Daniel Gebhardt for supplying the fix) to prevent +% a page break occurring at this point. +% \begin{macrocode} + \mbox{}\par\nobreak\@afterheading ##3\glspostdescription\space ##5}% % \end{macrocode} % Sub-entries start a new paragraph: @@ -19617,7 +20015,7 @@ This page discusses \gls{mcnemar} who introduced % Redefine the page numbers so that they appear as a word: - \renewcommand*{\thepage}{\Numberstring{page}} + \renewcommand*{\thepage}{\texorpdfstring{\Numberstring{page}}{\arabic{page}}} % Need to add this to the list of location styles. % \Numberstring{page} gets expanded to @@ -19744,7 +20142,7 @@ description={SI unit of electric current named after first={Archimedes of Syracuse},text={Archimedes}, description={Greek mathematician}} -\newglossaryentry{archimedesprinciple}{name={Archemedes' principle}, +\newglossaryentry{archimedesprinciple}{name={Archimedes' principle}, description={Principle that if a body is submerged in a fluid it experiences upthrust equal to the weight of the displaced fluid. Named after \gls{archimedes}}} @@ -19761,6 +20159,11 @@ description={German mathematician}} description={Complex number where both real and imaginary parts are integers}} +\newglossaryentry{gaussianfn}{name={Gaussian function}, + description={A function of the form: + \[f(x) = a \exp\left(-\frac{(x-b)^2}{2c^2}\right)\] + for some constants $a$, $b$ and $c$}} + \newglossaryentry{peano}{name={Peano, Giuseppe}, first={Giuseppe Peano},text={Peano}, description={Italian mathematician}} @@ -19787,7 +20190,12 @@ coefficient named after \gls{pearson}}} This is a section on \gls[format=(]{gauss}. This section spans several pages. -\newpage +\rule{1pt}{0.6\textheight} + +This paragraph has been shoved to the bottom of the page using a rule. +This paragraph spans a page break for testing purposes to ensure the +glossary entry in this paragraph has the correct location. Here's +the glossary entry: \gls{gaussianfn}. This page talks about \glspl[format=hyperbfit]{gaussianint}. Since it's the principle definition, the user-defined hyperbfit format is diff --git a/Master/texmf-dist/source/latex/glossaries/glossaries.ins b/Master/texmf-dist/source/latex/glossaries/glossaries.ins index a9c1d0ce4e6..1bede15922b 100644 --- a/Master/texmf-dist/source/latex/glossaries/glossaries.ins +++ b/Master/texmf-dist/source/latex/glossaries/glossaries.ins @@ -1,4 +1,4 @@ -% glossaries.ins generated using makedtx version 0.94b 2012/9/21 14:41 +% glossaries.ins generated using makedtx version 0.94b 2012/11/18 20:04 \input docstrip \preamble |