Wednesday 4 May 2011

Using LaTeX in Inkscape Drawings

I use Inkscape to draw all my vector graphics. I often use these graphics in combination with PdfLaTeX to write papers and Beamer presentations. However, one of the things I have been struggling with is how to include greek letters and mathematical formulas in the graphics. One simple solution for displaying Greek letters is to use the corresponding unicode. For example, to display the letter gamma, create a text box, press Ctrl+U, and enter <03B3>. However, the character will (usually) not be available in the same font as the LaTeX document, and it is also hard to write anything more complex than single characters.

It was not until today that I found out that Inkscape actually has a export option that solves this problem quite nicely. This is documented very nicely here. To create a drawing with LaTeX elements, simply enter the LaTeX code in a text box, export as PDF, and cross the box in the PDF export options. This will export the graphics to a PDF file and the text to a separate .tex file, which can then be included in the LaTeX document using this syntax (or similar):

\begin{figure}
\centering
\def\svgwidth{\columnwidth}
\includesvg{image}
\end{figure}

where the file name of the exported graphic is "image". Note that no additional packages are needed. Consult the documentation for more details.

0 comments:

Post a Comment