Hi everyone!

I'm using the LaTeX command "\write18{}" to be able to issue commands directly when compiling the document. However, when I'm trying to convert from Markdown to LaTeX, the "write18 {}" command gets escaped and therefore can't be processed by LaTeX.

Example (Markdown file, temp.md):
# This is a section
Capturing the output of a command with `write18`.

## Description
Some examples where the content does not get escaped:

\section{git --version}

\input{git --version}

\write{git --version}

Some examples where the content gets escaped:

\immediate\write18{git --version}

\write18{git --version}

This gets compiled down to (pandoc --to latex temp.md)
\section{This is a section}\label{this-is-a-section}

Capturing the output of a command with \texttt{write18}.

\subsection{Description}\label{description}

Some examples where the content does not get escaped:

\section{git --version}

\input{git --version}

\write{git --version}

Some examples where the content gets escaped:

\immediate\write18\{git --version\}

\write18\{git --version\}


As you can see, the "\write18{git --version}" command gets compiled down to "\write18\{git --version\}" that's escaped and therefore cannot be processed by LaTeX.
This seems to have something to do with the Markdown reader, since if you print out the JSON AST, each input gets treated separately.

Output of "pandoc --to json temp.md | python -m json.tool"
...
       
{
           
"c": [
               
{
                   
"c": [
                       
"tex",
                       
"\\write"
                   
],
                   
"t": "RawInline"
               
},
               
{
                   
"c": "18{git",
                   
"t": "Str"
               
},
               
{
                   
"t": "Space"
               
},
               
{
                   
"c": "--version}",
                   
"t": "Str"
               
}
           
],
           
"t": "Para"
       
}
...

Now to my actual question: is this expected behavior or some kind of missing token definition? And if so; how would I work around it?
I'd rather not write a Pandoc filter that would process the entire AST, but if the above behavior is expected I guess that's a solution that could work. Otherwise, does anyone else have any suggestions?

Thank you

Best regards,
Sven

--
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.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9a1c3693-5d46-4de0-921b-3408ca893bad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.