9

I noticed that tabsize only affects lstlisting and lstinline macros.

Here is the output. The top figure is displayed using lstinputlisting and the bottom one is displayed using lstlisting. The tabsize does not affect the top one. But it does for the bottom one.

alt text

How to make it works for all macros?

\documentclass[dvips,dvipsnames,rgb,table]{article}
\usepackage[a4paper,hmargin=20mm,vmargin=20mm]{geometry}
\usepackage{xcolor}

\usepackage{listings}
\lstset%
{%
    literate={ï}{}0
           {»}{}0
           {¿}{}0,
    language={[Sharp]C},
    breaklines=true,
    breakindent=0pt,
    tabsize=2,
    basicstyle=\color{White}\ttfamily\scriptsize,
    keywordstyle=\color{Orange}\sffamily\bfseries,
    commentstyle=\color{Green}\itshape,
    stringstyle=\color{Cyan}\rmfamily,
    showstringspaces=true,
    aboveskip=0pt,
    belowskip=0pt,
    backgroundcolor=\color{Black}%,
    %rangeprefix=\%,
    %rangesuffix=\%,
    %includerangemarker=false,
    %linerange=start-stop%
}


\usepackage{fancyvrb}
\def\MyOwn%
{%        
    \VerbatimEnvironment%
  \begin{VerbatimOut}{\jobname.tmp}%
}
\def\endMyOwn%
{%
    \end{VerbatimOut}% 
    \lstinputlisting{\jobname.tmp}%     
}


\begin{document}
\begin{MyOwn}
using System;
class Foo
{
    void Main()
    {
        Console.WriteLine("using lstinputlisting");
    }
}
\end{MyOwn}

\vspace{1cm}

\begin{lstlisting}
using System;
class Foo
{
    void Main()
    {
        Console.WriteLine("using lstlisting");
    }
}
\end{lstlisting}
\end{document}

Does the \VerbatimEnvironment cause this problem?

Display Name
  • 46,933
  • 2
    Look at the output file, does it contain tabs? If not, then tabsize doesn't do anything. – TH. Jan 04 '11 at 05:51

1 Answers1

5

use also:

\usepackage{fancyvrb}
\fvset{tabsize=2}