≡ Menu

How I draw figures for my mathematical lecture notes using Inkscape

Just like TikZ, Inkscape has the op­tion to ren­der the text of a fig­ure using LaTeX. For this, it ex­ports fig­ures as both a pdf and a LaTeX file. The pdf doc­u­ment con­tains the fig­ure with text stripped, and the LaTeX file con­tains the code need­ed to place the text at the cor­rect po­si­tion. For ex­am­ple, sup­pose you’re work­ing on the fol­low­ing fig­ure in Inkscape:

To in­clude this fig­ure in a LaTeX doc­u­ment, you’d go to File › Save As, se­lect ‘pdf’ as the ex­ten­sion and then press Save which makes the fol­low­ing di­a­log pop up:

Choos­ing ‘Omit text in pdf and cre­ate LaTeX file’, will save the fig­ure as pdf+LaTeX. To in­clude these Inkscape fig­ures in your LaTeX doc­u­ment, you can add the fol­low­ing code to your pre­am­ble:

\documentclass[11pt,a4paper]{scrbook}
\usepackage{import}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{import}
\usepackage{placeins}
\usepackage{graphicx}
\usepackage[labelfont=bf]{caption}
\usepackage{subcaption}
\usepackage{enumitem}
\usepackage{calc}
\begin{document}
 
\chapter{Introduction}

As­sum­ing the fig­ure is lo­cat­ed at figure/disegno.svg, it can sim­ply be in­clud­ed with fol­low­ing code:

\begin{figure}[hbt!]
 \centering
 \begin{normalsize} 
  \def\svgscale{0.5}
  \import{figure/}{disegno.pdf_tex}
 \end{normalsize}
 \caption{Test}
 \label{fig:test}
\end{figure}

Com­pil­ing your doc­u­ment, you’d get the fol­low­ing.

As you can see, the text is ren­dered by LaTeX which makes the fig­ure blend in beau­ti­ful­ly.

{ 0 comments… add one }

Rispondi

Next post:

Previous post: