I am new to Latex so I might be missing something basic. I need a custom command for code snippets. Normally I would write this:
\begin{minted}
[
frame=lines,
firstnumber=182,
framesep=2mm,
baselinestretch=1.2,
bgcolor=white,
fontsize=\footnotesize,
linenos
]{java}
int x = 3;
int y = x + 3;
\end{minted}
What I want to be able to use is this:
\code{182}{
int x = 3;
int y = x + 3;
}
This is my attempt at defining it:
\newcommand{\code}[2]{
\begin{minted}
[
frame=lines,
firstnumber=#1,
framesep=2mm,
baselinestretch=1.2,
bgcolor=white,
fontsize=\footnotesize,
linenos
]{java}
#2
\end{minted}
}
The \begin{minted} part and arguments are interpreted correctly, but my code (#2) is not printed, and the {minted} section ends when ended explicitly by a subsequent \end{minted}
