Different fontsize for minted and mintinline
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.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{minted}
\makeatletter
\newcommand{\currentfontsize}{\fontsize{\f@size}{\f@baselineskip}\selectfont}
\makeatother
\setminted[java]{fontsize=\footnotesize}
\setmintedinline{fontsize=\currentfontsize}
\begin{document}
{\LARGE This is LARGE inline code: \mintinline{java}{Do.magic()}}
\bigskip
This is inline code: \mintinline{java}{Do.magic()}
And here a code block:
\begin{minted}{java}
public class Magic(){
public void do(){
}
}
\end{minted}
\end{document}