ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Ajith R <ajithramayyan@yahoo.co.in>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: metafun transformation error
Date: Fri, 4 Jun 2021 17:28:19 +0200	[thread overview]
Message-ID: <e6a50ca0-48db-4ff6-ba13-e1c2560e9068@xs4all.nl> (raw)
In-Reply-To: <2090794061.1155729.1622819328604@mail.yahoo.com>

On 6/4/2021 5:08 PM, Ajith R wrote:
> Hi,
> 
> 
>> here a ; is missing after the q
> 
> That was a silly mistake while making the MWE.
> When I corrected it, the MWE compiled correctly. However, the original code didn't have that error and wouldn't compile.
> So, I tried another MWE and found out what was causing the error.
> In the array I defined, there were two elements with empty string as their value. Once I changed those empty strings to some valid string, there was no error and the file compiled as expected. Here is the new MWE with one array element defined as empty string
> 
> \starttext
> \switchtobodyfont[30pt]
> \startMPpage
> StartPage ;
> unit := 2 * cm ;
> %numeric lm, row, col, bm;
> pair  middle;
> row := 1; col := 1;
> picture p, q ; p := nullpicture; q := nullpicture;
> 
> 
> string l[], lbl;
> l[0] := "" ; l[1]:= "2";
> 
> 
> for i= 0 upto row:
> middle := 0.5[((( i * unit) ), ((2 * unit))), ((((i+1) * unit) ), ((2 * unit) ))];
> lbl := l[i];
> p := thelabel(lbl, middle);
> q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner p]);
> draw q;
> 
> 
> endfor
> StopPage ;
> \stopMPpage
> \stoptext
> 
> 
> This will throw an error. If l[0] is defined as, say, "hi", there is no error
> 
> I suppose, my work around would be to use a non empty string and then fill that cell dark. Is there another way?
> 
> Anyway, thanks for your prompt replies and patience.
> 
> Thanks a ton for sharing your efforts with the world
you canot reflect about zero dimensions:

     p := thetextext(lbl, middle);
     message(0.5[urcorner p, ulcorner p]);
     if llcorner p <> urcorner p :
         q := p reflectedabout (0.5[urcorner p, ulcorner p], 
0.5[lrcorner p, llcorner p]);
         draw q;
     fi

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

      reply	other threads:[~2021-06-04 15:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <561884252.127404.1622754117330.ref@mail.yahoo.com>
     [not found] ` <561884252.127404.1622754117330@mail.yahoo.com>
2021-06-04  8:15   ` Ajith R
2021-06-04  9:22     ` Hans Hagen
2021-06-04 11:25       ` Ajith R
2021-06-04 12:27         ` Hans Hagen
2021-06-04 15:08           ` Ajith R
2021-06-04 15:28             ` Hans Hagen [this message]

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=e6a50ca0-48db-4ff6-ba13-e1c2560e9068@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=ajithramayyan@yahoo.co.in \
    --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).