# XML style for Latex including Persian characters with some preferences

I am using the listings package to include some XML code in my document. Currently, I am using the following style:

\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
showstringspaces=false,

\lstdefinelanguage{XML} {
morestring=[b]",
morestring=[s]{>}{<},
morecomment=[s]{<?}{?>},
stringstyle=\color{black},
identifierstyle=\color{darkblue},
keywordstyle=\color{cyan},
morekeywords={xmlns,version,type} }


I have two main problems:

1- if the size of an element is bigger than the size of the line, the rest of the element text does not go to the next line and continues in the same line and the text goes to the margin!

2- It does not support Persian characters. I mean for example if I have an attribute like

Root="گوشی"


it does not write the Persian word.

• Hi, and welcome to TeX.SX. You can have a look at the starter guide to make yourself familiar with the site. You may notice I've edited your post a little bit. Code is formatted by indenting it by four spaces, rather than the > at the beginning of the line. It would also be a great help if you could include a full minimum working example beginning with \documentclass{...} and ending with \end{document} May 13 '14 at 16:50
• Adding breaklines = true to the lstset will automatically break the lines at the margins. See: stackoverflow.com/a/1875803/2449192 May 13 '14 at 16:51
• @darthbith Thanks dear friend. the first problem is solved. How about Persian characters? I know that xepersian package is for supporting Persian. how can I add the settings related to using xepersian package to the lstset? May 13 '14 at 17:00