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

[amsmath] Issues with \DeclareMathOperator #785

Closed
matteosecli opened this Issue Jul 8, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@matteosecli
Contributor

matteosecli commented Jul 8, 2016

I've run into a problem with \DeclareMathOperator from the amsopn package (loaded by the amsmath package, in my understanding). I've got this MWE:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\Tr}{Tr}

\begin{document}
    \begin{equation}
        \Tr\left(e^{-\beta H}\right)
    \end{equation}
\end{document}

Then, I run latexmlc --verbose --destination=MWE.html MWE.tex and I get a clean output without problems. But if I run latexmlc --verbose --mathsvg --destination=MWE.html MWE.tex, I get 1 error:

Error:shell:latex LaTeX command 'latex ltxmlimg > ltxmlimg.ltxoutput' failed
    returned code 256 (!= 0): 
    See /tmp/LaTeXML2vtErS/ltxmlimg.log
    In Post::MathImages[@0x46fd890] ->generateImages
Couldn't find image for 'LaTeXML::Post::MathImages:svg:\beginDISPLAY \Tr\left(e^{-\beta H}\right)\endDISPLAY'

The same with --mathimages. By looking into ltxmlimg.tex, I've found no definition at all about my \Tr operator; the file looks like

\batchmode
\def\inlatexml{true}
\documentclass[onecolumn]{article}
\usepackage{amsmath}
\makeatletter
% STUFF HERE, NO REFERENCE AT \Tr.
\makeatother
\begin{document}
\beginDISPLAY \Tr\left(e^{-\beta H}\right)\endDISPLAY\clearpage
\end{document}

If I manually add \DeclareMathOperator{\Tr}{Tr} just after \usepackage{amsmath}, then ltxmlimg.tex compiles as expected.

As a workaround, if I substitute \DeclareMathOperator{\Tr}{Tr} with \newcommand{\Tr}{\mathrm{Tr}} in my MWE, then both latexmlc --verbose --destination=MWE.html MWE.tex and latexmlc --verbose --mathsvg --destination=MWE.html MWE.tex produce the expected output. However, also for semantic reasons, I'd prefer to stick with \DeclareMathOperator.

Thanks in advance! 😃

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Dec 4, 2016

Sorry for the delay getting to this; easy fix actually: needed to dumbdown the TeX reversion. Thanks for the report!

@brucemiller brucemiller closed this Dec 4, 2016

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