开发者

LaTeX - Listings - Code Indention

开发者 https://www.devze.com 2023-01-26 08:02 出处:网络
so I\'m working on some kind of homework paper about git and I want to insert some console output examples. I\'m working with TextMate.

so I'm working on some kind of homework paper about git and I want to insert some console output examples. I'm working with TextMate. I have my LaTeX code indented like every other normal source code, to make it more readable. My question now is, why get listings in my output pdf indented and how do I prevent that.

Some example code:

\b开发者_如何学Pythonegin{lstlisting}
    $ git ls-files
    README
    TU_Logo_SW.pdf
    beleg.pdf
    beleg.tex 
\end{lstlisting} 

In my file there is one tab in front of \begin and two in the lines following. When I run pdflatex the code will be indented with two tabstops in the pdf. Quickfix is to format all the listings without indention in my tex file, but thats pretty ugly ;-(


lstlisting has a key that lets you remove spaces: \begin{lstlisting}[gobble=4] will remove the first four characters from every input line in the environment. (I think a tab should still count as one character at that point.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号