public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Theorem environment in markdown & pandoc
@ 2021-07-19 10:02 dualer
       [not found] ` <38362bc3-9a51-4094-9447-c0681231976bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: dualer @ 2021-07-19 10:02 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1817 bytes --]

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 into latex format, i.e. 
```
\begin{theorem}[name]\label{label}
math: $\pi$
\end{theorem}
```
I have done some searches on the internet, e.g. link1 
<https://pandoc.org/MANUAL.html#divs-and-spans> gives some information 
about div & span in pandoc, link2 
<https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> gives 
some ways to use the theorem environment in markdown, and link3 
<https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> gives 
some ways to transform it to latex format. I want to implement the 
following process: Using some code in markdown like 
```
::: {.theorem #label name="name"}
math: $\pi$
:::
```
or 
```
<div class="theorem" data-attribution="name">\label{label}
math: $\pi$
<\div>
```
to get the right display in vscode , e.g. 

*Theorem 1 (name)   *math $\pi$

after transforming it to latex, one can get the right latex content above. 
As far as I know, the way in link2 
<https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> doesn't 
support math formula & label and the way in link3 
<https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> doesn't 
support the `name` of theorem.

-- 
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/38362bc3-9a51-4094-9447-c0681231976bn%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2564 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Theorem environment in markdown & pandoc
       [not found] ` <38362bc3-9a51-4094-9447-c0681231976bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-20  0:39   ` Julien Dutant
       [not found]     ` <de0804ed-e7fb-4aeb-a6f5-e3a2fc96df18n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Julien Dutant @ 2021-07-20  0:39 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 5134 bytes --]

Thomas Hodgson and I are working on a filter 
(https://github.com/jdutant/statement ) to solve this. The README.md 
discusses in detail some existing tools and their syntax. Our aim is to 
handle HTML and XML output ("statement") as well as LaTeX, and some extra 
things (labelled statements) that are useful in philosophy papers. 

We still 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 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 against putting 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 some markdown formatting (the 
filter will have to process it). 

Let's fix terms: following the amsthm LaTeX package, 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 syntaxes. Any comments and 
suggestions appreciated!  

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 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/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 
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 one 
span, it's info, two spans, it's custom name and info; we could have a div 
type .custom-theorem that assumes that a single span is a name rather than 
info). But perhaps that's a risk.

2) bare syntax. 

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

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

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

::: 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 
clear rules (e.g. the parenthesis / strong should not contain points or 
newlines?).

Moreover, the filter should handle crossreferences 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...


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 into latex format, i.e. 
> ```
> \begin{theorem}[name]\label{label}
> math: $\pi$
> \end{theorem}
> ```
> I have done some searches on the internet, e.g. link1 
> <https://pandoc.org/MANUAL.html#divs-and-spans> gives some information 
> about div & span in pandoc, link2 
> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> gives 
> some ways to use the theorem environment in markdown, and link3 
> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> gives 
> some ways to transform it to latex format. I want to implement the 
> following process: Using some code in markdown like 
> ```
> ::: {.theorem #label name="name"}
> math: $\pi$
> :::
> ```
> or 
> ```
> <div class="theorem" data-attribution="name">\label{label}
> math: $\pi$
> <\div>
> ```
> to get the right display in vscode , e.g. 
>
> *Theorem 1 (name)   *math $\pi$
>
> after transforming it to latex, one can get the right latex content above. 
> As far as I know, the way in link2 
> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> doesn't 
> support math formula & label and the way in link3 
> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> doesn't 
> support the `name` of theorem.
>

