[tex4ht-commits] [SCM] tex4ht updated: r1104 - trunk/lit

Michal Hoftich INVALID.NOREPLY at gnu.org.ua
Wed Mar 30 14:06:52 CEST 2022


Author: michal_h21
Date: 2022-03-30 12:06:52 +0000 (Wed, 30 Mar 2022)
New Revision: 1104

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-sty.tex
Log:
Don't redefine \IfFileExists

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2022-03-29 15:46:43 UTC (rev 1103)
+++ trunk/lit/ChangeLog	2022-03-30 12:06:52 UTC (rev 1104)
@@ -1,3 +1,9 @@
+2022-03-30  Michal Hoftich  <michal.h21 at gmail.com>
+
+	* tex4ht-sty.tex (tex4ht.sty): don't redefine \IfFileExists. It can
+	break packages that don't expect extra tokens at it's end.
+	https://tex.stackexchange.com/a/638965/2891
+
 2022-03-29  Michal Hoftich  <michal.h21 at gmail.com>
 
 	* tex4ht-4ht.tex (subfiles.4ht): fixed support for multiple included

Modified: trunk/lit/tex4ht-sty.tex
===================================================================
--- trunk/lit/tex4ht-sty.tex	2022-03-29 15:46:43 UTC (rev 1103)
+++ trunk/lit/tex4ht-sty.tex	2022-03-30 12:06:52 UTC (rev 1104)
@@ -9082,18 +9082,25 @@
 \<defs for early latex subs/sups\><<<
 \append:def\:RestoreCatcodes{\early:sub\early:sup}
 \let\:IfFileExists\IfFileExists
-\long\def\IfFileExists#1#2#3{%
-   \csname recall:sub\endcsname   
-   \csname recall:sup\endcsname
-   \expandafter\let\csname #1:sub\endcsname=\early:sub
-   \expandafter\let\csname #1:sup\endcsname=\early:sup
-   \let\early:sub=\relax     \let\recall:sub\relax   
-   \let\early:sup=\relax     \let\recall:sup\relax
-   \:IfFileExists{#1}{#2}{#3}%
-   \expandafter\let\expandafter\early:sub\csname #1:sub\endcsname
-   \expandafter\let\expandafter\early:sup\csname #1:sup\endcsname
-   \early:sub \early:sup
-}
+
+% I am not sure why we used this declaration. It is from the original 
+% TeX4ht sources, so it probably had some reason. The problem is that it 
+% inserts extra tokens after \:IfFileExists, and if some package uses
+% something like \IfFileExists{foo.sty}{\@firstoftwo}{\@secondoftwo}{aa}{bb}, 
+% then it fails. I've found this issue with the Standalone class.
+% See https://tex.stackexchange.com/a/638965/2891 for example where it fails.
+% \long\def\IfFileExists#1#2#3{%
+%    \csname recall:sub\endcsname   
+%    \csname recall:sup\endcsname
+%    \expandafter\let\csname #1:sub\endcsname=\early:sub
+%    \expandafter\let\csname #1:sup\endcsname=\early:sup
+%    \let\early:sub=\relax     \let\recall:sub\relax   
+%    \let\early:sup=\relax     \let\recall:sup\relax
+%    \:IfFileExists{#1}{#2}{#3}%
+%    \expandafter\let\expandafter\early:sub\csname #1:sub\endcsname
+%    \expandafter\let\expandafter\early:sup\csname #1:sup\endcsname
+%    \early:sub \early:sup
+% }
 \ifx \o:document\:UnDef
    \pend:def\Preamble{%
      \csname recall:sub\endcsname   



More information about the tex4ht-commits mailing list.