Bollchen.de
Burkart Lingner

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

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

\lstset{texcsstyle=*\lst@keywordstyle}

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

\lstset{keywordstyle=...}

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:

‘Block-centered’ alignment inside LaTeX tables

  • July 15, 2010 19:55

By default LaTeX tables allow three basic types of column alignment: Left-aligned, centered, and right-aligned. Sometimes neither of these choices looks very good, particularly if the column header is wider than the contents of the column body. Several packages exist to deal with this issue. However, they are restricted to figures and don’t work with text in the table body. Using the eqparbox package it’s possible to define a new column type which i.e. right-aligns the column’s contents and then collectively centers the whole block in regard to the column header. After describing the general idea this article also shows how to avoid minor horizontal or vertical misalignments like those introduced by the microtype package.

LaTeX nuisances (I): Space width after an abbreviation

  • June 29, 2010 21:56

When writing English text, LaTeX adds a larger space after the end of a sentence than between words. This is in accordance with local typographic standards. Things get complicated when you let a machine decide what exactly makes up the end of a sentence.

Perfectly horizontal annotation lines in TikZ

  • June 4, 2010 21:02

Let’s assume you have two coordinates or nodes in your TikZ picture. You now want to add an annotation to identify the distance between these two points. However, you only want to show the distance along the x-axis whereas you don’t care for the distance along the y-axis. This means that you expect a straight horizontal line.

This article will show you how to achieve that goal without any need to manually tweak coordinates.