about | sitemap | feedback | search
Sunil Patel | LaTeX on a mac

5. Figures

Note: The following advice can be adapted to users working on Windows or other systems.

Figures are a hugely important part of a thesis (and other documents), they showcase the schematics of an experiment, the data and results and assist in explaining the text. More attention is given to a figure than the surrounding body text as it is much easier to simply "look" at a figure rather than "trawl" through the text. Figures provide a break and rest for the reader in what would otherwise be over 100 pages of solid type.

Unfortunately, it is very easy to make figures look awful in LaTeX, but by using the following advice, you can make the figures in your document look stunning.

Figure File Format

Though file formats such as JPEG and GIF or even TIFF and PNG are the standard for images and photos, the best file format to use with LaTeX is the PDF. This is because Mac OS X handles PDF files natively and this makes handling figures for LaTeX incredibly easy and also has some very good benefits.

Creating PDF files of your images is easy. Any application that has the "Print" menu option can create a PDF. There is a "PDF" button in the Print dialogue box (on the bottom left) from which one of the first options is to save the document as a PDF file. Done.

For ease-of-use and clear, sharp images, that stay sharp once they are put into LaTeX, the only option is to go for PDF.

Figure Size

A common mistake made with figures it to have LaTeX scale the image from its original size to fit the text width (eg. for a photo), whether this involves up- or down-scaling the results are usually always a pixelated mess, especially if the figure contains text.

So the first "rule" would be to never ever let LaTeX resize an image, and never insert any form of image resizing or scaling command as the results are usually always appalling looking figures. Figures should be created at a 1 to 1 scale and never resized or scaled, neither up nor down.

For the majority of cases, the width of the body text in a LaTeX document is 14 cm for an A4 sized document. If you are using another paper size (eg. Letter or legal) then you can find the text width by simply print a page of your LaTeX'ed PDF document and measuring the text width with a ruler.

One of the first things you should do when creating a figure in your favourite drawing application is to draw a box 14 cm wide (or the size of your text width) and draw the figure within it. When you have saved or exported the image as a PDF, you can use the Preview application to crop the PDF to the right size. Once again, you should almost never scale an image, especially if it contains text.

14 cm Image Box

Vector vs Bitmap Images

Where ever possible, figures should be vector art. Vector art is recognisable by its clear and sharp lines and "cartoon" look. It has the advantage that it can be scaled to any dimension without loosing sharpness and quality. It never suffers from pixelation when it is stretched too large and the file sizes for vector images are typically small.

Bitmap art on the other hand, should be only reserved for photos if possible and even then, photos should be at the highest resolution. It is important to retain as much of the original bitmap information as possible (so no down sampling) and remember that the computer screen is at 72dpi for a Mac, and printers can print up to 1200dpi for black and white and 600dpi for colour. This means that a photo, which doesn't have a high enough resolution will look pixelated when printed even though it looks fine on screen. Use lossless file formats for photos such as bitmap or TIFF even though this will produce large file sizes. Saving as JPEG - even at the best quality - may be asking for artefacts and degradation to appear in printed figures.

Vector vs Bitmap

Using vector art means diagrams don't look embarrassingly pixelated when the reader zooms into the page for a closer look at the figure. This is particularly important for graphs and detailed data. Always export the output from scientific applications (such as MatLab or Mathematica) in PDF format wherever possible.

Microsoft Word and LaTeX

Microsoft Word for Mac has some powerful drawing tools and is actually surprisingly good for producing even semi-complicated vector diagrams and schematics:

Microsoft Word Vector Art

A huge bonus is that Microsoft Word embeds the fonts into the file PDF file, meaning that when the "image" above is compiled into a LaTeX document in PDF format, the text remains text...and not a graphic. This means that in the final PDF document, the text in the image is fully selectable, fully searchable and of course, crystal sharp down to any zoom level.

If the diagram you need to produce isn't too complicated, it is best to create it in Word and export the file as a PDF for use in LaTeX. The text rendered as text in images and vector autoshapes are too great as features to discard lightly.

