Changes

Jump to navigation Jump to search
1,708 bytes added ,  17:08, 2 February 2009
Created page
< [[Main Page]] | [[Inside ConTeXt]] >

ConTeXt implements extensions from eTeX including the evaluation of expressions
(quoted from the [[http://www.ntg.nl/maps/20/38.pdf| eTeX manual]]):

== Expressions ==

eTeX introduces the notion of expressions of type number, dimen, glue, or
muglue, that can be used whenever a quantity of that type is needed. Such
expressions are evaluated by eTeX's scanning mechanism; they are initiated
by one of the commands <code>\numexpr</code>, <code>\dimexpr</code>,
<code>\glueexpr</code>, or <code>\muexpr</code>
(determining the type <i>t</i>) and optionally terminated by one <code>\relax</code> (that
will be absorbed by the scanning mechanism). An expression consists of one
or more terms of the same type to be added or subtracted; a term of type <i>t</i>
consists of a factor of that type, optionally multiplied and/or
divided by numeric factors; finally a factor of type <i>t</i> is either a
parenthesized subexpression or a quantity (number, etc.) of that type.

It has been pointed out that
the only important thing for <code>\dimexpr</code> is to write the dimen value
as first value after the <code>\dimexpr</code> command and then the numeric values.
Notice that the following expression is also valid:
<texcode>
\placesidebyside {\externalfigure[cow][width=.4\textwidth]}
{\framed[width=.4\textwidth,height=\dimexpr.4\textwidth*200/275\relax]
{\vbox{this is a box}}}
</texcode>

<context>
\setupexternalfigures[location={local,default}]
\placesidebyside{\externalfigure[cow][width=.4\textwidth]}
{\framed[width=.4\textwidth,height=\dimexpr.4\textwidth*200/275\relax]
{\vbox{this is a cow-sized box}}}
</context>

{{todo|Add more illustrative examples.}}
148

edits

Navigation menu