Matthijs Kooijman wrote:
Hi Taco,
You should try \the\textwidth Thanks, that works. Could you enlighten me as to what \the does and why this helps? Does Context treat \the specially within metapost code (which seems so, since there are more \the examples in the metafun manual), or is it expanded before getting inserted into metapost?
\the is an expandable command that 'converts' internal tex parameters into their value. The expansion takes places during \edef (like inside \expanded) or during write to a buffer.
Using this in arithmetic gets slightly more complicated (0.5\the\textwidth doesn't work, but since this gets put into metapost, 0.5 * \the\textwidth does work).
If you want a single value inside mpost, you could use \dimexpr to do the calculation in tex. Best wishes, Taco