metanorma / tex2mn

Write Metanorma documents in LaTeX
https://www.metanorma.com
MIT License
2 stars 0 forks source link

Wrong math interpreter used for equations #106

Open manuelfuenmayor opened 4 years ago

manuelfuenmayor commented 4 years ago

From https://github.com/metanorma/mn-samples-tex-iso/issues/5 I believe this is an easy-to-solve (and important) issue.

Currently, the math interpreter used for formulae is asciimath instead of latexmath. Since the equations in AsciiDoc output are typeset in LaTeX markup, the interpreter to use should be latexmath. For example,

This LaTeX equation:

\begin{equation}
    \cos (2\theta) = \cos^2 \theta - \sin^2 \theta
\end{equation}

Results in this AsciiDoc output:

[stem]
++++
\cos(2\theta)=\cos^{2}\theta-\sin^{2}\theta
++++

Which gives an incorrect rendering since the markup is in LaTeX approach. (The same applies for inline equations.)

stem-equation

The correct adoc output should be like:

[latexmath]
++++
\cos(2\theta)=\cos^{2}\theta-\sin^{2}\theta
++++

which renders: latexmath-equation

So, the solution is to change [stem] to [latexmath].

paolobrasolin commented 4 years ago

My idea was to always use :stem: latexmath in the produced preambles, but it definitely makes more sense to just use latexmath:[] and [latexmath]. This way it's also easier to locally change the math engine, in case one wants to fiddle with the adoc.