# Scale all TikZ images in a document by the same factor

Is it possible to scale all TikZ pictures in a document by the same factor globally?

Something like \usepackage[scale=0.9]{tikz} doesn't work.

-
You could do \newcommand*{\ScaleFactor}{0.9}% in your preamble, and wherever you have a tikzpicture use \providecommand*{\ScaleFactor}{1.0}%, (so that they can compile by themselves if needed), and use \begin{tikzpicture}[scale=\ScaleFactor]. Or to automate thie even further, redefine the tikzpicture environment to automatically apply the ScaleFactor if it is defined. –  Peter Grill Jun 11 '12 at 19:37

Every tikzpicture uses the style every picture. So if you put \tikzset{every picture/.append style={scale=0.9}} near the start of your document, all tikzpictures will be scaled by that amount (in addition to any scales you might already be applying to individual tikzpictures).

\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.append style={scale=2}}
First picture:
\begin{tikzpicture}[baseline]
\node [transform shape,anchor=base, draw] {Node 1};
\end{tikzpicture}

Second picture:
\begin{tikzpicture}[baseline]
\node [transform shape,anchor=base, draw] {Node 2};
\end{tikzpicture}
\end{document}

-
If everything in all pictures should be scaled, I would apply the transform shape also globally (e.g., every node/.append style={transform shape}) –  Daniel Jun 11 '12 at 20:00
@Daniel: Good point. Personally, I wouldn't want that, though. For me, one of the great things about creating figures right within the document is that the text size always matches that of the document exactly. –  Jake Jun 11 '12 at 20:07

If one wants that the text scales too, one can do something like this:

\documentclass{article}

\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{environ}
\usepackage{tikz}

\newcommand*{\scalefactor}{0.8}

\NewEnviron{mytikz}[1][]{
\scalebox{\scalefactor}{
\begin{tikzpicture}[{#1}]
\BODY
\end{tikzpicture}}}

\begin{document}

First picture:
\begin{mytikz}[baseline]
\node [transform shape,anchor=base, draw] {Node 1};
\end{mytikz}

Second picture:
\begin{mytikz}[baseline]
\node [transform shape,anchor=base, draw] {Node 2};
\end{mytikz}

\end{document}

-
Why use a \scalebox and not just pass the scale= option to tikzpicture? Also, using \scalebox will result in the text being scaled which is not usually desirable. Also, you could just redefine the tikzpicture environment to apply the scale= option. –  Peter Grill Jun 11 '12 at 20:51