Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Since Acrobat obviously isn't able to convert XML to PDF from command line, I'm trying to achieve it using LaTeX.

I found the minted package doing a quite good (and simple) job since it uses pygments to do the formatting and then puts back the formatted text into my document.

The package is working fine except when it comes to long lines in the input XML document that I'm trying to convert to PDF: the generated XML content in the PDF exceeds the right border of the document: screenshot

Finally, to put in a question:
Is there any way that I can tell pygments which page width to use for the output (and possibly keep a nice indent when it has to break a line, just like the Internet Explorer does when displaying XML files)?

Yes, I could use the listings package instead, but with that one, AFAIK I have to define the keywords to get a reasonable highlighting for the XML content, right?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

minted can’t do that and since I have no idea how this line-breaking feature is implemented in listings there are no plans a the moment to add the feature. Sorry. :-(

My advice: for your situation, switch to listings (or break the lines manually).

share|improve this answer
Thanks for the clear statement. I think, I'll go for manual line breaking. Seems less work to me than configuring the listings package for my needs... –  eckes Feb 8 '11 at 6:34

There seems to be no option for pygments to provide a line width. I would assume that it doesn't handles such thing by itself. If it can be done then only in its latex format driver.

Note that minted/pygments using fancyvrb to display the text while keeping \ the macro character. Unfortunately fancyvrb can't break lines itself. The listings package can do that, but doesn't support \ as single escape character! :-(

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.