diff options
author | Karl Berry <karl@freefriends.org> | 2014-09-02 22:45:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-09-02 22:45:52 +0000 |
commit | 681bba2f19e49a82af83d8db5ca7b2ca9b1c38c1 (patch) | |
tree | e555f1749d48be4428e80ad707fc5e22c1d1e5ba /Master/texmf-dist/source/latex/glossaries/glossaries.dtx | |
parent | 5948707e26c041128969126837b023209fd7a6ac (diff) |
glossaries (2sep14)
git-svn-id: svn://tug.org/texlive/trunk@35094 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 | 182 |
1 files changed, 118 insertions, 64 deletions
diff --git a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx index 7d645e5acd0..14ab4e75bbc 100644 --- a/Master/texmf-dist/source/latex/glossaries/glossaries.dtx +++ b/Master/texmf-dist/source/latex/glossaries/glossaries.dtx @@ -31,7 +31,7 @@ % -author "Nicola Talbot" % -codetitle "Main Package Code" % glossaries -% Created on 2014/8/27 15:20 +% Created on 2014/9/1 21:18 %\fi %\iffalse %<*package> @@ -141,7 +141,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of \setcounter{IndexColumns}{2} -\CheckSum{18625} +\CheckSum{18645} \newcommand*{\ifirstuse}{\iterm{first use}} \newcommand*{\firstuse}{\gls{firstuse}} @@ -169,12 +169,12 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of %\MakeShortVerb{"} %\DeleteShortVerb{\|} % -% \title{Documented Code For glossaries v4.10} +% \title{Documented Code For glossaries v4.11} % \author{Nicola L.C. Talbot\\[10pt] %Dickimaw Books\\ %\url{http://www.dickimaw-books.com/}} % -% \date{2014-08-27} +% \date{2014-09-01} % \maketitle % %This is the documented code for the \styfmt{glossaries} package. @@ -190,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.10: +%For the main user guide, read \qt{glossaries.sty v4.11: %\LaTeX2e\ Package to Assist Generating Glossaries}. % %\item[\url{mfirstuc-manual.pdf}] @@ -209,6 +209,21 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of % %\end{description} % +%The user level commands described in the user manual +%(glossaries-user.pdf) may be considered ``future-proof''. Even if +%they become deprecated, they should still work for +%old documents (although they may not work in a document that also +%contains new commands introduced since the old commands were +%deprecated, and you may need to specify a compatibility mode). +% +%The internal commands in \emph{this} document that aren't documented in the +%\emph{user manual} should not be considered future-proof and are liable to +%change. If you want a new user level command, you can post a feature +%request at \url{http://www.dickimaw-books.com/feature-request.html}. +%If you are a package writer wanting to integrate your package with +%\styfmt{glossaries}, it's better to request a new user level command +%than to hack these internals. +% %\clearpage %\tableofcontents % @@ -234,7 +249,7 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of % This package requires \LaTeXe. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{glossaries}[2014/08/27 v4.10 (NLCT)] +\ProvidesPackage{glossaries}[2014/09/01 v4.11 (NLCT)] % \end{macrocode} % Required packages: % \begin{macrocode} @@ -276,6 +291,9 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of %\begin{macro}{\if@gls@docloaded} % \begin{macrocode} \newif\if@gls@docloaded +% \end{macrocode} +%\end{macro} +% \begin{macrocode} \@ifpackageloaded{doc}% {% \@gls@docloadedtrue @@ -286,53 +304,10 @@ governed by the \gloskey{first} and \gloskey{firstplural} keys of \if@gls@docloaded % \end{macrocode} % \cs{doc} 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 \endgroup\@esphack - } -% \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} -%\changes{3.09a}{2013-10-09}{Add a fix for \cs{RecordChanges}} -% \begin{macrocode} - \renewcommand*{\RecordChanges}{% - \newwrite\@glossaryfile - \immediate\openout\@glossaryfile=\jobname.glo - \def\glsorg@glossary{\@bsphack\begingroup\@sanitize\glsorg@wrglossary}% - \typeout{Writing glossary file \jobname .glo}% - } -% \end{macrocode} -%\end{macro} -%\begin{macro}{\changes} -% Now we need to redefine \cs{changes} so that it uses the original -% definition of \cs{glossary}. (As from v4.10, this isn't actually -% needed any more, but it's kept for backward compatibility.) -% \begin{macrocode} - \let\glsorg@changes\changes - \renewcommand{\changes}[3]{% - \begingroup - \let\glossary\glsorg@glossary - \glsorg@changes{#1}{#2}{#3}% - \endgroup - } -% \end{macrocode} -%\end{macro} +% ensure both packages can work together. The amount of conflict has +% been reduced as from v4.11 and no longer involves patching +% internal commands. +% %\cs{PrintChanges} needs to use \sty{doc}'s version of %\env{theglossary}, so save that. %\begin{macro}{\glsorg@theglossary} @@ -1559,12 +1534,18 @@ false,nolabel,autolabel,nameref}[nolabel]{% % %\begin{option}{sanitize} % \changes{4.02}{2013-12-05}{fixed bug that caused an error here} +% \changes{4.11}{2014-09-01}{fixed backward compatibility support of +% deprecated sanitize=none option} % \begin{macrocode} -\define@key{glossaries.sty}{sanitize}[description=true,symbol=true, -name=true]{% +\define@key{glossaries.sty}{sanitize}[description=true,symbol=true,name=true]{% \ifthenelse{\equal{#1}{none}}% {% \GlossariesWarning{sanitize package option deprecated}% + \glssetexpandfield{name}% + \glssetexpandfield{symbol}% + \glssetexpandfield{symbolplural}% + \glssetexpandfield{desc}% + \glssetexpandfield{descplural}% }% {% \setkeys[gls]{sanitize}{#1}% @@ -10373,6 +10354,15 @@ name=true]{% \edef\glsclosebrace{\expandafter\@gobble\string\}} % \end{macrocode} %\end{macro} +% +%\begin{macro}{\glsbackslash} +%\changes{4.11}{2014-09-01}{new} +% Define \cs{glsbackslash} to make it easier to write a backslash to a file. +% \begin{macrocode} +\edef\glsbackslash{\expandafter\@gobble\string\\} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\glsquote} % Define command that makes it easier to write quote marks to % a file in the event that the double quote character has been @@ -11382,14 +11372,30 @@ you % \end{macrocode} %\end{macro} % -% As from v4.10, the \cs{glossary} command is no longer redefined -% and no longer used by the \styfmt{glossaries} package. Since the +% As from v4.10, the \cs{glossary} command is +% used by the \styfmt{glossaries} package. Since the % user isn't expected to use this command (as \styfmt{glossaries} % takes care of the particular format required for % \gls{makeindex}\slash\gls{xindy}) there's no need for a user level % command. Using a custom internal command prevents any conflict % with other packages (and with the \cs{mark} mechanism). % +% In v4.10, the redefinition of \cs{glossary} was removed since it +% wasn't intended as a user level command, however it +% seems there are packages that have hacked the internal macros used +% by \styfmt{glossaries} and no longer work with this redefinition +% removed, so it's been restored in v4.11 but is not used at all by +% \styfmt{glossaries}. (This may be removed or moved to a +% compatibility mode in future.) +%\begin{macro}{\glossary} +% \begin{macrocode} +\if@gls@docloaded +\else + \renewcommand*{\glossary}[1][main]{\gls@glossary{#1}} +\fi +% \end{macrocode} +%\end{macro} +% % The associated number should be stored in \cs{theglsentrycounter} % before using \cs{gls@glossary}. %\begin{macro}{\gls@glossary} @@ -11403,40 +11409,41 @@ you %\begin{macro}{\@gls@glossary} % (In v4.10, \cs{@glossary} was redefined to \cs{@gls@glossary} to % avoid conflict with other packages.) -% Define internal \cs{@glossary} to ignore its argument. +% Define internal \cs{@gls@glossary} to ignore its argument. % This gets redefined in \cs{@makeglossary}. This is % defined to just \cs{index} as \cls{memoir} changes the definition of % \cs{@index}. (Thanks to Dan Luecking for pointing this out.) -%\begin{macro}{\gls@glossary} %\changes{1.17}{2008 December 26}{changed definition to use %\cs{index} instead of \cs{@index}} %\changes{4.10}{2014-08-27}{Renamed \cs{@glossary} to \cs{@gls@glossary}} +% The argument \verb|#1| is the glossary type. % \begin{macrocode} \newcommand*{\@gls@glossary}[1]{\index} % \end{macrocode} %\end{macro} -%\end{macro} % This is a convenience command to set \cs{@gls@glossary}. % It's used by \cs{@makeglossary} and then redefined to % do nothing, as it only needs to be done once. %\begin{macro}{\@gls@renewglossary} % \begin{macrocode} \newcommand{\@gls@renewglossary}{% - \gdef\@gls@glossary##1{\@bsphack\begingroup\@wrglossary{##1}}% + \gdef\@gls@glossary##1{\@bsphack\begingroup\gls@wrglossary{##1}}% \let\@gls@renewglossary\@empty } % \end{macrocode} %\end{macro} -% The \cs{@wrglossary} command is redefined to have +% The \cs{gls@wrglossary} command is defined to have % two arguments. The first argument is the glossary type, % the second argument is the glossary entry % (the format of which is set in \cs{glslink}). -%\begin{macro}{\@wrglossary} +%\begin{macro}{\gls@wrglossary} %\changes{1.17}{2008 December 26}{modified to allow for xindy support} %\changes{3.0}{2010 Jul 12}{modified to take into account %\pkgopt{savewrites}} +%\changes{4.11}{2014-09-01}{renamed from \cs{@wrglossary} to +%\cs{gls@wrglossary}} % \begin{macrocode} -\renewcommand*{\@wrglossary}[2]{% +\newcommand*{\gls@wrglossary}[2]{% \ifglssavewrites \protected@edef\@gls@tmp{\the\csname glo@#1@filetok\endcsname#2}% \expandafter\global\expandafter\csname glo@#1@filetok\endcsname @@ -11528,6 +11535,48 @@ you \newcommand*{\gls@Romanpage}{\@Roman\c@page} % \end{macrocode} %\end{macro} +% +%\begin{macro}{\glsaddprotectedpagefmt} +%\begin{definition} +%\cs{glsaddprotectedpagefmt}\marg{cs name} +%\end{definition} +% Added a page format to the list of protected page formats. +% The argument should be the name (without a backslash) of the +% command that takes a \TeX\ register as the argument +% (\verb|\|\meta{csname}\verb|\c@page| must be valid). +%\changes{4.11}{2014-09-01}{new} +% \begin{macrocode} +\newcommand*{\glsaddprotectedpagefmt}[1]{% + \eappto\gls@protected@pagefmts{,\expandonce{\csname gls#1page\endcsname}}% + \csedef{gls#1page}{\expandonce{\csname#1\endcsname}\noexpand\c@page}% + \eappto\@wrglossarynumberhook{% + \noexpand\let\expandonce{\csname org@gls#1\endcsname}% + \expandonce{\csname#1\endcsname}% + \noexpand\def\expandonce{\csname#1\endcsname}{% + \noexpand\@wrglossary@pageformat + \expandonce{\csname gls#1page\endcsname}% + \expandonce{\csname org@gls#1\endcsname}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@wrglossarynumberhook} +% Hook used by \cs{@@do@wrglossary} +% \begin{macrocode} +\newcommand*\@wrglossarynumberhook{} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\@wrglossary@pageformat} +% \begin{macrocode} +\newcommand{\@wrglossary@pageformat}[3]{% + \ifx#3\c@page #1\else #2#3\fi +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\@@do@wrglossary} %\changes{1.17}{2008 December 26}{new} % Write the glossary entry in the appropriate format. @@ -11566,6 +11615,11 @@ you \def\@Alph##1{% \ifx##1\c@page \gls@Alphpage\else\orgAlph##1\fi}% % \end{macrocode} +% Add hook to allow for other number formats: +%\changes{4.11}{2014-09-01}{added hook} +% \begin{macrocode} + \@wrglossarynumberhook +% \end{macrocode} % Prevent expansion: % \begin{macrocode} \gls@disablepagerefexpansion |