ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Henning Hraban Ramm <texml@fiee.net>
Subject: MetaPost Examples
Date: Wed, 1 Sep 2021 14:19:43 +0200	[thread overview]
Message-ID: <2BE5EABC-68E9-408C-894F-84CE46423C06@fiee.net> (raw)

Hi, I’m trying to “translate” the documentation of “fiziko”* from LaTeX to ConTeXt and would like to avoid the doubling of MP code like:

\startMP
    path p;
    p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
    draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopMP

\startMPcode
    path p;
    p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
    draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopMPcode

I’m quite sure there’s a possibility with buffers, but how?

\startbuffer
    path p;
    p := (0,0){dir(30)}..(5cm, 0)..{dir(30)}(10cm, 0);
    draw brush (p)(2minStrokeWidth*sin(offsetPathLength*pi));
\stopbuffer

\typebuffer

... and then how do I get the MP graphic?


Hraban

*) https://github.com/jemmybutton/fiziko
___________________________________________________________________________________
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-09-01 12:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 12:19 Henning Hraban Ramm via ntg-context [this message]
2021-09-01 12:45 ` Hans Hagen via ntg-context
2021-09-01 13:50   ` Henning Hraban Ramm via ntg-context
  -- strict thread matches above, loose matches on Subject: below --
2001-08-24 14:06 metapost examples Patrick Gundlach
2001-08-24 20:58 ` Arun Mangalam
2001-04-29 18:50 Marc van Dongen

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=2BE5EABC-68E9-408C-894F-84CE46423C06@fiee.net \
    --to=ntg-context@ntg.nl \
    --cc=texml@fiee.net \
    /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).