Hi I use the following LaTeX to ouput xml format data, however, there is no space before each line.
\documentclass{minimal}
\usepackage{etex},
\begin{document}
\medskip
{\small\noindent
\fbox{\begin{minipage}{6cm}
<invoke operation="a3". . .>\\
\hspace{3mm}<Handler>\\
\ \ \ \ \ <operation="...." . . .>\\
\ \ <Handler>\\
</invoke>
\end{minipage}}
}
\medskip
\end{document}
The output is below:
However, I wish to output the format like this as there is some space align each line.
Can someone help me?
Best Answer
The
listings
package1 can help you out here, as suggested by Torbjørn T. in the comments. It's designed for typesetting code.Alternatives include the built-in
verbatim
environment, but that doesn't wrap lines quite as easily (you have to break them manually, instead of just settingbreaklines=true
).listings
also offers syntax highlighting; it's quite configurable, but there is very basic highlighting by default, if you specify the language (as I have withlanguage=XML
above).Footnotes