* How to use LaTeX command "\write18{}" in Pandoc @ 2017-07-12 8:10 sven.androd-Re5JQEeQqe8AvxtiuMwx3w [not found] ` <9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: sven.androd-Re5JQEeQqe8AvxtiuMwx3w @ 2017-07-12 8:10 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 2934 bytes --] 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. [-- Attachment #1.2: Type: text/html, Size: 20210 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: How to use LaTeX command "\write18{}" in Pandoc [not found] ` <9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2017-07-12 11:43 ` John MacFarlane [not found] ` <20170712114354.GA21458-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org> 2017-07-13 14:31 ` Ulrike Fischer 0 siblings, 2 replies; 5+ messages in thread From: John MacFarlane @ 2017-07-12 11:43 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw I can modify the LaTeX reader so it handles this special case better. (A LaTeX control sequence must be a sequence of letters -- here the '18' specifies a file handle, I think.) In the mean time, try defining a macro synonym: \newcommand{\mywrite}[1]{\write18{#1}} and then use `\mywrite`. +++ sven.androd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org [Jul 12 17 01:10 ]: > 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 [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to > [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > [3]https://groups.google.com/d/msgid/pandoc-discuss/9a1c3693-5d46-4de0- > 921b-3408ca893bad%40googlegroups.com. > For more options, visit [4]https://groups.google.com/d/optout. > >References > > 1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 3. https://groups.google.com/d/msgid/pandoc-discuss/9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer > 4. https://groups.google.com/d/optout ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20170712114354.GA21458-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>]
* Re: How to use LaTeX command "\write18{}" in Pandoc [not found] ` <20170712114354.GA21458-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org> @ 2017-07-12 12:04 ` sven.androd-Re5JQEeQqe8AvxtiuMwx3w 0 siblings, 0 replies; 5+ messages in thread From: sven.androd-Re5JQEeQqe8AvxtiuMwx3w @ 2017-07-12 12:04 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 5864 bytes --] Really neat solution! Thank you for taking the time to answer! Yeah, that's true what you're saying. According to my understanding the "18" in "write18" is special in the way that it's not a file handle, but instead a way of sending commands directly to the shell. With that said; I'm not sure how many file handles that actually exist, but from this <https://www.google.se/url?sa=t&rct=j&q=&esrc=s&source=web&cd=8&ved=0ahUKEwillb3t14PVAhWL8RQKHayaDc0QFghgMAc&url=http%3A%2F%2Ftug.ctan.org%2Fmacros%2Flatex%2Fcontrib%2Fkoma-script%2Fsource-doc%2Fenglish%2Fscrwfile.tex&usg=AFQjCNGtzXyJDQjnJZMEBAMyTbM9ddGlpA> file they mention that there only exist 18, so if an exception is to be made perhaps only 1-18 has to be added? Again; thanks you for the quick answer and such great software! :) // Sven Den onsdag 12 juli 2017 kl. 13:44:11 UTC+2 skrev John MacFarlane: > > I can modify the LaTeX reader so it handles this special > case better. (A LaTeX control sequence must be a sequence > of letters -- here the '18' specifies a file handle, I > think.) > > In the mean time, try defining a macro synonym: > > \newcommand{\mywrite}[1]{\write18{#1}} > > and then use `\mywrite`. > > +++ sven....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:> [Jul 12 17 01:10 ]: > > 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 [1]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > > To post to this group, send email to > > [2]pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > > To view this discussion on the web visit > > [3] > https://groups.google.com/d/msgid/pandoc-discuss/9a1c3693-5d46-4de0- > > 921b-3408ca893bad%40googlegroups.com. > > For more options, visit [4]https://groups.google.com/d/optout. > > > >References > > > > 1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> > > 2. mailto:pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:> > > 3. > https://groups.google.com/d/msgid/pandoc-discuss/9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer > > 4. https://groups.google.com/d/optout > > -- 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e980a9f0-9f1b-434d-9bf9-c96e342cd388%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. [-- Attachment #1.2: Type: text/html, Size: 11380 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to use LaTeX command "\write18{}" in Pandoc 2017-07-12 11:43 ` John MacFarlane [not found] ` <20170712114354.GA21458-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org> @ 2017-07-13 14:31 ` Ulrike Fischer [not found] ` <xrwf1rqnc3pu.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org> 1 sibling, 1 reply; 5+ messages in thread From: Ulrike Fischer @ 2017-07-13 14:31 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Am Wed, 12 Jul 2017 13:43:54 +0200 schrieb John MacFarlane: > I can modify the LaTeX reader so it handles this special > case better. (A LaTeX control sequence must be a sequence > of letters -- here the '18' specifies a file handle, I > think.) > > In the mean time, try defining a macro synonym: > > \newcommand{\mywrite}[1]{\write18{#1}} > > and then use `\mywrite`. There is no need for an own command. Load the shellesc package and use \ShellEscape and \DelayedShellEscape instead of \immediate\write18 and \write18 -- it is recommended anyway as it has the benefit to also work with luatex where \write18 no longer exists. -- Ulrike Fischer http://www.troubleshooting-tex.de/ ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <xrwf1rqnc3pu.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org>]
* Re: How to use LaTeX command "\write18{}" in Pandoc [not found] ` <xrwf1rqnc3pu.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org> @ 2017-07-15 11:22 ` sven.androd-Re5JQEeQqe8AvxtiuMwx3w 0 siblings, 0 replies; 5+ messages in thread From: sven.androd-Re5JQEeQqe8AvxtiuMwx3w @ 2017-07-15 11:22 UTC (permalink / raw) To: pandoc-discuss; +Cc: luatex-bMiYgyzgJ3Ab1SvskN2V4Q [-- Attachment #1.1: Type: text/plain, Size: 1512 bytes --] Thank you! I did not know about that package, but that seems like a more appropriate solution. // Sven Den torsdag 13 juli 2017 kl. 16:32:04 UTC+2 skrev Ulrike Fischer: > > Am Wed, 12 Jul 2017 13:43:54 +0200 schrieb John MacFarlane: > > > I can modify the LaTeX reader so it handles this special > > case better. (A LaTeX control sequence must be a sequence > > of letters -- here the '18' specifies a file handle, I > > think.) > > > > In the mean time, try defining a macro synonym: > > > > \newcommand{\mywrite}[1]{\write18{#1}} > > > > and then use `\mywrite`. > > There is no need for an own command. Load the shellesc package and > use > > \ShellEscape and \DelayedShellEscape > > instead of \immediate\write18 and \write18 -- it is recommended > anyway as it has the benefit to also work with luatex where \write18 > no longer exists. > > > > -- > Ulrike Fischer > http://www.troubleshooting-tex.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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/826afb01-9b76-452d-8aaa-6ecef81881ca%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. [-- Attachment #1.2: Type: text/html, Size: 2648 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-07-15 11:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-07-12 8:10 How to use LaTeX command "\write18{}" in Pandoc sven.androd-Re5JQEeQqe8AvxtiuMwx3w [not found] ` <9a1c3693-5d46-4de0-921b-3408ca893bad-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2017-07-12 11:43 ` John MacFarlane [not found] ` <20170712114354.GA21458-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org> 2017-07-12 12:04 ` sven.androd-Re5JQEeQqe8AvxtiuMwx3w 2017-07-13 14:31 ` Ulrike Fischer [not found] ` <xrwf1rqnc3pu.dlg-bMiYgyzgJ3Ab1SvskN2V4Q@public.gmane.org> 2017-07-15 11:22 ` sven.androd-Re5JQEeQqe8AvxtiuMwx3w
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).