# [texhax] tikzpicture of predefined width and subfig

Victor Ivrii vivrii at gmail.com
Tue Dec 29 10:06:15 CET 2009

Assume that I know how to create tikz-graphics

\begin{tikzpicture}
\draw[thin,->] (-2.3,0)--(2.5,0) node[below]{$x$};
\draw[thin,->] (0,-1)--(0,1.3) node[right]{$f(x)$};
\draw[ultra thick, domain=-2.3:2.3, smooth] plot function  {x^2};
\end{tikzpicture}

So far so good. Now I want to embed it in my article through figure or
subfloat. To do it properly I need to predefine width or scale.
Usually I create graphics externally (using pgf/tikz and then embed,
but scaling leads to inconsistency in font sizes and line widths. So,
how I create the same graph albeit 0.5\linewidth in its width?

Sure, I can play with [x=0.09\linewidth] where I 0.1\linewidth would
come from allocating 0.5\linewidth to this picture and noting that its
x-span is 5:

\begin{tikzpicture}[x=0.09\linewidth]
\draw[thin,->] (-2.5,0)--(2.5,0) node[below]{$x$};
\draw[thin,->] (0,-1)--(0,1.3) node[right]{$f(x)$};
\draw[ultra thick, domain=-2.3:2.3, smooth] plot function  {x^2};
\end{tikzpicture}

However I would like something more automatic
<PGF/TIKZ manual seems to ignore this question>

Thank you in advance

Victor

--
========================
Victor Ivrii, Professor, Department of Mathematics, University of Toronto
http://www.math.toronto.edu/ivrii