[Tex/LaTex] Is it possible to use the width of one TikZ node to calculate the width of another



Is it possible to store the variable width of a node and use that width to calculate the text width of another node in TikZ?


I have a list of similar nodes side-by-side (inline, not overlaid). Let's call the left column of nodes "A" and the right column of nodes "B". Column A nodes contain a number (counter variable, which means the node gets wider at each digit carry-over). Column B nodes should have some text width minus the text width of the corresponding node in column A.

  • get width of node A = \fontsize{50}{60}\selectfont\countervalue{}

  • text width of node B = (\textwidth) – (width of node A)

I think the answer I am looking for is hidden somewhere in this answer.

Best Answer

Did I understand correctly?


\foreach\j in {1,10,100}{
\node[outer sep=0] (a-\j) at (0,{-7*log10(\j)}) {\j};
\path let \p1=($(a-\j.east)-(a-\j.west)$) 
  node[anchor=west,text width=\textwidth-\x1] (b-\j) at (a-\j.east) 

enter image description here