Howto Write a Thesis using LaTeX: Generate Resolution Independent Figures Using Inkscape

When you are about to write your thesis, you have probably spend the last years working on a topic that has twisted your brain plenty of times and now your finally made it, you understand what your Professor was talking about the last years and you can be really proud. With a huge amount of self-confidence, you start writing down your hard work and you proofread every sentence and every word you are writing carefully. But at the end, the first thing anyone reading your thesis sees, is a figure like that:

Golum Figure

Do you really want to have that Golum of a figure in your thesis? Of course not!
Any figure you create for your thesis should be a vector graphic. Remind from part 1 of this tutorial, that there is a general difference between vector graphics and “common” images. Vector graphics do not save pixel values, but generate a description of the image, like you would say: “There is a circle in the left part of the image and another one in the right part. Both have a black border and gray background. The circles are further connected by an arrow.” Well, the real description might be a bit more accurate and fortunately, LaTeX can understand that description if we provide it in the correct format.

Sorry friends, but this is not going to be a tutorial in Inkscape, you will find many of them in the web. This is more a guide on how to use a vector graphic in LaTeX. Let’s assume we have drawn an image in Inkscape that may look like:

inkscape_figure

First, we have to resize the document to the content to avoid extra spacing around the image. From the top menu, select File->Document Properties. A new dialog will pop up. Notice that there is an area called Resize page to content:

Inkscape_resize_to_content

I usually use margins of 10.00 at each side. Then, simple press the “Resize page …” button and you will see that your document has been resized to your content. Be aware not to select a specific object while resizing, otherwise the document will be resized to the object size.

Once the image is ready, you can save the image as PDF by selecting File->Save As and choosing “Save as type” to be “Portable Document Format (*.pdf)”. You can simply use the default PDF setting and click OK in the dialog shown next. And that’s it! Inkscape is automatically generating a vector graphic based PDF. Please note that the default format for vector graphics is SVG, but as we want to use the graphic with LaTeX, we prefer to have a PDF file.

Let’s save the PDF image to the images subfolder (called fig) of our thesis project folder and name it image.pdf. All we have to do now, is to display the image in the thesis. For example, lets show the image in our “Boring Stuff” chapter. We are including figures by LaTeX command:

\chapter{Boring Stuff}
An example figure is shown in Figure ??.
\begin{figure}[ht]
	\centering
    \includegraphics[width=0.5\textwidth]{fig/image.pdf}
    \caption[Short caption]{Detailed caption}
    \label{fig:image}
\end{figure}

To get this working, we need to import the graphicx package in the preamble of the Thesis.tex file:

\usepackage{graphicx}

Once we translated the file to pdf (twice to update also the reference), we will see the figure in the Thesis.pdf file.

Inkscape_image_in_thesis

Please note, that also the list of figures at the end of the document has been updated and now includes an entry with the short description of the figure. To see the benefit of the vector graphic, here is a part of the image within the document, rescaled to 500%:

Inkscape_image_500

As you see, the figure can be scaled to any dimension without loosing resolution.

Warning: count(): Parameter must be an array or an object that implements Countable in /customers/5/e/0/torsten-schoen.de/httpd.www/wp-includes/class-wp-comment-query.php on line 399

2 thoughts on “Howto Write a Thesis using LaTeX: Generate Resolution Independent Figures Using Inkscape

  1. Pingback: Howto write a thesis using LaTeX, Part 3: Tips and Tricks | Torsten SchönTorsten Schön

  2. Pingback: Howto Write a Thesis using LaTeX: Export Scalable Graphs from Excel to Inkscape | Torsten SchönTorsten Schön

Leave a Reply

Your email address will not be published. Required fields are marked *