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: Fri, 20 Oct 2023 10:26:58 -0700	[thread overview]
Message-ID: <464EF7B5-5A64-495A-A195-CC62A3D2A637@gmail.com> (raw)
In-Reply-To: <daaf510b-50a3-4f9d-b7d5-58609d3821c6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>



> On Oct 20, 2023, at 12:40 AM, Guillaume Dehaene <guillaume.dehaene-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> 
> Thank you for your insight.
> 
> 1. I'm not 100% satisfied with your solution since it does not work with latex environments which open math-mode (such as a align). These produce errors because of the double-opening of math-mode. It's also pretty cumbersome compared to usual md.
> 
> I see that this is how pandoc parses typst equations (I should have looked!)
>     [ Math
>         DisplayMath
>         "\\begin{aligned}\n1 + 1 & = 2 \\\\\n1 + 1 & = 2\n\\end{aligned}"
>     ]
> 
> Is that now going to be the accepted format for multiline equations?

I'm not sure I understand.  This has always been possible in pandoc (and LaTeX); we use it here because it's the way to get equivalent LaTeX math to the typst formula.


Side note:

in pandoc you can also do

$$
\begin{align}
x & = 5\\
y &= 3
\end{align}
$$

even though this isn't possible in LaTeX.  Pandoc will do the right thing the output format.  Try it.

> 2. I had overlooked the possibility of writing a filter.
> The principle of the filter would then be:
> 
> parse DisplayMath
> if there are & and/or \\ present, modify the block
> depending on writer:
> - latex, HTML: transform to align
> - everything else: transform to accepted format(??) \begin{aligned}
> 
> Is that correct? If so, I'll start hacking at it in the near future.

Yes, something like that.


  parent reply	other threads:[~2023-10-20 17:26 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
     [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 [this message]
     [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=464EF7B5-5A64-495A-A195-CC62A3D2A637@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).