[NTG-context] A question about data types?

Stefan Müller warrence.stm at gmx.de
Wed Mar 2 12:37:38 CET 2011


Hi!

On 02.03.2011 12:25, Ian Lawrence wrote:
> Sorry. me again...and I have been all over the wiki, mailing lists and
> manuals...
>
> I have this:
>
> \setlayer[progresssteps]% name of the layer
> [hoffset=904 px, voffset= 28\nuggetnumber px]  % placement (from upper
> left corner of the layer)
> {\stepstack}  % the actual contents of the layer
>
> And I am hoping that as I increase nuggetnumber the voffset of the layer
> will be 28*nuggetnumber
>
> I am setting nuggetnumber like this for the moment:
>
> \def \nuggetnumber{3}
>
> (in the other dev document it is the result of counter, so set dynamically)
>
> and this in the text
>
> \nuggetnumber
>
> which compiles to '3', so I assume the assignment is good to go.
>
> varying both nuggetnumber and the scale factor (28) shift the layer up
> and down, but not in a way that suggests that 28\nuggetnumber is being
> evaluated as a product (so a scale factor of 7 and a nuggetnumber of 2
> do not give the same output as a scale factor of 2 and a nuggetnumber of 7).

If you expect a product you should tell ConTeXt you want a product. You 
don't do that with "28\nuggetnumber px".

Check out http://wiki.contextgarden.net/Expressions

I think "\dimexpr\nuggetnumber*28px\relax" should get you there, but I'm 
not sure (untested).

Stefan

> So I am led to think that there is something in the evaluating that is
> going wrong - data types / units? (if I hard code in the results I am
> expecting, say 28 px, 56 px or 84 px then I get exactly what I want...
>
> Thanks, as ever
>
> (Same result in ConTEXt ii or iv)
> Ian
>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


More information about the ntg-context mailing list