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.

I want to print an example source file so that I can study it. How do I print it with syntax highlighting? I'm currently using TeXShop in MacTeX; apparently it doesn't have this ability. What program do you recommend to do this?

share|improve this question
add comment

5 Answers

up vote 6 down vote accepted

You could try including the code inside another document using the minted package -- I don't think the listings package does colored syntax highlighting by default, but minted does.

share|improve this answer
1  
minted and Pygments really do their job well :) –  Kit Nov 3 '10 at 23:56
add comment

How about typesetting the source using the listings package and then printing the resultant pdf?

share|improve this answer
1  
This seems a little roundabout: put the whole source inside a listings environment in another tex file and compile that. Surely there's an easier way to just print the plaintext, suitably coloured... –  Seamus Oct 23 '10 at 12:44
6  
@Seamus: well you can use \lstinputlisting so you don’t need to do any copy&paste acrobatics. That’s not all that roundabout. –  Konrad Rudolph Oct 23 '10 at 14:30
    
Ah I didn't know that –  Seamus Oct 23 '10 at 14:45
add comment

Emacs with auctex.

M-x ps-print-buffer-with-faces

Actually it will work without auctex too, but that would be silly.

share|improve this answer
2  
Or from gvim or gedit (probably not available on mac) or many other good text editors. –  Caramdir Oct 23 '10 at 16:09
add comment

gedit with the latex plugin. gedit with latex plugin and embedded terminal I prefer over all of the latex IDEs. Highlight printing should be default.

share|improve this answer
    
AFAIK, gedit doesn't need a plugin to highlight latex. –  Kartik Jan 20 at 16:00
add comment

Try the Highlight Code Converter Produces highlighted code for a ton of languages, plus you can always write your own syntax file if the language you want isn't include. Free (under GPL3), available for most flavors of Linux, Windows, and Mac. Outputs in HTML, XHTML, TeX, LaTeX, RTF, XML, and SVG. Colors are easily customized.

share|improve this answer
add comment

Your Answer

 
discard

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.