Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox Fatal fixes 01.2024, round 2 #2315

Merged
merged 13 commits into from
Feb 14, 2024

Conversation

dginev
Copy link
Collaborator

@dginev dginev commented Feb 7, 2024

This PR is a (final) follow-up to the just merged #2309 .

I address another handful of Fatal issues, and one minor binding issue:

  • allow deeper recursion in digesting reads of parameters
  • allow deeper recursion in stringify
  • Guard against infinite loops in complex listings
    • The examples were in cases that deal with QUOTED_RE, but I think there are more general possible pitfalls related to colnum not getting incremented and sanity-checked in every possible arm of the loop conditional.
    • Finding all of the tricky corner cases is a little hard without a deep dive, so I added a distinctive Error message. We can collect all papers exhibiting the issue after a rerun and build a tougher test suite.
  • IEEEtran.cls.ltxml needs to support an optional arguments for its list envs, and also rebind the usual env names. This fixes Redundant Symbol "[]" in NOTATION arXiv/html_feedback#417
  • \@finalstrut and \@textsuperscript were being used, added to LaTeX.pool.
  • A very tricky case in pgfmath was that a single dot . is recognized as zero. So much so that \pgfmathparse{.-.2ex} is a valid expression.
     \documentclass{article}
     \usepackage{pgf}
     \begin{document}
     \pgfmathparse{.-.2ex}\pgfmathresult
     \end{document}
  • IEEEtran.cls also does not depend on \sc internally, and a handful of arXiv papers in that class redefined \sc to be something completely different, wreaking some Fatal havoc. I made two IEEEtran-specific primitives to avoid such clashes.
  • There was a very unpleasant infinite loop with OmniBus loading natbib late, during \bibitem expansion. For some reason not entirely clear to me the \bibitem DefMacro from natbib didn't stick, and the OmniBus definition expanded into itself in a loop.
    • I created a natbib-specific \lx@nat@bibitem, and used a let to bind \bibitem to it during natbib.sty.ltxml load, which appears to avoid the problem.
  • Last and least, I double-checked $text is always defaulted to an empty string before used in regexes for MathML.pm, which avoids a flurry of pointless perl warnings.

Happy to rerun the sandboxes once we merge here, and triple-check we are in good shape for a release tag.

@dginev dginev requested a review from brucemiller February 7, 2024 17:02
@dginev
Copy link
Collaborator Author

dginev commented Feb 9, 2024

The changes of the 2 recent stability PRs appear to improve conversion stability in our sandboxes, bringing roughly 1% improvement to the Fatal severity. Details at:
https://gist.github.com/dginev/abb72c989f4474a3a33300ed23ac6c86

Ready for review.

@@ -290,7 +290,7 @@ sub DecodeColor {
my $color_re = qr/($color_expr_re)(($func_expr_re)*)/;

my $color;
if ($expression =~ /^$color_re$/) {
if ($expression =~ /^$color_re\s*$/) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but the trailing space wasn't recognized and was creating 50+ needless errors. Example from arXiv:1705.04144:

\documentclass{article}
\usepackage{xcolor}
\begin{document}
\color{rgb, 255:red, 190; green, 190; blue, 190 } Test here.
\end{document}

Copy link
Owner

@brucemiller brucemiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks reasonable; Thanks!

@brucemiller brucemiller merged commit 1168b4d into brucemiller:master Feb 14, 2024
13 checks passed
@brucemiller brucemiller deleted the sandboxed-fixes-round2-2024 branch February 14, 2024 19:31
teepeemm pushed a commit to teepeemm/LaTeXML that referenced this pull request Oct 29, 2024
* guard revertScript from inner Tokens

* allow deep recursion for computing box sizes in larger tables

* allow deep recursion related to digesting parameter reads

* fix infinite bibitem loop with OmniBus natbib loading

* pgfmath recognizes a single dot as 0

* avoid perl warning for regex on undef

* add a couple of latex.ltx internals

* guard listings infinite loop

* protect IEEEtran.cls.ltxml from renewed definitions of \sc and \it

* allow for optional arguments in IEEEtran lists, and rebind the default latex envs

* Revert "guard revertScript from inner Tokens"

This reverts commit 328a7df.

* avoid Fatals in vertical/align checks over document without a root node

* allow trailing space in rgb colorspec (see arXiv:1705.04144)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redundant Symbol "[]" in NOTATION
2 participants