TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It seems that the scale option scales only the length of lines, but not the size of texts. For instance, 1 and true and not scaled in the following code.

\begin{tikzpicture}[thick, scale=0.6]
\draw [dashed] (1,12) -- (11,12);
\node[above] at (4,11) {1}; \node[above] at (8,11) {true};

Could anyone tell me how to scale everything together within a tikzpicture? Thank you very much!

PS: It is a picture in a presentation with Beamer.

share|improve this question
Seems to be a duplicate of Correctly scaling a tikzpicture. Please confirm. – Martin Scharrer Aug 29 '11 at 11:21
@Martin: I agree. Didn't know we already had that one! – Loop Space Aug 29 '11 at 11:30
up vote 128 down vote accepted

There are a few things that scaling doesn't affect; the most noticeable are node sizes and line widths. In a simple picture, it isn't hard to adjust the line width accordingly but the nodes can be difficult. It is possible to force a node to be scaled: put the scale option directly in the node's attributes. Thus \node[above,scale=0.6] at (8,11) {true}; would scale the node. This is a bit annoying to put on every node, so there's an every node style that can be used to do this. Thus:

\begin{tikzpicture}[thick,scale=0.6, every node/.style={scale=0.6}]

Even so, you'd still have to remember to change two things each time here if you wanted to change the scale factor. Fortunately, there's a key transform shape which means that the current transformation is applied to the node. The danger with using this is that this will also apply any rotations that happen to be in effect to the node (normally only translations are applied). If you don't have any rotations, then:

\begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]

will do just fine.

If you do have or worry about those rotations (or for anyone else interested) it would be simple to set a global scale key to fix this:

\tikzset{global scale/.style={
    every node/.style={scale=#1}

Back to the "normal" solutions. Here's the various solutions:



\draw [dashed] (1,12) -- (11,12);
\node[above] at (4,11) {1}; \node[above] at (8,11) {true};

\framebox{\begin{tikzpicture}[thick, scale=0.6]
\draw [dashed] (1,12) -- (11,12);
\node[above] at (4,11) {1}; \node[above] at (8,11) {true};

\framebox{\begin{tikzpicture}[thick, transform canvas={scale=0.6}]
\draw [dashed] (1,12) -- (11,12);
\node[above] at (4,11) {1}; \node[above] at (8,11) {true};

\framebox{\begin{tikzpicture}[thick,scale=0.6, every node/.style={scale=0.6}]
\draw [dashed] (1,12) -- (11,12);
\node[above] at (4,11) {1}; \node[above] at (8,11) {true};

\framebox{\begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]
\draw [dashed] (1,12) -- (11,12);
\node[above] at (4,11) {1}; \node[above] at (8,11) {true};


I put the \frameboxs in because if you count carefully, you'll see that the third example isn't there! In fact, it ended up somewhere at the top of the page, outside what the standalone package thought the page was. So it got clipped out.

scaled pictures

share|improve this answer
I really like this answer, but I couldn't up more than once :D – MP0 Jun 18 '12 at 10:51

The transform canvas option scales everything, including text. Be aware that this may lead to the bounding boxes being wrong...

share|improve this answer
That is true, I tried \begin{tikzpicture}[thick, scale = 0.6, transform canvas={scale=0.6}], the size is really good, but it is no more in a good position, so what can I do with that? – SoftTimur Aug 29 '11 at 10:45
@SoftTimur you shouldn't need to do both of transform canvas and scale. that will shrink it twice... Like I said, transform canvas will mess with the bounding box (where TeX thinks the picture is). I think "How to adjust position of a TikZ picture when using transform canvas" is a separate question... – Seamus Aug 29 '11 at 11:01

For a matrix of nodes transform canvas works enough fine

\begin{tikzpicture}[thick, scale = 0.6, transform canvas={scale=0.6}]
\matrix (m) [matrix of math nodes,left delimiter=(,right delimiter=)]
 0 &1 &0 &0 &0 &0 \\ 
 1 &0 &0 &0 &0 &0 \\        
 0 &0 &2 &0 &0 &0 \\        
 0 &0 &0 &1 &0 &2 \\       
 0 &0 &0 &0 &1 &0 \\        
 0 &0 &0 &1 &0 &1 \\        

 \draw[color=purple,thick] (m-1-1.north west)  rectangle  (m-2-2.south east);
 \draw[color=purple,thick] (m-3-3.south east)  rectangle  (m-3-3.north west);
 \draw[color=purple,thick] (m-4-4.north west)  rectangle  (m-6-6.south east);

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.