From 1a2ac4120a1e3d34a02cdd6e5e45cfd317125076 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Mon, 15 Feb 2021 12:27:21 +0000 Subject: [PATCH] avoid infinite loop on math alphabet error #501 (#503) --- base/changes.txt | 5 +++++ base/ltfssdcl.dtx | 8 ++++++-- base/testfiles/github-0501.lvt | 14 ++++++++++++++ base/testfiles/github-0501.tlg | 9 +++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 base/testfiles/github-0501.lvt create mode 100644 base/testfiles/github-0501.tlg diff --git a/base/changes.txt b/base/changes.txt index 1424800a2..67f9c839d 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ +2021-02-15 David Carlisle + + * ltfssdcl.dtx: two additional \expandafter to avoid infinite + loop on not in math error. (gh/501) + 2021-02-11 Frank Mittelbach * classes.dtx (subsubsection{Itemize}): diff --git a/base/ltfssdcl.dtx b/base/ltfssdcl.dtx index dd4e14fa8..9710d5438 100644 --- a/base/ltfssdcl.dtx +++ b/base/ltfssdcl.dtx @@ -36,7 +36,7 @@ % % \ProvidesFile{ltfssdcl.dtx} - [2021/01/15 v3.0v LaTeX Kernel (NFSS Declarative Interface)] + [2021/02/15 v3.0w LaTeX Kernel (NFSS Declarative Interface)] % \iffalse \documentclass{ltxdoc} \begin{document} @@ -490,7 +490,11 @@ in version \math@version}% \@eha \fi - \else \expandafter\non@alpherr\fi +% \end{macrocode} +% extra \cs{expandafter} to remove the \cs{expandafter} added below +% \changes{v3.0w}{2021/02/115}{fix for (gh/501)} +% \begin{macrocode} + \else \expandafter\expandafter\expandafter\non@alpherr\fi % \end{macrocode} % If the legacy interface is used, e.g., \verb=$\sf -1$= the math % alphabet \verb=#1= does not take an argument so we better do not diff --git a/base/testfiles/github-0501.lvt b/base/testfiles/github-0501.lvt new file mode 100644 index 000000000..9ad2a9b0c --- /dev/null +++ b/base/testfiles/github-0501.lvt @@ -0,0 +1,14 @@ +\documentclass{article} + +\input{test2e} + +\begin{document} + +\START + +% should give a single error on \mathit +% not loop errors on \expandafter + +\mathit{x} + +\END \ No newline at end of file diff --git a/base/testfiles/github-0501.tlg b/base/testfiles/github-0501.tlg new file mode 100644 index 000000000..ee87539b1 --- /dev/null +++ b/base/testfiles/github-0501.tlg @@ -0,0 +1,9 @@ +This is a generated file for the LaTeX2e validation system. +Don't change this file in any respect. +! LaTeX Error: \mathit allowed only in math mode. +See the LaTeX manual or LaTeX Companion for explanation. +Type H for immediate help. + ... +l. ...\mathit{x} +You're in trouble here. Try typing to proceed. +If that doesn't work, type X to quit.