* Re: Preserve math environment for mathjax?
[not found] ` <097b8e79-fbf1-4a7c-b626-a50995b0752c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-08-05 4:28 ` John MacFarlane
0 siblings, 0 replies; 2+ messages in thread
From: John MacFarlane @ 2019-08-05 4:28 UTC (permalink / raw)
To: David Roundy, pandoc-discuss
Actually, pandoc does differentiate between
\begin{equation} and \begin{aligned}.
% pandoc -f latex -t native
\begin{align}
2+2
\end{align}
[Para [Math DisplayMath "\\begin{aligned}\n2+2\\end{aligned}"]]
% pandoc -f latex -t native
\begin{equation}
2+2
\end{equation}
[Para [Math DisplayMath "2+2"]]
It parses both as display math, but when 'align' is
used it adds an 'aligned' environment.
So, effectively pandoc treats
\begin{align}
...
\end{align}
like
\[\begin{aligned}
...
\end{aligned}\]
I realize that these are not the same in LaTeX, since
the former creates a numbered equation but the latter
does not. Eventually we'd like to have a more
sophisticated system for labels and cross-references,
which would allow us to properly represent equation
numbers, but currently we do not.
As you note, when we're targeting html+mathjax we
could just pass through the 'align' environment
verbatim and let mathjax deal with it. But the
latex -> html translation is the composition of
two independent translations, latex -> native and
native -> html, and the first of these tries to
produce something that will render properly in
any output format.
When looking into this, though, I noticed that the
markdown reader actually behaves differently. When
you're going markdown -> mathjax, the markdown
(with embedded latex)
\begin{align} x \end{align}
is transformed into
<span class="math display">\[\begin{align} x
\end{align}\]</span>
which is essentially what you want. This is perhaps
an odd inconsistency. We could of course have the
LaTeX reader behave the same way, but this would give
worse results when converting to formats other than
HTML+MathJax. So I'm not sure.
David Roundy <daveroundy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> I'm wondering if there is any way to make pandoc preserve the math environment when compiling from latex to HTML? It seems to always forgot whether I used \begin{align} or \begin{equation}. They aren't the same, and I know the difference and mathjax knows the difference.
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/097b8e79-fbf1-4a7c-b626-a50995b0752c%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2sgqggrrw.fsf%40johnmacfarlane.net.
^ permalink raw reply [flat|nested] 2+ messages in thread