What is the equivalent to \makebox[s] and \framebox[s] stretching text in ConTeXt.

For example :

\makebox[5cm][s]{some contents}

Not sure if ConTeXt has an interface for it, but with the \hbox primitive it's quite straightforward. If you need nice frames, wrap a \framed and voilà.

Edit: Wolfgang suggested align=paragraph, so I'll include it too.

%%% Low level
\hbox to 5cm{Some text}
\framed[offset=0cm]{\hbox to 5cm{Some more text}}
%%% Cleaner, better
\framed[width=5cm,align=paragraph,frame=off]{Some text}
\framed[width=5cm,align=paragraph]{Some text}

I searched the ConTeXt mailing list and found this post by Luigi Scarso. AFAIU, the following MWE solves your problem. The two first lines look like TeX solution to me — but I am no boxing wizard at all. I added two lines on my own, using ConTeXt \framed

\hbox to 4cm{\hsize=4cm\stretched{some text}}

\ruledhbox to 5cm{\hsize=5cm\stretched{to the limit}}


\framed[width=4cm]{\hsize=4cm\stretched{some text}}

\framed[width=4cm,frame=off]{\hsize=4cm\stretched{some text}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.