Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backslashes with latex #2790

Closed
andrewthad opened this issue Mar 15, 2016 · 3 comments
Closed

Backslashes with latex #2790

andrewthad opened this issue Mar 15, 2016 · 3 comments

Comments

@andrewthad
Copy link

If we have the following as example_in.markdown:

Description
===========

This is Drew's custom line with a \thingslashchar in it.

And then we run this:

pandoc -s example_in.markdown -o example_out.tex

We get a latex document as example_out.tex. Here is the relevant section:

... 
\begin{document}

\section{Description}\label{description}

This is Drew's custom line with a \thingslashchar in it.

\end{document}
...

This latex is invalid. It seems like the backslash should be escaped in the latex output. In my actual use case, this is causing problems when people put in windows paths. My solution so far has just been to require wrapping them in backticks.

@jgm
Copy link
Owner

jgm commented Mar 15, 2016

Pandoc passes through things that look like LaTeX
commands. You can either backslash-escape the backslash
(i.e. \\thingslashchar) or disable the raw latex pass-through
extension:

pandoc -f markdown-raw_tex -t latex

+++ Andrew Martin [Mar 15 16 08:35 ]:

If we have the following as example_in.markdown:

Description

This is Drew's custom line with a \thingslashchar in it.

And then we run this:
pandoc -s example_in.markdown -o example_out.tex

We get a latex document as example_out.tex. Here is the relevant
section:
...
\begin{document}

\section{Description}\label{description}

This is Drew's custom line with a \thingslashchar in it.

\end{document}
...

This latex is invalid. It seems like the backslash should be escaped in
the latex output. In my actual use case, this is causing problems when
people put in windows paths. My solution so far has just been to
require wrapping them in backticks.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
[1]#2790

References

  1. Backslashes with latex #2790

@andrewthad
Copy link
Author

Thanks. That resolves my issue.

@jdhao
Copy link

jdhao commented Dec 27, 2017

I have also met this issue #4200. But in my case, the error message is not undefined command but utf-8 related issue, which is rather misleading.

After properly dealing with backslash issues, the error message disappeared and I can compile the markdown file successfully to pdf now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants