The following mwe is taken from: https://tex.stackexchange.com/a/336315/239572
https://www.latex4technics.com/?note=zzvqvi
\documentclass[border=10pt,multi,tikz]{standalone}
\begin{document}
% adapted from manual 1030
\newbox\mybox
\newcommand*\mysaver{%
\global\setbox\mybox=\box\pgfpositionnodelaterbox
\global\let\myname=\pgfpositionnodelatername
\global\let\myminx=\pgfpositionnodelaterminx
\global\let\myminy=\pgfpositionnodelaterminy
\global\let\mymaxx=\pgfpositionnodelatermaxx
\global\let\mymaxy=\pgfpositionnodelatermaxy
\pgfmathsetlengthmacro\mylaternodexlength{abs(\mymaxx-\myminx)-\pgflinewidth}%
\global\let\mylaternodewidth=\mylaternodexlength
}
\newcommand*\myrestorer{%
\let\pgfpositionnodelatername=\myname
\let\pgfpositionnodelaterminx=\myminx
\let\pgfpositionnodelaterminy=\myminy
\let\pgfpositionnodelatermaxx=\mymaxx
\let\pgfpositionnodelatermaxy=\mymaxy
\setbox\pgfpositionnodelaterbox=\box\mybox
}
\def\mylaternode#1;{%
{%
\pgfpositionnodelater{\mysaver}
\node #1;
}%
}
\def\placemynode(#1,#2){%
\myrestorer
\pgfpositionnodenow{\pgfqpoint{#1}{#2}}%
}
\begin{tikzpicture}
\mylaternode [fill=magenta, blend mode=normal, draw=magenta, fill opacity=.5, draw opacity=.75] (hi) {Hello world};
\node [top color=blue!50!cyan, bottom color=blue!50!cyan, middle color=white, minimum height=20mm, minimum width=\mylaternodewidth, draw=blue!50!cyan] at (10mm,10mm) {};
\placemynode(10mm,10mm)
\end{tikzpicture}
\end{document}
How can I expand it in order to generalize the \mylaternode and \placemynode so that I can create and place multiple nodes later? The cleanest way is imho to make use of the node name (hi), but I actually have no idea about the syntactical possibilities of latex, which is why I ask for help
Edit: The reason for asking the question is that I have a bunch of nodes that differ in size and sometimes overlap. I want to place them according to their rendered sizes. The node contents are read from a csv file
The approach "left/right=of othernode" does not seem to suffice since they are already placed in relation to a third node.
e.g.
\node (a) {a};
\node (b) at ($(a)+(1,0)$) {b};
\node (c) at ($(a)+(1.5,.5)$) {c};
due to the nodes size a+(1.5,.5) overlaps with a+(1,0)
for most of the nodes placed in that manner the problem does not occur, hence the question persists for the overlapping rest of them