From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33205 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Guillaume Dehaene Newsgroups: gmane.text.pandoc Subject: User story: typst multiline math in pandoc markdown and pandoc AST Date: Thu, 19 Oct 2023 06:47:41 -0700 (PDT) Message-ID: <672a5917-b04d-4eb9-966d-75b54df97837n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_6311_2076176589.1697723261989" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33994"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC7JVCW5SUMBB77GYSUQMGQEDWJWFLA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Oct 19 15:47:47 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f64.google.com ([209.85.210.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qtTNL-0008ei-8T for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 19 Oct 2023 15:47:47 +0200 Original-Received: by mail-ot1-f64.google.com with SMTP id 46e09a7af769-6ce279b7033sf1263469a34.0 for ; Thu, 19 Oct 2023 06:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1697723266; x=1698328066; darn=m.gmane-mx.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=7lMa/eCZ16YKSQZdFT0/AOTTLf7LExc+RMUttsSr99M=; b=WAmyYObEoQFnAVc5R8uwSdvSZ3JszSbNg1b+TXdhb3vVLtyEeAkCRpydT/gH19i9vf SQQGF122WT5DGqsYuHanmNgl6K8AdZ19hUaveRu6upDv+QG/uWTbKgEiJ8ueYzqvTKRM BtZQ37nDveLTf5rS2mlKktzLOZMSUBHP/3+GfzhcBNIGFh2ap2WB0lbJrqingzCbik/3 NWfoG50z6Yc5Eabx2Year5weAGjcKvWm6/Y8j/ygylJ9Hat8D+UVrWLmoNqG07Sd+JUD +3nHnumxQbFsYZLlwHHmTwdmT+aXJUpN+FVG+SFTifcif1p+xLHHsf7fNNngcFevvy0p Wx+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697723266; x=1698328066; darn=m.gmane-mx.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=7lMa/eCZ16YKSQZdFT0/AOTTLf7LExc+RMUttsSr99M=; b=ForOZr/isF06TEob9q8GyaoNUep32ER57GPM/gzC0fZTWwuw+DNC3YjIA6bors9t3I owNpOyENFCLrRyz58GrnYe7WGeWkKXtciFaSqKgzTksOKfoV2MWR0m60EuBMdE6JWpk3 2BZ+vU8/aPZVH1WW61z/QJpfIqi3Ss2s0fieRmfAeOZt/3NKpvbbcXEAc2cZsQvKpyM+ nmqrIyB27h46QgKpM77NsT2qqy+FdPCSu//3wawUbHFwf7UEcN7CzrT8qLc+P2cyUXVZ mlJ8CwDtBjXUQq5Q4lFJAMs4Om/Dsjndy1CchqkyHHpaue4adIugpMPD2OU6aJhBEErc accw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697723266; x=1698328066; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:message-id:to:from:date :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=7lMa/eCZ16YKSQZdFT0/AOTTLf7LExc+RMUttsSr99M=; b=KGg1IUXiafdCslQdfhFGP4+bIu7Y345tY7cp51CSrwRgpCc45JyGKXMQmK9IkMjknx CJXtKUt2JPi/whQUuTVmTofx3hm4biXy82CvWDCW40P6baXjvm9BEBu/BWMhO1sqkioF 0wmc/2QIAzdK0SL6JN0qQFzAlDU7/zRKArk9zA0lOz/R0j9E7gqsdlmOBbxDKyIs+gTG /RtvDR3LZmOp2pCqAFnmx1cfG9ieTD2mEq8gjR9iHxJLW23OQpm6oXKgWYaoJrsXg8nu dmUl3XKUL127Vn7ikU8BvR9U7DuveW7b0gSCseunhryLHgIoGmDvUFip6j8cC3RRkDfO Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YyQaKeF51oTQeaAGIRCHV7mP4tYUuKBmdkQe9mO7YUQMCoZISOb cUWbYh9qfVnOl0a4CiaaMqU= X-Google-Smtp-Source: AGHT+IEey+lkx+1w3LF9pikQBv1iczSwzF5kSWK8bfnbJ2PQ81mIjbfE/PrtvPb1m5qKLlmOqBqUzg== X-Received: by 2002:a05:6830:910:b0:6b9:924e:b43b with SMTP id v16-20020a056830091000b006b9924eb43bmr2449074ott.6.1697723266047; Thu, 19 Oct 2023 06:47:46 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a4a:3396:0:b0:581:e0ce:696f with SMTP id q144-20020a4a3396000000b00581e0ce696fls46852ooq.1.-pod-prod-08-us; Thu, 19 Oct 2023 06:47:42 -0700 (PDT) X-Received: by 2002:a05:6808:3312:b0:3ad:f3e6:66fe with SMTP id ca18-20020a056808331200b003adf3e666femr627719oib.4.1697723262596; Thu, 19 Oct 2023 06:47:42 -0700 (PDT) X-Original-Sender: guillaume.dehaene-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:33205 Archived-At: ------=_Part_6311_2076176589.1697723261989 Content-Type: multipart/alternative; boundary="----=_Part_6312_2014697019.1697723261989" ------=_Part_6312_2014697019.1697723261989 Content-Type: text/plain; charset="UTF-8" Hello everyone, Here is a "user story" in which I would like to discuss how math is handled by pandoc AST and pandoc markdown. I haven't been able to find existing discussion on this topic. I hope I'm not retreading something that has been discussed before. I'm sorry for any issues with clarity: this is my first time submitting something like this to a floss project. I write this as a mathematician, somewhat familiar with latex but frustrated by its opacity and how ugly .tex files look. I thus want to edit documents in a lighter markup while still having the following latex features: - math shortcodes: to simplify source code and for faster typing - multi-line equations - cross-references for a given equation line - cross-references for text blocks, for theorems I'd like to author documents in HTML, since it is the standard output format for the web, and PDF, if possible via latex, for back-compatibility with editors. 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. 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. It can always default down to multiple displayMath blocks For pandoc markdown, this makes the characters `&` and `\\` take on special meaning in math mode. I'm not familiar enough with math in markdown to know whether that could cause issues. If the behavior is implemented as an extension that the user can enable/disable, then this remains backwards compatible. It's also possible to use other characters, but this would mean that the syntax differs from latex. Do you believe that this is an interesting feature to have for pandoc? Best regards Guillaume -- 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/672a5917-b04d-4eb9-966d-75b54df97837n%40googlegroups.com. ------=_Part_6312_2014697019.1697723261989 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello everyone,

Here is a "user story" in which I would lik= e to discuss how math is handled by pandoc AST and pandoc markdown.
I = haven't been able to find existing discussion on this topic. I hope I'm not= retreading something that has been discussed before.
I'm sorry for an= y issues with clarity: this is my first time submitting something like this= to a floss project.

I write this as a mathematician, somewhat f= amiliar with latex but frustrated by its opacity and how ugly .tex files lo= ok.
I thus want to edit documents in a lighter markup while still havi= ng the following latex features:
- math shortcodes: to simplify source= code and for faster typing
- multi-line equations
- cross-refere= nces for a given equation line
- cross-references for text blocks, for= theorems
I'd like to author documents in HTML, since it is the standa= rd output format for the web, and PDF, if possible via latex, for back-comp= atibility with editors.

Pandoc provides a solution for almost al= l 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{ali= gn}
1 + 1 &=3D 2 \label{first_line} \\
1 + 2 &=3D 3 =C2= =A0\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 i= s parsed by both mathjax and katex.

However, I propose that form= atting equations like typst might be a good way to make multiline math nati= ve to Pandoc, instead of piggy-backing on raw latex.

Multiline e= quations could be written as in latex, wrapped in `$$ $$`:
```
$$=
1 + 1 &=3D 2 \\
1 + 2 &=3D 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
=C2=A0 =C2=A0 [
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 Math DisplayMathLine ["1+1", "=3D2"]
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 Math DisplayMathLine ["1+2", "=3D3"]
=C2=A0 =C2=A0 ]
]
```

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 di= splayMath 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. It c= an always default down to multiple=C2=A0displayMath blocks
For pandoc = markdown, this makes the characters `&` and `\\` take on special meanin= g in math mode. I'm not familiar enough with math in markdown to know wheth= er that could cause issues. If the behavior is implemented as an extension = that the user can enable/disable, then this remains backwards compatible. I= t's also possible to use other characters, but this would mean that the syn= tax differs from latex.

Do you believe that this is an interesti= ng feature to have for pandoc?

Best regards
Guillaume
=

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/672a5917-b04d-4eb9-966d-75b54df97837n%40googlegroups.= com.
------=_Part_6312_2014697019.1697723261989-- ------=_Part_6311_2076176589.1697723261989--