# change the size of the text when \input .pdf_tex file generated by Inkscape

I am trying to use inkscape to draw mathematical figures. Thre are example codes given in Inkscape manual and to include the PDF file with LaTex overlay (which is generated by file -> save as PDF and choose the option omit text in PDF and generate LaTex file)

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{color}
\begin{document}

\Huge
\def\svgwidth{3.333in}
\input{FileExportText_LaTeX.pdf_tex}

\end{document}


and it works.

However, the size of the math expressions in the picture is usually to small or too large. In this document How to include an SVG image in LaTex , it says "Font type and size do not matter and will not be exported to LATEX". Therefore, I am wondering how to change the text size of every specific math expression generated by Inkscape?

My goal is to draw figures like the great ones in Visual Complex Analysis . Maybe there is other choice than Inkscape?

• If you use the extension that exports tikz I added a solution that I suppose that will automate the procedure... But may be not really needed there. So, feel free to ask me delete. [But check if this extension is better for you] – koleygr Jan 19 '18 at 15:35

You can add your desired font size to a specific math expression in the FileExportText_LaTeX.pdf_tex file. For example change

\put(0.11,0.35603788){\makebox(0,0)[r]{\smash{10}}}%


to

\put(0.11,0.35603788){\makebox(0,0)[r]{\smash{\large 10}}}%


Or to get an homogeneous look use the same font size for all the text in the image.

{
\fontsize{9pt}{11pt}\selectfont% or whatever fontsize you like
\def\svgwidth{3.333in}
\input{FileExportText_LaTeX.pdf_tex}
}

• Thanks alot. It become involved to change the size when there are many mathematical expression in the figure. I am searching for better way to draw figure with many mathhematical expressions. maybe github.com/seebk/LaTeXText is another choice. – Rikeijin Jan 19 '18 at 15:12
• @Rikeijin I would try to layout the figure to only use one font size and only change the fontsize for specific elements as a last choice. many different font sizes will make the picture restless... – samcarter_is_at_topanswers.xyz Jan 19 '18 at 15:18
• May I ask how to change the code in .pdf_tex to lay out the figure with one specific font size? – Rikeijin Jan 19 '18 at 15:21
• @Rikeijin No change required. By default inkscape does not include any fontsize in the .pdf_tex, so everything is set in the fontsize which is currently active in the surrounding document. So choose whatever fontsize in the document before \include. In your example, it is \Huge – samcarter_is_at_topanswers.xyz Jan 19 '18 at 15:26
• Like add the enviroment \begin{large} ... \end{large} around the \input line? – Rikeijin Jan 19 '18 at 15:32

Edit the solution is about export tikz from the extensions

A solution with relsize package that doesn't need changes in the exported file:

Create the next command in your preamble:

\newcommand\scaleInNode[1][1]{\tikzset{execute at begin node={\normalsize\larger[#1]}}}


MWE:

\documentclass[12pt,paper=a4]{scrartcl}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{relsize}
\usepackage{graphicx}

\newcommand\scaleInNode[1][1]{\tikzset{execute at begin node={\normalsize\larger[#1]}}}

\begin{document}
Test text and math before

$f(x)=4\cdot x +1$

\scaleInNode[3]

Test text and math after

\begin{tikzpicture}
\node at (0,0) {$f(x)=4\cdot x +1$};
\node at (5,2) {Text};
\end{tikzpicture}

% Go back to scale 1
\scaleInNode

\begin{tikzpicture}
\node at (0,0) {$f(x)=4\cdot x +1$};
\node at (5,2) {Text};
\end{tikzpicture}

\end{document}


Output:

• Please do not upvote before test it... I haven't test it due to some problems (I hope a temporary bug) with that extension on my system. If somebody checked it and needed+works .. please inform me. If not needed or doesn't work... Inform me too to delete it – koleygr Jan 19 '18 at 15:38
• Thanks, I will devote it after the system lock is relieved. Is there a estenstion for Inkscape to export to tikz? I do not know how tikz works but trying to learn it. – Rikeijin Jan 19 '18 at 15:42
• @Rikeijin, If you are the one who voted up, you don't have to change it... Your options are vote up or vote down... There is not a "take back my vote" here... (A minus would not be really bad if this doesn't work or doesn't needed... but check it first) – koleygr Jan 19 '18 at 16:06