public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: A A <amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Fwd: Can math elements have attributes
Date: Fri, 17 Feb 2023 12:01:35 +0100	[thread overview]
Message-ID: <CAMwawgOzqqyDUYUCdHCh6t5Q0qe+BN=MGFCKM40gJawvQhHb_Q@mail.gmail.com> (raw)
In-Reply-To: <CAMwawgNMtvbVjzddff1aPcn=Qga=VYYi_Xb5ENE3zXQV=V_SwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- 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 --]

  parent reply	other threads:[~2023-02-17 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 12:52 A A
     [not found] ` <CAMwawgNMtvbVjzddff1aPcn=Qga=VYYi_Xb5ENE3zXQV=V_SwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-17 11:01   ` A A [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMwawgOzqqyDUYUCdHCh6t5Q0qe+BN=MGFCKM40gJawvQhHb_Q@mail.gmail.com' \
    --to=amine.aboufirass-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).