public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Can math elements have attributes
@ 2023-02-08 12:52 A A
       [not found] ` <CAMwawgNMtvbVjzddff1aPcn=Qga=VYYi_Xb5ENE3zXQV=V_SwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: A A @ 2023-02-08 12:52 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Dear all,

I am writing my own pandoc to latex converter using panflute and would like
to attach attributes to Math elements. I have tried the following syntax,
but it seems that the attribute is not being picked up by panflute:

```
$$x=y$${ a=b }
```

I did some of my own research to figure out what I was doing wrong. And a
couple of things became apparent:

- On the one hand, it looks like pandoc might not support this:
    - https://github.com/jgm/pandoc/issues/684
    - https://github.com/jgm/pandoc/issues/5286
- On the other hand, `pandoc-crossref` seems to be able to handle this
syntax:
    - https://github.com/lierdakil/pandoc-crossref
    - https://lierdakil.github.io/pandoc-crossref/#equation-labels

Is this currently supported by pandoc? If not then how is `pandoc-crossref`
able to handle it? Thanks for your consideration.

Regards,

Amine

-- 
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/CAMwawgNMtvbVjzddff1aPcn%3DQga%3DVYYi_Xb5ENE3zXQV%3DV_SwQ%40mail.gmail.com.

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

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

* Fwd: Can math elements have attributes
       [not found] ` <CAMwawgNMtvbVjzddff1aPcn=Qga=VYYi_Xb5ENE3zXQV=V_SwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-02-17 11:01   ` A A
       [not found]     ` <CAMwawgOzqqyDUYUCdHCh6t5Q0qe+BN=MGFCKM40gJawvQhHb_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: A A @ 2023-02-17 11:01 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Dear all,

Having not received a response to my query below, I ran a few of my own
tests to try to understand what is going on.

It seems that commonmark_x *does* recognize attributes for both inline and
display math. If I have the following in my markdown file:

$$x = 1+2$${ .cs #math:equation caption=test}

$x = 1+2${ .cs #math:equation caption=test}

~~~{
  .cs
  #lst:my-listing
  caption=test
  }
def f(x):
    return x
~~~

And I run pandoc --from commonmark_x --to native test.md I will get the
following:

[ Para
    [ Span
        ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
        [ Math DisplayMath "x = 1+2" ]
    ]
, Para
    [ Span
        ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
        [ Math InlineMath "x = 1+2" ]
    ]
, CodeBlock
    ( "" , [ "{" ] , [] )
    "  .cs \n  #lst:my-listing \n  caption=test\n  }\ndef f(x):\n    return x"
]

Notice that the multiline attributes for the CodeBlock element are not
picked up. If I instead try pandoc --from markdown --to native test.md:

[ Para
    [ Math DisplayMath "x = 1+2"
    , Str "{"
    , Space
    , Str ".cs"
    , Space
    , Str "#math:equation"
    , Space
    , Str "caption=test}"
    ]
, Para
    [ Math InlineMath "x = 1+2"
    , Str "{"
    , Space
    , Str ".cs"
    , Space
    , Str "#math:equation"
    , Space
    , Str "caption=test}"
    ]
, CodeBlock
    ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test" ) ] )
    "def f(x):\n    return x"
]


The attributes in the CodeBlock element *are* picked up, but the attributes
for display and inline math are not.

Unfortunately, for my use case I would like to be able to assign multiline
attributes to code block elements *and* assign attributes to display and
inline math elements.

Is there a way to achieve both in the same markdown file? Thanks for your
consideration.

Regards,

Amine

---------- Forwarded message ---------
From: A A <amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 8 Feb 2023 at 13:52
Subject: Can math elements have attributes
To: <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


Dear all,

I am writing my own pandoc to latex converter using panflute and would like
to attach attributes to Math elements. I have tried the following syntax,
but it seems that the attribute is not being picked up by panflute:

```
$$x=y$${ a=b }
```

I did some of my own research to figure out what I was doing wrong. And a
couple of things became apparent:

- On the one hand, it looks like pandoc might not support this:
    - https://github.com/jgm/pandoc/issues/684
    - https://github.com/jgm/pandoc/issues/5286
- On the other hand, `pandoc-crossref` seems to be able to handle this
syntax:
    - https://github.com/lierdakil/pandoc-crossref
    - https://lierdakil.github.io/pandoc-crossref/#equation-labels

Is this currently supported by pandoc? If not then how is `pandoc-crossref`
able to handle it? Thanks for your consideration.

Regards,

Amine

-- 
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/CAMwawgOzqqyDUYUCdHCh6t5Q0qe%2BBN%3DMGFCKM40gJawvQhHb_Q%40mail.gmail.com.

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

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

* Re: Can math elements have attributes
       [not found]     ` <CAMwawgOzqqyDUYUCdHCh6t5Q0qe+BN=MGFCKM40gJawvQhHb_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-02-22  8:15       ` A A
       [not found]         ` <CAMwawgP2XGxyiP9LQvG=sdmQs5x+_0pOcDd+pE-gyyx_5uXUJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: A A @ 2023-02-22  8:15 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Anyone? I also opened an issue in Github but no response.

On Fri, 17 Feb 2023 at 12:01, A A <amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Dear all,
>
> Having not received a response to my query below, I ran a few of my own
> tests to try to understand what is going on.
>
> It seems that commonmark_x *does* recognize attributes for both inline
> and display math. If I have the following in my markdown file:
>
> $$x = 1+2$${ .cs #math:equation caption=test}
>
> $x = 1+2${ .cs #math:equation caption=test}
>
> ~~~{
>   .cs
>   #lst:my-listing
>   caption=test
>   }
> def f(x):
>     return x
> ~~~
>
> And I run pandoc --from commonmark_x --to native test.md I will get the
> following:
>
> [ Para
>     [ Span
>         ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>         [ Math DisplayMath "x = 1+2" ]
>     ]
> , Para
>     [ Span
>         ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>         [ Math InlineMath "x = 1+2" ]
>     ]
> , CodeBlock
>     ( "" , [ "{" ] , [] )
>     "  .cs \n  #lst:my-listing \n  caption=test\n  }\ndef f(x):\n    return x"
> ]
>
> Notice that the multiline attributes for the CodeBlock element are not
> picked up. If I instead try pandoc --from markdown --to native test.md:
>
> [ Para
>     [ Math DisplayMath "x = 1+2"
>     , Str "{"
>     , Space
>     , Str ".cs"
>     , Space
>     , Str "#math:equation"
>     , Space
>     , Str "caption=test}"
>     ]
> , Para
>     [ Math InlineMath "x = 1+2"
>     , Str "{"
>     , Space
>     , Str ".cs"
>     , Space
>     , Str "#math:equation"
>     , Space
>     , Str "caption=test}"
>     ]
> , CodeBlock
>     ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>     "def f(x):\n    return x"
> ]
>
>
> The attributes in the CodeBlock element *are* picked up, but the
> attributes for display and inline math are not.
>
> Unfortunately, for my use case I would like to be able to assign multiline
> attributes to code block elements *and* assign attributes to display and
> inline math elements.
>
> Is there a way to achieve both in the same markdown file? Thanks for your
> consideration.
>
> Regards,
>
> Amine
>
> ---------- Forwarded message ---------
> From: A A <amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: Wed, 8 Feb 2023 at 13:52
> Subject: Can math elements have attributes
> To: <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>
>
> Dear all,
>
> I am writing my own pandoc to latex converter using panflute and would
> like to attach attributes to Math elements. I have tried the following
> syntax, but it seems that the attribute is not being picked up by panflute:
>
> ```
> $$x=y$${ a=b }
> ```
>
> I did some of my own research to figure out what I was doing wrong. And a
> couple of things became apparent:
>
> - On the one hand, it looks like pandoc might not support this:
>     - https://github.com/jgm/pandoc/issues/684
>     - https://github.com/jgm/pandoc/issues/5286
> - On the other hand, `pandoc-crossref` seems to be able to handle this
> syntax:
>     - https://github.com/lierdakil/pandoc-crossref
>     - https://lierdakil.github.io/pandoc-crossref/#equation-labels
>
> Is this currently supported by pandoc? If not then how is
> `pandoc-crossref` able to handle it? Thanks for your consideration.
>
> Regards,
>
> Amine
>
>
>

-- 
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/CAMwawgP2XGxyiP9LQvG%3DsdmQs5x%2B_0pOcDd%2BpE-gyyx_5uXUJA%40mail.gmail.com.

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

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

* Re: Can math elements have attributes
       [not found]         ` <CAMwawgP2XGxyiP9LQvG=sdmQs5x+_0pOcDd+pE-gyyx_5uXUJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-02-22 16:33           ` Julien Dutant
       [not found]             ` <0845b275-aa43-4fc3-86a5-17b20de652een-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Dutant @ 2023-02-22 16:33 UTC (permalink / raw)
  To: pandoc-discuss


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

I'd check out if there's an extension flag 
(https://pandoc.org/MANUAL.html#extensions) you can add to commonmark_x 
input for it to process multiline attributes. Or one that can be added to 
markdown to process math attributes.

As the Pandoc AST doesn't have attributes on Math elements 
(https://pandoc.org/lua-filters.html#type-math) the common mark reader 
turns them into attributes of a container Span element, as your output 
shows. So an alternative would be to simply write the span in Pandoc's 
markdown by simply adding a backtick before and after:

`$$x = 1+2$$`{ .cs #math:equation caption=test} 

`$x = 1+2$ `{ .cs #math:equation caption=test} 

~~~{
  .cs 
  #lst:my-listing 
  caption=test } 
def f(x): 
   return x
~~~

Writing a Lua filter that picks up either is also an option. Picking up 
attributes list after equations is probably a bit complicated. But using 
pattern matching to process the initial {...} in a code block is more 
feasible. 

All the best,

On Wednesday, February 22, 2023 at 8:15:53 AM UTC A A wrote:

> Anyone? I also opened an issue in Github but no response.
>
> On Fri, 17 Feb 2023 at 12:01, A A <amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Dear all,
>>
>> Having not received a response to my query below, I ran a few of my own 
>> tests to try to understand what is going on. 
>>
>> It seems that commonmark_x *does* recognize attributes for both inline 
>> and display math. If I have the following in my markdown file:
>>
>> $$x = 1+2$${ .cs #math:equation caption=test}
>>
>> $x = 1+2${ .cs #math:equation caption=test}
>>
>> ~~~{
>>   .cs 
>>   #lst:my-listing 
>>   caption=test
>>   }
>> def f(x):
>>     return x
>> ~~~
>>
>> And I run pandoc --from commonmark_x --to native test.md I will get the 
>> following:
>>
>> [ Para
>>     [ Span
>>         ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>>         [ Math DisplayMath "x = 1+2" ]
>>     ]
>> , Para
>>     [ Span
>>         ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>>         [ Math InlineMath "x = 1+2" ]
>>     ]
>> , CodeBlock
>>     ( "" , [ "{" ] , [] )
>>     "  .cs \n  #lst:my-listing \n  caption=test\n  }\ndef f(x):\n    return x"
>> ]
>>
>> Notice that the multiline attributes for the CodeBlock element are not 
>> picked up. If I instead try pandoc --from markdown --to native test.md:
>>
>> [ Para
>>     [ Math DisplayMath "x = 1+2"
>>     , Str "{"
>>     , Space
>>     , Str ".cs"
>>     , Space
>>     , Str "#math:equation"
>>     , Space
>>     , Str "caption=test}"
>>     ]
>> , Para
>>     [ Math InlineMath "x = 1+2"
>>     , Str "{"
>>     , Space
>>     , Str ".cs"
>>     , Space
>>     , Str "#math:equation"
>>     , Space
>>     , Str "caption=test}"
>>     ]
>> , CodeBlock
>>     ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>>     "def f(x):\n    return x"
>> ]
>>
>>
>> The attributes in the CodeBlock element *are* picked up, but the 
>> attributes for display and inline math are not.
>>
>> Unfortunately, for my use case I would like to be able to assign 
>> multiline attributes to code block elements *and* assign attributes to 
>> display and inline math elements.
>>
>> Is there a way to achieve both in the same markdown file? Thanks for your 
>> consideration.
>>
>> Regards,
>>
>> Amine
>>
>> ---------- Forwarded message ---------
>> From: A A <amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Date: Wed, 8 Feb 2023 at 13:52
>> Subject: Can math elements have attributes
>> To: <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>>
>>
>> Dear all,
>>
>> I am writing my own pandoc to latex converter using panflute and would 
>> like to attach attributes to Math elements. I have tried the following 
>> syntax, but it seems that the attribute is not being picked up by panflute:
>>
>> ```
>> $$x=y$${ a=b }
>> ```
>>
>> I did some of my own research to figure out what I was doing wrong. And a 
>> couple of things became apparent:
>>
>> - On the one hand, it looks like pandoc might not support this:
>>     - https://github.com/jgm/pandoc/issues/684
>>     - https://github.com/jgm/pandoc/issues/5286
>> - On the other hand, `pandoc-crossref` seems to be able to handle this 
>> syntax:
>>     - https://github.com/lierdakil/pandoc-crossref
>>     - https://lierdakil.github.io/pandoc-crossref/#equation-labels
>>
>> Is this currently supported by pandoc? If not then how is 
>> `pandoc-crossref` able to handle it? Thanks for your consideration.
>>
>> Regards,
>>
>> Amine
>>
>>
>>

-- 
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/0845b275-aa43-4fc3-86a5-17b20de652een%40googlegroups.com.

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

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

* Re: Can math elements have attributes
       [not found]             ` <0845b275-aa43-4fc3-86a5-17b20de652een-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-02-22 16:38               ` Bastien DUMONT
  2023-02-23  9:17                 ` A A
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien DUMONT @ 2023-02-22 16:38 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

For spans, it would rather be:

[$$x = 1+2$$]{ .cs #math:equation caption=test}

[$x = 1+2$]{ .cs #math:equation caption=test}

(Backticks are for code elements.)

Le Wednesday 22 February 2023 à 08:33:36AM, Julien Dutant a écrit :
> I'd check out if there's an extension flag (https://pandoc.org/MANUAL.html#
> extensions) you can add to commonmark_x input for it to process multiline
> attributes. Or one that can be added to markdown to process math attributes.
> 
> As the Pandoc AST doesn't have attributes on Math elements (https://pandoc.org/
> lua-filters.html#type-math) the common mark reader turns them into attributes
> of a container Span element, as your output shows. So an alternative would be
> to simply write the span in Pandoc's markdown by simply adding a backtick
> before and after:
> 
> `$$x = 1+2$$`{ .cs #math:equation caption=test}
> 
> `$x = 1+2$ `{ .cs #math:equation caption=test}
> 
> ~~~{
>   .cs
>   #lst:my-listing
>   caption=test }
> def f(x):
>    return x
> ~~~
> 
> Writing a Lua filter that picks up either is also an option. Picking up
> attributes list after equations is probably a bit complicated. But using
> pattern matching to process the initial {...} in a code block is more feasible.
> 
> All the best,
> 
> On Wednesday, February 22, 2023 at 8:15:53 AM UTC A A wrote:
> 
>     Anyone? I also opened an issue in Github but no response.
> 
>     On Fri, 17 Feb 2023 at 12:01, A A <amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
>         Dear all,
> 
> 
>         Having not received a response to my query below, I ran a few of my own
>         tests to try to understand what is going on.
> 
>         It seems that commonmark_x does recognize attributes for both inline
>         and display math. If I have the following in my markdown file:
> 
>         $$x = 1+2$${ .cs #math:equation caption=test}
> 
>         $x = 1+2${ .cs #math:equation caption=test}
> 
>         ~~~{
>           .cs
>           #lst:my-listing
>           caption=test
>           }
>         def f(x):
>             return x
>         ~~~
> 
>         And I run pandoc --from commonmark_x --to native test.md I will get the
>         following:
> 
>         [ Para
>             [ Span
>                 ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>                 [ Math DisplayMath "x = 1+2" ]
>             ]
>         , Para
>             [ Span
>                 ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>                 [ Math InlineMath "x = 1+2" ]
>             ]
>         , CodeBlock
>             ( "" , [ "{" ] , [] )
>             "  .cs \n  #lst:my-listing \n  caption=test\n  }\ndef f(x):\n    return x"
>         ]
> 
>         Notice that the multiline attributes for the CodeBlock element are not
>         picked up. If I instead try pandoc --from markdown --to native test.md:
> 
>         [ Para
>             [ Math DisplayMath "x = 1+2"
>             , Str "{"
>             , Space
>             , Str ".cs"
>             , Space
>             , Str "#math:equation"
>             , Space
>             , Str "caption=test}"
>             ]
>         , Para
>             [ Math InlineMath "x = 1+2"
>             , Str "{"
>             , Space
>             , Str ".cs"
>             , Space
>             , Str "#math:equation"
>             , Space
>             , Str "caption=test}"
>             ]
>         , CodeBlock
>             ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>             "def f(x):\n    return x"
>         ]
> 
> 
>         The attributes in the CodeBlock element are picked up, but the
>         attributes for display and inline math are not.
> 
>         Unfortunately, for my use case I would like to be able to assign
>         multiline attributes to code block elements and assign attributes to
>         display and inline math elements.
> 
>         Is there a way to achieve both in the same markdown file? Thanks for
>         your consideration.
> 
>         Regards,
> 
>         Amine
> 
> 
>         ---------- Forwarded message ---------
>         From: A A <amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>         Date: Wed, 8 Feb 2023 at 13:52
>         Subject: Can math elements have attributes
>         To: <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> 
> 
>         Dear all,
> 
>         I am writing my own pandoc to latex converter using panflute and would
>         like to attach attributes to Math elements. I have tried the following
>         syntax, but it seems that the attribute is not being picked up by
>         panflute:
> 
>         ```
>         $$x=y$${ a=b }
>         ```
> 
>         I did some of my own research to figure out what I was doing wrong. And
>         a couple of things became apparent:
> 
>         - On the one hand, it looks like pandoc might not support this:
>             - [1]https://github.com/jgm/pandoc/issues/684
>             - [2]https://github.com/jgm/pandoc/issues/5286
>         - On the other hand, `pandoc-crossref` seems to be able to handle this
>         syntax:
>             - [3]https://github.com/lierdakil/pandoc-crossref
>             - [4]https://lierdakil.github.io/pandoc-crossref/#equation-labels
> 
>         Is this currently supported by pandoc? If not then how is
>         `pandoc-crossref` able to handle it? Thanks for your consideration.
> 
>         Regards,
> 
>         Amine
> 
> 
> 
> --
> 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 [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [6]https://groups.google.com/d/msgid/
> pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%40googlegroups.com.
> 
> References:
> 
> [1] https://github.com/jgm/pandoc/issues/684
> [2] https://github.com/jgm/pandoc/issues/5286
> [3] https://github.com/lierdakil/pandoc-crossref
> [4] https://lierdakil.github.io/pandoc-crossref/#equation-labels
> [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [6] https://groups.google.com/d/msgid/pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%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/Y/ZFCMVKXpyaki12%40localhost.


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

* Re: Can math elements have attributes
  2023-02-22 16:38               ` Bastien DUMONT
@ 2023-02-23  9:17                 ` A A
       [not found]                   ` <CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: A A @ 2023-02-23  9:17 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I see, thank you both for your response. I guess I will have to go with
enclosing things in a Span or Div element.

If I’m designing my own writer though, I’m not sure why this:

[$x = 1+2$]{ .cs #math:equation caption=test}

Is any better than this:

[x = 1+2]{ .cs #math:equation caption=test}

Because in both cases I have access to the LaTeX math inside of the span.
What added advantage does including the mathematical expression between
dollar signs $...$ provide?

Regards,

Amine

On Wed, 22 Feb 2023 at 17:38, Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
wrote:

> For spans, it would rather be:
>
> [$$x = 1+2$$]{ .cs #math:equation caption=test}
>
> [$x = 1+2$]{ .cs #math:equation caption=test}
>
> (Backticks are for code elements.)
>
> Le Wednesday 22 February 2023 à 08:33:36AM, Julien Dutant a écrit :
> > I'd check out if there's an extension flag (
> https://pandoc.org/MANUAL.html#
> > extensions) you can add to commonmark_x input for it to process multiline
> > attributes. Or one that can be added to markdown to process math
> attributes.
> >
> > As the Pandoc AST doesn't have attributes on Math elements (
> https://pandoc.org/
> > lua-filters.html#type-math) the common mark reader turns them into
> attributes
> > of a container Span element, as your output shows. So an alternative
> would be
> > to simply write the span in Pandoc's markdown by simply adding a backtick
> > before and after:
> >
> > `$$x = 1+2$$`{ .cs #math:equation caption=test}
> >
> > `$x = 1+2$ `{ .cs #math:equation caption=test}
> >
> > ~~~{
> >   .cs
> >   #lst:my-listing
> >   caption=test }
> > def f(x):
> >    return x
> > ~~~
> >
> > Writing a Lua filter that picks up either is also an option. Picking up
> > attributes list after equations is probably a bit complicated. But using
> > pattern matching to process the initial {...} in a code block is more
> feasible.
> >
> > All the best,
> >
> > On Wednesday, February 22, 2023 at 8:15:53 AM UTC A A wrote:
> >
> >     Anyone? I also opened an issue in Github but no response.
> >
> >     On Fri, 17 Feb 2023 at 12:01, A A <amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> >         Dear all,
> >
> >
> >         Having not received a response to my query below, I ran a few of
> my own
> >         tests to try to understand what is going on.
> >
> >         It seems that commonmark_x does recognize attributes for both
> inline
> >         and display math. If I have the following in my markdown file:
> >
> >         $$x = 1+2$${ .cs #math:equation caption=test}
> >
> >         $x = 1+2${ .cs #math:equation caption=test}
> >
> >         ~~~{
> >           .cs
> >           #lst:my-listing
> >           caption=test
> >           }
> >         def f(x):
> >             return x
> >         ~~~
> >
> >         And I run pandoc --from commonmark_x --to native test.md I will
> get the
> >         following:
> >
> >         [ Para
> >             [ Span
> >                 ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" )
> ] )
> >                 [ Math DisplayMath "x = 1+2" ]
> >             ]
> >         , Para
> >             [ Span
> >                 ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" )
> ] )
> >                 [ Math InlineMath "x = 1+2" ]
> >             ]
> >         , CodeBlock
> >             ( "" , [ "{" ] , [] )
> >             "  .cs \n  #lst:my-listing \n  caption=test\n  }\ndef
> f(x):\n    return x"
> >         ]
> >
> >         Notice that the multiline attributes for the CodeBlock element
> are not
> >         picked up. If I instead try pandoc --from markdown --to native
> test.md:
> >
> >         [ Para
> >             [ Math DisplayMath "x = 1+2"
> >             , Str "{"
> >             , Space
> >             , Str ".cs"
> >             , Space
> >             , Str "#math:equation"
> >             , Space
> >             , Str "caption=test}"
> >             ]
> >         , Para
> >             [ Math InlineMath "x = 1+2"
> >             , Str "{"
> >             , Space
> >             , Str ".cs"
> >             , Space
> >             , Str "#math:equation"
> >             , Space
> >             , Str "caption=test}"
> >             ]
> >         , CodeBlock
> >             ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test" ) ] )
> >             "def f(x):\n    return x"
> >         ]
> >
> >
> >         The attributes in the CodeBlock element are picked up, but the
> >         attributes for display and inline math are not.
> >
> >         Unfortunately, for my use case I would like to be able to assign
> >         multiline attributes to code block elements and assign
> attributes to
> >         display and inline math elements.
> >
> >         Is there a way to achieve both in the same markdown file? Thanks
> for
> >         your consideration.
> >
> >         Regards,
> >
> >         Amine
> >
> >
> >         ---------- Forwarded message ---------
> >         From: A A <amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >         Date: Wed, 8 Feb 2023 at 13:52
> >         Subject: Can math elements have attributes
> >         To: <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> >
> >
> >         Dear all,
> >
> >         I am writing my own pandoc to latex converter using panflute and
> would
> >         like to attach attributes to Math elements. I have tried the
> following
> >         syntax, but it seems that the attribute is not being picked up by
> >         panflute:
> >
> >         ```
> >         $$x=y$${ a=b }
> >         ```
> >
> >         I did some of my own research to figure out what I was doing
> wrong. And
> >         a couple of things became apparent:
> >
> >         - On the one hand, it looks like pandoc might not support this:
> >             - [1]https://github.com/jgm/pandoc/issues/684
> >             - [2]https://github.com/jgm/pandoc/issues/5286
> >         - On the other hand, `pandoc-crossref` seems to be able to
> handle this
> >         syntax:
> >             - [3]https://github.com/lierdakil/pandoc-crossref
> >             - [4]
> https://lierdakil.github.io/pandoc-crossref/#equation-labels
> >
> >         Is this currently supported by pandoc? If not then how is
> >         `pandoc-crossref` able to handle it? Thanks for your
> consideration.
> >
> >         Regards,
> >
> >         Amine
> >
> >
> >
> > --
> > 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 [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit [6]
> https://groups.google.com/d/msgid/
> > pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%40googlegroups.com.
> >
> > References:
> >
> > [1] https://github.com/jgm/pandoc/issues/684
> > [2] https://github.com/jgm/pandoc/issues/5286
> > [3] https://github.com/lierdakil/pandoc-crossref
> > [4] https://lierdakil.github.io/pandoc-crossref/#equation-labels
> > [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [6]
> https://groups.google.com/d/msgid/pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%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/Y/ZFCMVKXpyaki12%40localhost
> .
>

-- 
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/CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA%40mail.gmail.com.

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

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

* Re: Can math elements have attributes
       [not found]                   ` <CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-02-23  9:30                     ` Bastien DUMONT
  2023-02-23  9:36                       ` A A
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien DUMONT @ 2023-02-23  9:30 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Semantically, it signals the text as a mathematical expression. Pragmatically, you get access to it via the Math element in your writer, where it is represented as a plain string, not as a list of Inlines, which makes it more easy to handle and prevents it to be interpreted as markdown (think of what could happen with the characters ^ and _).

Le Thursday 23 February 2023 à 10:17:35AM, A A a écrit :
> I see, thank you both for your response. I guess I will have to go with
> enclosing things in a Span or Div element.
> 
> If I’m designing my own writer though, I’m not sure why this:
> 
> [$x = 1+2$]{ .cs #math:equation caption=test}
> 
> Is any better than this:
> 
> [x = 1+2]{ .cs #math:equation caption=test}
> 
> Because in both cases I have access to the LaTeX math inside of the span. What
> added advantage does including the mathematical expression between dollar signs
> $...$ provide?
> 
> Regards,
> 
> Amine
> 
> 
> On Wed, 22 Feb 2023 at 17:38, Bastien DUMONT <[1]bastien.dumont-VwIFZPTo/vqzQB+pC5nmwQ@public.gmane.orgt>
> wrote:
> 
>     For spans, it would rather be:
> 
>     [$$x = 1+2$$]{ .cs #math:equation caption=test}
> 
>     [$x = 1+2$]{ .cs #math:equation caption=test}
> 
>     (Backticks are for code elements.)
> 
>     Le Wednesday 22 February 2023 à 08:33:36AM, Julien Dutant a écrit :
>     > I'd check out if there's an extension flag ([2]https://pandoc.org/
>     MANUAL.html#
>     > extensions) you can add to commonmark_x input for it to process multiline
>     > attributes. Or one that can be added to markdown to process math
>     attributes.
>     >
>     > As the Pandoc AST doesn't have attributes on Math elements ([3]https://
>     pandoc.org/
>     > lua-filters.html#type-math) the common mark reader turns them into
>     attributes
>     > of a container Span element, as your output shows. So an alternative
>     would be
>     > to simply write the span in Pandoc's markdown by simply adding a backtick
>     > before and after:
>     >
>     > `$$x = 1+2$$`{ .cs #math:equation caption=test}
>     >
>     > `$x = 1+2$ `{ .cs #math:equation caption=test}
>     >
>     > ~~~{
>     >   .cs
>     >   #lst:my-listing
>     >   caption=test }
>     > def f(x):
>     >    return x
>     > ~~~
>     >
>     > Writing a Lua filter that picks up either is also an option. Picking up
>     > attributes list after equations is probably a bit complicated. But using
>     > pattern matching to process the initial {...} in a code block is more
>     feasible.
>     >
>     > All the best,
>     >
>     > On Wednesday, February 22, 2023 at 8:15:53 AM UTC A A wrote:
>     >
>     >     Anyone? I also opened an issue in Github but no response.
>     >
>     >     On Fri, 17 Feb 2023 at 12:01, A A <[4]amine.ab...@gmail.com> wrote:
>     >
>     >         Dear all,
>     >
>     >
>     >         Having not received a response to my query below, I ran a few of
>     my own
>     >         tests to try to understand what is going on.
>     >
>     >         It seems that commonmark_x does recognize attributes for both
>     inline
>     >         and display math. If I have the following in my markdown file:
>     >
>     >         $$x = 1+2$${ .cs #math:equation caption=test}
>     >
>     >         $x = 1+2${ .cs #math:equation caption=test}
>     >
>     >         ~~~{
>     >           .cs
>     >           #lst:my-listing
>     >           caption=test
>     >           }
>     >         def f(x):
>     >             return x
>     >         ~~~
>     >
>     >         And I run pandoc --from commonmark_x --to native test.md I will
>     get the
>     >         following:
>     >
>     >         [ Para
>     >             [ Span
>     >                 ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ]
>     )
>     >                 [ Math DisplayMath "x = 1+2" ]
>     >             ]
>     >         , Para
>     >             [ Span
>     >                 ( "math:equation" , [ "cs" ] , [ ( "caption" , "test" ) ]
>     )
>     >                 [ Math InlineMath "x = 1+2" ]
>     >             ]
>     >         , CodeBlock
>     >             ( "" , [ "{" ] , [] )
>     >             "  .cs \n  #lst:my-listing \n  caption=test\n  }\ndef f(x):\
>     n    return x"
>     >         ]
>     >
>     >         Notice that the multiline attributes for the CodeBlock element
>     are not
>     >         picked up. If I instead try pandoc --from markdown --to native
>     test.md:
>     >
>     >         [ Para
>     >             [ Math DisplayMath "x = 1+2"
>     >             , Str "{"
>     >             , Space
>     >             , Str ".cs"
>     >             , Space
>     >             , Str "#math:equation"
>     >             , Space
>     >             , Str "caption=test}"
>     >             ]
>     >         , Para
>     >             [ Math InlineMath "x = 1+2"
>     >             , Str "{"
>     >             , Space
>     >             , Str ".cs"
>     >             , Space
>     >             , Str "#math:equation"
>     >             , Space
>     >             , Str "caption=test}"
>     >             ]
>     >         , CodeBlock
>     >             ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test" ) ] )
>     >             "def f(x):\n    return x"
>     >         ]
>     >
>     >
>     >         The attributes in the CodeBlock element are picked up, but the
>     >         attributes for display and inline math are not.
>     >
>     >         Unfortunately, for my use case I would like to be able to assign
>     >         multiline attributes to code block elements and assign attributes
>     to
>     >         display and inline math elements.
>     >
>     >         Is there a way to achieve both in the same markdown file? Thanks
>     for
>     >         your consideration.
>     >
>     >         Regards,
>     >
>     >         Amine
>     >
>     >
>     >         ---------- Forwarded message ---------
>     >         From: A A <[5]amine.ab...-Re5JQEeQqe8@public.gmane.orgm>
>     >         Date: Wed, 8 Feb 2023 at 13:52
>     >         Subject: Can math elements have attributes
>     >         To: <[6]pandoc-...-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm>
>     >
>     >
>     >         Dear all,
>     >
>     >         I am writing my own pandoc to latex converter using panflute and
>     would
>     >         like to attach attributes to Math elements. I have tried the
>     following
>     >         syntax, but it seems that the attribute is not being picked up by
>     >         panflute:
>     >
>     >         ```
>     >         $$x=y$${ a=b }
>     >         ```
>     >
>     >         I did some of my own research to figure out what I was doing
>     wrong. And
>     >         a couple of things became apparent:
>     >
>     >         - On the one hand, it looks like pandoc might not support this:
>     >             - [1][7]https://github.com/jgm/pandoc/issues/684
>     >             - [2][8]https://github.com/jgm/pandoc/issues/5286
>     >         - On the other hand, `pandoc-crossref` seems to be able to handle
>     this
>     >         syntax:
>     >             - [3][9]https://github.com/lierdakil/pandoc-crossref
>     >             - [4][10]https://lierdakil.github.io/pandoc-crossref/#
>     equation-labels
>     >
>     >         Is this currently supported by pandoc? If not then how is
>     >         `pandoc-crossref` able to handle it? Thanks for your
>     consideration.
>     >
>     >         Regards,
>     >
>     >         Amine
>     >
>     >
>     >
>     > --
>     > 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 [5][11]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>     > To view this discussion on the web visit [6][12]https://groups.google.com
>     /d/msgid/
>     > pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%[13]
>     40googlegroups.com.
>     >
>     > References:
>     >
>     > [1] [14]https://github.com/jgm/pandoc/issues/684
>     > [2] [15]https://github.com/jgm/pandoc/issues/5286
>     > [3] [16]https://github.com/lierdakil/pandoc-crossref
>     > [4] [17]https://lierdakil.github.io/pandoc-crossref/#equation-labels
>     > [5] mailto:[18]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>     > [6] [19]https://groups.google.com/d/msgid/pandoc-discuss/
>     0845b275-aa43-4fc3-86a5-17b20de652een%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 [20]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>     To view this discussion on the web visit [21]https://groups.google.com/d/
>     msgid/pandoc-discuss/Y/ZFCMVKXpyaki12%40localhost.
> 
> --
> 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 [22]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [23]https://groups.google.com/d/msgid/
> pandoc-discuss/
> CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA%40mail.gmail.com.
> 
> References:
> 
> [1] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org
> [2] https://pandoc.org/MANUAL.html#
> [3] https://pandoc.org/
> [4] mailto:amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> [5] mailto:amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> [6] mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [7] https://github.com/jgm/pandoc/issues/684
> [8] https://github.com/jgm/pandoc/issues/5286
> [9] https://github.com/lierdakil/pandoc-crossref
> [10] https://lierdakil.github.io/pandoc-crossref/#equation-labels
> [11] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [12] https://groups.google.com/d/msgid/
> [13] http://40googlegroups.com/
> [14] https://github.com/jgm/pandoc/issues/684
> [15] https://github.com/jgm/pandoc/issues/5286
> [16] https://github.com/lierdakil/pandoc-crossref
> [17] https://lierdakil.github.io/pandoc-crossref/#equation-labels
> [18] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [19] https://groups.google.com/d/msgid/pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%40googlegroups.com?utm_medium=email&utm_source=footer
> [20] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [21] https://groups.google.com/d/msgid/pandoc-discuss/Y/ZFCMVKXpyaki12%40localhost
> [22] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [23] https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA%40mail.gmail.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/Y/cyOCyZLIs9UXPC%40localhost.


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

* Re: Can math elements have attributes
  2023-02-23  9:30                     ` Bastien DUMONT
@ 2023-02-23  9:36                       ` A A
  0 siblings, 0 replies; 8+ messages in thread
From: A A @ 2023-02-23  9:36 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I see. It sounds like there is definitely an advantage here. Thanks.

On Thu, 23 Feb 2023 at 10:30, Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
wrote:

> Semantically, it signals the text as a mathematical expression.
> Pragmatically, you get access to it via the Math element in your writer,
> where it is represented as a plain string, not as a list of Inlines, which
> makes it more easy to handle and prevents it to be interpreted as markdown
> (think of what could happen with the characters ^ and _).
>
> Le Thursday 23 February 2023 à 10:17:35AM, A A a écrit :
> > I see, thank you both for your response. I guess I will have to go with
> > enclosing things in a Span or Div element.
> >
> > If I’m designing my own writer though, I’m not sure why this:
> >
> > [$x = 1+2$]{ .cs #math:equation caption=test}
> >
> > Is any better than this:
> >
> > [x = 1+2]{ .cs #math:equation caption=test}
> >
> > Because in both cases I have access to the LaTeX math inside of the
> span. What
> > added advantage does including the mathematical expression between
> dollar signs
> > $...$ provide?
> >
> > Regards,
> >
> > Amine
> >
> >
> > On Wed, 22 Feb 2023 at 17:38, Bastien DUMONT <[1]
> bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
> > wrote:
> >
> >     For spans, it would rather be:
> >
> >     [$$x = 1+2$$]{ .cs #math:equation caption=test}
> >
> >     [$x = 1+2$]{ .cs #math:equation caption=test}
> >
> >     (Backticks are for code elements.)
> >
> >     Le Wednesday 22 February 2023 à 08:33:36AM, Julien Dutant a écrit :
> >     > I'd check out if there's an extension flag ([2]https://pandoc.org/
> >     MANUAL.html#
> >     > extensions) you can add to commonmark_x input for it to process
> multiline
> >     > attributes. Or one that can be added to markdown to process math
> >     attributes.
> >     >
> >     > As the Pandoc AST doesn't have attributes on Math elements
> ([3]https://
> >     pandoc.org/
> >     > lua-filters.html#type-math) the common mark reader turns them into
> >     attributes
> >     > of a container Span element, as your output shows. So an
> alternative
> >     would be
> >     > to simply write the span in Pandoc's markdown by simply adding a
> backtick
> >     > before and after:
> >     >
> >     > `$$x = 1+2$$`{ .cs #math:equation caption=test}
> >     >
> >     > `$x = 1+2$ `{ .cs #math:equation caption=test}
> >     >
> >     > ~~~{
> >     >   .cs
> >     >   #lst:my-listing
> >     >   caption=test }
> >     > def f(x):
> >     >    return x
> >     > ~~~
> >     >
> >     > Writing a Lua filter that picks up either is also an option.
> Picking up
> >     > attributes list after equations is probably a bit complicated. But
> using
> >     > pattern matching to process the initial {...} in a code block is
> more
> >     feasible.
> >     >
> >     > All the best,
> >     >
> >     > On Wednesday, February 22, 2023 at 8:15:53 AM UTC A A wrote:
> >     >
> >     >     Anyone? I also opened an issue in Github but no response.
> >     >
> >     >     On Fri, 17 Feb 2023 at 12:01, A A <[4]amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> wrote:
> >     >
> >     >         Dear all,
> >     >
> >     >
> >     >         Having not received a response to my query below, I ran a
> few of
> >     my own
> >     >         tests to try to understand what is going on.
> >     >
> >     >         It seems that commonmark_x does recognize attributes for
> both
> >     inline
> >     >         and display math. If I have the following in my markdown
> file:
> >     >
> >     >         $$x = 1+2$${ .cs #math:equation caption=test}
> >     >
> >     >         $x = 1+2${ .cs #math:equation caption=test}
> >     >
> >     >         ~~~{
> >     >           .cs
> >     >           #lst:my-listing
> >     >           caption=test
> >     >           }
> >     >         def f(x):
> >     >             return x
> >     >         ~~~
> >     >
> >     >         And I run pandoc --from commonmark_x --to native test.md I
> will
> >     get the
> >     >         following:
> >     >
> >     >         [ Para
> >     >             [ Span
> >     >                 ( "math:equation" , [ "cs" ] , [ ( "caption" ,
> "test" ) ]
> >     )
> >     >                 [ Math DisplayMath "x = 1+2" ]
> >     >             ]
> >     >         , Para
> >     >             [ Span
> >     >                 ( "math:equation" , [ "cs" ] , [ ( "caption" ,
> "test" ) ]
> >     )
> >     >                 [ Math InlineMath "x = 1+2" ]
> >     >             ]
> >     >         , CodeBlock
> >     >             ( "" , [ "{" ] , [] )
> >     >             "  .cs \n  #lst:my-listing \n  caption=test\n  }\ndef
> f(x):\
> >     n    return x"
> >     >         ]
> >     >
> >     >         Notice that the multiline attributes for the CodeBlock
> element
> >     are not
> >     >         picked up. If I instead try pandoc --from markdown --to
> native
> >     test.md:
> >     >
> >     >         [ Para
> >     >             [ Math DisplayMath "x = 1+2"
> >     >             , Str "{"
> >     >             , Space
> >     >             , Str ".cs"
> >     >             , Space
> >     >             , Str "#math:equation"
> >     >             , Space
> >     >             , Str "caption=test}"
> >     >             ]
> >     >         , Para
> >     >             [ Math InlineMath "x = 1+2"
> >     >             , Str "{"
> >     >             , Space
> >     >             , Str ".cs"
> >     >             , Space
> >     >             , Str "#math:equation"
> >     >             , Space
> >     >             , Str "caption=test}"
> >     >             ]
> >     >         , CodeBlock
> >     >             ( "lst:my-listing" , [ "cs" ] , [ ( "caption" , "test"
> ) ] )
> >     >             "def f(x):\n    return x"
> >     >         ]
> >     >
> >     >
> >     >         The attributes in the CodeBlock element are picked up, but
> the
> >     >         attributes for display and inline math are not.
> >     >
> >     >         Unfortunately, for my use case I would like to be able to
> assign
> >     >         multiline attributes to code block elements and assign
> attributes
> >     to
> >     >         display and inline math elements.
> >     >
> >     >         Is there a way to achieve both in the same markdown file?
> Thanks
> >     for
> >     >         your consideration.
> >     >
> >     >         Regards,
> >     >
> >     >         Amine
> >     >
> >     >
> >     >         ---------- Forwarded message ---------
> >     >         From: A A <[5]amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >     >         Date: Wed, 8 Feb 2023 at 13:52
> >     >         Subject: Can math elements have attributes
> >     >         To: <[6]pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> >     >
> >     >
> >     >         Dear all,
> >     >
> >     >         I am writing my own pandoc to latex converter using
> panflute and
> >     would
> >     >         like to attach attributes to Math elements. I have tried
> the
> >     following
> >     >         syntax, but it seems that the attribute is not being
> picked up by
> >     >         panflute:
> >     >
> >     >         ```
> >     >         $$x=y$${ a=b }
> >     >         ```
> >     >
> >     >         I did some of my own research to figure out what I was
> doing
> >     wrong. And
> >     >         a couple of things became apparent:
> >     >
> >     >         - On the one hand, it looks like pandoc might not support
> this:
> >     >             - [1][7]https://github.com/jgm/pandoc/issues/684
> >     >             - [2][8]https://github.com/jgm/pandoc/issues/5286
> >     >         - On the other hand, `pandoc-crossref` seems to be able to
> handle
> >     this
> >     >         syntax:
> >     >             - [3][9]https://github.com/lierdakil/pandoc-crossref
> >     >             - [4][10]https://lierdakil.github.io/pandoc-crossref/#
> >     equation-labels
> >     >
> >     >         Is this currently supported by pandoc? If not then how is
> >     >         `pandoc-crossref` able to handle it? Thanks for your
> >     consideration.
> >     >
> >     >         Regards,
> >     >
> >     >         Amine
> >     >
> >     >
> >     >
> >     > --
> >     > 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 [5][11]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >     > To view this discussion on the web visit [6][12]
> https://groups.google.com
> >     /d/msgid/
> >     > pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%[13]
> >     40googlegroups.com.
> >     >
> >     > References:
> >     >
> >     > [1] [14]https://github.com/jgm/pandoc/issues/684
> >     > [2] [15]https://github.com/jgm/pandoc/issues/5286
> >     > [3] [16]https://github.com/lierdakil/pandoc-crossref
> >     > [4] [17]
> https://lierdakil.github.io/pandoc-crossref/#equation-labels
> >     > [5] mailto:[18]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> >     > [6] [19]https://groups.google.com/d/msgid/pandoc-discuss/
> >     0845b275-aa43-4fc3-86a5-17b20de652een%
> 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 [20]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >     To view this discussion on the web visit [21]
> https://groups.google.com/d/
> >     msgid/pandoc-discuss/Y/ZFCMVKXpyaki12%40localhost.
> >
> > --
> > 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 [22]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit [23]
> https://groups.google.com/d/msgid/
> > pandoc-discuss/
> > CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA%40mail.gmail.com.
> >
> > References:
> >
> > [1] mailto:bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org
> > [2] https://pandoc.org/MANUAL.html#
> > [3] https://pandoc.org/
> > [4] mailto:amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> > [5] mailto:amine.ab...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> > [6] mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [7] https://github.com/jgm/pandoc/issues/684
> > [8] https://github.com/jgm/pandoc/issues/5286
> > [9] https://github.com/lierdakil/pandoc-crossref
> > [10] https://lierdakil.github.io/pandoc-crossref/#equation-labels
> > [11] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [12] https://groups.google.com/d/msgid/
> > [13] http://40googlegroups.com/
> > [14] https://github.com/jgm/pandoc/issues/684
> > [15] https://github.com/jgm/pandoc/issues/5286
> > [16] https://github.com/lierdakil/pandoc-crossref
> > [17] https://lierdakil.github.io/pandoc-crossref/#equation-labels
> > [18] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [19]
> https://groups.google.com/d/msgid/pandoc-discuss/0845b275-aa43-4fc3-86a5-17b20de652een%40googlegroups.com?utm_medium=email&utm_source=footer
> > [20] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [21]
> https://groups.google.com/d/msgid/pandoc-discuss/Y/ZFCMVKXpyaki12%40localhost
> > [22] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [23]
> https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA%40mail.gmail.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/Y/cyOCyZLIs9UXPC%40localhost
> .
>

-- 
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/CAMwawgMia8TwdPJdyZuub-4xGjDJ9aVTOUGP%3Dwf7nbtb3BmbpA%40mail.gmail.com.

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

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

end of thread, other threads:[~2023-02-23  9:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 12:52 Can math elements have attributes A A
     [not found] ` <CAMwawgNMtvbVjzddff1aPcn=Qga=VYYi_Xb5ENE3zXQV=V_SwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-17 11:01   ` Fwd: " A A
     [not found]     ` <CAMwawgOzqqyDUYUCdHCh6t5Q0qe+BN=MGFCKM40gJawvQhHb_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-22  8:15       ` A A
     [not found]         ` <CAMwawgP2XGxyiP9LQvG=sdmQs5x+_0pOcDd+pE-gyyx_5uXUJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-22 16:33           ` Julien Dutant
     [not found]             ` <0845b275-aa43-4fc3-86a5-17b20de652een-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-22 16:38               ` Bastien DUMONT
2023-02-23  9:17                 ` A A
     [not found]                   ` <CAMwawgMca58Ae4Ag0mB0XP_PMPbYubUY2UxBjTvPxXiS4DvozA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-23  9:30                     ` Bastien DUMONT
2023-02-23  9:36                       ` A A

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