# Text size in inkscape

I use the pdf+tex output for inkscape drawings so image fonts match document fonts and TeX can render the mathematics. When I scale the image for inclusion in my document, text does not scale (a well known problem). As the MWE below shows, I can tinker with font size manually. I'd like to be able to do that automatically, with a macro that wraps \svgwidth to reuse its argument. (I know I may still have to play with text positioning.)

I have looked at the related questions on this site.

inkscape screen capture:

(I can provide a link to the inkscape svg file if necessary.)

MWE output:

The MWE:

\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{color} % for inkscape
\usepackage{graphicx}

\begin{document}

Example with 12 point type in a 3 inch box in inkscape.

No size set (so the real thing)
\begin{center}
\input{inkscapeout.pdf_tex}
\end{center}

2/3 size
\begin{center}
\def\svgwidth{2in}
\input{inkscapeout.pdf_tex}
\end{center}

2/3 size with small font
\begin{center}
\def\svgwidth{2in}
\small{
\input{inkscapeout.pdf_tex}
}
\end{center}

2/3 size with tiny font
\begin{center}
\def\svgwidth{2in}
\tiny{
\input{inkscapeout.pdf_tex}
}
\end{center}

\end{document}


and, finally, the pdf_tex file generated by inkscape.

%% Creator: Inkscape 0.48.3.1, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'inkscapeout.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%%   \input{<filename>.pdf_tex}
%%   \includegraphics{<filename>.pdf}
%% To scale the image, write
%%   \def\svgwidth{<desired width>}
%%   \input{<filename>.pdf_tex}
%%   \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the import' package (which may need to be
%% installed) using
%%   \usepackage{import}
%% in the preamble, and then including the image with
%%   \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%%   \graphicspath{{<path to file>/}}
%%
%%   http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{215.5bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.09907193)%
\put(0,0){\includegraphics[width=\unitlength]{inkscapeout.pdf}}%
\put(0.02059777,0.037881){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{Boxed 12 pt mathematics: $x^2 + y^2 = z^2$.}}}%


without the image I can't test but it looks like rather than use

\def\svgwidth{2in}


You want to use

\begin{center}
\resizebox{2in}{!}{\input{inkscapeout.pdf_tex}}
\end{center}
`

to scale everything together.

• Works like a charm! Sorry I can't upvote twice. – Ethan Bolker May 8 '13 at 22:02
• Of course, while this works perfectly for keeping the proportions of text and figure, as I've found, it's no substitute for outputting as (approximately) the right size to start with - on my test figure the text is too small to read, but just using \svgwidth, overlaps the axes of the graph. Also, of course, the font face matches but the size doesn't, an argument in favour of using \svgwidth for fine tuning. Still gets my vote though. – Chris H Aug 13 '13 at 8:09