public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: User story: typst multiline math in pandoc markdown and pandoc AST
Date: Thu, 19 Oct 2023 09:11:34 -0700	[thread overview]
Message-ID: <E89C2FED-79B7-4150-B015-D11C177D3F9B@gmail.com> (raw)
In-Reply-To: <672a5917-b04d-4eb9-966d-75b54df97837n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

> Pandoc provides a solution for almost all of these. The only issue is multi-line equations.
> A work-around I am aware of is to just use raw latex code like:
> ```latex
> \begin{align}
> 1 + 1 &= 2 \label{first_line} \\
> 1 + 2 &= 3  \label{second_line}
> \end{align}
> ```
> which works fine when exporting to both HTML and latex: it is added as is to the HTML where it is parsed by both mathjax and katex.

Note that there's another way to do this that will create a native Math element in pandoc:

$$
\begin{aligned}
1 + 1 &= 2 \\
1 + 2 &= 3
\end{aligned}
$$


> However, I propose that formatting equations like typst might be a good way to make multiline math native to Pandoc, instead of piggy-backing on raw latex.
> 
> Multiline equations could be written as in latex, wrapped in `$$ $$`:
> ```
> $$
> 1 + 1 &= 2 \\
> 1 + 2 &= 3 
> $$
> ```
> 
> which could be parsed as a new DisplayMathMultiline type in the AST.
> (This is a mockup: I really don't understand how the AST is written)
> ```
> [ Math DisplayMathMultiline
>     [
>         Math DisplayMathLine ["1+1", "=2"]
>         Math DisplayMathLine ["1+2", "=3"]
>     ]
> ]
> ```
> 
> This type can be written to:
> - HTML and latex: as an `align` block
> - typst: as a multiline math block
> - pandoc markdown: as a multiline math block
> - other: as multiple successive displayMath blocks
> 
> I do not see how modifying the AST in this way would produce an issue: it's an additive feature as far as I can tell.

Any change to our algebraic data types is a breaking change that would require modifications throughout the ecosystem (all writers and readers, filters, etc.).  That's why we're very conservative about such changes and make them infrequently and only with very strong reasons.

I suppose one possibility would be to parse this syntax into

\begin{aligned}
1 + 1 &= 2 \\
1 + 2 &= 3
\end{aligned}

which should work with all the formats you mention...

You could  even create a filter that does this, without changes to pandoc itself.


-- 
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/E89C2FED-79B7-4150-B015-D11C177D3F9B%40gmail.com.


  parent reply	other threads:[~2023-10-19 16:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 13:47 Guillaume Dehaene
     [not found] ` <672a5917-b04d-4eb9-966d-75b54df97837n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-10-19 16:11   ` John MacFarlane [this message]
     [not found]     ` <E89C2FED-79B7-4150-B015-D11C177D3F9B-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-10-20  7:40       ` Guillaume Dehaene
     [not found]         ` <daaf510b-50a3-4f9d-b7d5-58609d3821c6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-10-20 17:26           ` John MacFarlane
     [not found]             ` <464EF7B5-5A64-495A-A195-CC62A3D2A637-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-10-20 19:25               ` Guillaume Dehaene
     [not found]                 ` <e9222236-9514-4cdc-b986-ae8e7e198576n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-10-20 22:00                   ` John MacFarlane
     [not found]                     ` <73813E01-A490-4C3E-8B23-8952A80487DD-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-10-22 19:18                       ` Guillaume Dehaene
2023-10-20 19:08       ` Gwern Branwen

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=E89C2FED-79B7-4150-B015-D11C177D3F9B@gmail.com \
    --to=fiddlosopher-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).