Pick a selection with the buttons in the left margin, then click on one of the titles or subscribe to my RSS feed.

Mon, 27 Feb 2012 14:44:00 GMT
Typesetting code listings in InDesign
Method using two paragraph styles and a list

This is my solution using CS 5.5. There are most likely more professional or best-practice ways I have missed. First I defined two paragraph styles, ListingCaption and Listing. In the Type menu under Bulleted & Numbered Lists I defined an additional list called LineNumbers. Then I set both paragraph styles to use LineNumbers, ListingCaption at level 1 and Listing at level 2, checking Restart Numbers at This Level After: Any Previous Level. ListingCaption is a numbered paragraph that counts my listings (Listing 1 - Your Basic Code) and Listing are the individual lines of code, each formatted using the Listing paragraph style.

Click the back button to return to your selection, or create a random one using the buttons in the margin.