From b8f67cb908880c8fdf6b03eb9c4d5219d7409171 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 11 Dec 2018 22:32:49 +0000
Subject: latex(2e) (11dec18)

git-svn-id: svn://tug.org/texlive/trunk@49390 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/base/latex.ltx | 96 ++++++++++++++++++++++--------
 1 file changed, 72 insertions(+), 24 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/base/latex.ltx')

diff --git a/Master/texmf-dist/tex/latex/base/latex.ltx b/Master/texmf-dist/tex/latex/base/latex.ltx
index b3ae3eab45d..23ef93d9f88 100644
--- a/Master/texmf-dist/tex/latex/base/latex.ltx
+++ b/Master/texmf-dist/tex/latex/base/latex.ltx
@@ -700,8 +700,8 @@
 %%% From File: ltvers.dtx
 \def\fmtname{LaTeX2e}
 \edef\fmtversion
-   {2018-04-01}
-\def\patch@level{5}
+   {2018-12-01}
+\def\patch@level{0}
 \iffalse
 \def\reserved@a#1/#2/#3\@nil{%
   \count@\year
@@ -859,7 +859,7 @@
            {#4}}}
 \long\def\@testopt#1#2{%
   \kernel@ifnextchar[{#1}{#1[{#2}]}}
-\def\@protected@testopt#1{%%
+\def\@protected@testopt#1{%
   \ifx\protect\@typeset@protect
     \expandafter\@testopt
   \else
@@ -886,7 +886,7 @@
 \def\renew@command#1{%
   \begingroup \escapechar\m@ne\xdef\@gtempa{{\string#1}}\endgroup
   \expandafter\@ifundefined\@gtempa
-     {\@latex@error{\noexpand#1undefined}\@ehc}%
+     {\@latex@error{Command \string#1 undefined}\@ehc}%
      \relax
   \let\@ifdefinable\@rc@ifdefinable
   \new@command#1}
@@ -1488,6 +1488,10 @@ Type  H <return>  for immediate help.}%
       \fi
       \ignorespaces
     \fi
+  \else
+    \ifvmode
+      \if@nobreak\nobreak\else\if@noskipsec\nobreak\fi\fi
+    \fi
   \fi}%
 \def\@Esphack{%
   \relax
@@ -1623,9 +1627,10 @@ Type  H <return>  for immediate help.}%
 \newskip\fill
 \fill = 0pt plus 1fill
 \def\stretch#1{\z@ \@plus #1fill\relax}
-\def\thinspace{\kern .16667em }
-\def\negthinspace{\kern-.16667em }
-\def\enspace{\kern.5em }
+\def\thinspace{\leavevmode@ifvmode\kern .16667em }
+\def\negthinspace{\leavevmode@ifvmode\kern-.16667em }
+\def\enspace{\leavevmode@ifvmode\kern.5em }
+\protected\def\leavevmode@ifvmode{\ifvmode\expandafter\indent\fi}
 \def\enskip{\hskip.5em\relax}
 \def\quad{\hskip1em\relax}
 \def\qquad{\hskip2em\relax}
@@ -4243,9 +4248,23 @@ Type  H <return>  for immediate help.}%
 \def\@testdef #1#2#3{%
   \def\reserved@a{#3}\expandafter \ifx \csname #1@#2\endcsname
  \reserved@a  \else \@tempswatrue \fi}
+\protected\def\protected@file@percent{}
+
+\begingroup
+\catcode`\%=12
+\catcode`\^^A=9
+\long\gdef\add@percent@to@temptokena
+    #1\protected@file@percent#2\add@percent@to@temptokena
+    {\ifx!#2!\@temptokena\expandafter{#1}\else
+             \@temptokena\expandafter{#1%^^A
+      }\fi}
+\endgroup
 \long\def\@writefile#1#2{%
   \@ifundefined{tf@#1}\relax
-    {\@temptokena{#2}%
+    {%
+      \add@percent@to@temptokena
+        \@empty#2\protected@file@percent
+        \add@percent@to@temptokena
      \immediate\write\csname tf@#1\endcsname{\the\@temptokena}%
     }%
 }
@@ -4321,7 +4340,38 @@ Type  H <return>  for immediate help.}%
 \def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim}
 \def\endverbatim{\if@newlist \leavevmode\fi\endtrivlist}
 \def\verbatim@font{\normalfont\ttfamily}
-\@namedef{verbatim*}{\@verbatim\@sxverbatim}
+\DeclareRobustCommand\asciispace{\char 32 }
+\ifx\Umathcode\@undefined
+  \let\verbvisiblespace\asciispace                                % Pdftex version
+\else
+  \DeclareRobustCommand\verbvisiblespace
+           {\leavevmode{\usefont{OT1}{cmtt}{m}{n}\asciispace}}    % xetex/luatex version
+\fi
+
+\def\@setupverbvisiblespace{%
+  \ifx\verbvisiblespace\asciispace
+    \let\@xobeysp\asciispace
+  \else
+    \setbox\z@\hbox{x}%
+    \setbox\@verbvisiblespacebox\hbox to\wd\z@{\hss\verbvisiblespace\hss}%
+    \def\@xobeysp{\leavevmode\copy\@verbvisiblespacebox}%
+  \fi
+}
+
+\newbox\@verbvisiblespacebox
+\def\@sverb#1{%
+  \catcode`#1\active
+  \lccode`\~`#1%
+  \gdef\verb@balance@group{\verb@egroup
+     \@latex@error{\noexpand\verb illegal in command argument}\@ehc}%
+  \aftergroup\verb@balance@group
+  \lowercase{\let~\verb@egroup}%
+  \ifnum\catcode`\ =\active
+  \else  \@setupverbvisiblespace \@vobeyspaces \fi
+}
+\@namedef{verbatim*}{\@verbatim
+  \@setupverbvisiblespace
+  \frenchspacing\@vobeyspaces\@sxverbatim}
 \expandafter\let\csname endverbatim*\endcsname =\endverbatim
 \def\@makeother#1{\catcode`#112\relax}
 \let\verb@balance@group\@empty
@@ -4338,13 +4388,6 @@ Type  H <return>  for immediate help.}%
     \verbatim@font\@noligs
     \language\l@nohyphenation
     \@ifstar\@sverb\@verb}
-\def\@sverb#1{%
-  \catcode`#1\active
-  \lccode`\~`#1%
-  \gdef\verb@balance@group{\verb@egroup
-     \@latex@error{\noexpand\verb illegal in command argument}\@ehc}%
-  \aftergroup\verb@balance@group
-  \lowercase{\let~\verb@egroup}}%
 \def\@verb{\@vobeyspaces \frenchspacing \@sverb}
 \def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-}
 \def\do@noligs#1{%
@@ -4445,7 +4488,8 @@ Type  H <return>  for immediate help.}%
 \def\finph@nt{%
   \setbox\tw@\null
   \ifv@ \ht\tw@\ht\z@ \dp\tw@\dp\z@\fi
-  \ifh@ \wd\tw@\wd\z@\fi \box\tw@}
+  \ifh@ \wd\tw@\wd\z@\fi
+  \leavevmode@ifvmode\box\tw@}
 \def\mathstrut{\vphantom(}
 \def\smash{%
   \relax % \relax, in case this comes first in \halign
@@ -4458,7 +4502,7 @@ Type  H <return>  for immediate help.}%
   \setbox\z@\hbox{\color@begingroup#1\color@endgroup}\finsm@sh}
 \def\mathsm@sh#1#2{%
   \setbox\z@\hbox{$\m@th#1{#2}$}\finsm@sh}
-\def\finsm@sh{\ht\z@\z@ \dp\z@\z@ \box\z@}
+\def\finsm@sh{\ht\z@\z@ \dp\z@\z@ \leavevmode@ifvmode\box\z@}
 \def\buildrel#1\over#2{\mathrel{\mathop{\kern\z@#2}\limits^{#1}}}
 \def\cases#1{\left\{\,\vcenter{\normalbaselines\m@th
     \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\right.}
@@ -6057,7 +6101,8 @@ Type  H <return>  for immediate help.}%
     \@nobreakfalse
   \endgroup}
 \def\addcontentsline#1#2#3{%
-  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}}
+  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}%
+                     \protected@file@percent}}
 \long\def\addtocontents#1#2{%
   \protected@write\@auxout
       {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
@@ -6077,9 +6122,12 @@ Type  H <return>  for immediate help.}%
         \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
         mu$}\hfill
      \nobreak
-     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
+     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5%
+                        \kern-\p@\kern\p@}%
      \par}%
   \fi}
+
+\DeclareRobustCommand\noprotrusion{\leavevmode\kern-\p@\kern\p@}
 \def\numberline#1{\hb@xt@\@tempdima{#1\hfil}}
 %%% From File: ltfloat.dtx
 \message{floats,}
@@ -6456,7 +6504,7 @@ Type  H <return>  for immediate help.}%
 \let\bibstyle=\@gobble
 \def\bibliography#1{%
   \if@filesw
-    \immediate\write\@auxout{\string\bibdata{#1}}%
+    \immediate\write\@auxout{\string\bibdata{\zap@space#1 \@empty}}%
   \fi
   \@input@{\jobname.bbl}}
 \def\bibliographystyle#1{%
@@ -7065,7 +7113,7 @@ Type  H <return>  for immediate help.}%
          \dblfigrule
        \fi
        \vskip \dbltextfloatsep
-       \box\@outputbox
+       \unvbox\@outputbox
        }%
   \fi
 }
@@ -8110,10 +8158,10 @@ Type  H <return>  for immediate help.}%
     ^^M}%
   \catcode`\^^L\active%
   \let\L\@undefined%
-  \def^^L{\@ifundefined L^^J^^J^^J}%
+  \def^^L{\expandafter\ifx\csname L\endcsname\relax\fi ^^J^^J}%
   \catcode`\^^I\active%
   \let\I\@undefined%
-  \def^^I{\@ifundefined I\space\space}%
+  \def^^I{\expandafter\ifx\csname I\endcsname\relax\fi\space}%
   \catcode`\^^M\active%
   \edef^^M##1^^M{%
     \noexpand\reserved@b##1\E\E\relax}}%
-- 
cgit v1.2.3

