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

Underscore in codeblock caption breaks output with listings #6742

Closed
sys9kdr opened this issue Oct 13, 2020 · 2 comments
Closed

Underscore in codeblock caption breaks output with listings #6742

sys9kdr opened this issue Oct 13, 2020 · 2 comments

Comments

@sys9kdr
Copy link

sys9kdr commented Oct 13, 2020

I've got problem with codeblock captions and listings.
Underscores in codeblock caption cause PDF generation error with --listings option.

pandoc version

2.10.1

> pandoc --version
pandoc 2.10.1
Compiled with pandoc-types 1.21, texmath 0.12.0.2, skylighting 0.8.5
Default user data directory: /Users/ghnoda/.local/share/pandoc or /Users/ghnoda/.pandoc
Copyright (C) 2006-2020 John MacFarlane
Web:  https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

Steps to reproduce

  1. Create this markdown file, sample.md.
```{caption='some_code.c'}
code here
```
  1. Error caused when building pdf with listings options and lualatex.
> pandoc -o output.pdf --pdf-engine=lualatex --listings sample.md
Error producing PDF.
! Missing $ inserted.
<inserted text> 
$
l.59 \begin{lstlisting}[caption={some_code.c}]
  • latex output with same file and options
> pandoc -t latex --listings sample.md
\begin{lstlisting}[caption={some_code.c}]
code here
\end{lstlisting}
@jgm
Copy link
Owner

jgm commented Oct 13, 2020

What is required here? A backslash-escape \_?

@sys9kdr
Copy link
Author

sys9kdr commented Oct 14, 2020

Yes. I think the latex output should include \_.

\begin{lstlisting}[caption={some\_code.c}]
code here
\end{lstlisting}

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

2 participants