From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28869 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" Newsgroups: gmane.text.pandoc Subject: Re: Theorem environment in markdown & pandoc Date: Wed, 21 Jul 2021 00:28:25 -0700 (PDT) Message-ID: 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_906_1635300755.1626852505163" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24042"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCS252WXTEIBBGUZ36DQMGQETDKICMA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jul 21 09:28:28 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f60.google.com ([209.85.210.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m66ea-00065F-JL for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 21 Jul 2021 09:28:28 +0200 Original-Received: by mail-ot1-f60.google.com with SMTP id s11-20020a056830124bb02904d1d78ee61csf995399otp.3 for ; Wed, 21 Jul 2021 00:28:28 -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=EypPkd6kv1ll1TsDOpcSdkGxWVqougyRB025tQ6QOfc=; b=TyT9SW6IT2WHIjx7sV8+i6YIne+NEDIEfNIMth/nI1qz9ddlzEShPNX2V/p7bY3zpf oTAiSC7ID5ZMFpLYx9iPywaVprh9l7/WSx1bWVZmw5OuoRDYBylwX1ZYvcw8Kr6cNYGs l7ycoa/vDqyjTg1YpFObJ9/eFdm+XU4lThh3JIUm6clCkUQDAkeXvj12OuUtsFN5CZR4 qH1IldY02CLNWUWD5J90+NTjlDII5RtJUAg/QfjgRh3VmU39ZeGV1i30wOesbU06MEuU f2boenBETCjZtdYwenbZ4P/E/7DeVodyJ+sjYrEDxNTfnerSAra0FJoGFaRtBLdMrC1t 7y3g== 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=EypPkd6kv1ll1TsDOpcSdkGxWVqougyRB025tQ6QOfc=; b=KEW1TtQKui40UdQblLypdkZoKVLGmybYztcXoO9uQ3VVDoodvTHLIskB5HT/EnhPpU vREmzl3W8jDwoP1YeYZ+MEeFi9qV6TDg98RFRgUr6smmgXAm1pQInzK1wkWKkixL/NPo 08yL3RwKrzrBFPtZ1NI5JF8Ejqm9NJlEkFsHZv9EZUcWIXqL7T5Sx3yEEMApwk9GGbFw dFDXvjOB/iJaMXzF28ljijEQ5trfRXHje9z9+MvgBUtqq/D/df9cmJxIWg09DHhTmN7R f0qxY2FFHGF/sRHmyWakXof2LS5zjjQtYsz24+IqKJNG3x9bd7ceSoW06AsA+CH9ixSd 2aBQ== 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=EypPkd6kv1ll1TsDOpcSdkGxWVqougyRB025tQ6QOfc=; b=JwMCpqMMEJoXVLSC/oUHCmGHxuZkHBv3koreLT320/937/3TniflvK5Rcd3+eOh7K2 yVLXZS8IDqyY3tg4u0hNle67n0zB/VW/ARJ9gh/3qRkRu7WrBDV9kWic/1AZ38RGGsvW UpDeJcxIKfFT3FBncccMLQP0mZhG5Y+MkdC6+EOKnadVvcySwRFx0Hcws/6hRM3gKpZ6 w/4g/94r6vtP56zfAyIDAk3Zwd0vMxBl00T+uQLdOQr2KotjxImsQvMTLK3ULQYmsNtD TkP7JZ8TttH8YC+eadOgSMmKW4YEL57IcutHbB/0L4RV9WiWcGYSU/rqvJJWEnppVBOA ZY5w== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531H4lYqCiu6O+Fv+bI54/0J180aGxPmBOtukfpkD/RlXDhuslih bpM1PWbXJQEqWjobhHq9gDY= X-Google-Smtp-Source: ABdhPJxfTD2yYfoTQE2d3wvoRipM7WzLnSOQq5FZdPyVQXXc7BAF09rL3K3v5D/iLhZLFg7NTPTshg== X-Received: by 2002:aca:31d8:: with SMTP id x207mr1680229oix.144.1626852507613; Wed, 21 Jul 2021 00:28:27 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:1d5:: with SMTP id x21ls440242oic.9.gmail; Wed, 21 Jul 2021 00:28:26 -0700 (PDT) X-Received: by 2002:a05:6808:13c5:: with SMTP id d5mr24161750oiw.164.1626852505780; Wed, 21 Jul 2021 00:28:25 -0700 (PDT) In-Reply-To: X-Original-Sender: christian.kolen-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:28869 Archived-At: ------=_Part_906_1635300755.1626852505163 Content-Type: multipart/alternative; boundary="----=_Part_907_254504797.1626852505163" ------=_Part_907_254504797.1626852505163 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 far= 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 UT= C+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 extr= a=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 synta= x=20 >> (used by some filters). Constraint (2) tells against putting the name of= =20 >> theorem in a div's attributes. Another limitation of div's attributes is= =20 >> that they're not great if the name includes some markdown formatting (th= e=20 >> 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 emphasis/stron= g=20 >> 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 on= e=20 >> span, it's info, two spans, it's custom name and info; we could have a d= iv=20 >> type .custom-theorem that assumes that a single span is a name rather th= an=20 >> 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 support= =20 >>> the theorem environment. I wonder whether one can make it happen, and u= se=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/cd7c54d3-c8d8-4cbc-b8a1-6b99c8c1eb39n%40googlegroups.com. ------=_Part_907_254504797.1626852505163 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Reluctantly mentioning pandoc-amsthm that targets HTML with CSS and LaTeX o= utput. There=E2=80=99s a branch work in progress using panflute and so far = target latex output only.

On Tuesday, July 20, 2021 at 11:00:37 PM UTC-7 dual= er wrote:
Tha= nks 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 UTC+8 =E4=B8=8A=E5=8D=888:39:4= 6<Julien Dutant> =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 discusses in detail s= ome existing tools and their syntax. Our aim is to handle HTML and XML outp= ut ("statement") as well as LaTeX, and some extra things (labelle= d statements) that are useful in philosophy papers.=C2=A0

We still need to decide on the syntax and finish writing the filter. In s= hort, I'm inclined to pick a syntax that:
1. doesn't brea= k anything
2. prints reasonably well if the filter isn't used= .

Constraint (1) tells against clever re-purposing= of the definition syntax (used by some filters). Constraint (2) tells agai= nst putting the name of theorem in a div's attributes. Another limitati= on of div's attributes is that they're not great if the name includ= es some markdown formatting (the filter will have to process it).=C2=A0

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

My inclination is to go for either of two syntax= es. Any comments and suggestions appreciated!=C2=A0=C2=A0

1) Span-based.

::: theorem
[(Kle= in 1975)]{.info}
Content of the theorem
:::
<= br>
Would be converted to:

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

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

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

Prints out:

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

The filter should assume that outer parentheses and o= uter emphasis/strong on the name and info
are not part of the lab= el. So it would simply pass to LaTeX:

\newtheorem{= Kleinslemma}{Klein's Lemma}
\begin{Kleinslemma}[Klein 1975] C= ontent of the theorem \end{kleinslemma}

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

::: theorem
[**= Klein's Lemma**]{}
[(Klein 1975)]{}
Content of = the theorem
:::

Would be process j= ust the 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 .custo= m-theorem that assumes that a single span is a name rather than info). But = perhaps that's a risk.

2) bare syntax.=C2=A0

An even cleaner syntax would let the filter guess w= hat's a custom name and info. Example:

::: the= orem
(Bayes 1763). Content of the theorem
:::
=

The filter would assume that `Bayes 1763`, or anything = between two brackets starting the paragraph, is theorem info.=C2=A0

::: theorem
**Klein's Lemma**. Content of t= he theorem
:::

The filter would assume t= hat 'Klein's lemma is a custom name.

A fil= ter for this syntax is more complex to write and we need to settle clear ru= les (e.g. the parenthesis / strong should not contain points or newlines?).=

Moreover, the filter should handle crossreference= s to theorems. We were 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...
<= br>

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 environm= ent. I wonder whether one can make it happen, and use pandoc to transform i= t into latex=C2=A0format, i.e.=C2=A0
```
\begin{theorem}= [name]\label{label}
math: $\pi$
\end{theorem}
```
I have done some searches on the internet, e.g.=C2=A0link1<= /a>=C2=A0gives some information about div & span in pandoc,=C2=A0link2=C2=A0gives some ways to use the theorem envi= ronment in markdown, and=C2=A0l= ink3=C2=A0gives some ways to transform it to latex format. I want to im= plement the following process: Using some code in markdown like=C2=A0
=
```
:::=C2=A0{.theorem=C2=A0#label=C2=A0name=3D"n= ame"}
math: $\pi$
:::
```
or=C2=A0
```
<div=C2=A0class=3D&quo= t;theorem"=C2=A0data-attribution=3D"name">\label{label}
math: $\pi$
<\div>
```
=
to get the right display in vscode , e.g.=C2=A0

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=A0link2=C2= =A0doesn't support math formula & label and the way in=C2=A0link3=C2=A0doesn't support t= he `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/cd7c54d3-c8d8-4cbc-b8a1-6b99c8c1eb39n%40googlegroups.= com.
------=_Part_907_254504797.1626852505163-- ------=_Part_906_1635300755.1626852505163--