[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh583: first aid for ulem and varwidth (5df1a9fc)

Frank Mittelbach frank.mittelbach at latex-project.org
Tue Jun 8 14:18:45 CEST 2021


Repository : https://github.com/latex3/latex2e
On branch  : hotfix/gh583
Link       : https://github.com/latex3/latex2e/commit/5df1a9fc82508a4f586fb3b5eb8797ba127def11

>---------------------------------------------------------------

commit 5df1a9fc82508a4f586fb3b5eb8797ba127def11
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Tue Jun 8 14:18:45 2021 +0200

    first aid for ulem and varwidth


>---------------------------------------------------------------

5df1a9fc82508a4f586fb3b5eb8797ba127def11
 required/firstaid/changes.txt                      |  6 ++
 .../latex2e-first-aid-for-external-files.dtx       | 72 +++++++++++++++++++++-
 .../firstaid/testfiles/firstaid-ulem-varwidth.lvt  | 32 ++++++++++
 .../firstaid/testfiles/firstaid-ulem-varwidth.tlg  |  5 +-
 support/texlive.sh                                 |  6 +-
 5 files changed, 115 insertions(+), 6 deletions(-)

diff --git a/required/firstaid/changes.txt b/required/firstaid/changes.txt
index d7823c21..71133394 100644
--- a/required/firstaid/changes.txt
+++ b/required/firstaid/changes.txt
@@ -1,3 +1,9 @@
+2021-06-08  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* latex2e-first-aid-for-external-files.dtx:
+	ulem doesn't handle \hspace gracefully not that it is calc aware.
+	varwidth needs an additional \unskip when unraveling a vertical list.
+
 2021-03-15  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* latex2e-first-aid-for-external-files.dtx:
diff --git a/required/firstaid/latex2e-first-aid-for-external-files.dtx b/required/firstaid/latex2e-first-aid-for-external-files.dtx
index 7eb10841..6e6e25ec 100644
--- a/required/firstaid/latex2e-first-aid-for-external-files.dtx
+++ b/required/firstaid/latex2e-first-aid-for-external-files.dtx
@@ -111,8 +111,8 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\def\LaTeXFirstAidDate{2021/03/15}
-\def\LaTeXFirstAidVersion{v1.0l}
+\def\LaTeXFirstAidDate{2021/06/08}
+\def\LaTeXFirstAidVersion{v1.0m}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
@@ -134,7 +134,9 @@
 %    \begin{macrocode}
 \ExplSyntaxOn             
 \cs_new:Npn\FirstAidNeededT#1#2#3{
-  \exp_args:Nc\str_if_eq:onT{ver@#1.#2}{#3}
+  \exp_args:Ncx\str_if_eq:onF{ver@#1.#2}{#3}
+      { \typeout{==>~ First~ Aid~ for~ #1.#2~ no~ longer~ applied!} }
+  \exp_args:Ncx\str_if_eq:onT{ver@#1.#2}{#3}
 }
 \ExplSyntaxOff
 %    \end{macrocode}
@@ -546,6 +548,70 @@
 %
 %
 %
+% \subsection{\cs{ulem} first aid}
+%
+%    In 2020 we fixed various kernel commands to accept \pkg{calc}
+%    syntax. The \pkg{ulem} package redefines some internals and that
+%    now conflicts with the new definitions as they involve an extra
+%    group. So we alter the definition of \cs{@hspace} if \pkg{ulem}
+%    was loaded. This is not perfect, obviously, so it will go out the
+%    moment \pkg{ulem} gets adjusted.
+%
+%    \begin{macrocode}
+\AddToHook{file/after/ulem.sty}[firstaid]{%
+   \def\@hspace#1{\begingroup\setlength\skip@{#1}%
+                  \edef\x{\endgroup\hskip\the\skip@\relax}\x}%
+   }
+%    \end{macrocode}
+%
+%
+% \subsection{\cs{varwidth} first aid}
+%
+%    the \pkg{varwidth} package does a lot of low-level paragraph
+%    manipulation assuming tradition \TeX{} paragraphs. However with
+%    the paragraph hooks we end up with one extra glue 0pt item on the
+%    vertical list and if that isn't removed then the package doesn't
+%    find its penalties.
+%
+%    So this this needs to be removed as well.
+%     
+%    \begin{macrocode}
+\AddToHook{file/after/varwidth.sty}[firstaid]{%
+  \FirstAidNeededT{varwidth}{sty}%
+       {2009/03/30 ver 0.92; \space Variable-width minipages}%
+     {%
+\def\@vwid at sift{%
+  \skip@\lastskip\unskip
+  \unskip                         % <---- the first aid here
+  \dimen@\lastkern\unkern
+  \count@\lastpenalty\unpenalty
+  \setbox\z@\lastbox
+  \ifvoid\z@ \advance\sift at deathcycles\@ne \else \sift at deathcycles\z@ \fi
+  \ifnum\sift at deathcycles>33 
+    \let\@vwid at sift\relax
+    \PackageWarning{varwidth}{Failed to reprocess entire contents}%
+  \fi
+  \ifnum\count@=\@vwid at preeqp \@vwid at eqmodefalse\fi
+  \ifnum\count@=\@vwid at posteqp \@vwid at eqmodetrue\fi
+  \ifnum\count@=\@vwid at toppen % finished
+    \let\@vwid at sift\relax
+  \else\ifnum\count@=\@vwid at offsets
+    \@vwid at setoffsets
+  \else
+    \ifnum\count@=\@vwid at postw
+    \else
+      \@vwid at resetb % reset box \z@ or measure it
+    \fi
+    \@vwid at append
+  \fi\fi
+  \@vwid at sift}%
+     }%
+   }
+%    \end{macrocode}
+%
+%
+%
+%
 % \subsection[Temporary fixes for the kernel (until the next
 %             patch-level release)]
 %    {Temporary fixes for the kernel \\
diff --git a/required/firstaid/testfiles/firstaid-ulem-varwidth.lvt b/required/firstaid/testfiles/firstaid-ulem-varwidth.lvt
new file mode 100644
index 00000000..35bd7cb6
--- /dev/null
+++ b/required/firstaid/testfiles/firstaid-ulem-varwidth.lvt
@@ -0,0 +1,32 @@
+\documentclass{article}
+
+\usepackage{expl3}  % make sure the backend files are loaded early
+
+\input{regression-test}
+
+
+\usepackage{ulem,varwidth}
+
+
+\begin{document}
+
+\START
+
+\typeout{no error please:}
+
+\uline{{\hspace{1cm}}}
+
+\setbox0\hbox{%
+  x
+  \begin{varwidth}[t]{10cm}
+    varwidth
+  \end{varwidth}
+  x
+}
+
+\typeout{same baseline please: \the\ht0 + \the\dp0}
+
+\unhbox0  % visual check only
+
+
+\end{document}
diff --git a/base/testfiles-lthooks/shipout-006.tlg b/required/firstaid/testfiles/firstaid-ulem-varwidth.tlg
similarity index 52%
copy from base/testfiles-lthooks/shipout-006.tlg
copy to required/firstaid/testfiles/firstaid-ulem-varwidth.tlg
index 944f14ef..aaa7e95b 100644
--- a/base/testfiles-lthooks/shipout-006.tlg
+++ b/required/firstaid/testfiles/firstaid-ulem-varwidth.tlg
@@ -1,3 +1,6 @@
 This is a generated file for the l3build validation system.
 Don't change this file in any respect.
--- There should be no error and no log output other than this line --
+no error please:
+same baseline please: 6.94444pt+ 0.0pt
+[1
+] (firstaid-ulem-varwidth.aux)
diff --git a/support/texlive.sh b/support/texlive.sh
index 0dd78c58..87bfbc65 100644
--- a/support/texlive.sh
+++ b/support/texlive.sh
@@ -60,7 +60,7 @@ tlmgr install   \
   stringenc     \
   url
 
-# special testing
+# special testing for firstaid
 tlmgr install   \
   bidi          \
   bigfoot       \
@@ -69,7 +69,9 @@ tlmgr install   \
   everyshi      \
   filehook      \
   pgf           \
-  pgfmorepages
+  pgfmorepages  \
+  ulem          \
+  varwidth
 
 # Additional support for typesetting
 tlmgr install  \





More information about the latex3-commits mailing list.