How can the dimensions of a box be retrieved with LaTeX
You really shouldn't be referring to boxes by number even with the plain format. For example,
\newbox\mybox
\setbox\mybox=\hbox{Hello}
\showthe\wd\mybox
\bye
will work fine. Both \newbox
and \newsavebox
do a \chardef
to assign the name you give as a number. So in LaTeX you can happily do
\newsavebox{\mybox}
\savebox{\mybox}{\parbox{4cm}{\lorem}}
\showthe\wd\mybox
and all will be fine.
I believe the canonical LaTeX way is this:
\newlength{\myhh}
\newlength{\mydd}
\newlength{\myww}
\settoheight{\myhh}{\usebox{\Abox}}
\settodepth{\mydd}{\usebox{\Abox}}
\settowidth{\myww}{\usebox{\Abox}}