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

Latex keyword used as delimiter for \lstinline when using --listings option #1595

Closed
mikewesthad opened this issue Sep 1, 2014 · 0 comments

Comments

@mikewesthad
Copy link

I'm working on a project that uses pandoc for markdown to PDF conversion. I stumbled upon what I believe is an issue with delimiter selection for \lstinline.

If you start with a markdown file like:

`Hello World`

`Hello World!`

`"Hello World!"`

And convert it to a PDF with pandoc test.md --listings -o test.pdf

You end up getting a reserved keyword error:

! Illegal parameter number in definition of \reserved@a.
<to be read again>
                   }
l.54 \lstinline#

pandoc: Error producing PDF from TeX source

If you convert it to .tex and check out the source:

\lstinline!Hello World!

\lstinline"Hello World!"

\lstinline#"Hello World!"#

Pandoc does some searching of the inline code to find a delimiter that isn't used in the code. It seems like the order of selection is ! -> " -> # -> etc. The problem is that # is a latex keyword and cannot be used as a delimiter. I'm not sure where in Pandoc the delimiter selection is done, but the fix seems like it would just be to remove latex keywords from the pool of possible delimiters.

Pandoc Version Info (on Win 8.1 64x):

pandoc 1.13.0.1
Compiled with texmath 0.8, highlighting-kate 0.5.8.5.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gcc, gnuassembler, go, haskell, haxe, html, ini, isocpp,
    java, javadoc, javascript, json, jsp, julia, latex, lex, literatecurry,
    literatehaskell, lua, makefile, mandoc, markdown, matlab, maxima, metafont,
    mips, modelines, modula2, modula3, monobasic, nasm, noweb, objectivec,
    objectivecpp, ocaml, octave, pascal, perl, php, pike, postscript, prolog,
    pure, python, r, relaxngcompact, restructuredtext, rhtml, roff, ruby, rust,
    scala, scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo,
    verilog, vhdl, xml, xorg, xslt, xul, yacc, yaml
Default user data directory: C:\Users\Michael\AppData\Roaming\pandoc
Copyright (C) 2006-2014 John MacFarlane
Web:  http://johnmacfarlane.net/pandoc
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
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

1 participant