LaTeX

Overwide figures in LaTeX

26 November, 2009 - 13:05
Categories:

When using default LaTeX styles, you get a rather small text width. This is for a very good reason: readability. However, when you want to add an image, figure or table, this width can be a bit limiting. If you naively add an image (or table) that is wider than the text width, the image will typically align on the left margin and extend into the right margin, which is not that pretty. Moreover, because you're not using the left margin, it limits the maximum width you can use.

Read more...

LaTeX: inline BibTeX entries with the bibentry package

17 July, 2009 - 11:28

In the introduction chapter of my PhD dissertation, I had to make a listing of my publications. The obvious brain dead way to achieve this is just typing everything manually in a list. But this feels just so wrong when you're already using BibTeX for managing references and bibliographical stuff. However, the traditional usage of BibTeX in LaTeX is to generate a full list of all references and put this in a dedicated section or chapter.

With the bibentry package (which is part of the natlib package actually) it is possible to put bibliographic entries anywhere in the text. As far as I know and experienced, the bibentry package is included in a default LaTeX setup, so you don't have to install something, just enable it in your document.

Getting it work as desired can take some trial and error, so I thought it may be a good idea to feed "them search engines" with a working example.

Read more...

Setting global XFig defaults for working with LyX/LaTeX

15 May, 2009 - 10:26

When making a document with Lyx (or LaTeX), I often create figures and diagrams in XFig. I know, Xfig's user interface sucks big time. (I tried the Java port JFig, but that one even feels worse to me.) However, the main reason I bite the bullet is that it enables a work flow where the text you add to the XFig figure is typeset by LaTeX when you compile the document. This way, the text in the figure is in the same font as the normal text in the document and, maybe more importantly, you can use all the fancy LaTeX commands, e.g. to put mathematical expressions, symbols and formulas in your figure.

To make this work, one of the required things is to enable the "special" flag on the text objects in XFig, and use a LaTeX font. These things are disabled by default and manually setting for every text object is a bit tedious. To changes these defaults, you can start xfig from the command like with the following options:

Read more...

LaTeX: promille/permille sign

12 June, 2008 - 17:28
Categories:

I needed the LaTeX code for the sign that is called the "promille" sign in Dutch. It's the sign like the percent sign "%" ("procent" in Dutch), but with two circles at the bottom. Googling for "latex promille" was not very successful, so I thought this would be a good botsnack.
(Googling for "permille" or "(parts) per thousand", yield better results however.)

Anyway, I found two solutions:

  1. \textperthousand from the package textcomp, also provides \textpertenthousand but both only work in text mode, not in math mode.
  2. \permil from the package wasysym, works in both text mode as in math mode.

That's all folks

LaTeX trick: putting the subversion revision number on every page

8 February, 2008 - 18:40
Categories:

I mostly use LaTeX for writing documents (LyX actually, but that doesn't matter here) and use Subversion for the version control. For managing the revision info of a source code file I use Subversion's built in feature Keyword Substitution which expands some special keyword (like $Date$ or $Revision$) in the source code to their current values.

Now two questions arise here:

  1. How to get the Subversion keywords nicely into LaTeX? Note that the $ character used for the Subversion keywords is already a reserved LaTeX control character and make things messy.
  2. How to get the version info on every page (e.g. as a footer)?
Read more...

LaTeX trick: customizing captions

29 January, 2008 - 16:34
Categories:

Captions of floats (figures and tables) in LaTeX are by default typeset the same way as the body text. For better readability it could be appropriate to use a different font, font size or margin for the captions. This is possible with the LaTeX package caption.

Read more...

Using custom LaTeX document classes in LyX

21 September, 2006 - 10:23
Categories:

For writing with LaTeX I prefer using LyX because it hides the ugliness of LaTeX source code behind a pseudo-WYSIWYG frontend (the developers call it WYSIWYM: what you see is what you mean). Including mathematical expressions, however, is very LaTeX minded and comfortable: you type LaTeX math constructs (stuff with _, ^, \sum, ...) and LyX directly visualises it as a pretty printed formula. For the advanced LaTeX constructions not available in LyX's interface one can always fall back om "raw LaTeX" input fields. In short, I think LyX is a very handy compromise between the power of LaTeX and the user friendliness of a WYSIWYG system.

Sometimes, for example when writing an article for a conference, one need to use a custom LaTeX document class, recommended by the conference author guidelines. The procedure to make LyX using this custom document class is non obvious and a bit involved. It is broadly explained in the LyX manual (Part Customization, Chapter 5 Installing New Document Classes, Layouts, and Templates), but here is the short version (for teTeX on Linux or related systems, I don't know about Windows):

Read more...

LaTeX: use \textnormal instead of \textrm (or \textsf) in math

14 December, 2005 - 14:17
Categories:

If you you want to use normal text in a math environment (mathdisplay, equation,...) you should use \textnormal{} instead of \textrm{}. Apparently the latter is more popular: a google search for "latex textrm" delivers almost 25.000 hits, whereas google search for "latex textnormal" returns not more than 800 hits. The advantage of \textnormal is that the text will be typeset in the normal font of the body text. \textrm on the other hand activates a roman (serif) font. Most of the time the result of these two will be the same because the default font of the body text is a serif one in most cases. But sometimes it is not.

Read more...