ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Matthijs Kooijman <matthijs@stdin.nl>
To: Mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Passing variables into context
Date: Wed, 30 Sep 2009 13:27:28 +0200	[thread overview]
Message-ID: <20090930112727.GS4289@katherina.student.utwente.nl> (raw)


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

Hi all,

I've been trying to make a metapost graphic, based on the \textwidth. However,
it seems I can't just pass in \textwidth as an option. For example, the
following breaks:

  \startuniqueMPgraphic{HLine}
  draw origin -- (\MPvar{width}, 0mm); 
  \stopuniqueMPgraphic

  \starttext

  \setupMPvariables[HLine][width=\textwidth]
  \uniqueMPgraphic{HLine}

  \stoptext

with the following error:

  mplib | mp terminal: >> textwidth
    ! Undefined x coordinate has been replaced by 0.
    <to be read again>
                   ;
    <*> ...d:=3441; draw origin -- (\textwidth , 0mm);

It seems that the \textwidth option is not expanded before being passed to MP.
Is there any way to force this expansion? I've tried \expandafter (without
really understanding what that does), but that didn't help.

I've tried putting this graphic as an overlay under an \framed, which allows
me to use the \overlaywidth macro in metapost (which I assume is expanded
specially by context?). This worked, but is not very elegant. Is there
something more straightforward possible?

Gr.

Matthijs

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2009-09-30 11:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 11:27 Matthijs Kooijman [this message]
2009-09-30 11:29 ` Taco Hoekwater
2009-09-30 11:36   ` Matthijs Kooijman
2009-09-30 12:07     ` Taco Hoekwater

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=20090930112727.GS4289@katherina.student.utwente.nl \
    --to=matthijs@stdin.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).