ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: calculations
Date: Mon, 25 Sep 2006 12:21:52 +0200	[thread overview]
Message-ID: <4517ADC0.7070102@wxs.nl> (raw)
In-Reply-To: <4517A56C.5020704@gmx.net>

Peter Rolf wrote:
> Henning Hraban Ramm wrote:
>   
>> Am 2006-09-21 um 21:12 schrieb Peter Rolf:
>>
>>     
>>>>>      \externalfigure[\lily!img][scale=\dimexpr(1000\LPscale)]%
>>>>>           
>>> \numexpr should work here
>>>   ..[scale=\numexpr1000\LPscale\relax]%
>>>       
>> thank you, that seemed what I looked for, but:
>> ! You can't use `\numexpr' in horizontal mode.
>>
>>     
> One of my favourite errors. Everytime it occurs I'm a bit puzzled, as
> I've no general solution for this. I can only tell you what I do in such
> a case.
>
> - check every parameter of the expression
>
> If the expression itself is ok
>
> - check the correct grouping of prior commands (boxes, conditionals,..)
> - try to calculate the expression before you pass it
>   \newcount\Myscale
>   \Myscale\numexpr1000\LPscale\relax
>   ..[scale=\the\Myscale]
>
> But in the end it is more try and error than a systematic action.
> If there is a more general approach to solve this, I would be happy to
> hear it.
>
> Gr
some day soon:

\def\integer#1{\lua{tex.sprint(math.floor(#1))}

scale=\integer{1000*\LPscale}

Hans

-- 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

  reply	other threads:[~2006-09-25 10:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-19 20:53 calculations Henning Hraban Ramm
2006-09-19 21:22 ` calculations Hans Hagen
2006-09-19 21:34 ` calculations nico
2006-09-19 22:04   ` calculations Henning Hraban Ramm
2006-09-19 22:40     ` calculations nico
2006-09-20 20:39       ` calculations Henning Hraban Ramm
2006-09-21  8:04         ` calculations Vit Zyka
2006-09-21 19:12         ` calculations Peter Rolf
2006-09-24 19:47           ` calculations Henning Hraban Ramm
2006-09-25  9:46             ` calculations Peter Rolf
2006-09-25 10:21               ` Hans Hagen [this message]
2006-09-25 21:11               ` calculations Henning Hraban Ramm
2006-09-26  6:53                 ` calculations Taco Hoekwater
2006-09-26 17:14                   ` calculations Henning Hraban Ramm
2006-09-26 20:14                     ` calculations Peter Rolf
2006-09-26 20:19                       ` calculations Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4517ADC0.7070102@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).