Hi all, Is there a ConTeXt equivalent to LaTeX \settowidth{}, or better still some macro I can do things like \setupsomething[ ... width={\widthof{\bf sometext\emspace}}, ...] Cheers, Robin
Hi, Robin
I think you can include the texts in an \hbox and use \wd?? to get its width
On 3/14/07, Robin Kirkham
Hi all,
Is there a ConTeXt equivalent to LaTeX \settowidth{}, or better still some macro I can do things like
\setupsomething[ ... width={\widthof{\bf sometext\emspace}}, ...]
Cheers,
Robin _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Sincerely yours, Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ----------------------------------------------------------------
2007/3/14, Robin Kirkham
Hi all,
Is there a ConTeXt equivalent to LaTeX \settowidth{}, or better still some macro I can do things like
\setupsomething[ ... width={\widthof{\bf sometext\emspace}}, ...]
Cheers,
Robin
Hi Robin, I don't know if there is something build in but the following definition should work for simple cases. \def\widthof#1% {\bgroup \setbox\scratchbox\hbox{#1}% \the\wd\scratchbox% \egroup} \starttext \getrawparameters [robin] [width=\widthof{Robin Kirkham}] \robinwidth \stoptext Wolfgang
Wolfgang Schuster wrote:
2007/3/14, Robin Kirkham
: Hi all,
Is there a ConTeXt equivalent to LaTeX \settowidth{}, or better still some macro I can do things like
\setupsomething[ ... width={\widthof{\bf sometext\emspace}}, ...]
Cheers,
Robin
Hi Robin,
I don't know if there is something build in but the following definition should work for simple cases.
\def\widthof#1% {\bgroup \setbox\scratchbox\hbox{#1}% \the\wd\scratchbox% \egroup}
\starttext
\getrawparameters [robin] [width=\widthof{Robin Kirkham}]
\robinwidth
\stoptext
this will typeset ok, but not with \dimen0=\robinwidth \def\setwidthof#1\to#2% {\bgroup \setbox\scratchbox\hbox{#1}% \expanded{\egroup\def\noexpand#2{\the\wd\scratchbox}}} \starttext \setwidthof{Robin Kirkham}\to\whatever \getrawparameters [robin] [width=\whatever] \robinwidth or so (untested) -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Hans Hagen
-
Robin Kirkham
-
Wolfgang Schuster
-
Zhichu Chen