-- 
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/de0804ed-e7fb-4aeb-a6f5-e3a2fc96df18n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 8148 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Theorem environment in markdown & pandoc
       [not found]     ` <de0804ed-e7fb-4aeb-a6f5-e3a2fc96df18n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-21  6:00       ` dualer
       [not found]         ` <ddc8755e-8aad-41b0-8635-7bb3a2ab6b30n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: dualer @ 2021-07-21  6:00 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 5636 bytes --]

Thanks for your detailed explanation. I will try it.

在2021年7月20日星期二 UTC+8 上午8:39:46<Julien Dutant> 写道:

> Thomas Hodgson and I are working on a filter (
> https://github.com/jdutant/statement ) to solve this. The README.md 
> discusses in detail some existing tools and their syntax. Our aim is to 
> handle HTML and XML output ("statement") as well as LaTeX, and some extra 
> things (labelled statements) that are useful in philosophy papers. 
>
> We still 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 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 against putting 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 some markdown formatting (the 
> filter will have to process it). 
>
> Let's fix terms: following the amsthm LaTeX package, 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 syntaxes. Any comments and 
> suggestions appreciated!  
>
> 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 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/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 
> 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 one 
> span, it's info, two spans, it's custom name and info; we could have a div 
> type .custom-theorem that assumes that a single span is a name rather than 
> info). But perhaps that's a risk.
>
> 2) bare syntax. 
>
> An even cleaner syntax would let the filter guess what's a custom name and 
> info. Example:
>
> ::: theorem
> (Bayes 1763). Content of the theorem
> :::
>
> The filter would assume that `Bayes 1763`, or anything between two 
> brackets starting the paragraph, is theorem info. 
>
> ::: 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 
> clear rules (e.g. the parenthesis / strong should not contain points or 
> newlines?).
>
> Moreover, the filter should handle crossreferences 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...
>
>
> 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 into latex format, i.e. 
>> ```
>> \begin{theorem}[name]\label{label}
>> math: $\pi$
>> \end{theorem}
>> ```
>> I have done some searches on the internet, e.g. link1 
>> <https://pandoc.org/MANUAL.html#divs-and-spans> gives some information 
>> about div & span in pandoc, link2 
>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> gives 
>> some ways to use the theorem environment in markdown, and link3 
>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> gives 
>> some ways to transform it to latex format. I want to implement the 
>> following process: Using some code in markdown like 
>> ```
>> ::: {.theorem #label name="name"}
>> math: $\pi$
>> :::
>> ```
>> or 
>> ```
>> <div class="theorem" data-attribution="name">\label{label}
>> math: $\pi$
>> <\div>
>> ```
>> to get the right display in vscode , e.g. 
>>
>> *Theorem 1 (name)   *math $\pi$
>>
>> after transforming it to latex, one can get the right latex content 
>> above. As far as I know, the way in link2 
>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> doesn't 
>> support math formula & label and the way in link3 
>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> doesn't 
>> support the `name` of theorem.
>>
>

-- 
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/ddc8755e-8aad-41b0-8635-7bb3a2ab6b30n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 9147 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Theorem environment in markdown & pandoc
       [not found]         ` <ddc8755e-8aad-41b0-8635-7bb3a2ab6b30n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-21  7:28           ` christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
       [not found]             ` <cd7c54d3-c8d8-4cbc-b8a1-6b99c8c1eb39n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org @ 2021-07-21  7:28 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 6027 bytes --]

Reluctantly mentioning pandoc-amsthm that targets HTML with CSS and LaTeX 
output. There’s 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 dualer wrote:

> Thanks for your detailed explanation. I will try it.
>
> 在2021年7月20日星期二 UTC+8 上午8:39:46<Julien Dutant> 写道:
>
>> Thomas Hodgson and I are working on a filter (
>> https://github.com/jdutant/statement ) to solve this. The README.md 
>> discusses in detail some existing tools and their syntax. Our aim is to 
>> handle HTML and XML output ("statement") as well as LaTeX, and some extra 
>> things (labelled statements) that are useful in philosophy papers. 
>>
>> We still 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 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 against putting 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 some markdown formatting (the 
>> filter will have to process it). 
>>
>> Let's fix terms: following the amsthm LaTeX package, 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 syntaxes. Any comments and 
>> suggestions appreciated!  
>>
>> 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 
>> 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/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 
>> 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 one 
>> span, it's info, two spans, it's custom name and info; we could have a div 
>> type .custom-theorem that assumes that a single span is a name rather than 
>> info). But perhaps that's a risk.
>>
>> 2) bare syntax. 
>>
>> An even cleaner syntax would let the filter guess what's a custom name 
>> and info. Example:
>>
>> ::: theorem
>> (Bayes 1763). Content of the theorem
>> :::
>>
>> The filter would assume that `Bayes 1763`, or anything between two 
>> brackets starting the paragraph, is theorem info. 
>>
>> ::: 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 
>> clear rules (e.g. the parenthesis / strong should not contain points or 
>> newlines?).
>>
>> Moreover, the filter should handle crossreferences 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...
>>
>>
>> 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 into latex format, i.e. 
>>> ```
>>> \begin{theorem}[name]\label{label}
>>> math: $\pi$
>>> \end{theorem}
>>> ```
>>> I have done some searches on the internet, e.g. link1 
>>> <https://pandoc.org/MANUAL.html#divs-and-spans> gives some information 
>>> about div & span in pandoc, link2 
>>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> gives 
>>> some ways to use the theorem environment in markdown, and link3 
>>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> gives 
>>> some ways to transform it to latex format. I want to implement the 
>>> following process: Using some code in markdown like 
>>> ```
>>> ::: {.theorem #label name="name"}
>>> math: $\pi$
>>> :::
>>> ```
>>> or 
>>> ```
>>> <div class="theorem" data-attribution="name">\label{label}
>>> math: $\pi$
>>> <\div>
>>> ```
>>> to get the right display in vscode , e.g. 
>>>
>>> *Theorem 1 (name)   *math $\pi$
>>>
>>> after transforming it to latex, one can get the right latex content 
>>> above. As far as I know, the way in link2 
>>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> doesn't 
>>> support math formula & label and the way in link3 
>>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> doesn't 
>>> support the `name` of theorem.
>>>
>>

