\documentclass[a4paper]{report} \usepackage{listings} \newcommand{\xmlcode}[1]{ {\lstset{frameround=tttt,language=XML, basicstyle=\footnotesize, stepnumber=1, stringstyle={\ttfamily}, frame=single, breaklines=true, showspaces=false, showstringspaces=false, numbers=left} \begin{lstlisting} #1 \end{lstlisting} }} \begin{document} This is a test \xmlcode{ } \end{document}