public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Inaccurate parsing with tex_math_dollars
@ 2023-01-17  8:58 Claudio Di Vita
       [not found] ` <d0ebb8c1-bced-44cc-869d-bae152411448n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-17  8:58 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi folks,

reading the documentation, with the extension tex_math_dollars enabled 
(that's the default) anything between two $ (or two $$) characters will be 
treated as TeX math.

However, I think that when such extension is enabled, the document parsing, 
including the metadata, is a bit inaccurate, because also strings like 
${value1}/${value2} are treated like TeX math.

Of course disabling the extension or escaping the $ characters there are no 
issues, but it would be nice to avoid that, if possible.

Any idea of what can be the wrong parsing cause ?

Cheers,

Claudio

-- 
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/d0ebb8c1-bced-44cc-869d-bae152411448n%40googlegroups.com.

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

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

* Re: Inaccurate parsing with tex_math_dollars
       [not found] ` <d0ebb8c1-bced-44cc-869d-bae152411448n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-01-17 11:53   ` Albert Krewinkel
       [not found]     ` <87fsc9xs68.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  2023-01-17 16:07   ` John MacFarlane
  2023-01-24 14:25   ` Claudio Di Vita
  2 siblings, 1 reply; 14+ messages in thread
From: Albert Krewinkel @ 2023-01-17 11:53 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> reading the documentation, with the extension tex_math_dollars
> enabled (that's the default) anything between two $ (or two $$)
> characters will be treated as TeX math.
>
> However, I think that when such extension is enabled, the document
> parsing, including the metadata, is a bit inaccurate, because also
> strings like ${value1}/${value2} are treated like TeX math.

One solution is to backslash escape the dollar characters, as in

    \${value1}/\${value2}



-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]     ` <87fsc9xs68.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2023-01-17 13:35       ` Claudio Di Vita
       [not found]         ` <CAMBF16uoWv5=UtiMRvWQ8139hk64bGqL-+ejfO6+CiatgvBTBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-17 13:35 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Thanks Albert,

I forgot to mention that possibility.

However I was wondering if the parsing can be fixed/improved.

Cheers,

Claudio

Il Mar 17 Gen 2023, 13:27 Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> ha
scritto:

>
> Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > reading the documentation, with the extension tex_math_dollars
> > enabled (that's the default) anything between two $ (or two $$)
> > characters will be treated as TeX math.
> >
> > However, I think that when such extension is enabled, the document
> > parsing, including the metadata, is a bit inaccurate, because also
> > strings like ${value1}/${value2} are treated like TeX math.
>
> One solution is to backslash escape the dollar characters, as in
>
>     \${value1}/\${value2}
>
>
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
>
> --
> 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/V5fTt9aN_AI/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/87fsc9xs68.fsf%40zeitkraut.de
> .
>

-- 
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/CAMBF16uoWv5%3DUtiMRvWQ8139hk64bGqL-%2BejfO6%2BCiatgvBTBg%40mail.gmail.com.

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

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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]         ` <CAMBF16uoWv5=UtiMRvWQ8139hk64bGqL-+ejfO6+CiatgvBTBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-01-17 14:06           ` Albert Krewinkel
       [not found]             ` <87bkmxxn5r.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Albert Krewinkel @ 2023-01-17 14:06 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: Claudio Di Vita


Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> However I was wondering if the parsing can be fixed/improved.

My personal opinion is that the current rules for math parsing strike a
nice balance between simplicity and usability.

But I guess nothing is ever set in stone, and if you have a suggestion
for new set of rules to govern parsing, I for one would be curious to
hear about it. 👍

> Il Mar 17 Gen 2023, 13:27 Albert Krewinkel <
> albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> ha scritto:
>
>    
>     Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>    
>     > reading the documentation, with the extension tex_math_dollars
>     > enabled (that's the default) anything between two $ (or two $$)
>     > characters will be treated as TeX math.
>     >
>     > However, I think that when such extension is enabled, the
>     document
>     > parsing, including the metadata, is a bit inaccurate, because
>     also
>     > strings like ${value1}/${value2} are treated like TeX math.
>    
>     One solution is to backslash escape the dollar characters, as in
>    
>         \${value1}/\${value2}
>    
>    
>    
>     --
>     Albert Krewinkel
>     GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
>    
>     --
>     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/V5fTt9aN_AI/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/
>     87fsc9xs68.fsf%40zeitkraut.de.


-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124

-- 
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/87bkmxxn5r.fsf%40zeitkraut.de.


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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]             ` <87bkmxxn5r.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2023-01-17 14:31               ` Claudio Di Vita
  0 siblings, 0 replies; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-17 14:31 UTC (permalink / raw)
  To: pandoc-discuss


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