-- 
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/cd7c54d3-c8d8-4cbc-b8a1-6b99c8c1eb39n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 9570 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Theorem environment in markdown & pandoc
       [not found]             ` <cd7c54d3-c8d8-4cbc-b8a1-6b99c8c1eb39n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-22  3:24               ` dualer
       [not found]                 ` <90b0b827-d4f2-4ae3-97de-e845938a94e4n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: dualer @ 2021-07-22  3:24 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 6310 bytes --]

Got it.

在2021年7月21日星期三 UTC+8 下午3:28:25<christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 写道:

> Reluctantly mentioning pandoc-amsthm that targets HTML with CSS and LaTeX 
> output. There’s 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 dualer wrote:
>
>> Thanks for your detailed explanation. I will try it.
>>
>> 在2021年7月20日星期二 UTC+8 上午8:39:46<Julien Dutant> 写道:
>>
>>> Thomas Hodgson and I are working on a filter (
>>> https://github.com/jdutant/statement ) to solve this. The README.md 
>>> discusses in detail some existing tools and their syntax. Our aim is to 
>>> handle HTML and XML output ("statement") as well as LaTeX, and some extra 
>>> things (labelled statements) that are useful in philosophy papers. 
>>>
>>> We still 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 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 against putting 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 some markdown 
>>> formatting (the filter will have to process it). 
>>>
>>> Let's fix terms: following the amsthm LaTeX package, 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 syntaxes. Any comments and 
>>> suggestions appreciated!  
>>>
>>> 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 
>>> 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/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 
>>> 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 
>>> one span, it's info, two spans, it's custom name and info; we could have a 
>>> div type .custom-theorem that assumes that a single span is a name rather 
>>> than info). But perhaps that's a risk.
>>>
>>> 2) bare syntax. 
>>>
>>> An even cleaner syntax would let the filter guess what's a custom name 
>>> and info. Example:
>>>
>>> ::: theorem
>>> (Bayes 1763). Content of the theorem
>>> :::
>>>
>>> The filter would assume that `Bayes 1763`, or anything between two 
>>> brackets starting the paragraph, is theorem info. 
>>>
>>> ::: 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 
>>> clear rules (e.g. the parenthesis / strong should not contain points or 
>>> newlines?).
>>>
>>> Moreover, the filter should handle crossreferences 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...
>>>
>>>
>>> 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 into latex format, i.e. 
>>>> ```
>>>> \begin{theorem}[name]\label{label}
>>>> math: $\pi$
>>>> \end{theorem}
>>>> ```
>>>> I have done some searches on the internet, e.g. link1 
>>>> <https://pandoc.org/MANUAL.html#divs-and-spans> gives some information 
>>>> about div & span in pandoc, link2 
>>>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> gives 
>>>> some ways to use the theorem environment in markdown, and link3 
>>>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> gives 
>>>> some ways to transform it to latex format. I want to implement the 
>>>> following process: Using some code in markdown like 
>>>> ```
>>>> ::: {.theorem #label name="name"}
>>>> math: $\pi$
>>>> :::
>>>> ```
>>>> or 
>>>> ```
>>>> <div class="theorem" data-attribution="name">\label{label}
>>>> math: $\pi$
>>>> <\div>
>>>> ```
>>>> to get the right display in vscode , e.g. 
>>>>
>>>> *Theorem 1 (name)   *math $\pi$
>>>>
>>>> after transforming it to latex, one can get the right latex content 
>>>> above. As far as I know, the way in link2 
>>>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> doesn't 
>>>> support math formula & label and the way in link3 
>>>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> doesn't 
>>>> support the `name` of theorem.
>>>>
>>>

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

[-- Attachment #1.2: Type: text/html, Size: 9923 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Theorem environment in markdown & pandoc
       [not found]                 ` <90b0b827-d4f2-4ae3-97de-e845938a94e4n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-22  3:29                   ` Kolen Cheung
  2021-07-22  4:49                     ` dualer
  0 siblings, 1 reply; 7+ messages in thread
From: Kolen Cheung @ 2021-07-22  3:29 UTC (permalink / raw)
  To: pandoc-discuss, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 7513 bytes --]

