7

I have two node styles with a minimum size set to 7mm and they look perfect:

\begin{tikzpicture}

    \tikzstyle{style1} = [circle,draw,fill=white,minimum size=7mm,font=\Large];
    \tikzstyle{style2} = [rectangle,draw,fill=white,minimum size=7mm,font=\Large];

    \node (node1) at (0,0)  [style1] {1};
    \node (node2) at (1,0)  [style2] {A};

\end{tikzpicture}

enter image description here

But then I'd like to be able to scale the whole picture and have the minimum sizes scale accordingly (without having to set the scale parameter for every node style manually). Since the default unit length is 1cm, I figured I can change minimum size=7mm to minimum size= 0.7 but then the rectangle appears smaller:

enter image description here

Setting minimum size=20 gives the desired effect. It seems the units are not working the way I expect them to. What's going on here?

| improve this question | | | | |
  • I'd look in the general direction of using a multiplier that you use everywhere, e.g. set some macro \newcommand\multiplier{.5} and use \dimexpr14\multiplier as well as scale=\multiplier as your minimum size. – 1010011010 Oct 7 '14 at 12:13
  • 2
    minimum size is a dimension. If you omit the unit then pt will be inserted. That means minimum size=.7 is the same as minimum size=.7pt. – esdd Oct 7 '14 at 12:31
9

You can let the transformation apply to nodes via transform shape key.

\begin{tikzpicture}[
        style1/.style={circle,draw,fill=white,minimum size=7mm,font=\Large},
        style2/.style={rectangle,draw,fill=white,minimum size=7mm,font=\Large},
        transform shape
]

\foreach \x in {0.5,1,...,4}{
\begin{scope}[scale=\x,yshift=2cm]
    \node (node1) at (0,0)  [style1] {1};
    \node (node2) at (1,0)  [style2] {A};
\end{scope}
}
\end{tikzpicture}

enter image description here

Nevermind the fonts, it got stuck from a different answer.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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