ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* A question about data types?
@ 2011-03-02 11:25 Ian Lawrence
  2011-03-02 11:37 ` Stefan Müller
  2011-03-02 11:41 ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Ian Lawrence @ 2011-03-02 11:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1203 bytes --]

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).

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

[-- Attachment #1.2: Type: text/html, Size: 1811 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A question about data types?
  2011-03-02 11:25 A question about data types? Ian Lawrence
@ 2011-03-02 11:37 ` Stefan Müller
  2011-03-02 11:41 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Müller @ 2011-03-02 11:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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@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
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A question about data types?
  2011-03-02 11:25 A question about data types? Ian Lawrence
  2011-03-02 11:37 ` Stefan Müller
@ 2011-03-02 11:41 ` Wolfgang Schuster
  2011-03-02 12:39   ` Ian Lawrence
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2011-03-02 11:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 02.03.2011 um 12:25 schrieb Ian Lawrence:

> 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

Variant 1:

\newdimen\baseoffset \baseoffset=28px

\setlayer[…][voffset=4\nuggetnumber]{…}

Variant 2:

\def\nuggetnumber{4}

\setlayer[…][voffset=\dimexpr28px*\nuggetnumber\relax]{…}

Variant 3 (what i suggest):

\definemeasure[baseoffset][28px]
\definemeasure[verticaloffset][\dimexpr\measure{baseoffset}*4\relax] % replace “4” with your own factor

\setlayer[…][voffset=\measure{verticaloffset}]{…}

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A question about data types?
  2011-03-02 11:41 ` Wolfgang Schuster
@ 2011-03-02 12:39   ` Ian Lawrence
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lawrence @ 2011-03-02 12:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2054 bytes --]

Thank you both.

I got as far as \dimexpr  (expressions) page in the Wiki, and all the words
made sense, more or less, but not the whole.

In case anyone else find this useful, I have success with Wolfgang 2 and 3,
with (2) being the simplest....but that may just be the fit to my brain.


It's building stacked progress bars for documents with subsections, in case
anyone searches this- colours and prettification to follow!


Ian

On 2 March 2011 11:41, Wolfgang Schuster
<schuster.wolfgang@googlemail.com>wrote:

>
> Am 02.03.2011 um 12:25 schrieb Ian Lawrence:
>
> > 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
>
> Variant 1:
>
> \newdimen\baseoffset \baseoffset=28px
>
> \setlayer[…][voffset=4\nuggetnumber]{…}
>
> Variant 2:
>
> \def\nuggetnumber{4}
>
> \setlayer[…][voffset=\dimexpr28px*\nuggetnumber\relax]{…}
>
> Variant 3 (what i suggest):
>
> \definemeasure[baseoffset][28px]
> \definemeasure[verticaloffset][\dimexpr\measure{baseoffset}*4\relax] %
> replace “4” with your own factor
>
> \setlayer[…][voffset=\measure{verticaloffset}]{…}
>
> Wolfgang
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 2960 bytes --]

[-- Attachment #2: mini-menus.png --]
[-- Type: image/png, Size: 1717 bytes --]

[-- Attachment #3: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-02 12:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-02 11:25 A question about data types? Ian Lawrence
2011-03-02 11:37 ` Stefan Müller
2011-03-02 11:41 ` Wolfgang Schuster
2011-03-02 12:39   ` Ian Lawrence

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).