My listing that works, which I want to turn into a command.
Code: Select all
\begin{listing}
\begin{tcblisting}{title = {Pseudocode},
fonttitle=\sffamily,
listing only,
listing remove caption=false,
label = lst:json2,
colframe = black,
colback = white,
left=6mm,
bottom=-1mm,
top=0mm,
enhanced,
boxrule=0.5pt,
attach boxed title to top left = {xshift=5mm, yshift=-3mm},
boxed title style={colback=white, colframe=white},
coltitle=black,
sharp corners,
listing options={style=pseudo}}
print "Hello, World!"
\end{tcblisting}
\caption{Example of a pseudocode block}
\end{listing}
Code: Select all
\newcommand{\chnInnerListing}[5]
{
\begin{listing}
\begin{tcblisting}{title = {{#1}},
fonttitle=\sffamily,
listing only,
listing remove caption=false,
label = {#3},
colframe = black,
colback = white,
left=6mm,
bottom=-1mm,
top=0mm,
enhanced,
boxrule=0.5pt,
attach boxed title to top left = {xshift=5mm, yshift=-3mm},
boxed title style={colback=white, colframe=white},
coltitle=black,
sharp corners,
listing options={style={#2}}}
{#5}
\end{tcblisting}
\caption{{#4}}
\end{listing}
}
\newcommand{\chnpseudo}[3]
{
\chnInnerListing{Pseudocode}{pseudo}{{#1}}{{#2}}{{#3}}
}
\chnpseudo{lst:pseudo4}{Example of a pseudocode block}{print "Hello, World!"}
File ended while scanning use of \next. \input{chapters/introduction/readingGuide}.
I have tried matching all the {}, and they seem to be right. I have also removing the extra wrapping around #number. I have tried removing spaces as well.