There may be others. The pandoc extras page in pandoc wiki often is quite exhaustive and you can check there.
On Jul 21, 2021, 8:24 PM -0700, dualer <maxwellguo1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, wrote:
> Got it.
>
> > 在2021年7月21日星期三 UTC+8 下午3:28:25<christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 写道:
> > > Reluctantly mentioning pandoc-amsthm that targets HTML with CSS and LaTeX output. There’s 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 dualer wrote:
> > > > > Thanks for your detailed explanation. I will try it.
> > > > >
> > > > > > 在2021年7月20日星期二 UTC+8 上午8:39:46<Julien Dutant> 写道:
> > > > > > > Thomas Hodgson and I are working on a filter (https://github.com/jdutant/statement ) to solve this. The README.md discusses in detail some existing tools and their syntax. Our aim is to handle HTML and XML output ("statement") as well as LaTeX, and some extra things (labelled statements) that are useful in philosophy papers.
> > > > > > >
> > > > > > > We still 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 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 against putting 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 some markdown formatting (the filter will have to process it).
> > > > > > >
> > > > > > > Let's fix terms: following the amsthm LaTeX package, 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 syntaxes. Any comments and suggestions appreciated!
> > > > > > >
> > > > > > > 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 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/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 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 one span, it's info, two spans, it's custom name and info; we could have a div type .custom-theorem that assumes that a single span is a name rather than info). But perhaps that's a risk.
> > > > > > >
> > > > > > > 2) bare syntax.
> > > > > > >
> > > > > > > An even cleaner syntax would let the filter guess what's a custom name and info. Example:
> > > > > > >
> > > > > > > ::: theorem
> > > > > > > (Bayes 1763). Content of the theorem
> > > > > > > :::
> > > > > > >
> > > > > > > The filter would assume that `Bayes 1763`, or anything between two brackets starting the paragraph, is theorem info.
> > > > > > >
> > > > > > > ::: 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 clear rules (e.g. the parenthesis / strong should not contain points or newlines?).
> > > > > > >
> > > > > > > Moreover, the filter should handle crossreferences 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...
> > > > > > >
> > > > > > >
> > > > > > > > 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 into latex format, i.e.
> > > > > > > > > ```
> > > > > > > > > \begin{theorem}[name]\label{label}
> > > > > > > > > math: $\pi$
> > > > > > > > > \end{theorem}
> > > > > > > > > ```
> > > > > > > > > I have done some searches on the internet, e.g. link1 gives some information about div & span in pandoc, link2 gives some ways to use the theorem environment in markdown, and link3 gives some ways to transform it to latex format. I want to implement the following process: Using some code in markdown like
> > > > > > > > > ```
> > > > > > > > > ::: {.theorem #label name="name"}
> > > > > > > > > math: $\pi$
> > > > > > > > > :::
> > > > > > > > > ```
> > > > > > > > > or
> > > > > > > > > ```
> > > > > > > > > <div class="theorem" data-attribution="name">\label{label}
> > > > > > > > > math: $\pi$
> > > > > > > > > <\div>
> > > > > > > > > ```
> > > > > > > > > to get the right display in vscode , e.g.
> > > > > > > > >
> > > > > > > > > Theorem 1 (name)   math $\pi$
> > > > > > > > >
> > > > > > > > > after transforming it to latex, one can get the right latex content above. As far as I know, the way in link2 doesn't support math formula & label and the way in link3 doesn't support the `name` of theorem.
> --
> You received this message because you are subscribed to a topic in the Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/dXTM0t2Yj7o/unsubscribe.
> To unsubscribe from this group and all its topics, 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/90b0b827-d4f2-4ae3-97de-e845938a94e4n%40googlegroups.com.

-- 
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/134b85e5-1ca1-4c62-a235-ff3e18bd01e7%40Spark.

[-- Attachment #2: Type: text/html, Size: 11685 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Theorem environment in markdown & pandoc
  2021-07-22  3:29                   ` Kolen Cheung
@ 2021-07-22  4:49                     ` dualer
  0 siblings, 0 replies; 7+ messages in thread
From: dualer @ 2021-07-22  4:49 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 7561 bytes --]

Thank you for your information. It's really a nice place.

在2021年7月22日星期四 UTC+8 上午11:29:22<christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 写道:

> There may be others. The pandoc extras page in pandoc wiki often is quite 
> exhaustive and you can check there.
> On Jul 21, 2021, 8:24 PM -0700, dualer <maxwe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, wrote:
>
> Got it.
>
> 在2021年7月21日星期三 UTC+8 下午3:28:25<christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 写道:
>
>> Reluctantly mentioning pandoc-amsthm that targets HTML with CSS and LaTeX 
>> output. There’s 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 dualer wrote:
>>
>>> Thanks for your detailed explanation. I will try it.
>>>
>>> 在2021年7月20日星期二 UTC+8 上午8:39:46<Julien Dutant> 写道:
>>>
>>>> Thomas Hodgson and I are working on a filter (
>>>> https://github.com/jdutant/statement ) to solve this. The README.md 
>>>> discusses in detail some existing tools and their syntax. Our aim is to 
>>>> handle HTML and XML output ("statement") as well as LaTeX, and some extra 
>>>> things (labelled statements) that are useful in philosophy papers.  
>>>>
>>>> We still 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 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 against putting 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 some markdown 
>>>> formatting (the filter will have to process it). 
>>>>
>>>> Let's fix terms: following the amsthm LaTeX package, 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 syntaxes. Any comments and 
>>>> suggestions appreciated!  
>>>>
>>>> 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 
>>>> 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/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 
>>>> 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 
>>>> one span, it's info, two spans, it's custom name and info; we could have a 
>>>> div type .custom-theorem that assumes that a single span is a name rather 
>>>> than info). But perhaps that's a risk.
>>>>
>>>> 2) bare syntax. 
>>>>
>>>> An even cleaner syntax would let the filter guess what's a custom name 
>>>> and info. Example:
>>>>
>>>> ::: theorem
>>>> (Bayes 1763). Content of the theorem
>>>> :::
>>>>
>>>> The filter would assume that `Bayes 1763`, or anything between two 
>>>> brackets starting the paragraph, is theorem info. 
>>>>
>>>> ::: 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 
>>>> clear rules (e.g. the parenthesis / strong should not contain points or 
>>>> newlines?).
>>>>
>>>> Moreover, the filter should handle crossreferences 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...
>>>>
>>>>
>>>> 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 into latex format, i.e.  
>>>>> ```
>>>>> \begin{theorem}[name]\label{label}
>>>>> math: $\pi$
>>>>> \end{theorem}
>>>>> ```
>>>>> I have done some searches on the internet, e.g. link1 
>>>>> <https://pandoc.org/MANUAL.html#divs-and-spans> gives some 
>>>>> information about div & span in pandoc, link2 
>>>>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> gives 
>>>>> some ways to use the theorem environment in markdown, and link3 
>>>>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> gives 
>>>>> some ways to transform it to latex format. I want to implement the 
>>>>> following process: Using some code in markdown like 
>>>>> ```
>>>>> ::: {.theorem #label name="name"}
>>>>> math: $\pi$
>>>>> :::
>>>>> ```
>>>>> or 
>>>>> ```
>>>>> <div class="theorem" data-attribution="name">\label{label}
>>>>> math: $\pi$
>>>>> <\div>
>>>>> ```
>>>>> to get the right display in vscode , e.g. 
>>>>>
>>>>> *Theorem 1 (name)   *math $\pi$
>>>>>
>>>>> after transforming it to latex, one can get the right latex content 
>>>>> above. As far as I know, the way in link2 
>>>>> <https://stackoverflow.com/questions/55152190/implementing-a-named-theorem-environment-in-html-css> doesn't 
>>>>> support math formula & label and the way in link3 
>>>>> <https://github.com/jgm/pandocfilters/blob/master/examples/theorem.py> doesn't 
>>>>> support the `name` of theorem.
>>>>>
>>>> --
> You received this message because you are subscribed to a topic in the 
> Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/pandoc-discuss/dXTM0t2Yj7o/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> pandoc-discus...-/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 
> <https://groups.google.com/d/msgid/pandoc-discuss/90b0b827-d4f2-4ae3-97de-e845938a94e4n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>

-- 
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/b3bd2205-c6b9-4bc1-b690-0cadfd50dd02n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 12873 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-22  4:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 10:02 Theorem environment in markdown & pandoc dualer
     [not found] ` <38362bc3-9a51-4094-9447-c0681231976bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-20  0:39   ` Julien Dutant
     [not found]     ` <de0804ed-e7fb-4aeb-a6f5-e3a2fc96df18n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-21  6:00       ` dualer
     [not found]         ` <ddc8755e-8aad-41b0-8635-7bb3a2ab6b30n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-21  7:28           ` christi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
     [not found]             ` <cd7c54d3-c8d8-4cbc-b8a1-6b99c8c1eb39n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-22  3:24               ` dualer
     [not found]                 ` <90b0b827-d4f2-4ae3-97de-e845938a94e4n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-22  3:29                   ` Kolen Cheung
2021-07-22  4:49                     ` dualer

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).