As linhas de texto não estão alinhadas ao usar lstlisting

As linhas de texto não estão alinhadas ao usar lstlisting

Quero fazer uma caixa de texto onde cada linha comece na mesma coluna. Porém, quando compilo o documento, as linhas não ficam alinhadas por algum motivo. Aqui está meu código:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{listings}
\title{Example}
\lstset{basicstyle=\normalsize\ttfamily, breaklines=true}
\lstset{framextopmargin=10pt,framexbottommargin=10pt,frame=single}
\date{2012\\Julio}

\begin{document}

\maketitle

\noindent \textbf{\large{Example 1}}
\bigskip
\begin{lstlisting}
Example text. As you can see here, for some reason, and even though the first line of text is fine, the rest of the lines are not aligned
\end{lstlisting}

\end{document}

Aqui está o que recebo ao compilar:

insira a descrição da imagem aqui

Estou compilando com xetex, não sei se isso importa

Responder1

Ao listingsquebrar uma linha muito longa, ele insere algum espaço no início da(s) nova(s) linha(s). Você pode remover este espaço breakindent=0ptconfigurando \lstset:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{listings}
\title{Example}
\lstset{
    basicstyle=\normalsize\ttfamily,
    breaklines=true,
    framextopmargin=10pt,
    framexbottommargin=10pt,
    frame=single,
    breakindent=0pt      % <-- NEW
}
\date{2012\\Julio}

\begin{document}

\maketitle

\noindent \textbf{\large{Example 1}}
\bigskip
\begin{lstlisting}
Example text. As you can see here, for some reason, and even though the first line of text is fine, the rest of the lines are not aligned
\end{lstlisting}

\end{document}

insira a descrição da imagem aqui

informação relacionada