diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/base/fixltx2e.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/base/fixltx2e.dtx | 377 |
1 files changed, 349 insertions, 28 deletions
diff --git a/Master/texmf-dist/source/latex/base/fixltx2e.dtx b/Master/texmf-dist/source/latex/base/fixltx2e.dtx index a55e295fcac..8c9a12996f0 100644 --- a/Master/texmf-dist/source/latex/base/fixltx2e.dtx +++ b/Master/texmf-dist/source/latex/base/fixltx2e.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 +% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 % The LaTeX3 Project and any individual authors listed elsewhere % in this file. % @@ -8,12 +8,12 @@ % ------------------------------------------- % % It may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% conditions of the LaTeX Project Public License, either version 1.3c % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX -% version 2003/12/01 or later. +% and version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. % % This file has the LPPL maintenance status "maintained". % @@ -38,7 +38,7 @@ %<driver>\ProvidesFile{fixltx2e.drv} % \fi % \ProvidesFile{fixltx2e.dtx} - [2004/02/13 v1.1h fixes to LaTeX] + [2006/03/24 v1.1n fixes to LaTeX] % % \iffalse %<*driver> @@ -54,7 +54,7 @@ %</driver> % \fi % -% \CheckSum{896} +% \CheckSum{1077} % %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -426,7 +426,7 @@ %\end{verbatim} % % -% \subsection{No hyphenation in first word after float environment(pr/3498)} +% \subsection{No hyphenation in first word after float environment (pr/3498)} % %\begin{verbatim} % >Number: 3498 @@ -579,6 +579,147 @@ % The packages \Lpack{type1cm} and \Lpack{type1ec} must not be loaded % additionally; they enable only continuous scaling. % +% +% +% \section{Fixes added for 2005/12/01} +% +% \subsection{\texttt{\textbackslash textsubscript} not defined in +% latex.ltx (pr/3492)} +% +%\begin{verbatim} +% >Number: 3492 +% >Category: latex +% >Synopsis: \textsubscript not defined in latex.ltx +% >Arrival-Date: Tue Jan 14 23:01:00 CET 2003 +% >Originator: tgakic@chem.tue.nl (Ionel Mugurel Ciobica) +% +% I use \textsubscript much more often than \textsuperscript, and +% \textsubscript it is not defined in latex.ltx. Could you please +% consider including the definition of \textsubscript in the latex.ltx +% for the next versions of LaTeX. Thank you. +%\end{verbatim} +% +% \subsection{\texttt{\textbackslash DeclareMathSizes} only take pts. +% (pr/3693)} +% +%\begin{verbatim} +% >Number: 3693 +% >Category: latex +% >Synopsis: \DeclareMathSizes only take pts. +% >Arrival-Date: Fri Jun 11 16:21:00 CEST 2004 +% >Originator: moho01ab@student.cbs.dk (Morten Hoegholm) +% +% The last three arguments of \@DeclareMathSizes cannot take a dimension +% as argument, making it inconsistent with the rest of the font changing +% commands and itself, as the second argument can take a dimension +% specification. +%\end{verbatim} +% +% \subsection{\texttt{\textbackslash addpenalty} ruins flush-bottom (pr/3073)} +% +%\begin{verbatim} +% >Number: 3073 +% >Category: latex +% >Synopsis: \addpenalty ruins flush-bottom +% >Arrival-Date: 20 Oct 2005 14:46:35 -0700 +% >Originator: asnd@triumf.ca (Donald Arseneau) +% >Description: +% The (revised) definition of \addpenalty has been +% incorporated into fixltx2e, but now Plamen Tanovski has found a +% problem: since the \vskip is increased by the previous depth, +% consecutive \addpenalty and \addvspace commands keep enlarging +% the \vskip. +%\end{verbatim} +% +% \subsection{\texttt{\textbackslash footnotemark[x]} crashes with fixltx2e.sty +% (pr/3752)} +% +%\begin{verbatim} +% >Number: 3752 +% >Category: tools +% >Synopsis: feature \footnotemark[x] crashes with fixltx2e.sty +% >Arrival-Date: Fri Dec 17 10:11:00 +0100 2004 +% >Originator: stefan.pofahl@zsw-bw.de (Stefan Pofahl) +% +% If I use /fnsymbol together with fixltx2e.sty I can not use +% optinal parameter [num] +% \footnotemark[1] is not showing the mark number 1 but +% the mark \value{footnote}. +%\end{verbatim} +% This bug was related to pr/3400, where |\@fnsymbol| was made robust. +% +% \subsubsection{Notes on the implementation strategy} +% +% Pr/3400 made |\@fnsymbol| decide between text-mode and math-mode, +% which requires a certain level of robustness somewhere as the +% decision between text and math must be made at typesetting time and +% not when inside |\protected@edef| or similar commands. One way of +% dealing with this is to make sure the value seen by |\@fnsymbol| is +% a fully expanded number, which could be handled by code such as +% \begin{verbatim} +% \def\fnsymbol#1{\expandafter\@fnsymbol +% \expandafter{\the\csname c@#1\endcsname}} +% \end{verbatim} +% This would be a good solution if everybody used the high level +% commands only by writing code like |\fnsymbol{footnote}|. Unfortunately +% many classes (including the standard classes) and packages use the +% internal forms directly as in |\@fnsymbol\c@footnote| so the easy +% solution of changing |\fnsymbol| would break code that had worked for +% the past 20~years. +% +% Therefore the implementation here makes |\@fnsymbol| itself a +% non-robust command again and instead uses a new robust command +% \DescribeMacro{\TextOrMath}|\TextOrMath|, which will take care of +% typesetting either the math or the text symbol. In order to do so, +% we face an age old problem and unsolvable problem in \TeX: A +% reliable test for math mode that doesn't destroy +% kerning. Fortunately this problem can be solved when using e\TeX\ so +% if you use this as engine for your \LaTeX\ format, as recommended by +% the \LaTeX3 Project, you will get a fully functioning |\TextOrMath| +% command with no side effects. If you use regular \TeX\ as engine for +% your \LaTeX\ format then we have to choose between the lesser of two +% evils: 1)~breaking ligatures and preventing kerning or 2)~face the +% risk of choosing text-mode at the beginning of an alignment cell, +% which was suppodes to be math-mode. We have decided upon 1) as is +% costumary for regular robust commands in \LaTeX. +% +% +% \subsection{Fewer fragile commands} +% +%\begin{verbatim} +% >Number: 3816 +% >Category: latex +% >Synopsis: Argument of \@sect has an extra }. +% >Arrival-Date: Sat Oct 22 23:11:01 +0200 2005 +% >Originator: susi@uriah.heep.sax.de (Susanne Wunsch) +% +% Use of a \raisebox in \section{} produces the error message +% mentioned in the subject. +% +% PR latex/1738 descriped a similar problem, which has been solved +% 10 years ago. Protecting the \raisebox with \protect solved my +% problem as well, but wouldn't it make sense to have a similar fix +% as in the PR? +% +% It is particulary confusing, that an unprotected \raisebox in a +% \section*-environment works fine, while in a \section-environment +% produces error. +%\end{verbatim} +% +% While not technically a bug, in this day and age there are few +% reasons why commands taking optional arguments should not be robust. +% +% \subsubsection{Notes on the implementation strategy} +% +% Rather than changing the kernel macros to be robust, we have decided +% to add the macro \DescribeMacro{\MakeRobust}|\MakeRobust| in +% \Lpack{fixltx2e} so that users can easily turn fragile macros into +% robust ones. A macro |\foo| is made robust by doing the simple +% |\MakeRobust{\foo}|. \Lpack{fixltx2e} makes the following kernel +% macros robust: |\(|, |\)|, |\[|, |\]|, |\makebox|, |\savebox|, +% |\framebox|, |\parbox|, |\rule| and |\raisebox|. +% +% % \StopEventually{} % % \section{Implementation} @@ -1077,7 +1218,11 @@ % (pr/3073)} % % \begin{macro}{\addpenalty} -% Fix provided by Donald (though the original fix was not good enough). +% Fix provided by Donald (though the original fix was not good +% enough). In 2005 Plamen Tanovski discovered that this fix wasn't +% good enough either as the \cs{vskip} kept getting bigger if +% several \cs{addpenalty} commands followed each other. Donald +% kindly send a new fix. % \begin{macrocode} \def\addpenalty#1{% \ifvmode @@ -1089,8 +1234,16 @@ \penalty#1\relax \else \@tempskipb\lastskip - \advance \@tempskipb - \ifdim\prevdepth>\maxdepth\maxdepth\else +% \end{macrocode} +% \changes{v1.1l}{2005/11/10}{Add the correct \cs{vskip}} +% We have to make sure the final \cs{vskip} seen by \TeX\ is the +% correct one, namely \cs{@tempskipb}. However we may have to +% adjust for \cs{prevdepth} when placing the penalty but that +% should not affect the skip we pass on to \TeX. +% \begin{macrocode} + \begingroup + \advance \@tempskipb + \ifdim\prevdepth>\maxdepth\maxdepth\else % \end{macrocode} % If |\prevdepth| is -1000pt due to |\nointerlineskip| we better % not add it! @@ -1099,9 +1252,12 @@ % \begin{macrocode} \ifdim \prevdepth = -\@m\p@ \z@ \else \prevdepth \fi \fi + \vskip -\@tempskipb + \penalty#1% + \vskip\@tempskipb + \endgroup \vskip -\@tempskipb - \penalty#1% - \vskip\@tempskipb + \vskip \@tempskipb \fi \fi \fi @@ -1115,25 +1271,86 @@ % % \subsection{\texttt{\textbackslash fnsymbol} should use text symbols % if possible (pr/3400)} -% +% \begin{macro}{\@fnsymbol} +% +% 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{% + \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 +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\TextOrMath} +% \changes{v1.1m}{2006/01/08}{Add command to solve robustness +% issues (pr/3752)} +% 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} -\DeclareRobustCommand{\@fnsymbol}[1]{% - \ifmmode - \ifcase#1\or *\or\dagger\or \ddagger\or - \mathsection\or \mathparagraph\or \|\or **\or - \dagger\dagger - \or \ddagger\ddagger \else\@ctrerr\fi - \else - \ifcase#1\or \textasteriskcentered\or \textdagger\or - \textdaggerdbl\or \textsection\or \textparagraph\or - \textbardbl\or \textasteriskcentered\textasteriskcentered\or - \textdagger\textdagger\or \textdaggerdbl\textdaggerdbl - \else\@ctrerr\fi - \fi} +\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 +% \end{macrocode} +% \end{macro} % % \subsection{No hyphenation in first word after float environment(pr/3498)} % +% \begin{macro}{\@esphack} +% \begin{macro}{\@Esphack} % Fix suggested by Donald Arseneau. % \changes{v1.1g}{2003/09/19}{Fix for \cs{@esphack} (pr/3498)} % \changes{v1.1h}{2004/02/13}{Fix for \cs{@Esphack} (pr/3498)} @@ -1161,11 +1378,13 @@ \fi \fi} % \end{macrocode} -% +% \end{macro} +% \end{macro} % % \subsection{Allowing \texttt{\textbackslash emph} to produce small % caps, etc} -% +% \begin{macro}{\em} +% \begin{macro}{\eminnershape} % \changes{v1.1g}{2003/09/19}{Allow \cs{emph} to produce small caps} % \begin{macrocode} \DeclareRobustCommand\em @@ -1173,6 +1392,108 @@ \eminnershape \else \itshape \fi} \def\eminnershape{\upshape} % \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsection{\texttt{\textbackslash textsubscript} not defined in +% latex.ltx (pr/3492)} +% +% \begin{macro}{\textsubscript} +% \changes{v1.1j}{2005/07/13}{Add \cs{textsubscript}} +% \changes{v1.1k}{2005/09/29}{Fixed blank lines} +% This macro is almost identical to \cs{textsuperscript} from the +% kernel. +% \begin{macrocode} +\DeclareRobustCommand*\textsubscript[1]{% + \@textsubscript{\selectfont#1}} +\def\@textsubscript#1{% + {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}} +% \end{macrocode} +% \end{macro} +% +% \subsection{\texttt{\textbackslash DeclareMathSizes} only take pts. +% (pr/3693)} +% +% \begin{macro}{\@DeclareMathSizes} +% \changes{v1.1k}{2005/09/29}{Fixed blank lines} +% This fix given by Michael J. Downes on comp.text.tex on 2002/10/17 +% allows the user to have settings such as +% \verb=\DeclareMathSizes{9.5dd}{9.5dd}{7.4dd}{6.6dd}=. +% \begin{macrocode} +\def\@DeclareMathSizes #1#2#3#4#5{% + \@defaultunits\dimen@ #2pt\relax\@nnil + \if $#3$% + \expandafter\let\csname S@\strip@pt\dimen@\endcsname\math@fontsfalse + \else + \@defaultunits\dimen@ii #3pt\relax\@nnil + \@defaultunits\@tempdima #4pt\relax\@nnil + \@defaultunits\@tempdimb #5pt\relax\@nnil + \toks@{#1}% + \expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{% + \gdef\noexpand\tf@size{\strip@pt\dimen@ii}% + \gdef\noexpand\sf@size{\strip@pt\@tempdima}% + \gdef\noexpand\ssf@size{\strip@pt\@tempdimb}% + \the\toks@ + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Fewer fragile macros} +% +% \begin{macro}{\MakeRobust} +% \changes{v1.1n}{2006/03/24}{Added macro} +% +% The macro firstly checks if the controls sequence in question exists +% at all. +% \begin{macrocode} +\providecommand*\MakeRobust[1]{% + \@ifundefined{\expandafter\@gobble\string#1}{% + \@latex@error{The control sequence `\string#1' is undefined!% + \MessageBreak There is nothing here to make robust}% + \@eha + }% +% \end{macrocode} +% Then we check if the macro is already robust. We do this by testing +% if the internal name for a robust macro is defined, namely +% \verb*=\foo =. If it is already defined do nothing, otherwise set +% \verb*=\foo = equal to \verb*=\foo= and redefine \verb*=\foo= so +% that it acts like a macro defined with \verb=\DeclareRobustCommand=. +% \begin{macrocode} + {% + \@ifundefined{\expandafter\@gobble\string#1\space}% + {% + \expandafter\let\csname + \expandafter\@gobble\string#1\space\endcsname=#1% + \edef\reserved@a{\string#1}% + \def\reserved@b{#1}% + \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}% + \edef#1{% + \ifx\reserved@a\reserved@b + \noexpand\x@protect\noexpand#1% + \fi + \noexpand\protect\expandafter\noexpand + \csname\expandafter\@gobble\string#1\space\endcsname}% + }% + {\@latex@info{The control sequence `\string#1' is already robust}}% + }% +} +% \end{macrocode} +% \end{macro} +% Here we make some kernel macros robust. +% \begin{macrocode} +\MakeRobust\( +\MakeRobust\) +\MakeRobust\[ +\MakeRobust\] +\MakeRobust\makebox +\MakeRobust\savebox +\MakeRobust\framebox +\MakeRobust\parbox +\MakeRobust\rule +\MakeRobust\raisebox +% \end{macrocode} % % \begin{macrocode} %</fixltx2e> |