1

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

For example :

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

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.

\starttext
%%% 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}
\stoptext
0

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

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

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

\blank[big]

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

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

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.