summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/base/ltdefns.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-06 21:33:45 +0000
committerKarl Berry <karl@freefriends.org>2018-04-06 21:33:45 +0000
commit588be4d1b7e254f46ac3c678ef1b3f38833f6491 (patch)
treec73b58d23db18c19737ff12c67e208fd7a89c4c6 /Master/texmf-dist/source/latex/base/ltdefns.dtx
parentc436d9d03043bac0aac83254a8f1a2a45e4aaafd (diff)
latex2e (6apr18)
git-svn-id: svn://tug.org/texlive/trunk@47330 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltdefns.dtx')
-rw-r--r--Master/texmf-dist/source/latex/base/ltdefns.dtx88
1 files changed, 76 insertions, 12 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltdefns.dtx b/Master/texmf-dist/source/latex/base/ltdefns.dtx
index 7cc8a1361b1..6c6e691efc0 100644
--- a/Master/texmf-dist/source/latex/base/ltdefns.dtx
+++ b/Master/texmf-dist/source/latex/base/ltdefns.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright 1993-2017
+% Copyright 1993-2018
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
@@ -11,7 +11,7 @@
% 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
+% 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.
%
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltdefns.dtx}
- [2017/03/73 v1.5b LaTeX Kernel (definition commands)]
+ [2018/01/08 v1.5d LaTeX Kernel (definition commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltdefns.dtx}
@@ -987,10 +987,11 @@
% file. So |\protect\foo| will write |\protect\foo| followed by a
% space. This value is also used inside |\edef|s, |\mark|s and
% other commands which evaluate their arguments fully.
-% \item |\@unexpandable@noexpand|, for performing a deferred write
-% inside an |\edef|. So |\protect\foo| will write |\foo| followed
-% by a space. If you want |\protect\foo| to be written, you should
-% use |\@unexpandable@protect|. (Removed as never used).
+% More precisely, whenever the content of an |\edef| or |\xdef| etc.\
+% can contain arbitrary user input not under the direct control of the
+% programmer, one should use |\proetected@edef| instead of |\edef|, etc.,
+% so that |\protect| has a suitable definition and the user input will
+% not break if it contains fragile commands.
% \end{itemize}
%
% \changes{1.1b}{1994/05/17}
@@ -1000,15 +1001,11 @@
% one which is no longer needed.}
%
% \begin{macro}{\@unexpandable@protect}
-% \begin{macro}{\@unexpandable@noexpand}
-% \changes{1.2w}{1995/12/05}{Removed as never used. internal/1733}
-% These commands are used for setting |\protect| inside |\edef|s.
+% \changes{1.2w}{1995/12/05}{Removed \cs{unexpandable@noexpand} as never used. internal/1733}
% \begin{macrocode}
\def\@unexpandable@protect{\noexpand\protect\noexpand}
-%\def\@unexpandable@noexpand{\noexpand\noexpand\noexpand}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \changes{v1.2e}{1994/11/04}{Rewrote protected short commands
% using \cs{x@protect}. ASAJ.}
@@ -1222,6 +1219,34 @@
% \changes{LaTeX2e}{1993/11/23}{Redefined to remove a trailing \cs{fi}}
% Check if first arg is undefined or \cs{relax} and execute second or
% third arg depending,
+% \changes{1.5c}{2018/01/06}{Avoid defining undefined commands to \cs{relax}}
+% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2018-04-01}{\@ifundefined}
+%<latexrelease>{Leave commands undefined in \@ifundefined}%
+%<*2ekernel|latexrelease>
+% \end{macrocode}
+% Version using |\ifcsname| to avoid defining undefined tokens to |\relax|.
+% Defined here to simplify using unmatched |\fi|.
+% \begin{macrocode}
+\def\@ifundefined#1{%
+ \ifcsname#1\endcsname\@ifundefin@d@i\else\@ifundefin@d@ii\fi{#1}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\@ifundefin@d@i#1\fi#2{\fi
+ \expandafter\ifx\csname #2\endcsname\relax
+ \@ifundefin@d@ii
+ \fi
+ \@secondoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\@ifundefin@d@ii\fi#1#2#3{\fi #2}
+% \end{macrocode}
+% Now test of engine.
+% \begin{macrocode}
+\ifx\numexpr\@undefined
+% \end{macrocode}
+% Classic version (should not be needed as etex is assumed).
% \begin{macrocode}
\def\@ifundefined#1{%
\expandafter\ifx\csname#1\endcsname\relax
@@ -1229,6 +1254,38 @@
\else
\expandafter\@secondoftwo
\fi}
+\else\ifx\directlua\@undefined
+% \end{macrocode}
+% Use the |\ifcsname| defined above.
+% \begin{macrocode}
+\else
+% \end{macrocode}
+% Optimised version for Lua\TeX, using |\lastnamedcs|
+% \begin{macrocode}
+\def\@ifundefined#1{%
+ \ifcsname#1\endcsname
+ \expandafter\ifx\lastnamedcs\relax\else\@ifundefin@d@i\fi
+ \fi
+ \@firstoftwo}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\@ifundefin@d@i#1#2#3#4#5{#1#2#5}
+% \end{macrocode}
+% \begin{macrocode}
+\fi
+\fi
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000-00-00}{\@ifundefined}
+%<latexrelease>{Leave commands undefined in \@ifundefined}%
+%<latexrelease>\def\@ifundefined#1{%
+%<latexrelease> \expandafter\ifx\csname#1\endcsname\relax
+%<latexrelease> \expandafter\@firstoftwo
+%<latexrelease> \else
+%<latexrelease> \expandafter\@secondoftwo
+%<latexrelease> \fi}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
@@ -1469,6 +1526,13 @@
%<*2ekernel>
% \end{macrocode}
% \end{macro}
+%
+% Delayed from |ltvers.dtx|
+% \begin{macrocode}
+\newif\if@includeinrelease
+\@includeinreleasefalse
+% \end{macrocode}
+%
% \begin{macrocode}
%</2ekernel>
% \end{macrocode}