diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltcounts.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltcounts.dtx | 120 |
1 files changed, 112 insertions, 8 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltcounts.dtx b/Master/texmf-dist/source/latex/base/ltcounts.dtx index 4ccd7e9a043..935f5f4c11b 100644 --- a/Master/texmf-dist/source/latex/base/ltcounts.dtx +++ b/Master/texmf-dist/source/latex/base/ltcounts.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 +% Copyright 1993-2015 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltcounts.dtx} - [1998/05/16 v1.1g LaTeX Kernel (Counters)] + [2015/01/10 v1.1h LaTeX Kernel (Counters)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltcounts.dtx} @@ -49,13 +49,14 @@ Rainer Sch\"opf} \begin{document} -\maketitle + \MaintainedByLaTeXTeam{latex} + \maketitle \DocInput{\filename} \end{document} %</driver> % \fi % -% \CheckSum{256} +% \CheckSum{373} % % \changes{v1.0c}{1994/03/29} % {Create file from parts of ltmiscen and ltherest.} @@ -252,8 +253,21 @@ % \end{macro} % % \begin{macro}{\@stpelt} +% \changes{v1.1h}{2015/01/10}{Reset all within counters in one go (latexrelease)} +% +% Rather than resetting the ``within'' counter to zero we set it to +% $-1$ and then run |\stepcounter| that moves it to $0$ and also +% initiates resetting the next level down. % \begin{macrocode} -\def\@stpelt#1{\global\csname c@#1\endcsname \z@} +%</2ekernel> +%<latexrelease>\IncludeInRelease}{2015/01/01}{\@stpelt}{% +%<*2ekernel|latexrelease> +\def\@stpelt#1{\global\csname c@#1\endcsname \m@ne\stepcounter{#1}}% +%</2ekernel|latexrelease> +%<latexrelease>} +%<latexrelease>\def\@stpelt#1{\global\csname c@#1\endcsname \z@}% +%<latexrelease>} +%<*2ekernel> % \end{macrocode} % \end{macro} % @@ -418,13 +432,103 @@ % \changes{v1.1b}{1995/05/20}{Allowing both text and math} % Typesetting old fashioned footnote symbols. % This can be done both in text or math mode now. +% +% \changes{v1.1h}{2015/01/10}{Unse \cs{TextOrMath} (latexrelease)} +% This macro is another example of an ever recurring problem in +% \TeX: Determining if something is text-mode or math-mode. It is +% imperative for the decision between text and math to be delayed +% until the actual typesetting is done as the code in question may +% go through an |\edef| or |\write| where an |\ifmmode| test would +% be executed prematurely. Hence in the implementation below, +% |\@fnsymbol| is not robust in itself but the parts doing the +% actual typesetting are. +% +% In the case of |\@fnsymbol| we make use of the robust command +% |\TextOrMath| which takes two arguments and typesets the first if +% in text-mode and the second if in math-mode. Note that in order +% for this command to make the correct decision, it must insert a +% |\relax| token if run under regular \TeX, which ruins any kerning +% between the preceding characters and whatever awaits +% typesetting. If you use e\TeX\ as engine for \LaTeX\ (as +% recommended) this unfortunate side effect is not present. % \begin{macrocode} -\def\@fnsymbol#1{\ensuremath{\ifcase#1\or *\or \dagger\or \ddagger\or - \mathsection\or \mathparagraph\or \|\or **\or \dagger\dagger - \or \ddagger\ddagger \else\@ctrerr\fi}} +%</2ekernel> +%<latexrelease>\IncludeInRelease{2015/01/01}{\@fnsymbol}{Use \TexOrMath}% +%<*2ekernel|latexrelease> +\def\@fnsymbol#1{% + \ifcase#1\or \TextOrMath\textasteriskcentered *\or + \TextOrMath \textdagger \dagger\or + \TextOrMath \textdaggerdbl \ddagger \or + \TextOrMath \textsection \mathsection\or + \TextOrMath \textparagraph \mathparagraph\or + \TextOrMath \textbardbl \|\or + \TextOrMath {\textasteriskcentered\textasteriskcentered}{**}\or + \TextOrMath {\textdagger\textdagger}{\dagger\dagger}\or + \TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}\else + \@ctrerr \fi +}% +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}{\@fnsymbol}{Use \TexOrMath}% +%<latexrelease>\def\@fnsymbol#1{\ensuremath{% +%<latexrelease> \ifcase#1\or *\or \dagger\or \ddagger\or \mathsection\or +%<latexrelease> \mathparagraph\or \|\or **\or \dagger\dagger +%<latexrelease> \or \ddagger\ddagger \else\@ctrerr\fi}}% +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % +% \begin{macro}{\TextOrMath} +% \changes{v1.1h}{2015/01/11}{Add command to solve robustness +% issues (pr/3752) (latexrelease)} +% When using regular \TeX, we make this command robust so that it +% always selects the correct branch in an |\ifmmode| switch with +% the usual disadvantage of ruining kerning. For the application we +% use it for here that shouldn't matter. The alternative would be +% to mimic |\IeC| from \textsf{inputenc} but then it wil have the +% disadvantage of choosing the wrong branch if appearing at the +% beginning of an alignment cell. However, users of e\TeX\ will be +% pleasantly surprised to get the best of both worlds and no bad +% side effects. +% +% First some code for checking if we are running e\TeX\ but making +% sure not to permanently turn |\eTeXversion| into |\relax|. +% \begin{macrocode} +%</2ekernel> +%<latexrelease>\IncludeInRelease{2015/01/01}{\TextOrMath}{\TextOrMath}% +%<*2ekernel|latexrelease> +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname eTeXversion\endcsname\relax +% \end{macrocode} +% In case of ordinary \TeX\ we define |\TextOrMath| as a robust +% command but make sure it always grabs its arguments. If we didn't do +% this it might very well gobble spaces in the input stream. +% \begin{macrocode} +\DeclareRobustCommand\TextOrMath{% + \ifmmode \expandafter\@secondoftwo + \else \expandafter\@firstoftwo \fi} +\protected@edef\TextOrMath#1#2{\TextOrMath{#1}{#2}} +\else +% \end{macrocode} +% For e\TeX\ the situation is similar. The robust macro is a hidden +% one so that we again avoid problems of gobbling spaces in the input. +% \begin{macrocode} +\protected\expandafter\def\csname TextOrMath\space\endcsname{% + \ifmmode \expandafter\@secondoftwo + \else \expandafter\@firstoftwo \fi} +\edef\TextOrMath#1#2{% + \expandafter\noexpand\csname TextOrMath\space\endcsname + {#1}{#2}} +\fi +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}{\TextOrMath}{\TextOrMath}% +%<latexrelease>\let\TextOrMath\@undefined +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% \end{macro} % % \begin{macrocode} %</2ekernel> |