[NTG-context] calculations

Henning Hraban Ramm hraban at fiee.net
Wed Sep 20 00:04:33 CEST 2006


Am 2006-09-19 um 23:34 schrieb nico:

>> I need to downscale every score to 63%, and the shown width check
>> should use the corrected width.
>> How can I do that? (FigWidth should be LPscale * figurewidth)
>
> I don't know what you really want to do, but an example of computation
> could look like this:
>
> \newdimen\myfigwidth
> \newdimen\myfigurewidth
> \def\myscale{.63}
>
> \figurewidth=23pt
> \myfigwidth=\dimexpr(\myscale\myfigurewidth)
>
> \starttext
> \the\myfigwidth
> \stoptext

Thank you, but now I always get:

! Illegal unit of measure (pt inserted).
<to be read again>
                    .
\figurewidth ->545.
                    03625pt
\dodostartlilypond ...expr (\LPscale \figurewidth
                                                   ) \ifdim \FigWidth  
 >\localh...

from the code:

\def\LPscale{.6315789} % downscale the image
    \ifvmode
       \getfiguredimensions[\bufferprefix lilypond-\the\lily! 
figures.pdf][]%
       \leavevmode%
       \newdimen\FigWidth
       \FigWidth=\dimexpr(\LPscale\figurewidth)
       \ifdim\FigWidth>\localhsize
         \!!dimena=\localhsize
         \advance\!!dimena by-\FigWidth
         \noindent\hskip\!!dimena
       \fi
    \fi
    \externalfigure[\lily!img][scale=\dimexpr(1000\LPscale)]%
    \egroup%

What's wrong with \dimexpr{\SomeDef\SomeDim} ?
Some expansion problem?

(Sorry, I only try to patch the code, I didn't write it.)

Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)



More information about the ntg-context mailing list