# Node-local coordinate system

This is essentially the same question as this, this or this, but in all three questions the picture that defines the new coordinates is positioned at (0, 0) of the tikzpicture. In my case it is not.

MWE:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,calc}

\pagestyle{empty}
\usepackage{parskip}

\begin{document}
\begin{tikzpicture}
\coordinate (TL) at (1+.3*rand,4+.3*rand);
\coordinate (BR) at (6+.3*rand,1+.3*rand);
\node [draw,fit=(TL) (BR)]{Background};
\begin{scope}
\node at (5,5) {X};
\end{scope}
\end{tikzpicture}
\end{document} As an example, how can I set up a coordinate system (0..10) inside the node so that (5,5) is in the middle of the box?

## 1 Answer

You only need to shift to the south west corner of the coordinate system.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,calc}

\pagestyle{empty}
\usepackage{parskip}

\begin{document}
\begin{tikzpicture}
\coordinate (TL) at (1+.3*rand,4+.3*rand);
\coordinate (BR) at (6+.3*rand,1+.3*rand);
\node [draw,fit=(TL) (BR)] (fit) {Background};
\begin{scope}[shift={(fit.south west)},
x={($0.1*($(fit.south east)-(fit.south west)$)$)},
y={($0.1*($(fit.north west)-(fit.south west)$)$)}]
\node at (5,5) {X};
\end{scope}
\end{tikzpicture}
\end{document} • Oh, nested calculation. – AndreKR Jun 10 at 18:51