Burkart Lingner

You are currently browsing all posts tagged with 'Listings'.

LaTeX listings: MATLAB / Octave block comments

  • January 17, 2012 17:49

The listings package is a great tool to typeset source code beautifully and according to one’s personal taste due to a range of customizable settings. Among the many languages supported off the shelf is MATLAB and its free software sibling GNU Octave. Unfortunately the latest version 1.4 of the listings package dates back to February 2007 which might be the reason why block comments for MATLAB and Octave are not supported by default.

LaTeX listings: Emphasize the backslash, too

  • April 24, 2011 18:02

It always striked me as odd that the listings package doesn’t include the leading backslash of (La)TeX commands when emphasizing them. Thankfully you can change that behavior by i.e. setting \lstset{\texcsstyle=*\bfseries} (note the asterisk). Unfortunately this cuts the connection between the styling of LaTeX commands and that defined as keywordstyle. In order to have LaTeX commands and the leading backslash styled just like keywords in any other language, use


in the document’s preamble. The actual keyword style is changed via


Good-looking line breaks with the listings package

  • April 24, 2011 17:48

If you want to typeset source code in LaTeX you’ll probably end up using the listings package. The output looks good and you have quite a few options to customize it to your taste. Some of those options deal with how long lines are wrapped. Personally, I like them to look this way: