Meer, Hans van der
5. Februar 2016 um 20:34
I am struggling with the following problem:

Collect a number of boxes with:
\global\setbox\placexcontent=\hbox{%
\box\placexcontent % collection of previous boxes
\box\placexbox % next box affixed to previous onse
\hskip\placexdistanceskip % spearation, replacing by \hfill does not solve problem
}%
Thus the incoming \placexbox'es are strung together separated by a skip.
Later they are typeset centered as a whole with:
\hbox to\textwidth{% % will be wider than the sum of the original box collection
\hss
\box\placexcontent % or \unhbox, doesn't look different
\unskip % unskip removes the last (extra) \hskip
\hss % should succumb to \hskip 0pt plus1fill
}%

The problem is the following:
(1) \placexdistanceskip=10pt boxes are separated neatly
(2) \placexdistanceskip=0pt plus1fill BOXES DO NOT SPREAD OUT AS I EXPECTED THEM TO DO
The flexible component does sadly not carry over to the final box, apparently.

Clearly my misunderstanding of working with boxes.
Can this be solved easily?
It will really help when you send complete working examples and not only code snippets.

Maybe you’re looking for the \spreadhbox command.

\starttext

\setbox\scratchbox\emptyhbox

\setbox\scratchbox\hbox{First box}
\setbox\scratchbox\hbox{\box\scratchbox\hbox{Second box}}
\setbox\scratchbox\hbox{\box\scratchbox\hbox{Third box}}

\maxaligned{\spreadhbox\scratchbox}

\stoptext

Wolfgang