summaryrefslogtreecommitdiff
path: root/macros/latex/base/ltdefns.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-05 03:01:15 +0000
committerNorbert Preining <norbert@preining.info>2019-10-05 03:01:15 +0000
commit72c9345e5bafe708888bf65448a81d1aee8275ed (patch)
treea1a99929b3d7307572844833f09ad7ba5ad1405d /macros/latex/base/ltdefns.dtx
parent9d9c04e14d0da9dd7829d0ec896aabfd50414fd8 (diff)
CTAN sync 201910050301
Diffstat (limited to 'macros/latex/base/ltdefns.dtx')
-rw-r--r--macros/latex/base/ltdefns.dtx187
1 files changed, 163 insertions, 24 deletions
diff --git a/macros/latex/base/ltdefns.dtx b/macros/latex/base/ltdefns.dtx
index 3a7d6f06ea..44d7bfde64 100644
--- a/macros/latex/base/ltdefns.dtx
+++ b/macros/latex/base/ltdefns.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright 1993-2018
+% Copyright (C) 1993-2019
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
@@ -13,7 +13,7 @@
% The latest version of this license is in
% https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
-% version 2005/12/01 or later.
+% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltdefns.dtx}
- [2018/09/26 v1.5e LaTeX Kernel (definition commands)]
+ [2019/08/27 v1.5f LaTeX Kernel (definition commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltdefns.dtx}
@@ -1046,7 +1046,7 @@
%
% \emph{Note}: setting |\protect| to any value other than |\relax|
% whilst in `typesetting' mode will cause commands to go into an
-% infinite loop! In particular, setting |\relax| to |\@empty| will
+% infinite loop! In particular, setting |\protect| to |\@empty| will
% cause |\_| to loop forever. It will also break lots of other
% things, such as protected |\ifmmode|s inside |\halign|s. If you
% really really have to do such a thing, then please set
@@ -1101,7 +1101,9 @@
% \end{macro}
%
% \begin{macro}{\@typeset@protect}
-%
+% We set \cs{@typeset@protect} to \cs{relax} rather than \cs{@empty}
+% to make sure that the protection mechanism stops the look-ahead
+% and expansion performed at the start of \cs{halign} cells.
% \begin{macrocode}
\let\@typeset@protect\relax
% \end{macrocode}
@@ -1166,12 +1168,27 @@
%
% \begin{macro}{\MakeRobust}
% \changes{v1.4a}{2015/01/08}{Added macro}
-%
-% The macro firstly checks if the controls sequence in question exists
-% at all.
+% \changes{v1.5f}{2019/08/27}{Make the assignments global as we may
+% need to apply them inside a group}
+%
+% This macro makes an existing fragile macro robust, but only if it
+% hasn't been robust in the past, i.e., it checks for the existence
+% of the macro
+% \verb*=\<name> = and if that exists it assumes that
+% \verb=\<name>= is already robust. In that case either undefine
+% the inner macro first or use \cs{DeclareRobustCommand} to
+% define it in a robust way directly. We could probably test the
+% top-level definition to have the right kind of structure, but
+% this is somewhat problematical as we then have to distinguish
+% between \cs{long} macros and others and also take into account
+% that sometimes the top-level is deliberately dones manually (like
+% with \cs{begin}).
+%
+% The macro firstly checks if the control sequence in question exists
+% at all.
% \begin{macrocode}
%</2ekernel>
-%<latexrelease>\IncludeInRelease{2015/01/01}{\MakeRobust}{\MakeRobust}%
+%<latexrelease>\IncludeInRelease{2019/10/01}{\MakeRobust}{\MakeRobust}%
%<*2ekernel|latexrelease>
\def\MakeRobust#1{%
\@ifundefined{\expandafter\@gobble\string#1}{%
@@ -1189,12 +1206,12 @@
{%
\@ifundefined{\expandafter\@gobble\string#1\space}%
{%
- \expandafter\let\csname
+ \global\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{%
+ \xdef#1{%
\ifx\reserved@a\reserved@b
\noexpand\x@protect\noexpand#1%
\fi
@@ -1206,6 +1223,32 @@
}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{2015/01/01}{\MakeRobust}{\MakeRobust}%
+%<latexrelease>\def\MakeRobust#1{%
+%<latexrelease> \@ifundefined{\expandafter\@gobble\string#1}{%
+%<latexrelease> \@latex@error{The control sequence `\string#1' is undefined!%
+%<latexrelease> \MessageBreak There is nothing here to make robust}%
+%<latexrelease> \@eha
+%<latexrelease> }%
+%<latexrelease> {%
+%<latexrelease> \@ifundefined{\expandafter\@gobble\string#1\space}%
+%<latexrelease> {%
+%<latexrelease> \expandafter\let\csname
+%<latexrelease> \expandafter\@gobble\string#1\space\endcsname=#1%
+%<latexrelease> \edef\reserved@a{\string#1}%
+%<latexrelease> \def\reserved@b{#1}%
+%<latexrelease> \edef\reserved@b{\expandafter\strip@prefix\meaning\reserved@b}%
+%<latexrelease> \edef#1{%
+%<latexrelease> \ifx\reserved@a\reserved@b
+%<latexrelease> \noexpand\x@protect\noexpand#1%
+%<latexrelease> \fi
+%<latexrelease> \noexpand\protect\expandafter\noexpand
+%<latexrelease> \csname\expandafter\@gobble\string#1\space\endcsname}%
+%<latexrelease> }%
+%<latexrelease> {\@latex@info{The control sequence `\string#1' is already robust}}%
+%<latexrelease> }%
+%<latexrelease>}%
+%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}{\MakeRobust}{\MakeRobust}%
%<latexrelease>\let\MakeRobust\@undefined
%<latexrelease>\EndIncludeInRelease
@@ -1213,6 +1256,49 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
+
+% \begin{macro}{\kernel@make@fragile}
+% The opposite of |\MakeRobust| execpt that it doesn't do many
+% checks as it is internal to the kernel. Why does one want such a
+% thing?
+% Only for compatibility reasons if \texttt{latexrelease} requests
+% a rollback of the kernel. For this reason we pretend that this
+% command existed in all earler versions of \LaTeX{} i.e., we are
+% not rolling it back since we need it precisely then. But we have
+% to get it into the \texttt{latexrelease} file so that a roll
+% forward is possible too.
+% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\kernel@make@fragile}{Undo robustness}%
+\def\kernel@make@fragile#1{%
+ \@ifundefined{\expandafter\@gobble\string#1\space}%
+% \end{macrocode}
+% If not robust do nothing.
+% \begin{macrocode}
+ {}%
+% \end{macrocode}
+% Otherwise copy \verb*=\foo = back to \verb=\foo= and then undefine
+% the payload command.
+% \begin{macrocode}
+ {%
+ \global\expandafter\let\expandafter #1\csname
+ \expandafter\@gobble\string#1\space\endcsname
+ \global\expandafter\let\csname
+ \expandafter\@gobble\string#1\space\endcsname\@undefined
+ }%
+}
+%<latexrelease>\EndIncludeInRelease
+%</2ekernel|latexrelease>
+%<*2ekernel>
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \subsection{Internal defining commands}
%
% These commands are used internally to define other \LaTeX{}
@@ -1392,19 +1478,6 @@
\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}
% \end{macrocode}
% \end{macro}
-
-% \changes{v1.0n}{1994/05/10}{Added \cs{makeatletter} and
-% \cs{makeatother} ASAJ.}
-%
-% \begin{macro}{\makeatletter}
-% \begin{macro}{\makeatother}
-% Make internal control sequences accessible or inaccessible.
-% \begin{macrocode}
-\def\makeatletter{\catcode`\@11\relax}
-\def\makeatother{\catcode`\@12\relax}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
%
%
% \begin{macro}{\@ifstar}
@@ -1459,6 +1532,22 @@
% \end{macrocode}
% \end{macro}
%
+%
+%
+% \begin{macro}{\makeatletter}
+% \begin{macro}{\makeatother}
+% \changes{v1.0n}{1994/05/10}{Added \cs{makeatletter} and
+% \cs{makeatother} ASAJ.}
+% Make internal control sequences accessible or inaccessible.
+% \begin{macrocode}
+\DeclareRobustCommand\makeatletter{\catcode`\@11\relax}
+\DeclareRobustCommand\makeatother{\catcode`\@12\relax}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+
+%
% \section{Discretionary Hyphenation}
% \begin{macro}{\-}
% \changes{1.2x}{1995/12/13}{Documentation changed.}
@@ -1535,6 +1624,56 @@
\@includeinreleasefalse
% \end{macrocode}
%
+% \changes{v1.5f}{2019/08/27}{Make various commands robust}
+%
+% Delayed from |ltplain.dtx|
+% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2019/10/01}%
+%<latexrelease> {\allowbreak}{Make various commands robust}%
+\MakeRobust\allowbreak
+\MakeRobust\bigbreak
+\MakeRobust\break
+\MakeRobust\dotfill
+\MakeRobust\frenchspacing
+\MakeRobust\goodbreak
+\MakeRobust\hrulefill
+\MakeRobust\medbreak
+\MakeRobust\nobreak
+\MakeRobust\nonfrenchspacing
+\MakeRobust\obeylines
+\MakeRobust\obeyspaces
+\MakeRobust\slash
+\MakeRobust\smallbreak
+\MakeRobust\strut
+\MakeRobust\underbar
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\allowbreak}{Make various commands robust}%
+%<latexrelease>
+%<latexrelease>\kernel@make@fragile\allowbreak
+%<latexrelease>\kernel@make@fragile\bigbreak
+%<latexrelease>\kernel@make@fragile\break
+%<latexrelease>\kernel@make@fragile\dotfill
+%<latexrelease>\kernel@make@fragile\frenchspacing
+%<latexrelease>\kernel@make@fragile\goodbreak
+%<latexrelease>\kernel@make@fragile\hrulefill
+%<latexrelease>\kernel@make@fragile\medbreak
+%<latexrelease>\kernel@make@fragile\nobreak
+%<latexrelease>\kernel@make@fragile\nonfrenchspacing
+%<latexrelease>\kernel@make@fragile\obeylines
+%<latexrelease>\kernel@make@fragile\obeyspaces
+%<latexrelease>\kernel@make@fragile\slash
+%<latexrelease>\kernel@make@fragile\smallbreak
+%<latexrelease>\kernel@make@fragile\strut
+%<latexrelease>\kernel@make@fragile\underbar
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+% \end{macrocode}
+%
% \begin{macrocode}
%</2ekernel>
% \end{macrocode}