I was wondering if it is possible to distinguish between \mintinline
and \begin{minted}
, to use different font size for both.
Background: I'm placing java code in my document with \begin{minted}
and I set the font-size globally with \setminted[java]{fontsize=\footnotesize}
. But when I want to show some code parts inline, I need to have a larger font size (for aesthetic reasons 🙂 ) so I have to use \mintinline[fontsize=\small]{java}
everytime.
Maybe it is possible to copy the java settings and create something like \mintinline{javainline}
, but I did not find information on this.
As requested a sample code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{minted}
\setminted[java]{fontsize=\footnotesize}
\begin{document}
This is inline code: \mintinline[fontsize=\normalsize]{java}{Do.magic()} \\
And here a code block:
\begin{minted}{java}
public class Magic(){
public void do(){
}
}
\end{minted}
\end{document}
I want to get rid of writing [fontsize=\normalsize]
everytime I use \mintinline.
Best Answer
You can do even better, namely make
\mintinline
use the current font size.The package
minted
allows for\setmintinline
, that takes precedence over\setminted
for\mintinline
; the only trick is to define a macro that chooses the current font size.