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

weird error for ntheorem depending on order of commands #2496

Open
lamBOOO opened this issue Jan 23, 2025 · 1 comment
Open

weird error for ntheorem depending on order of commands #2496

lamBOOO opened this issue Jan 23, 2025 · 1 comment

Comments

@lamBOOO
Copy link

lamBOOO commented Jan 23, 2025

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.

@dginev dginev added this to the LaTeXML-0.9 milestone Jan 23, 2025
@dginev
Copy link
Collaborator

dginev commented Jan 23, 2025

Thank you for the report. If I am not seeing this wrong, the binding is unfinished -- it seems to use \newtheoremstyle and \renewtheoremstyle as imported from amsthm.sty.ltxml, but those macros have a different argument signature ntheorem docs here.

So even for the example that you show working, it is working by a very lucky accident. (Assuming I am not misreading something in ntheorem.sty.ltxml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants