9

While using minted I can change font size (Change font size in minted) on each individual place using the fontsize=\footnotesize:

\begin{listing}
\inputminted[fontsize=\footnotesize]{javascript}{file.js}
\end{listing}

Can I set this once for the entire document?

CarLaTeX
  • 62,716
KcFnMi
  • 1,242

1 Answers1

12

With \setminted{fontsize=...} you can set the default font size for all your minted environments.

If you explicitly indicate a font size in a single minted environment, it overrides the default.

I think your question is a duplicate of Minted, setstretch and font size, the most correct answer to that question is Himura's one.

\documentclass{article}
\usepackage{minted}
\setminted{fontsize=\footnotesize}
\begin{document}
\noindent\verb|\footnotesize| is the default font size:
\begin{minted}{objc}
if you do not specify another fontsize
your minted environment will be footnotesize
\end{minted}
\begin{minted}{objc}
all your minted evronments will be footnotesize
\end{minted}
Unless you specify another font size:
\begin{minted}[fontsize=\large]{objc}
this is large
\end{minted}
\end{document}

enter image description here

CarLaTeX
  • 62,716