From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28885 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dualer Newsgroups: gmane.text.pandoc Subject: Re: Theorem environment in markdown & pandoc Date: Wed, 21 Jul 2021 20:24:45 -0700 (PDT) Message-ID: <90b0b827-d4f2-4ae3-97de-e845938a94e4n@googlegroups.com> References: <38362bc3-9a51-4094-9447-c0681231976bn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1970_2091026635.1626924285213" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20128"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDF5LNHQ5EARB7WJ4ODQMGQE2AH4IAY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jul 22 05:24:49 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f56.google.com ([209.85.161.56]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m6PKK-00055W-7g for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 22 Jul 2021 05:24:48 +0200 Original-Received: by mail-oo1-f56.google.com with SMTP id p142-20020a4a2f940000b0290263980f2b45sf1821708oop.8 for ; Wed, 21 Jul 2021 20:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=ELbDEa8rtcJc2gTWGHW/0QoWpcFixQOme2f31KQ4Sns=; b=nP+OOM7blZOzfoCRJYDQwrwtzD36BU64CrK7Haac8hPxO6Obe10n+p4yb8SEW7ERLT AfBzZPLFjQGLxHOUwCL6o1ekSx1WakJ55DIRyLYZDCzRNq+mnmw/Xedi7kvySWOaNseI ztwVO5vwZBDvCA3CHnQoBQJl02QwUGNTG21pGYFNozP552maoQyUv2ZLTkCXex4rREQC eGze2Hq9CF+4CMLN1gzeifiD5hiJ+SnG9zh3pPuCaSTkkDV0jUSOQeeGFwXYMAC19T47 MMhY+APpByRjaZt8Tb2rZTofvIFqRHpRATLkmvbFcrHqJPvrgyUUr1YWnGufbFxdi0x1 NsZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=ELbDEa8rtcJc2gTWGHW/0QoWpcFixQOme2f31KQ4Sns=; b=YXJ4aC/UtQqKrdEgEkVl0GyrkP13bJFBpLGIHpmIRoLzIvhG9QQzLYCh02ekrCMZfs shhsiHfIr28UlLyCUgPyt+Ssf3VwxHms/a2dSDfGH12QyjHB6WfvPDylZysLzHFKW7mD JqV9fmNdyk47wBSvM48YiQh3k4/SKmx7y13yEbIPc8CrsqDOSNHiXL3HLQkk0eL+Kcad 7EsJe1bNZeK48bvPZUXrMnuGV57IBGe3PjicjWfXyE5/opO4B4CLF8KWfJnc5sye35sW 8EvFJLGw452V8YmiHY5Ytf7ZdfXgh+LGGo7lgkKjpgdztFP4elOH5VXp+pbKEhEJoWpD U4Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=ELbDEa8rtcJc2gTWGHW/0QoWpcFixQOme2f31KQ4Sns=; b=tuWl0Hc1aVtGS0MEUOn2OoaSpYr1o7najtV6uClxnX854quoJSxna8BkV7GXY56QnS ApZhtu7vQzdYMOU4/woiP9EnSD15rUJg99u437E9n9o44/aLsz27HVqCBoHClTcq1adk 64iVDLq2BkdWmb84inrmk4p0BPO3WIHfPkjLkLCF88eMLAIZm1xHRopPG6meNQ8ZUA4o 1O3OZZAm/10UwVj7QU99TG1nwmOChjrA0spfA10VPJrEmZByP8ap+Xno2tXs3oH6a1cn 8zFX58kjy1bFta54L26eOyv5arGNuMFvG6cbETbd6LkEXmD3/6232/HT/HEyPvZKhFnY GunA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5333Hu8S0MDerPCe6fMvm2AF5pXHbXGY6lEg/qiEUybQXfWDlnvn piUG58N0pnq2wR8wQe2VPvs= X-Google-Smtp-Source: ABdhPJxCKmoza6hah/0M9n6NvffOKzFNo/MlSok0wTiJ1Lu+k9f0Hq8v+MbwWrPD669FLM3A5z9Ttg== X-Received: by 2002:aca:bdc4:: with SMTP id n187mr26868460oif.169.1626924287181; Wed, 21 Jul 2021 20:24:47 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:c7c8:: with SMTP id x191ls1119840oif.2.gmail; Wed, 21 Jul 2021 20:24:45 -0700 (PDT) X-Received: by 2002:a05:6808:24d:: with SMTP id m13mr2263503oie.137.1626924285777; Wed, 21 Jul 2021 20:24:45 -0700 (PDT) In-Reply-To: X-Original-Sender: maxwellguo1-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:28885 Archived-At: ------=_Part_1970_2091026635.1626924285213 Content-Type: multipart/alternative; boundary="----=_Part_1971_1714810016.1626924285213" ------=_Part_1971_1714810016.1626924285213 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Got it. =E5=9C=A82021=E5=B9=B47=E6=9C=8821=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8=89 UTC+= 8 =E4=B8=8B=E5=8D=883:28:25 =E5=86=99=E9=81=93=EF=BC= =9A > Reluctantly mentioning pandoc-amsthm that targets HTML with CSS and LaTeX= =20 > output. There=E2=80=99s a branch work in progress using panflute and so f= ar target=20 > latex output only. > > On Tuesday, July 20, 2021 at 11:00:37 PM UTC-7 dualer wrote: > >> Thanks for your detailed explanation. I will try it. >> >> =E5=9C=A82021=E5=B9=B47=E6=9C=8820=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=8C U= TC+8 =E4=B8=8A=E5=8D=888:39:46 =E5=86=99=E9=81=93=EF=BC=9A >> >>> Thomas Hodgson and I are working on a filter ( >>> https://github.com/jdutant/statement ) to solve this. The README.md=20 >>> discusses in detail some existing tools and their syntax. Our aim is to= =20 >>> handle HTML and XML output ("statement") as well as LaTeX, and some ext= ra=20 >>> things (labelled statements) that are useful in philosophy papers.=20 >>> >>> We still need to decide on the syntax and finish writing the filter. In= =20 >>> short, I'm inclined to pick a syntax that: >>> 1. doesn't break anything >>> 2. prints reasonably well if the filter isn't used. >>> >>> Constraint (1) tells against clever re-purposing of the definition=20 >>> syntax (used by some filters). Constraint (2) tells against putting the= =20 >>> name of theorem in a div's attributes. Another limitation of div's=20 >>> attributes is that they're not great if the name includes some markdown= =20 >>> formatting (the filter will have to process it).=20 >>> >>> Let's fix terms: following the amsthm LaTeX package, the theorem *label= *=20 >>> is "Theorem + Num" or a custom name such as "Klein's Lemma". This is=20 >>> optionally followed by an *info* bit that's normally printed between=20 >>> parenthesis, e.g. (Klein 1972, 1975) >>> >>> My inclination is to go for either of two syntaxes. Any comments and=20 >>> suggestions appreciated! =20 >>> >>> 1) Span-based. >>> >>> ::: theorem >>> [(Klein 1975)]{.info} >>> Content of the theorem >>> ::: >>> >>> Would be converted to: >>> >>> **Theorem 1**. (Klein 1975). Content of the theorem. >>> >>> Optionally, if a {.name} span is provided, the filter should convert it= =20 >>> to a custom name theorem: >>> >>> ::: theorem >>> [**Klein's Lemma**]{.name} >>> [(Klein 1975)]{.info} >>> Content of the theorem >>> ::: >>> >>> Prints out: >>> >>> **Klein's Lemma**. (Klein 1975). Content of the theorem. >>> >>> The filter should assume that outer parentheses and outer=20 >>> emphasis/strong on the name and info >>> are not part of the label. So it would simply pass to LaTeX: >>> >>> \newtheorem{Kleinslemma}{Klein's Lemma} >>> \begin{Kleinslemma}[Klein 1975] Content of the theorem \end{kleinslemma= } >>> >>> We could make the Span syntax lighter by deciding that it's optional to= =20 >>> give the Span a class, e.g.: >>> >>> ::: theorem >>> [**Klein's Lemma**]{} >>> [(Klein 1975)]{} >>> Content of the theorem >>> ::: >>> >>> Would be process just the same (assumes that if the block starts with= =20 >>> one span, it's info, two spans, it's custom name and info; we could hav= e a=20 >>> div type .custom-theorem that assumes that a single span is a name rath= er=20 >>> than info). But perhaps that's a risk. >>> >>> 2) bare syntax.=20 >>> >>> An even cleaner syntax would let the filter guess what's a custom name= =20 >>> and info. Example: >>> >>> ::: theorem >>> (Bayes 1763). Content of the theorem >>> ::: >>> >>> The filter would assume that `Bayes 1763`, or anything between two=20 >>> brackets starting the paragraph, is theorem info.=20 >>> >>> ::: theorem >>> **Klein's Lemma**. Content of the theorem >>> ::: >>> >>> The filter would assume that 'Klein's lemma is a custom name. >>> >>> A filter for this syntax is more complex to write and we need to settle= =20 >>> clear rules (e.g. the parenthesis / strong should not contain points or= =20 >>> newlines?). >>> >>> Moreover, the filter should handle crossreferences to theorems. We were= =20 >>> thinking of picking up Cite elements, as with pandoc-crossref ( >>> https://github.com/lierdakil/pandoc-crossref) >>> >>> ::: theorem {#thm:bayes} >>> Content of the theorem >>> ::: >>> >>> From @thm:bayes it follows that... >>> >>> >>> On Monday, July 19, 2021 at 11:02:05 AM UTC+1 dualer wrote: >>> >>>> I use vscode to write the markdown document now, but it doesn't suppor= t=20 >>>> the theorem environment. I wonder whether one can make it happen, and = use=20 >>>> pandoc to transform it into latex format, i.e.=20 >>>> ``` >>>> \begin{theorem}[name]\label{label} >>>> math: $\pi$ >>>> \end{theorem} >>>> ``` >>>> I have done some searches on the internet, e.g. link1=20 >>>> gives some information= =20 >>>> about div & span in pandoc, link2=20 >>>> gives=20 >>>> some ways to use the theorem environment in markdown, and link3=20 >>>> = gives=20 >>>> some ways to transform it to latex format. I want to implement the=20 >>>> following process: Using some code in markdown like=20 >>>> ``` >>>> ::: {.theorem #label name=3D"name"} >>>> math: $\pi$ >>>> ::: >>>> ``` >>>> or=20 >>>> ``` >>>>
\label{label} >>>> math: $\pi$ >>>> <\div> >>>> ``` >>>> to get the right display in vscode , e.g.=20 >>>> >>>> *Theorem 1 (name) *math $\pi$ >>>> >>>> after transforming it to latex, one can get the right latex content=20 >>>> above. As far as I know, the way in link2=20 >>>> doesn't=20 >>>> support math formula & label and the way in link3=20 >>>> = doesn't=20 >>>> support the `name` of theorem. >>>> >>> --=20 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 e= mail 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/90b0b827-d4f2-4ae3-97de-e845938a94e4n%40googlegroups.com. ------=_Part_1971_1714810016.1626924285213 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Got it.

=E5=9C=A82021=E5=B9=B47=E6=9C=8821=E6=97=A5=E6=98=9F=E6=9C=9F=E4=B8= =89 UTC+8 =E4=B8=8B=E5=8D=883:28:25<christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> =E5=86=99=E9= =81=93=EF=BC=9A
Reluctantly mentioning pandoc-amsthm that targets HTML with CSS and LaTe= X output. There=E2=80=99s a branch work in progress using panflute and so f= ar target latex output only.

On Tuesday, July 20, 2021 at 11:00:37 PM UTC-7 d= ualer wrote:
Thanks fo= r your detailed explanation. I will try it.

=E5=9C=A82021=E5=B9=B47=E6=9C=882= 0=E6=97=A5=E6=98=9F=E6=9C=9F=E4=BA=8C UTC+8 =E4=B8=8A=E5=8D=888:39:46<Ju= lien Dutant> =E5=86=99=E9=81=93=EF=BC=9A
Thomas Hodgson and I are working on a filter (https://github.com/jduta= nt/statement ) to solve this. The README.md discusses in detail some ex= isting tools and their syntax. Our aim is to handle HTML and XML output (&q= uot;statement") as well as LaTeX, and some extra things (labelled stat= ements) that are useful in philosophy papers.=C2=A0

We s= till need to decide on the syntax and finish writing the filter. In short, = I'm inclined to pick a syntax that:
1. doesn't break anyt= hing
2. prints reasonably well if the filter isn't used.

Constraint (1) tells against clever re-purposing of th= e definition syntax (used by some filters). Constraint (2) tells against pu= tting the name of theorem in a div's attributes. Another limitation of = div's attributes is that they're not great if the name includes som= e markdown formatting (the filter will have to process it).=C2=A0

Let's fix terms: following the amsthm LaTeX package, th= e theorem *label* is "Theorem + Num" or a custom name such as &qu= ot;Klein's Lemma". This is optionally followed by an *info* bit th= at's normally printed between parenthesis, e.g. (Klein 1972, 1975)

My inclination is to go for either of two syntaxes. An= y comments and suggestions appreciated!=C2=A0=C2=A0

1) Span-based.

::: theorem
[(Klein 197= 5)]{.info}
Content of the theorem
:::

Would be converted to:

**Theorem 1**. (Kle= in 1975). Content of the theorem.

Optionally, if a= {.name} span is provided, the filter should convert it to a custom name th= eorem:

::: theorem
[**Klein's Lemma*= *]{.name}
[(Klein 1975)]{.info}
Content of the theo= rem
:::

Prints out:

=
**Klein's Lemma**. (Klein 1975). Content of the theorem.

The filter should assume that outer parentheses and outer e= mphasis/strong on the name and info
are not part of the label. So= it would simply pass to LaTeX:

\newtheorem{Kleins= lemma}{Klein's Lemma}
\begin{Kleinslemma}[Klein 1975] Content= of the theorem \end{kleinslemma}

We could make th= e Span syntax lighter by deciding that it's optional to give the Span a= class, e.g.:

::: theorem
[**Klein&= #39;s Lemma**]{}
[(Klein 1975)]{}
Content of the th= eorem
:::

Would be process just th= e same (assumes that if the block starts with one span, it's info, two = spans, it's custom name and info; we could have a div type .custom-theo= rem that assumes that a single span is a name rather than info). But perhap= s that's a risk.

2) bare syntax.=C2=A0

An even cleaner syntax would let the filter guess what= 9;s a custom name and info. Example:

::: theorem
(Bayes 1763). Content of the theorem
:::
<= br>
The filter would assume that `Bayes 1763`, or anything betwee= n two brackets starting the paragraph, is theorem info.=C2=A0
::: theorem
**Klein's Lemma**. Content of the the= orem
:::

The filter would assume that &#= 39;Klein's lemma is a custom name.

A filter fo= r this syntax is more complex to write and we need to settle clear rules (e= .g. the parenthesis / strong should not contain points or newlines?).
=

Moreover, the filter should handle crossreferences to t= heorems. We were thinking of picking up Cite elements, as with pandoc-cross= ref (https://github.com/lierdakil/pandoc-crossref)

<= div>::: theorem {#thm:bayes}
Content of the theorem
:::=

From @thm:bayes it follows that...

=

On Monday, July 19, 2021 at 11:02:05 AM UTC+1 dualer wrote:
=
I use vscode to write the= markdown document now, but it doesn't support the theorem environment.= I wonder whether one can make it happen, and use pandoc to transform it in= to latex=C2=A0format, i.e.=C2=A0
```
\begin{theorem}[nam= e]\label{label}
math: $\pi$
\end{theorem}
```=
I have done some searches on the internet, e.g.=C2=A0link1=C2=A0gives some information about div & span in pandoc,=C2=A0link2=C2=A0gives some ways to use the theorem en= vironment in markdown, and=C2=A0link3=C2=A0gives some ways to transform it to latex format. I want = to implement the following process: Using some code in markdown like=C2=A0<= /div>
```
:::=C2=A0{.theorem=C2=A0#label=C2=A0name=3D&q= uot;name"}
math: $\pi$
:::
``= `
or=C2=A0
```
<div=C2=A0class= =3D"theorem"=C2=A0data-attribution=3D"name">\label{l= abel}
math: $\pi$
<\div>
``= `
to get the right display in vscode , e.g.=C2=A0

<= /div>
Theorem 1 (name)=C2=A0 =C2=A0math $\pi$

after transforming it to latex, one can get the right latex content = above. As far as I know, the way in=C2=A0link= 2=C2=A0doesn't support math formula & label and the way in=C2= =A0link3=C2=A0doesn'= t support the `name` of theorem.

--
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/90b0b827-d4f2-4ae3-97de-e845938a94e4n%40googlegroups.= com.
------=_Part_1971_1714810016.1626924285213-- ------=_Part_1970_2091026635.1626924285213--