public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: David Roundy <daveroundy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Preserve math environment for mathjax?
Date: Sun, 04 Aug 2019 21:28:19 -0700	[thread overview]
Message-ID: <m2sgqggrrw.fsf@johnmacfarlane.net> (raw)
In-Reply-To: <097b8e79-fbf1-4a7c-b626-a50995b0752c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


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.


      parent reply	other threads:[~2019-08-05  4:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 15:13 David Roundy
     [not found] ` <097b8e79-fbf1-4a7c-b626-a50995b0752c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-08-05  4:28   ` John MacFarlane [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2sgqggrrw.fsf@johnmacfarlane.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=daveroundy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).