I just tried to use the relative positioning of nodes with respect to the current bounding box of a tikzpicture
as proposed in Position node relative to current bounding box.
The proposed solution works fine (unsurprisingly of course) for the requested case. However, when trying to draw a path containing to[out=...,in=...]
statements, the compiler fails with
Package tikz Error: (, +, coordinate, pic, or node expected
As proposed in the Log, I
Pretend that you're Hercule Poirot: Examine all clues, and deduce the truth by order and method.
but up to now, nothing came out... If you have any ideas, thank you in advance.
Here is the MWE
\documentclass[tikz,border=1mm]{standalone}
\usetikzlibrary{calc}
% Relative positioning in tikzpicture as per https://tex.stackexchange.com/questions/274893/position-node-relative-to-current-bounding-box
\newcommand\relcoord[2]{({$(current bounding box.south west)!#1!(current bounding box.south east)$} |- {$(current bounding box.south west)!#2!(current bounding box.north west)$})}
\begin{document}
\begin{tikzpicture}
% Bounding box setup
\draw[black] (0,0) rectangle (10,10);
\useasboundingbox \relcoord{0}{0} rectangle \relcoord{1}{1};
% Red rectangle -> OK
\draw[red] \relcoord{0.1}{0.1} rectangle \relcoord{0.8}{0.8};
% Blude dashed lines -> OK
\draw[blue,dashed] \relcoord{0.1}{0.1} -- \relcoord{0.1}{0.8} -- \relcoord{0.8}{0.8} -- \relcoord{0.8}{0.1} -- cycle;
% Orange curves -> KO, to be commented for compilation
\draw[orange,dashed] \relcoord{0.1}{0.1} to[out=90,in=-90] \relcoord{0.1}{0.8} to[out=0,in=180] \relcoord{0.8}{0.8} to[out=-90,in=90] \relcoord{0.8}{0.1} -- cycle;
\end{tikzpicture}
\end{document}
+
which implies to change relative values:\draw[orange,dashed] \relcoord{0.1}{0.1} to[out=90,in=-90] +\relcoord{0.0}{0.7} to[out=0,in=180]+\relcoord{0.7}{0} to[out=-90,in=90] +\relcoord{0.0}{-0.7} -- cycle;