From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
Jan Willem Flamma <register12c@gmail.com>
Subject: Re: Combining modes and MetaFun
Date: Fri, 4 Sep 2020 15:09:05 +0200 [thread overview]
Message-ID: <885f772b-3f8c-bc0d-dc35-030669fe08b0@xs4all.nl> (raw)
In-Reply-To: <7B53B8C1-B92C-4EC3-94AF-91DFEF9C1B4B@hxcore.ol>
On 9/4/2020 2:20 PM, Jan Willem Flamma wrote:
> Dear list members,
>
> Is it possible to combine modes and MetaFun?
>
> In the below MWE, the \doifmode construction does not work.
>
> Kind regards,
>
> Jan Willem Flamma
>
> ===
>
> \enablemode[en]
>
> %\enablemode[nl]
>
> \starttext
>
> \startbuffer[square]
>
> u := 2cm ;
>
> draw unitsquare scaled u ;
>
> drawdblarrow (0,-0.2u)..(u,-0.2u) ;
>
> drawdblarrow (1.2u, 0)..(1.2u, u) ;
>
> %\doifmode{en}{label(\sometxt{length}, (0.5u,-0.4u)) ;}
>
> %\doifmode{nl}{label(\sometxt{lengte}, (0.5u,-0.4u)) ;}
>
> %\doifmode{en}{label(\sometxt{width}, (1.6u, 0.5u)) ;}
>
> %\doifmode{nl}{label(\sometxt{breedte}, (1.6u, 0.5u)) ;}
>
> \stopbuffer
>
> \placefigure
>
> [here,none][]{}
>
> {\scale[width=0.5\textwidth]{\processMPbuffer[square]}}
>
> \stoptext
You need to compensate these solutions by "wikifying" them:
\starttext
\startuseMPgraphic{whatever}{s::mode}
u := 2cm ;
draw unitsquare scaled u ;
drawdblarrow (0,-0.2u)..(u,-0.2u) ;
drawdblarrow (1.2u, 0)..(1.2u, u) ;
if "\MPvar{mode}" = "en" :
label("e", (0.5u,-0.4u)) ;
label("n", (1.6u, 0.5u)) ;
else :
label("n", (0.5u,-0.4u)) ;
label("l", (1.6u, 0.5u)) ;
fi ;
\stopuseMPgraphic
\useMPgraphic{whatever}{mode=en} \blank
\useMPgraphic{whatever}{mode=nl} \blank
\startuseMPgraphic{whatever}
u := 2cm ;
draw unitsquare scaled u ;
drawdblarrow (0,-0.2u)..(u,-0.2u) ;
drawdblarrow (1.2u, 0)..(1.2u, u) ;
if texmode("en") :
label("e", (0.5u,-0.4u)) ;
label("n", (1.6u, 0.5u)) ;
else :
label("n", (0.5u,-0.4u)) ;
label("l", (1.6u, 0.5u)) ;
fi ;
\stopuseMPgraphic
{ \enablemode[en] \useMPgraphic{whatever} } \blank
{ \useMPgraphic{whatever} } \blank
\stoptext
-----------------------------------------------------------------
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
___________________________________________________________________________________
next prev parent reply other threads:[~2020-09-04 13:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 12:20 Jan Willem Flamma
2020-09-04 13:09 ` Hans Hagen [this message]
2020-09-06 12:36 ` Jan Willem Flamma
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=885f772b-3f8c-bc0d-dc35-030669fe08b0@xs4all.nl \
--to=j.hagen@xs4all.nl \
--cc=ntg-context@ntg.nl \
--cc=register12c@gmail.com \
/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).