[Tex/LaTex] Remove indentation to \texttt

indentationtypewriter

I'm writing my thesis using the book document class.
Each paragraph is indented automatically. This is fine with me for the whole thesis except in small pieces of "code" that are enclosed between \texttt.
I would like to eliminate the indentation in this case but I can't. I tried with /noindent but remains a small space (shorter than the indentation but a space). Then I tried it but has no effect because the indentation remains.

\texttt{
{\setlength{\parindent}{0cm}
text 1: Follow the white rabbit!\\
text 2: Follow the tiny white rabbit!\\
}
}

How can I fix?
Thanks!

Best Answer

Setting \parindent inside \textt is not something I'd do. Remember that an end-of-line is the same as a space:

\noindent\texttt{%
  text 1: Follow the white rabbit!\\
  text 2: Follow the tiny white rabbit!\\
}%
Some text follows.

But perhaps you want verbatim:

Some text before the typewriter type text
\begin{verbatim}
text 1: Follow the white rabbit!
text 2: Follow the tiny white rabbit!
\end{verbatim}
Some text follows.
Related Question