brucemiller / LaTeXML

LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator.
http://dlmf.nist.gov/LaTeXML/
Other
916 stars 96 forks source link

Support scrartcl.cls #1670

Open averms opened 2 years ago

averms commented 2 years ago

Redfining \nand as \barwedge fails. The exact logged message is

Info:ignore:\nand Ignoring redefinition (\newcommand) of '\nand' at _math.tex; line 20 col 0
dginev commented 2 years ago

Hi @averms ,

The way latexml deals with \nand and \barwedge, they get defined globally, and early in a range of binding files (e.g. svjour3.cls.ltxml, but there are multiple others). So a \newcommand would encounter them as already defined, while they may not have been in a pdflatex pass.

A quickfix in your source document would be to switch to \renewcommand, or even switch to that just for latexml as with

\usepackage{latexml}
\iflatexml
  \renewcommand{\nand}...
\else
  \newcommand{\nand}...
\fi

If you think your source should work exactly as it is written, since it does with pdflatex, we would tend to agree. For us to figure out how to upgrade our .ltxml definitions, it would be quite helpful to see a minimal preamble that comes before your \newcommand, so that we're sure we're solving exactly the case you're looking at.

I know that at least for svjour3 the definition of \nand happens during \maketitle, localized to a current group with a simple \def, so \newcommand works normally in the rest of the document - as the definition never leaks into the outer groups. That could be one avenue for us to refactor.

averms commented 2 years ago

If you think your source should work exactly as it is written, since it does with pdflatex, we would tend to agree. For us to figure out how to upgrade our .ltxml definitions, it would be quite helpful to see a minimal preamble that comes before your \newcommand, so that we're sure we're solving exactly the case you're looking at.

I was using scrartcl from KOMA-script which might be what confused LaTeXML. Here is a minimal example:

\documentclass{scrartcl}
\newcommand*\nand[0]{\barwedge}

\begin{document}
Here is $\nand 1$.
\end{document}

In any case, the quick workaround you mentioned worked for me. Thanks.

dginev commented 12 months ago

FYI: scrartcl.cls is used in 0.28% of arXiv articles today.

I'll bump back a milestone here for now.