I am using R Markdown
and Latex
with memoir
to compile a book to pdf. I am using lstset
for the normal code blocks while the inline code is converter and uses \lstinline
. I would like to globally add a border (like the one in the photo) around all inline code without affecting the normal code examples.
EDIT: MWE
\documentclass{article}
\usepackage{listings}
\usepackage[framemethod=tikz]{mdframed}
\lstset{
basicstyle=\linespread{1}\footnotesize\ttfamily,
extendedchars=true,
showspaces=false,
xleftmargin=5pt,
framexleftmargin=17pt,
framexbottommargin=0pt,
showtabs=false,
}
\surroundwithmdframed[
innerleftmargin=0pt,
innerrightmargin=0pt,
innertopmargin=5pt,
innerbottommargin=0pt,
linewidth= 0.8pt,
linecolor= gray,
roundcorner=0pt
]{lstlisting}
\begin{document}
This is an example of some inline code that appears like \lstinline{Env.linen} and another one like \lstinline{Out.ar}. And this is a normal code block:
\begin{lstlisting}
(
SynthDef(\mySynth4, {
var signal, env; // declare variables
env = Env.linen(
attackTime: 0.05,
sustainTime: 0.5,
releaseTime: 1);
signal =
LFCub.ar(freq: 220, mul: 0.3) *
EnvGen.kr(envelope: env, doneAction: 2);
Out.ar([0,1], signal);
}).add;
)
g = Synth(\mySynth4);
\end{lstlisting}
\end{document}
memoir
at all so I suggest removing thememoir
tag. If you want help you need to provide example code that others can test. Given that this is via R markdown (which not many people here know anything about, it is probably best to provide examples of the latex code generated from R Markdown\lstinline
than. People are much more inclined to help if they have code to work with.