After looking for something like that here and searching the site. I haven't found something that works (may be I skipped something important).
I would like an automated way of telling tikz the final size of the tikzpicture.
I want to draw something and I want tikz to calculate automatically the scale to show me the maximum possible. Something like \begin{tikzpicture}[scale to width = \textwidth] will scale the figure so the final tikzpicture has a width of \textwidth. The cool thing would be to make also something like scale to height = …, with both forms keeping the original ratio of the tikzpicture. But if both are issued at the same time there should be a way of having the final size fixed.
I would like this to work within tikzpicture (and not with scalebox or resizebox) so that the resulting image has the correct font size and line width.
Example:
\documentclass{scrartcl}
\usepackage{tikz}
…% Some magic code
\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a square of 1cm x 1cm.
\begin{tikzpicture}[scale to with = 10cm]
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a square of 10cm x 10cm with the word in correct size
\begin{tikzpicture}[scale to height = 8cm]
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a square of 8cm x 8cm with the word in a correct size
\begin{tikzpicture}[scale to with = 10cm, scale to height = 6cm]
\draw (0,0) rectangle (1,1);
\draw (0.5,0.5) node {Center};
\end{tikzpicture}% This should be a rectangle of 10cm x 6cm with the word in a correct size/shape
\end{document}
tikzscalepackage comes in handy. See (How to scale tikz drawing to paperwidth?). – Jake Feb 20 '14 at 10:51.tikzfiles and then use\includegraphics[width=10cm]{figure.tikz}? I think that's far from handy. It would be much better to have that option inside thetikzpictureoptions. – Manuel Feb 20 '14 at 10:54tikzpicturewhich does exactly that: process the complete image to get the size, then calculate the scale factor and then reprocess it? – Manuel Feb 20 '14 at 11:12manuelstikzpicturethat wraps around the process described in Ulrike's answer (or you could redefinetikzpictureto do the same). – Jake Feb 20 '14 at 11:31tikzpicture*environment). Iftikzscaleis better I will try something. – Manuel Feb 20 '14 at 11:34