Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem with the fit library in TikZ.

When I scale the figure (with the tikz scale command), the fit box doesn't!

Why is that? Could I somehow change it?

Example:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{fit}
\begin{document}

\begin{tikzpicture}[state/.style={circle,draw,thick,loop above,inner sep=0,minimum width=10}]
\node[state] (a) at (0,1) {} edge [loop above, thick] coordinate (al) ();
\node[state] (b) at (1,1) {} edge [loop above, thick] coordinate (bl) ();

\node[draw,rectangle,fit=(a) (b) (al) (bl)] {};
\end{tikzpicture}


\begin{tikzpicture}[scale=2,state/.style={circle,draw,thick,loop above,inner sep=0,minimum width=10}]
\node[state] (a) at (0,1) {} edge [loop above, thick] coordinate (al) ();
\node[state] (b) at (1,1) {} edge [loop above, thick] coordinate (bl) ();

\node[draw,rectangle,fit=(a) (b) (al) (bl)] {};
\end{tikzpicture}

\end{document}

output

share|improve this question
    
I see now that minimum size of node also doesn't scale, anyone knows why that is? –  Peter Smit Dec 3 '10 at 13:55
add comment

2 Answers 2

up vote 9 down vote accepted

Add the option transform shape to scale also the box resp. shapes:

\begin{tikzpicture}[scale=2,transform shape,
    state/.style={circle,draw,thick,loop above,inner sep=0,minimum width=10}]

alt text

share|improve this answer
add comment

A possibility without transform shape. You can scale with x=2cm y=2cm

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{fit}
\begin{document}

\begin{tikzpicture}[state/.style={circle,draw,thick,loop above,inner sep=0,minimum width=10}]
\node[state] (a) at (0,1) {} edge [loop above, thick] coordinate (al) ();
\node[state] (b) at (1,1) {} edge [loop above, thick] coordinate (bl) ();

\node[draw,rectangle,fit=(a) (b) (al) (bl)] {};
\end{tikzpicture}


\begin{tikzpicture}[x=2cm,y=2cm,state/.style={circle,draw,thick,loop above,inner sep=0,minimum width=10}]
\node[state] (a) at (0,1) {} edge [loop above, thick] coordinate (al) ();
\node[state] (b) at (1,1) {} edge [loop above, thick] coordinate (bl) ();

\node[draw,rectangle,fit=(a) (b) (al) (bl)] {};
\end{tikzpicture}

\end{document}  

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

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.