public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* latex_macros not working with raw latex
@ 2022-02-20 15:51 jcr
       [not found] ` <b7516705-be96-41a0-b539-877a29258e44n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: jcr @ 2022-02-20 15:51 UTC (permalink / raw)
  To: pandoc-discuss


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

The documentation for the `latex_macros` extension says, "When this 
extension is enabled, pandoc will parse LaTeX macro definitions and apply 
the resulting macros to all LaTeX math and raw LaTeX." This works for me in 
math, but not in raw LaTeX, which I would rather use. With `test.md` 
containing the following:
```
\newcommand{\test}{test}

- This is a $\test$.
- This is a \test
- This is a `\test`{=latex}.
```

I get this output from `pandoc test.md -t plain`:
```
-   This is a test.
-   This is a
-   This is a .
```

I'm using pandoc 2.17.1.1

-- 
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/b7516705-be96-41a0-b539-877a29258e44n%40googlegroups.com.

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

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

* Re: latex_macros not working with raw latex
       [not found] ` <b7516705-be96-41a0-b539-877a29258e44n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-02-20 16:29   ` jcr
  0 siblings, 0 replies; 2+ messages in thread
From: jcr @ 2022-02-20 16:29 UTC (permalink / raw)
  To: pandoc-discuss


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

After further investigation, I understand better what the documentation 
means. The macros do work in raw LaTeX, but after replacement, the result 
is still raw LaTeX, and so does not appear in the `plain` output. Math 
works because the math is converted to plain text. In an old thread 
<https://groups.google.com/g/pandoc-discuss/c/DMAa5C3PJ8A/m/EASRpU0PAQAJ>, 
I found a filter that will do what I want: it uses `pandoc.read` to convert 
the raw inlines. However, it still seems that there's a problem: it doesn't 
work with an explicit raw span. With the above `test.md` and the filter, I 
get this output:

```
-   This is a test.
-   This is a test
-   This is a .
```

Why isn't the macro applied inside `\test`{=latex}?

On Sunday, February 20, 2022 at 4:51:50 PM UTC+1 jcr wrote:

> The documentation for the `latex_macros` extension says, "When this 
> extension is enabled, pandoc will parse LaTeX macro definitions and apply 
> the resulting macros to all LaTeX math and raw LaTeX." This works for me in 
> math, but not in raw LaTeX, which I would rather use. With `test.md` 
> containing the following:
> ```
> \newcommand{\test}{test}
>
> - This is a $\test$.
> - This is a \test
> - This is a `\test`{=latex}.
> ```
>
> I get this output from `pandoc test.md -t plain`:
> ```
> -   This is a test.
> -   This is a
> -   This is a .
> ```
>
> I'm using pandoc 2.17.1.1
>

-- 
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/65614b00-e083-40c3-83ef-a372d81deafcn%40googlegroups.com.

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

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

end of thread, other threads:[~2022-02-20 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-20 15:51 latex_macros not working with raw latex jcr
     [not found] ` <b7516705-be96-41a0-b539-877a29258e44n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-02-20 16:29   ` jcr

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