diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-04-29 11:05:44 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-04-29 11:05:44 +0200 |
commit | 730796ee314d42477fab216621b8e44539c94656 (patch) | |
tree | 023418122afdff27f4595d3edb070f3d9f11db88 /data | |
parent | e76b6724144032c62c183f850fe05271aa245fb5 (diff) | |
download | pandoc-730796ee314d42477fab216621b8e44539c94656.tar.gz |
LaTeX writer: Fix problem with escaping in lstinline.
Previously the LaTeX writer created invalid LaTeX
when `--listings` was specified and a code span occured
inside emphasis or another construction.
This is because the characters `%{}\` must be escaped
in lstinline when the listinline occurs in another
command, otherwise they must not be escaped.
To deal with this, adoping Michael Kofler's suggestion,
we always wrap lstinline in a dummy command `\passthrough`,
now defined in the default template if `--listings` is
specified. This way we can consistently escape the
special characters.
Closes #1629.
Diffstat (limited to 'data')
-rw-r--r-- | data/templates/default.beamer | 1 | ||||
-rw-r--r-- | data/templates/default.latex | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/data/templates/default.beamer b/data/templates/default.beamer index 4f2cae89a..fb02cb058 100644 --- a/data/templates/default.beamer +++ b/data/templates/default.beamer @@ -125,6 +125,7 @@ $if(verbatim-in-note)$ $endif$ $if(listings)$ \usepackage{listings} +\newcommand{\passthrough}[1]{#1} $endif$ $if(lhs)$ \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} diff --git a/data/templates/default.latex b/data/templates/default.latex index 030ab90f1..899a00aea 100644 --- a/data/templates/default.latex +++ b/data/templates/default.latex @@ -129,6 +129,7 @@ $endfor$ $endif$ $if(listings)$ \usepackage{listings} +\newcommand{\passthrough}[1]{#1} $endif$ $if(lhs)$ \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} |