# minted and tabs

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?

• What would help is a picture or at least a description of the expected output. – jub0bs Aug 14 '14 at 12:11

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 the obeytabs 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:

\documentclass{article}

\usepackage{minted}
\usemintedstyle{pastie}
\begin{document}

\begin{minted}[tabsize=2,obeytabs,showtabs]{c}
int foo //bar
//ffff
\end{minted}

\begin{minted}[tabsize=4,obeytabs,showtabs]{c}
int foo //bar
//ffff
\end{minted}

\begin{minted}[tabsize=6,obeytabs,showtabs]{c}
int foo //bar
//ffff
\end{minted}

\end{document}


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!)

• Perhaps worth noting that this is a fancyvrb thing: you don't need minted to see the effect. – Joseph Wright Aug 14 '14 at 12:34
• That is exactly what I wanted. I was confused by the minted documentation which states tabsize (integer) (default: 8) The number of spaces a tab is equivalent to if obeytabs is not active. – cmz Aug 14 '14 at 21:45