I can get a code block including tab characters in a minted
environment to work with the obeytabs
option, which results in a tab size of 8. The tabsize
option, however, will mess up the tab alignment.
\documentclass{article}
\usepackage{minted}
\usemintedstyle{pastie}
\begin{document}
\begin{minted}[obeytabs,showtabs]{c}
int foo //bar
//ffff
\end{minted}
\begin{minted}[tabsize=4,showtabs]{c}
int foo //bar
//ffff
\end{minted}
\end{document}
The output looks as follows:
Is there a solution to this?
Best Answer
I am possibly missing the point because I've set up my editor to automatically expand tabs, but after disabling this (I think) it seems to me that
minted
does do what it is supposed to here. The problem is that in your second example you have forgotten to include theobeytabs
option. If you put this in then minted does what (I think) you want.For example, I get what seems to me to be the following perfectly reasonable output
from the following latex file:
If I've misunderstood the issue let me know and I'll delete this.
(Btw, I could have answered this in the comments but I'm trying to start a movement to stop answering questions in the comments because currently there are 4190 questions posted on TeX.SX with no answers...except that I suspect that most of these questions are actually answered in the comments!)