While I can guess that the parsing code is 
within https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Parsing/Math.hs, 
I should learn Haskell to propose an alternative solution.

Lua was definitely simpler to learn (or at least to know enough for 
implementing filters).

Cheers,

Claudio

Il giorno martedì 17 gennaio 2023 alle 15:15:39 UTC+1 Albert Krewinkel ha 
scritto:

>
> Claudio Di Vita <claudio...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > However I was wondering if the parsing can be fixed/improved.
>
> My personal opinion is that the current rules for math parsing strike a
> nice balance between simplicity and usability.
>
> But I guess nothing is ever set in stone, and if you have a suggestion
> for new set of rules to govern parsing, I for one would be curious to
> hear about it. 👍
>
> > Il Mar 17 Gen 2023, 13:27 Albert Krewinkel <
> > albert...-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> ha scritto:
> >
> > 
> > Claudio Di Vita <claudio...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> > 
> > > reading the documentation, with the extension tex_math_dollars
> > > enabled (that's the default) anything between two $ (or two $$)
> > > characters will be treated as TeX math.
> > >
> > > However, I think that when such extension is enabled, the
> > document
> > > parsing, including the metadata, is a bit inaccurate, because
> > also
> > > strings like ${value1}/${value2} are treated like TeX math.
> > 
> > One solution is to backslash escape the dollar characters, as in
> > 
> >     \${value1}/\${value2}
> > 
> > 
> > 
> > --
> > Albert Krewinkel
> > GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
> > 
> > --
> > 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/V5fTt9aN_AI/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/
> > 87fsc9xs68.fsf%40zeitkraut.de.
>
>
> -- 
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
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/747eddbe-d05c-4be4-a622-4db217c2d194n%40googlegroups.com.

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

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

* Re: Inaccurate parsing with tex_math_dollars
       [not found] ` <d0ebb8c1-bced-44cc-869d-bae152411448n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2023-01-17 11:53   ` Albert Krewinkel
@ 2023-01-17 16:07   ` John MacFarlane
       [not found]     ` <4AB3C54A-0054-4E50-9DD7-FBA2D4DA281A-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2023-01-24 14:25   ` Claudio Di Vita
  2 siblings, 1 reply; 14+ messages in thread
From: John MacFarlane @ 2023-01-17 16:07 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I don't know how pandoc is supposed to know that

${value1}/$

is not math.  It could be.  It's perfectly valid LaTeX math.


> On Jan 17, 2023, at 12:58 AM, Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> ${value1}/$


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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]     ` <4AB3C54A-0054-4E50-9DD7-FBA2D4DA281A-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2023-01-24  9:56       ` Claudio Di Vita
       [not found]         ` <c9214947-3546-4322-9523-f80998e60e32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-24  9:56 UTC (permalink / raw)
  To: pandoc-discuss


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

That's true: not math, but LaTeX math.

Can the parsing of LaTeX math be disabled ? Even if I disable 
the tex_math_dollars, it seems that pandoc tries to parse LaTeX math (I see 
it from the native output).

Thanks,

Claudio
Il giorno martedì 17 gennaio 2023 alle 17:07:54 UTC+1 fiddlosopher ha 
scritto:

> I don't know how pandoc is supposed to know that
>
> ${value1}/$
>
> is not math. It could be. It's perfectly valid LaTeX math.
>
>
> > On Jan 17, 2023, at 12:58 AM, Claudio Di Vita <claudio...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 
> wrote:
> > 
> > ${value1}/$
>
>

-- 
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/c9214947-3546-4322-9523-f80998e60e32n%40googlegroups.com.

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

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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]         ` <c9214947-3546-4322-9523-f80998e60e32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-01-24 10:42           ` Albert Krewinkel
       [not found]             ` <877cxcky9v.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Albert Krewinkel @ 2023-01-24 10:42 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> That's true: not math, but LaTeX math.
>
> Can the parsing of LaTeX math be disabled ? Even if I disable
> the tex_math_dollars, it seems that pandoc tries to parse LaTeX math
> (I see it from the native output).

Here's what I see:

    % echo '$hello$' | pandoc -f markdown -t native
    [ Para [ Math InlineMath "hello" ] ]

    % echo '$hello$' | pandoc -f markdown-tex_math_dollars -t native
    [ Para [ Str "$hello$" ] ]

Seems to work?

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124

-- 
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/877cxcky9v.fsf%40zeitkraut.de.


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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]             ` <877cxcky9v.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2023-01-24 12:09               ` Claudio Di Vita
       [not found]                 ` <CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1=93dWiddrQXkcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-24 12:09 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I have a more complicated scenario, with multiple dollar signs and file
inclusion (using pandoc.read) that ends up in Math.

When reading the files I pass the PANDOC_READER_OPTIONS, with does not
include tex_math_dollars within the extensions...but the Math is there
anyway

Il Mar 24 Gen 2023, 11:44 Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> ha
scritto:

>
> Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > That's true: not math, but LaTeX math.
> >
> > Can the parsing of LaTeX math be disabled ? Even if I disable
> > the tex_math_dollars, it seems that pandoc tries to parse LaTeX math
> > (I see it from the native output).
>
> Here's what I see:
>
>     % echo '$hello$' | pandoc -f markdown -t native
>     [ Para [ Math InlineMath "hello" ] ]
>
>     % echo '$hello$' | pandoc -f markdown-tex_math_dollars -t native
>     [ Para [ Str "$hello$" ] ]
>
> Seems to work?
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
>
> --
> 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/V5fTt9aN_AI/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/877cxcky9v.fsf%40zeitkraut.de
> .
>

-- 
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/CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1%3D93dWiddrQXkcg%40mail.gmail.com.

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

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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]                 ` <CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1=93dWiddrQXkcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-01-24 13:04                   ` Duncan Murdoch
       [not found]                     ` <1a7053ea-0a6d-94af-2a67-d209420b9039-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Duncan Murdoch @ 2023-01-24 13:04 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw, Claudio Di Vita

If you run "pandoc --list-extensions", you'll see that tex_math_dollars 
defaults to being included.  You need to explicitly exclude it, as 
Albert did.

Duncan Murdoch

On 24/01/2023 7:09 a.m., Claudio Di Vita wrote:
> I have a more complicated scenario, with multiple dollar signs and file 
> inclusion (using pandoc.read) that ends up in Math.
> 
> When reading the files I pass the PANDOC_READER_OPTIONS, with does not 
> include tex_math_dollars within the extensions...but the Math is there 
> anyway
> 
> Il Mar 24 Gen 2023, 11:44 Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org 
> <mailto:albert%2Bpandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>> ha scritto:
> 
> 
>     Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
>     <mailto:claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> writes:
> 
>      > That's true: not math, but LaTeX math.
>      >
>      > Can the parsing of LaTeX math be disabled ? Even if I disable
>      > the tex_math_dollars, it seems that pandoc tries to parse LaTeX math
>      > (I see it from the native output).
> 
>     Here's what I see:
> 
>          % echo '$hello$' | pandoc -f markdown -t native
>          [ Para [ Math InlineMath "hello" ] ]
> 
>          % echo '$hello$' | pandoc -f markdown-tex_math_dollars -t native
>          [ Para [ Str "$hello$" ] ]
> 
>     Seems to work?
> 
>     -- 
>     Albert Krewinkel
>     GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
> 
>     -- 
>     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/V5fTt9aN_AI/unsubscribe <https://groups.google.com/d/topic/pandoc-discuss/V5fTt9aN_AI/unsubscribe>.
>     To unsubscribe from this group and all its topics, send an email to
>     pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>     <mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
>     To view this discussion on the web visit
>     https://groups.google.com/d/msgid/pandoc-discuss/877cxcky9v.fsf%40zeitkraut.de <https://groups.google.com/d/msgid/pandoc-discuss/877cxcky9v.fsf%40zeitkraut.de>.
> 
> -- 
> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 
> <mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1%3D93dWiddrQXkcg%40mail.gmail.com <https://groups.google.com/d/msgid/pandoc-discuss/CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1%3D93dWiddrQXkcg%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/1a7053ea-0a6d-94af-2a67-d209420b9039%40gmail.com.


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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]                     ` <1a7053ea-0a6d-94af-2a67-d209420b9039-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2023-01-24 13:19                       ` Claudio Di Vita
  0 siblings, 0 replies; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-24 13:19 UTC (permalink / raw)
  To: Duncan Murdoch; +Cc: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

I did it, but I have the impression that within a Lua filter the
pandoc.read method ignore it

Il Mar 24 Gen 2023, 14:04 Duncan Murdoch <murdoch.duncan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ha
scritto:

> If you run "pandoc --list-extensions", you'll see that tex_math_dollars
> defaults to being included.  You need to explicitly exclude it, as
> Albert did.
>
> Duncan Murdoch
>
> On 24/01/2023 7:09 a.m., Claudio Di Vita wrote:
> > I have a more complicated scenario, with multiple dollar signs and file
> > inclusion (using pandoc.read) that ends up in Math.
> >
> > When reading the files I pass the PANDOC_READER_OPTIONS, with does not
> > include tex_math_dollars within the extensions...but the Math is there
> > anyway
> >
> > Il Mar 24 Gen 2023, 11:44 Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org
> > <mailto:albert%2Bpandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>> ha scritto:
> >
> >
> >     Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> >     <mailto:claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> writes:
> >
> >      > That's true: not math, but LaTeX math.
> >      >
> >      > Can the parsing of LaTeX math be disabled ? Even if I disable
> >      > the tex_math_dollars, it seems that pandoc tries to parse LaTeX
> math
> >      > (I see it from the native output).
> >
> >     Here's what I see:
> >
> >          % echo '$hello$' | pandoc -f markdown -t native
> >          [ Para [ Math InlineMath "hello" ] ]
> >
> >          % echo '$hello$' | pandoc -f markdown-tex_math_dollars -t native
> >          [ Para [ Str "$hello$" ] ]
> >
> >     Seems to work?
> >
> >     --
> >     Albert Krewinkel
> >     GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
> >
> >     --
> >     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/V5fTt9aN_AI/unsubscribe <
> https://groups.google.com/d/topic/pandoc-discuss/V5fTt9aN_AI/unsubscribe>.
> >     To unsubscribe from this group and all its topics, send an email to
> >     pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> >     <mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
> >     To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pandoc-discuss/877cxcky9v.fsf%40zeitkraut.de
> <
> https://groups.google.com/d/msgid/pandoc-discuss/877cxcky9v.fsf%40zeitkraut.de
> >.
> >
> > --
> > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > <mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pandoc-discuss/CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1%3D93dWiddrQXkcg%40mail.gmail.com
> <
> https://groups.google.com/d/msgid/pandoc-discuss/CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1%3D93dWiddrQXkcg%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/CAMBF16vEmvbXS3%2B0tXCB51SmPe%3D0tsQ%2BV%2BZoQ0DvqhpRwTp4uw%40mail.gmail.com.

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

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

* Re: Inaccurate parsing with tex_math_dollars
       [not found] ` <d0ebb8c1-bced-44cc-869d-bae152411448n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2023-01-17 11:53   ` Albert Krewinkel
  2023-01-17 16:07   ` John MacFarlane
@ 2023-01-24 14:25   ` Claudio Di Vita
       [not found]     ` <6599e581-5fc3-4a77-8be1-d6d962d54600n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2 siblings, 1 reply; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-24 14:25 UTC (permalink / raw)
  To: pandoc-discuss


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

Confirmed: when tex_math_dollars is disabled pandoc doesn't create Math 
elements, while under the same conditions (inheriting 
PANDOC_READER_OPTIONS) pandoc.read create Math elements for the same 
document.


Il giorno martedì 17 gennaio 2023 alle 09:58:14 UTC+1 Claudio Di Vita ha 
scritto:

> Hi folks,
>
> reading the documentation, with the extension tex_math_dollars enabled 
> (that's the default) anything between two $ (or two $$) characters will be 
> treated as TeX math.
>
> However, I think that when such extension is enabled, the document 
> parsing, including the metadata, is a bit inaccurate, because also strings 
> like ${value1}/${value2} are treated like TeX math.
>
> Of course disabling the extension or escaping the $ characters there are 
> no issues, but it would be nice to avoid that, if possible.
>
> Any idea of what can be the wrong parsing cause ?
>
> Cheers,
>
> Claudio
>

-- 
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/6599e581-5fc3-4a77-8be1-d6d962d54600n%40googlegroups.com.

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

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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]     ` <6599e581-5fc3-4a77-8be1-d6d962d54600n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-01-24 14:35       ` Albert Krewinkel
       [not found]         ` <87y1psj8ie.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Albert Krewinkel @ 2023-01-24 14:35 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Claudio Di Vita <claudio.divita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Confirmed: when tex_math_dollars is disabled pandoc doesn't create
> Math elements, while under the same conditions (inheriting
> PANDOC_READER_OPTIONS) pandoc.read create Math elements for the same
> document.

That's a problem in the docs: it should be noted more clearly that the
format extensions are taken from the format, not from the ReaderOptions.
Try with

    pandoc.read('$2^a$', 'markdown-tex_math_dollars')

or (with pandoc 3)

    md = {
      format = 'markdown',
      extensions = {tex_math_dollars = 'disable'}
    }
    pandoc.read('$a$', md)

> Il giorno martedì 17 gennaio 2023 alle 09:58:14 UTC+1 Claudio Di Vita
> ha scritto:
>
>     Hi folks,
>    
>     reading the documentation, with the extension tex_math_dollars
>     enabled (that's the default) anything between two $ (or two $$)
>     characters will be treated as TeX math.
>    
>     However, I think that when such extension is enabled, the
>     document parsing, including the metadata, is a bit inaccurate,
>     because also strings like ${value1}/${value2} are treated like
>     TeX math.
>    
>     Of course disabling the extension or escaping the $ characters
>     there are no issues, but it would be nice to avoid that, if
>     possible.
>    
>     Any idea of what can be the wrong parsing cause ?
>    
>     Cheers,
>    
>     Claudio


-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124

-- 
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/87y1psj8ie.fsf%40zeitkraut.de.


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

* Re: Inaccurate parsing with tex_math_dollars
       [not found]         ` <87y1psj8ie.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2023-01-24 17:11           ` Claudio Di Vita
  0 siblings, 0 replies; 14+ messages in thread
From: Claudio Di Vita @ 2023-01-24 17:11 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi Albert,

it works, thanks for the support.

The documentation is clear now, I guess that it was more concise for pandoc 
2.x. Moreover, I started my filter implementation looking at the 
include-files filter, that doesn't seem to care about the current 
extensions configuration.

Cheers,

Claudio

Il giorno martedì 24 gennaio 2023 alle 15:46:12 UTC+1 Albert Krewinkel ha 
scritto:

>
> Claudio Di Vita <claudio...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Confirmed: when tex_math_dollars is disabled pandoc doesn't create
> > Math elements, while under the same conditions (inheriting
> > PANDOC_READER_OPTIONS) pandoc.read create Math elements for the same
> > document.
>
> That's a problem in the docs: it should be noted more clearly that the
> format extensions are taken from the format, not from the ReaderOptions.
> Try with
>
> pandoc.read('$2^a$', 'markdown-tex_math_dollars')
>
> or (with pandoc 3)
>
> md = {
> format = 'markdown',
> extensions = {tex_math_dollars = 'disable'}
> }
> pandoc.read('$a$', md)
>
> > Il giorno martedì 17 gennaio 2023 alle 09:58:14 UTC+1 Claudio Di Vita
> > ha scritto:
> >
> > Hi folks,
> > 
> > reading the documentation, with the extension tex_math_dollars
> > enabled (that's the default) anything between two $ (or two $$)
> > characters will be treated as TeX math.
> > 
> > However, I think that when such extension is enabled, the
> > document parsing, including the metadata, is a bit inaccurate,
> > because also strings like ${value1}/${value2} are treated like
> > TeX math.
> > 
> > Of course disabling the extension or escaping the $ characters
> > there are no issues, but it would be nice to avoid that, if
> > possible.
> > 
> > Any idea of what can be the wrong parsing cause ?
> > 
> > Cheers,
> > 
> > Claudio
>
>
> -- 
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
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/a05750c3-a66c-44ff-a4c5-1434378aea0dn%40googlegroups.com.

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

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

end of thread, other threads:[~2023-01-24 17:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17  8:58 Inaccurate parsing with tex_math_dollars Claudio Di Vita
     [not found] ` <d0ebb8c1-bced-44cc-869d-bae152411448n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-17 11:53   ` Albert Krewinkel
     [not found]     ` <87fsc9xs68.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-01-17 13:35       ` Claudio Di Vita
     [not found]         ` <CAMBF16uoWv5=UtiMRvWQ8139hk64bGqL-+ejfO6+CiatgvBTBg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-17 14:06           ` Albert Krewinkel
     [not found]             ` <87bkmxxn5r.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-01-17 14:31               ` Claudio Di Vita
2023-01-17 16:07   ` John MacFarlane
     [not found]     ` <4AB3C54A-0054-4E50-9DD7-FBA2D4DA281A-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-01-24  9:56       ` Claudio Di Vita
     [not found]         ` <c9214947-3546-4322-9523-f80998e60e32n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-24 10:42           ` Albert Krewinkel
     [not found]             ` <877cxcky9v.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-01-24 12:09               ` Claudio Di Vita
     [not found]                 ` <CAMBF16tbV8W-h_AkmLGyKzbcufgapHL77qP1=93dWiddrQXkcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-01-24 13:04                   ` Duncan Murdoch
     [not found]                     ` <1a7053ea-0a6d-94af-2a67-d209420b9039-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-01-24 13:19                       ` Claudio Di Vita
2023-01-24 14:25   ` Claudio Di Vita
     [not found]     ` <6599e581-5fc3-4a77-8be1-d6d962d54600n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-24 14:35       ` Albert Krewinkel
     [not found]         ` <87y1psj8ie.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-01-24 17:11           ` Claudio Di Vita

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