Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to know how you can syntax highlighting in a LaTex document for codes.

An example of such document is this guide about a Pyhton library and Page 9.

Perhaps, the document is not built by LaTex. Perhaps, by Markdown and with some addons.

share|improve this question
    
Thank you for your answers! –  Masi Jul 27 '09 at 23:40

2 Answers 2

up vote 1 down vote accepted

I'm guessing that you can look at Prettify. You might be able to create a custom CSS file for LaTeX and get Prettify set up for it...

http://code.google.com/p/google-code-prettify/

I use this plug-in on my website: http://rsolberg.com/ViewBlog/2

StackOverflow also uses it!

share|improve this answer

The listings package is one way to include syntax-highlighted source code listings in a LaTeX document. For other options, see the relevant entry in the TeX FAQ.

share|improve this answer
1  
listings unfortunately has several shortcomings in that it only highlights what it thinks might be nice to highlight instead of having a grammar for the languages. It does weird things on floating point numbers in exponential notation, for example. That being said, I don't know a better replacement, sadly. –  Joey Jul 30 '09 at 14:14

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.