1

Below are two TikZ pictures. In the second one, I've added a \scalebox to scale the nodes ABC and the distance between them. I want the A to remain in the same position, but unfortunately the coordinates are scaled with respect to origin.

How can I rescale that part of the figure without translating it?

enter image description here

MWE for the picture with a scalebox:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}

\node at (0,0) {0,0};
\node at (4,4) {4,4};
\node at (0,4) {0,4};
\node at (4,0) {4,0};

\scalebox{0.67}{
    \node at (2,2) (A) {A};
    \node [right=of A] {B};
    \node [below=of A] {C};
}
\end{tikzpicture}
\end{document}

To be clear: I do want the distances between A, B and C to scale, I just don't want the entire scalebox to move towards origin. In my actual document, the contents of the scalebox are more complicated.

3

Use a scope with options scale=0.67 and transform shape instead of the \scalebox. All numeric coordinates inside the scope will be scaled. But you can use an outside the scope defined named coordinate as "anchor" to position the node A.

\documentclass[tikz,margin=5mm]{standalone}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
\draw[help lines](0,0)grid(4,4);
\node at (0,0) {0,0};
\node at (4,4) {4,4};
\node at (0,4) {0,4};
\node at (4,0) {4,0};
\coordinate (O) at (2,2);% coordinate for positioning node A
\begin{scope}[scale=0.67,transform shape]
    \node at (O) (A) {A};
    \node [right=of A] {B};
    \node [below=of A] {C};
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

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.