# [Tex/LaTex] Text size in inkscape

fontsizeinkscape

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.