jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.37k stars 3.37k forks source link

Org reader: Latex \newcommand and Powerpoint export #5826

Closed knubee closed 5 years ago

knubee commented 5 years ago

I have a number of .org documents that I typically export via latex to pdf. However, in some cases, I need to export to Powerpoint to share with others.

In most cases, it works fine to export latex commands from an org file to Powerpoint (eg, italics, bold, etc. all export fine).

However, export of latex \newcommand commands do not. Below is MWE.

#+LATEX: \newcommand{\test}{\textbf{{TEST}}}

Org markup *TEST* 

Latex markup \textbf{TEST} 

Latex newcommand \test

PDF output:

Org markup 𝐓𝐄𝐒𝐓

Latex markup 𝐓𝐄𝐒𝐓

Latex newcommand 𝐓𝐄𝐒𝐓

Powerpoint output

Org markup 𝐓𝐄𝐒𝐓

Latex markup 𝐓𝐄𝐒𝐓

Latex newcommand 

The result of \test is not exported at all. The Emacs Messages log shows

Running pandoc with args: (-f org -t pptx -o test.pptx --standalone test.tmpBBBR8K.org)

I am using Pandoc 1.17.5.4 and the latest version of Emacs from source on Ubuntu 19.04. I check Powerpoint output in LibreOffice Impress (version 6.2.7.1) -- but I have also confirmed this with Powerpoint on Windows and a Mac.

mb21 commented 5 years ago

Please try the newest pandoc version from https://pandoc.org/installing.html

knubee commented 5 years ago

Oh, sorry about that. I wrote the wrong Pandoc version number in my original message. I am actually using the latest version, 2.7.3

Any other suggestions?

mb21 commented 5 years ago

The \test is converted to RawInline (Format "latex" "\\test") in the pandoc document AST... so that's why it only works in LaTeX output. I think this is intended behaviour.

Depending on what exactly you're trying to do, you might want to use a lua filter instead.

jgm commented 5 years ago

Yes, this is the intended behavior. A filter could intercept these raw tex bits and convert them to, say, a regular boldface.