If you are creating many figures in Word, then it is good practice to set up several new paper sizes, each one should have zero margins and the width should be the the width of the text on the page (about 14 cm, see earlier), only vary the page height to the size you need. These new paper sizes will help keep diagram sizes consistent and it also means there is no need to manually crop the exported PDF to the correct size using Preview since the page size is already set to the correct size hence the PDF will also be the correct size.

Using the Correct Text Fonts in Figures

In the majority of articles in Journals, dissertations and other documents created using LaTeX, the fonts used in the figures are completely different to the fonts in the body text. This is because by default LaTeX uses a series of fonts called "Computer Modern Unicode". These fonts are not installed by default by any operating system and even when you have LaTeX installed, these fonts are not made available to other applications, such as those you may be creating your figures in.

Having the fonts in the figures match the fonts of the body text adds a very high degree of polish and makes the document look more "integrated" and "together" as opposed to having the figures stand out because the fonts in them are jarringly different and also of a different size; as though they had been manually pasted in as an after thought.

Compuer Modern Unicode Sample

The font series LaTeX uses is "CMU" or "Computer Modern Unicode" for which there are fonts for bold, light, italic and emphasised text as well as a large array of glyphs and mathematical symbols and many others. Specifically for the body text, the font, "CMU Serif Roman" is used and this is the font you should use in figures too. These fonts are freely available online from several sources and can also be downloaded from here:

Download the CMU Fonts for use in creating figures (all contained in a folder, in a zip-file)

See the original website for the fonts here Go

Simply unzip the downloaded file and select and drag the font files (the files that have the ".otf" extension, which is OpenType format) to the FontBook window (FontBook is a bundled application located in the Utilities folder). FontBook will then ask whether you would like to install the fonts. Clicking "OK" will copy the fonts to the fonts folder and make them available to the system. You can now delete the downloaded folder.

You can also create a new collection for your CMU fonts in Fontbook (by clicking on the "+" sign at the bottom left of the window), rename it to "LaTeX Fonts", then use the search field and enter, "cmu". The results are all the Computer Modern Unicode fonts installed in the system. Now you can drag the search results to the "LaTeX Fonts" collection.

Font Book

As for which font size to use in images, it is a good idea to keep the number of different font sizes to a minimum and never make the font size large than that of the body text. Best practice is to have the font size (for titles and headings etc) the same as the body text and a smaller font size (smaller by two points) for items such as axis labels etc.

Presenting Figures

There are several tweaks and graphical additions you can do to present and make your images look outstanding.

Stick-thin Figures

A very common mistake when creating a vector schematic is to draw out lines and shapes with the line width kept to 1/4pt or "hair-thin", which the is the default in many drawing applications. This ends up producing awful looking, "stick" figures that have no "solid" feel to them. When creating these kinds of diagrams, always increase the thickness of the lines to a few pt, this ensures your diagrams look bold, stand out and don't look flimsy.

Stick-thin and Solid Figures

Stick-thin lines should be reserved for high-precision, CAD-like diagrams and results. In this case, producing vector art, PDF output is crucial if you want to retain the image details down to 1200% zoom and beyond.

Photo Drop Shadow

If a figure is simply a photo, then adding a soft and subtle drop shadow to the whole image will "lift" the image off the page and "present" it to the reader. It suddenly stands out as separate and "above" the text on the page. Virtually all graphics applications have a drop shadow function. The important thing is that if you change the default settings for the drop shadow for one figure, it ought to be done to all other photo-figures to maintain consistency.

Drop Shadow to Photo Figures

Reflection Gallery

Sometimes, a figure is made up of a collection of smaller images or photos. Adding a drop shadow to each image can look overdone, so another aesthetic way to present images in this case is to add a soft reflection of the image, as though it were standing on a shiny floor or shelf.

Creating a reflection requires a little more know-how. The basic steps are to carefully align the images, then copy and flip each image vertically and position it just below the original. Making a seamless join or leaving a gap is your choice. Finally a box with a semi-transparent to background fill is needed and goes over the reflected images to soften and fade the reflection.

Reflection Gallery

Representing a Time-line

Sometimes a figure is composed of a series of images that are taken sequentially to show variations in time. A very stylistic way of showing this is to create a "filmstrip"-like background that immediately indicates to the reader the element of time. Time lines can be represented many other ways, the filmstrip is a very bold statement of it.

Filmstrip