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

commentstyle=\color{gray}\upshape }

\lstdefinelanguage{XML} {   
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


it does not write the Persian word.

  • 1
    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}
    – darthbith
    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
    – darthbith
    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?
    – Pedram
    May 13 '14 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.