To print .md
to .pdf
I use pandoc. (due to many contributor in this forum. Thx to them)
problem = I would like to have (in the pdf) the same background color for the code no matter if I use triple backtick or simple backtick
eg:
` code surrounded by one backtick = no background color `
but
“` code with tree backticks = background color OK
“`
I'm a noob in Latex, if I could get some help…
my settings
- My Command :
#!/bin/bash
pandoc "$1" \
--include-in-header inline_code.tex \
--include-in-header listings-setup.tex \
-V linkcolor:blue \
-V geometry:a4paper \
-V geometry:margin=2cm \
-V mainfont="DejaVu Serif" \
-V monofont="Space Mono" \
--listings \
--pdf-engine=xelatex \
-o "$2"
- the file
listings-setup.tex
used with--listings
\usepackage{xcolor}
\lstset{
basicstyle=\ttfamily,
extendedchars=true
numbers=left,
numberstyle=\tiny\ttfamily,
backgroundcolor=\color[RGB]{248,197,196},
showstringspaces=false,
tabsize=2,
columns=fixed,
frame=trbl,
frameround=tttt,
framesep=7pt,
breaklines=true,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}},
- the file
inline_code.tex
\definecolor{Light}{HTML}{F4F4F4}
\let\oldtexttt\texttt
\renewcommand{\texttt}[1]{
\colorbox{Light}{\oldtexttt{#1}}
}
Best Answer
With the option
--listings
pandoc uses\lstinline
for inline code (not\texttt
), so you have to patch\lstlinsting
. You can do so with egreg's code here. The code below replaces the code in yourlistings-setup.tex
(you don't needinline_code.tex
anymore, since it's all done with listings):Now call
The result looks like this: