[Tex/LaTex] what is meaning of “\hbox to \hsize” in ConTeXt

contextcontext-mkiicontext-mkiv

In many tex, I saw \hbox to \hsize, such as:

{\hbox to \hsize \bgroup
\hfill
\setupframed[height=5cm,offset=.5em,frame=off,backgroundcolor=red]
\framed[width=12cm,align=left]{#1}%
\framed[width=4cm,align=left,leftframe=off]{#2}%
\egroup}

I don't know the meaning of the whole box? And what meaning of to in it?

Best Answer

compare the different boxes:

\starttext
foo\hfill bar

\def\test#1#2{\hbox to \hsize \bgroup
\hfill
\setupframed[height=5cm,offset=.5em,frame=on,backgroundcolor=red]
\framed[width=0.2\hsize,align=left,framecolor=blue]{#1}%
\framed[width=0.29\hsize,align=left,leftframe=off,framecolor=red]{#2}%
\egroup}

\blank
\framed{\test{some more text}{the second argument}}

\def\test#1#2{\hbox to 0.5\hsize \bgroup
\hfill
\setupframed[height=5cm,offset=.5em,frame=on,backgroundcolor=red]
\framed[width=0.2\hsize,align=left,framecolor=blue]{#1}%
\framed[width=0.29\hsize,align=left,leftframe=off,framecolor=red]{#2}%
\egroup}

\framed{\test{some more text}{the second argument}}
\stoptext

enter image description here

Related Question