When writing with minted code snippets I dislike to remove indentation in latex source, so correct results are generated. Is there a way to substract latex indentation-level from minted indentation? I hope this mwe makes it clear:
\documentclass{beamer}
\usepackage{minted}
\begin{document}
\begin{frame}[fragile,t]
\begin{itemize}
\item readable Latex source
\begin{minted}{python}
l = 1
\end{minted}
not so nice Latex source but, correct indentation
\begin{minted}{python}
l = 1
\end{minted}
So how to subtract the indentation level from latex source?
\end{itemize}
\end{frame}
\end{document}
BTW: Please consider that code listings may have a line lengths up to 80 characters, where this additional indent will cause overlapping source, or linebreaks.
Best Answer
There's an option called
autogobble
which does exactly what you want.