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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The listings package does not support YAML out of the box. Does a package exist that extends listings with YAML support? More generally, is there a good listing somewhere of extensions to listings?

share|improve this question
The »minted« package supports YAML indirectly by its back-end Python Pygments. – Thorsten Donig Nov 17 '13 at 19:57
Which yaml? The css framework or the markup language? – knut Nov 17 '13 at 20:33
@knut The markup language. Didn't even know the CSS framework existed! – Sean Mackesey Nov 17 '13 at 23:22
@ThorstenDonig Thanks Thorsten, this works. You should make it an answer so I can accept it. – Sean Mackesey Nov 17 '13 at 23:22
related: tex.stackexchange.com/questions/152829/… – Jubobs Mar 20 '14 at 23:12
up vote 4 down vote accepted

The »minted« package is your friend here. It uses Python Pygments as back-end for syntax highlighting. And one of the Pygments lexers is for YAML. An approach how to get a YAML script formatted could look like this.


  \section{The YAML Language}
    --- !clarkevans.com/^invoice
    invoice: 34843
    date   : 2001-01-23
    bill-to: &id001
        given  : Chris
        family : Dumars
            lines: |
                458 Walkman Dr.
                Suite #292
            city    : Royal Oak
            state   : MI
            postal  : 48046
    ship-to: *id001
        - sku         : BL394D
          quantity    : 4
          description : Basketball
          price       : 450.00
        - sku         : BL4438H
          quantity    : 1
          description : Super Hoop
          price       : 2392.00
    tax  : 251.42
    total: 4443.52
    comments: >
        Late afternoon is best.
        Backup contact is Nancy
        Billsmer @ 338-4338.

For details about the package and further options for customization please refer to its manual. The example script is taken from the YAML start page.

enter image description here

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.