LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

weird error for ntheorem depending on order of commands

Open lamBOOO opened this issue 9 months ago • 1 comments

I get an error for the ntheorem package that seems to weirdly depend on the order of commands:

I redefine the break inbuild theorem style and then also define another style

\documentclass{article}
\usepackage{ntheorem}

\renewtheoremstyle{break}%
{\item[\hskip\labelsep ##1\ HELLO  ##2]\normalfont}%
{\item[\hskip\labelsep ##1\ ##2]{(##3)}\newline\normalfont}

\newtheoremstyle{plain1}%
{\item[\hskip\labelsep ##1\ HELLO  ##2]\normalfont}%
{\item[\hskip\labelsep ##1\ ##2]{(##3)}\newline\normalfont}

\theoremstyle{break}
\newtheorem{theorem}{Theorem}
\theoremstyle{plain1}
\newtheorem{remark}{Remark}

\begin{document}
\begin{theorem}
  This is a theorem.
\end{theorem}
\begin{remark}
  This is a theorem.
\end{remark}
\end{document}

and running latexmlc --destination=paper.html --format=html5 --path=. test.tex, I get the following error:

latexmlc (LaTeXML version 0.8.8)
processing started Thu Jan 23 22:00:29 2025
Error:undefined:\renewtheoremstyle The token T_CS[\renewtheoremstyle] is not defined. at test.tex; line 4 col 18
Error:misdefined:# The token T_PARAM[#] should never reach Stomach! at test.tex; line 6 col 35
Error:misdefined:# The token T_PARAM[#] should never reach Stomach! at test.tex; line 6 col 36
Error:undefined:{theorem} The environment {theorem} is not defined. at test.tex; line 18 col 0
Warning:undefined:theoremstyle Unknown theorem style '\lx@tag', reverting to 'plain'. at test.tex; line 22 col 3
Conversion complete: 1 warning; 4 errors; 2 undefined macros[\renewtheoremstyle, {theorem}] (See /Users/lamberttheisen/Desktop/theoremstyle/test.latexml.log)
Post-processing complete: No obvious problems
Status:conversion:2

However, if I just change the order, i.e. first define my own style and then redefine the inbuilt style:

\documentclass{article}
\usepackage{ntheorem}

\newtheoremstyle{plain1}%
{\item[\hskip\labelsep ##1\ HELLO  ##2]\normalfont}%
{\item[\hskip\labelsep ##1\ ##2]{(##3)}\newline\normalfont}

\renewtheoremstyle{break}%
{\item[\hskip\labelsep ##1\ HELLO  ##2]\normalfont}%
{\item[\hskip\labelsep ##1\ ##2]{(##3)}\newline\normalfont}

\theoremstyle{break}
\newtheorem{theorem}{Theorem}
\theoremstyle{plain1}
\newtheorem{remark}{Remark}

\begin{document}
\begin{theorem}
  This is a theorem.
\end{theorem}
\begin{remark}
  This is a theorem.
\end{remark}
\end{document}

I get no error:

latexmlc (LaTeXML version 0.8.8)
processing started Thu Jan 23 22:02:55 2025
Conversion complete: No obvious problems
Post-processing complete: No obvious problems
Status:conversion:0

What is going on? How can I fix it?

The problem is actually a MWE of an error produced by the SIAM templates (https://epubs.siam.org/journal-authors#macros) (line 1419 in the cls-file errors) when uploading a preprint to arXiv, where latexml is used to generate the HTML version.

lamBOOO avatar Jan 23 '25 21:01 lamBOOO