Re: [NTG-context] MPinstance

2016-04-07 Thread Alan BRASLAU
On Thu, 7 Apr 2016 12:14:39 +0200
Hans Hagen <pra...@wxs.nl> wrote:

> On 4/7/2016 11:20 AM, dr. Hans van der Meer wrote:
> > I do not understand the info in the ConTeXt wiki on setupMPinstance.
> >
> > The syntax is specified as \setupMPinstance[...][...,...=...,...0
> > [...] name
> > format metafun mpost
> > etc.
> >
> > I read this as:
> > in the first argument one can specify a name presumably a name
> > specified on \defineMPinstance. in the second argument
> > [format=metafun] specifies the format. But then the example under
> > Usage gives: \setupMPinstance[metafun][...]
> > Why metafun in the first instead of the second argument as implied
> > in the syntax description? I get confused here.
> >
> > Also in the description \startMPextensions and
> > \startMPinitializations are mentioned, but their descriptions are
> > missing from the list given in the page MetaPost in ConTeXt. How
> > are these described and what is the specific purpose of
> > \startMPextensions compared to \startMPinitializations? What is the
> > recommended use for them?
> 
> you can look in m-graph.mkiv for an example of using instances

For example, I work with a "3D" instance of MP:

\defineMPinstance
  [three]
  [format=metafun,
   extensions=yes,
   initializations=yes,
   method=double]

\startMPdefinitions{three}
  input three ;
\stopMPdefinitions

Where three.mp contains my 3D projection macros.

Use is then

\startMPcode{three}
...
\stopMPcode


Alan
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] MPinstance

2016-04-07 Thread Hans Hagen

On 4/7/2016 11:20 AM, dr. Hans van der Meer wrote:

I do not understand the info in the ConTeXt wiki on setupMPinstance.

The syntax is specified as \setupMPinstance[...][...,...=...,...0
[...] name
format metafun mpost
etc.

I read this as:
in the first argument one can specify a name presumably a name specified on 
\defineMPinstance.
in the second argument [format=metafun] specifies the format.
But then the example under Usage gives:
\setupMPinstance[metafun][...]
Why metafun in the first instead of the second argument as implied in the 
syntax description?
I get confused here.

Also in the description \startMPextensions and \startMPinitializations are 
mentioned, but their descriptions are missing from the list given in the page 
MetaPost in ConTeXt. How are these described and what is the specific purpose 
of \startMPextensions compared to \startMPinitializations? What is the 
recommended use for them?


you can look in m-graph.mkiv for an example of using instances


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | www.pragma-ade.com | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] MPinstance

2016-04-07 Thread dr. Hans van der Meer
I do not understand the info in the ConTeXt wiki on setupMPinstance.

The syntax is specified as \setupMPinstance[...][...,...=...,...0
[...] name
format metafun mpost
etc.

I read this as:
in the first argument one can specify a name presumably a name specified on 
\defineMPinstance.
in the second argument [format=metafun] specifies the format.
But then the example under Usage gives:
\setupMPinstance[metafun][...]
Why metafun in the first instead of the second argument as implied in the 
syntax description?
I get confused here.

Also in the description \startMPextensions and \startMPinitializations are 
mentioned, but their descriptions are missing from the list given in the page 
MetaPost in ConTeXt. How are these described and what is the specific purpose 
of \startMPextensions compared to \startMPinitializations? What is the 
recommended use for them?

Hans van der Meer

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] deprecated startMPenvironment

2016-04-04 Thread Wolfgang Schuster

Meer, Hans van der <mailto:h.vanderm...@uva.nl>
4. April 2016 um 11:48


On 04 Apr 2016, at 00:12, Hans Hagen <pra...@wxs.nl 
<mailto:pra...@wxs.nl>> wrote:


On 4/3/2016 4:07 PM, Meer, Hans van der wrote:

Previously I could do the following

\starttext
\startMPenvironment[+]\switchtobodyfont[small]\stopMPenvironment
\startMPpage
% metafont code
\stopMPpage
\stoptext
\endinput

This is called by context --run --once etc. producing the figure and 
in this case modifying the font to a smaller size. Note, the context 
call occurs on the fly inside a \directlua{{os.execute(..)}. You may 
find this complicated, but it works for me and I would rather like 
not having to change may things all over the place.


Now I learn from the ConTeXtgarden that startMPenvironment is 
deprecated and that I should use defineMPinstance and 
setupMPinstance instead.

Thus I tried

\defineMPinstance[mp:local][metafun][setups=mp:smallfont,textcolor=red]
\startsetups mp:smallfont
\switchtobodyfont[small]
\stopsetups
\startMPpage  and also \startMPpage[mp:local]
% metafont code
\stopMPpage
\stoptext
\endinput

But nothing happens. How do I get the effect earlier obtained with 
startMPenvironment without having to rely an a deprecated macro?


the bodyfont environment was needed because we had to communicate to 
the external mp run what the intended settings were
in mkiv the run is internal so the mp text generator adapts to the 
current settings and there is no need to pass anything




Indeed, I can see the effect of mp functioning inside mkiv. But there 
is still something I do not understand.


I get small italic text doing this:

\startMPenvironment[+]
\switchtobodyfont[small]
\it
\stopMPenvironment


But italic only doing:

%\startMPenvironment[+]
\switchtobodyfont[small]
\it
%\stopMPenvironment


How is that possible?

Please send complete examples and not only snippets.

Wolfgang
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] deprecated startMPenvironment

2016-04-04 Thread Meer, Hans van der


On 04 Apr 2016, at 00:12, Hans Hagen <pra...@wxs.nl<mailto:pra...@wxs.nl>> 
wrote:

On 4/3/2016 4:07 PM, Meer, Hans van der wrote:
Previously I could do the following

\starttext
\startMPenvironment[+]\switchtobodyfont[small]\stopMPenvironment
\startMPpage
% metafont code
\stopMPpage
\stoptext
\endinput

This is called by context --run --once etc. producing the figure and in this 
case modifying the font to a smaller size. Note, the context call occurs on the 
fly inside a \directlua{{os.execute(..)}. You may find this complicated, but it 
works for me and I would rather like not having to change may things all over 
the place.

Now I learn from the ConTeXtgarden that startMPenvironment is deprecated and 
that I should use defineMPinstance and setupMPinstance instead.
Thus I tried

\defineMPinstance[mp:local][metafun][setups=mp:smallfont,textcolor=red]
\startsetups mp:smallfont
\switchtobodyfont[small]
\stopsetups
\startMPpage  and also \startMPpage[mp:local]
% metafont code
\stopMPpage
\stoptext
\endinput

But nothing happens. How do I get the effect earlier obtained with 
startMPenvironment without having to rely an a deprecated macro?

the bodyfont environment was needed because we had to communicate to the 
external mp run what the intended settings were
in mkiv the run is internal so the mp text generator adapts to the current 
settings and there is no need to pass anything


Indeed, I can see the effect of mp functioning inside mkiv. But there is still 
something I do not understand.

I get small italic text doing this:

\startMPenvironment[+]
\switchtobodyfont[small]
\it
\stopMPenvironment

But italic only doing:

%\startMPenvironment[+]
\switchtobodyfont[small]
\it
%\stopMPenvironment

How is that possible?

Hans van der Meer

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] deprecated startMPenvironment

2016-04-03 Thread Hans Hagen

On 4/3/2016 4:07 PM, Meer, Hans van der wrote:

Previously I could do the following

\starttext
\startMPenvironment[+]\switchtobodyfont[small]\stopMPenvironment
\startMPpage
% metafont code
\stopMPpage
\stoptext
\endinput

This is called by context --run --once etc. producing the figure and in this 
case modifying the font to a smaller size. Note, the context call occurs on the 
fly inside a \directlua{{os.execute(..)}. You may find this complicated, but it 
works for me and I would rather like not having to change may things all over 
the place.

Now I learn from the ConTeXtgarden that startMPenvironment is deprecated and 
that I should use defineMPinstance and setupMPinstance instead.
Thus I tried

\defineMPinstance[mp:local][metafun][setups=mp:smallfont,textcolor=red]
\startsetups mp:smallfont
\switchtobodyfont[small]
\stopsetups
\startMPpage  and also \startMPpage[mp:local]
% metafont code
\stopMPpage
\stoptext
\endinput

But nothing happens. How do I get the effect earlier obtained with 
startMPenvironment without having to rely an a deprecated macro?


the bodyfont environment was needed because we had to communicate to the 
external mp run what the intended settings were


in mkiv the run is internal so the mp text generator adapts to the 
current settings and there is no need to pass anything


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | www.pragma-ade.com | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] deprecated startMPenvironment

2016-04-03 Thread Meer, Hans van der
Previously I could do the following

\starttext
\startMPenvironment[+]\switchtobodyfont[small]\stopMPenvironment
\startMPpage
% metafont code
\stopMPpage
\stoptext
\endinput

This is called by context --run --once etc. producing the figure and in this 
case modifying the font to a smaller size. Note, the context call occurs on the 
fly inside a \directlua{{os.execute(..)}. You may find this complicated, but it 
works for me and I would rather like not having to change may things all over 
the place.

Now I learn from the ConTeXtgarden that startMPenvironment is deprecated and 
that I should use defineMPinstance and setupMPinstance instead.
Thus I tried

\defineMPinstance[mp:local][metafun][setups=mp:smallfont,textcolor=red]
\startsetups mp:smallfont
\switchtobodyfont[small]
\stopsetups
\startMPpage  and also \startMPpage[mp:local]
% metafont code
\stopMPpage
\stoptext
\endinput

But nothing happens. How do I get the effect earlier obtained with 
startMPenvironment without having to rely an a deprecated macro?

Hans van der Meer




___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] textcolor not working with MPinstance

2014-04-24 Thread Hans Hagen

On 4/21/2014 10:47 PM, Wolfgang Schuster wrote:


Am 21.04.2014 um 22:18 schrieb Aditya Mahajan adit...@umich.edu:


On Tue, 15 Apr 2014, Aditya Mahajan wrote:


textcolor does not work any longer with MPinstance. Consider the following 
example from the wiki: http://wiki.contextgarden.net/Command/defineMPinstance


Is there any update on this? This bug breaks the visualcounter module.

I am including a smaller minimal example:

\defineMPinstance
  [important]
  [metafun]
  [textcolor=red]

\starttext

\startMPcode{important}
  draw textext(Am I red?) ;
\stopMPcode

\stoptext



It fails also with the default instance:

\setupMPinstance
   [textcolor=red,
textstyle=bold]

\starttext

\startMPcode
  draw textext(Am I red?) ;
\stopMPcode

\stoptext


fixed

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] textcolor not working with MPinstance

2014-04-24 Thread Aditya Mahajan

On Thu, 24 Apr 2014, Hans Hagen wrote:


On 4/21/2014 10:47 PM, Wolfgang Schuster wrote:


Am 21.04.2014 um 22:18 schrieb Aditya Mahajan adit...@umich.edu:


On Tue, 15 Apr 2014, Aditya Mahajan wrote:

textcolor does not work any longer with MPinstance. Consider the 
following example from the wiki: 
http://wiki.contextgarden.net/Command/defineMPinstance


Is there any update on this? This bug breaks the visualcounter module.

I am including a smaller minimal example:

\defineMPinstance
  [important]
  [metafun]
  [textcolor=red]

\starttext

\startMPcode{important}
  draw textext(Am I red?) ;
\stopMPcode

\stoptext



It fails also with the default instance:

\setupMPinstance
   [textcolor=red,
textstyle=bold]

\starttext

\startMPcode
  draw textext(Am I red?) ;
\stopMPcode

\stoptext


fixed


Thanks!

Aditya
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] textcolor not working with MPinstance

2014-04-21 Thread Wolfgang Schuster

Am 21.04.2014 um 22:18 schrieb Aditya Mahajan adit...@umich.edu:

 On Tue, 15 Apr 2014, Aditya Mahajan wrote:
 
 textcolor does not work any longer with MPinstance. Consider the following 
 example from the wiki: http://wiki.contextgarden.net/Command/defineMPinstance
 
 Is there any update on this? This bug breaks the visualcounter module.
 
 I am including a smaller minimal example:
 
 \defineMPinstance
  [important]
  [metafun]
  [textcolor=red]
 
 \starttext
 
 \startMPcode{important}
  draw textext(Am I red?) ;
 \stopMPcode
 
 \stoptext


It fails also with the default instance:

\setupMPinstance
  [textcolor=red,
   textstyle=bold]

\starttext

\startMPcode
 draw textext(Am I red?) ;
\stopMPcode

\stoptext

Wolfgang
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] Portrait vs. landscape orientation for Tabloid paper

2013-06-25 Thread Pavneet Arora
I believe that the definitions for portrait and landscape orientation
for Tabloid/Ledger paper are flipped.

In the following MWE using Hans' clue to using \scaling directive, I am
having to specify landscape in order for the page to be set in portrait.
This observation is confirmed when I retrieve the document properties
using evince under Bodhi Linux and under Ubuntu 12.04 (ALTENTER
brings up the document properties).  With this MWE, the properties under
both systems is shown as Tabloid, Portrait (11.00 x 17.00 inches)

Have I got this right?

MWE:

\setuppapersize[tabloid,landscape][tabloid,landscape]
\setuplayout[
backspace=0.5in,
width=10in,
topspace=1.0in,
header=0in, 
footer=0in,
height=16.5in]
\setuppagenumbering[location=,state=stop]

\usemodule[simplefonts]
\setmainfont[schola]
\setupbodyfont[rm,16pt]
\setupinterlinespace[line=2.8ex]

\starttext
%\showlayout[in,pt]

\setupMPinstance
[metafun]
[extensions=yes,
initializations=yes]

\startuseMPgraphic{Example}
u:=1cm;

pickup pencircle scaled 1pt;

draw (5u,0u) {dir 90}..(0u,5u) {dir 180};
draw (0u,5u) .. (-1.5u,10.5u) {dir 90} .. (0u,16u);
draw (0u,16u) {dir 0} .. (5u,21u) {dir 90};
draw (5u,21u) -- (39u,21u);
draw (39u,21u) {dir 270} .. (42u,18u) {dir 0};
draw (42u,18u) .. (43.5u,10.5u) {dir 270} .. (42u,3u);
draw (42u,3u) {dir 180} .. (39u,0u) {dir 270};
draw (39u,0u) -- (35u,0u);
draw (35u,0u) .. (22u,3u) {dir 180} .. (9u,0u);
draw (9u,0u) -- (5u,0u);
label(btex A POOL etex, (22u,10.5u));

\stopuseMPgraphic
\startalignment[middle]
\definedfont[Serif at 16pt]\setupinterlinespace
{\tfb\sc An Example Plumbing Schematic}
\blank[big]
{\tfb \tt [DRAFT---To Be Verified]}
\blank[2*big]
\stopalignment
\scale[width=10in]{\useMPgraphic{Example}}
\stoptext

-- 

Pavneet Arora   m: 647.406.6843
Waroc Informatikt: 416.937.9276
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] [***SPAM***] Scaling large (annotated) MetaFun drawing

2013-06-18 Thread Pavneet Arora
[Sorry about the previous null message.]

Background:

Typically I use MetaPost to create small figures, which I then can scale
as needed in larger documents.  These figures contain no text so I can
simply use the .eps output of mpost as an inclusion.

Recently, I have embarked on a large illustration replete with lots of
text labels.  It is a distilled architectural drawing intended for
diagnostic and maintenance purposes.  In it plumbing details are
overlaid over a layout.  For simplicity, I standardized on unit size of
1cm so that co-ordinates can easily map from physical dimensions with
the unusual hybrid scale of 1cm=1ft ;)..

Status:

With this set unit size, my drawing has grown very large.  My intent is
to get it printed on one of the (U.S.) based architectural paper sizes,
or if it can be made legible on U.S. Tabloid size paper (17 x 11)..
My first successful approach (and where I stand right now) is to simply
use \startMPpage and \stopMPpage to scale to the page.

Thera are a couple of issues, though, with this approach.  First, I want
to add additional information to the page, other than what would be
handled by MetaPost, e.g., some tables, etc.  Even without this
additional information, having the drawing scale to page size does not
give adequate margin buffering and if there are some labels right at the
edge, I have seen some clipping of the text.

Objective:

I would like to create a scalable drawing with all of its text
labels so that I can scale appropriately to different page sizes, and
also incorporate the illustration with other document elements.

From what I have read at:

http://wiki.contextgarden.net/MetaPost_in_ConTeXt

I think what I need is something akin to \startuseMPgraphic with a
scaling option if I want to include the code inline.  Otherwise, the
drawing is clipped on the page.

Or perhaps I simply try to convert the existing PDF output to PS, and
then include it?

What I am hoping is to get a best practises workflow from the list so
that I can simply adopt it.

advTHANKSance.

Sample:

A MWE is found below:

\setuppapersize[tabloid,landscape][tabloid,landscape]
\starttext

\setupMPinstance
[metafun]
[extensions=yes,
initializations=yes,
textstyle=bold]

\startMPpage
u:=1cm;

pickup pencircle scaled 1pt;

draw (5u,0u) {dir 90}..(0u,5u) {dir 180};
draw (0u,5u) .. (-1.5u,10.5u) {dir 90} .. (0u,16u);
draw (0u,16u) {dir 0} .. (5u,21u) {dir 90};
draw (5u,21u) -- (39u,21u);
draw (39u,21u) {dir 270} .. (42u,18u) {dir 0};
draw (42u,18u) .. (43.5u,10.5u) {dir 270} .. (42u,3u);
draw (42u,3u) {dir 180} .. (39u,0u) {dir 270};
draw (39u,0u) -- (35u,0u);
draw (35u,0u) .. (22u,3u) {dir 180} .. (9u,0u);
draw (9u,0u) -- (5u,0u);
label(btex AN ARCHITECTURAL ELEMENT etex, (22u,10.5u));

\stopMPpage
\stoptext


-- 

Pavneet Arora   m: 647.406.6843
Waroc Informatikt: 416.937.9276
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] [***SPAM***] Scaling large (annotated) MetaFun drawing

2013-06-18 Thread Hans Hagen

On 6/18/2013 3:13 PM, Pavneet Arora wrote:

[Sorry about the previous null message.]

Background:

Typically I use MetaPost to create small figures, which I then can scale
as needed in larger documents.  These figures contain no text so I can
simply use the .eps output of mpost as an inclusion.

Recently, I have embarked on a large illustration replete with lots of
text labels.  It is a distilled architectural drawing intended for
diagnostic and maintenance purposes.  In it plumbing details are
overlaid over a layout.  For simplicity, I standardized on unit size of
1cm so that co-ordinates can easily map from physical dimensions with
the unusual hybrid scale of 1cm=1ft ;)..

Status:

With this set unit size, my drawing has grown very large.  My intent is
to get it printed on one of the (U.S.) based architectural paper sizes,
or if it can be made legible on U.S. Tabloid size paper (17 x 11)..
My first successful approach (and where I stand right now) is to simply
use \startMPpage and \stopMPpage to scale to the page.

Thera are a couple of issues, though, with this approach.  First, I want
to add additional information to the page, other than what would be
handled by MetaPost, e.g., some tables, etc.  Even without this
additional information, having the drawing scale to page size does not
give adequate margin buffering and if there are some labels right at the
edge, I have seen some clipping of the text.

Objective:

I would like to create a scalable drawing with all of its text
labels so that I can scale appropriately to different page sizes, and
also incorporate the illustration with other document elements.

 From what I have read at:

http://wiki.contextgarden.net/MetaPost_in_ConTeXt

I think what I need is something akin to \startuseMPgraphic with a
scaling option if I want to include the code inline.  Otherwise, the
drawing is clipped on the page.


you can use the \scale command

\scale[width=1cm]{\useMPgraphic{somename}}

it takes the same options as externalfigure


Or perhaps I simply try to convert the existing PDF output to PS, and
then include it?

What I am hoping is to get a best practises workflow from the list so
that I can simply adopt it.

advTHANKSance.

Sample:

A MWE is found below:

\setuppapersize[tabloid,landscape][tabloid,landscape]
\starttext

\setupMPinstance
[metafun]
[extensions=yes,
initializations=yes,
textstyle=bold]

\startMPpage
u:=1cm;

pickup pencircle scaled 1pt;

draw (5u,0u) {dir 90}..(0u,5u) {dir 180};
draw (0u,5u) .. (-1.5u,10.5u) {dir 90} .. (0u,16u);
draw (0u,16u) {dir 0} .. (5u,21u) {dir 90};
draw (5u,21u) -- (39u,21u);
draw (39u,21u) {dir 270} .. (42u,18u) {dir 0};
draw (42u,18u) .. (43.5u,10.5u) {dir 270} .. (42u,3u);
draw (42u,3u) {dir 180} .. (39u,0u) {dir 270};
draw (39u,0u) -- (35u,0u);
draw (35u,0u) .. (22u,3u) {dir 180} .. (9u,0u);
draw (9u,0u) -- (5u,0u);
label(btex AN ARCHITECTURAL ELEMENT etex, (22u,10.5u));

\stopMPpage
\stoptext





--

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] fontsize drawing in metapost

2013-05-06 Thread Meer, H. van der
This is but a partial solution in my case, for two reasons:
1. \textstyle=\small gives few control, I tried textstyle=5pt without result
2. the setup cannot be placed inside \startuseMPgraphic, where I need it most.

I skimmed through meta-ini.mkiv, but did not find a solution.
It is however quite possible things cannot be done other than by putting a 
fontchange inside each label.

Hans van der Meer



On 6 May 2013, at 6:04 PM, Marco Patzer home...@lavabit.com wrote:

 On 2013–05–06 Meer, H. van der wrote:
 
 What is the simplest way to change the size of fonts in labels drawn in 
 MetaPost?
 
 Probably a font switch directly in the label:
 
  label(\small foobar, origin);
 
 \switchtobodyfont[size] can be done in \startMPenvironment and inside each 
 label.
 
 Better use setupMPinstance:
 
  \setupMPinstance
[metafun]
[textstyle=\small]
 
 Marco
 __
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] fontsize drawing in metapost

2013-05-06 Thread Meer, H. van der
I did some further experimentation, hoping using dimexp calculations would 
help. But either I am doing somthing wrong or I do not understand the innards 
of bodyfont switching well enough.
The example program seems to have accessed a 30 pt font (see the log file) but 
did not typeset in it, the dimexpr does evaluates to 30 pt.
Where am I at fault?

Hans van der Meer

\setuppapersize[A6][A6]
\setupbodyfont[10pt]
\starttext
10pt\ \begingroup\switchtobodyfont[20pt]20pt\endgroup\ 10pt\par
\writestatus{==}{}
10pt\ \begingroup\switchtobodyfont[\the\dimexpr(3\bodyfontsize)] times 
3\endgroup\ 10pt\par
dimexpr=\the\dimexpr(3\bodyfontsize)\par
\stoptext

fonts'fallback modern rm 10pt' is loaded
fontsbodyfont '20pt' is defined (can better be done global)
fontsbodyfont '24pt' is defined (can better be done global)
fontsbodyfont '16pt' is defined (can better be done global)
==  
fontsbodyfont '30.0pt' is defined (can better be done global)
fontsbodyfont '36pt' is defined (can better be done global)
fontsbodyfont '24pt' is defined (can better be done global)
fontsbodyfont '30.0pt' is defined (can better be done global)
fontsbodyfont '30.0pt' is not defined


On 6 May 2013, at 8:57 PM, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

This is but a partial solution in my case, for two reasons:
1. \textstyle=\small gives few control, I tried textstyle=5pt without result
2. the setup cannot be placed inside \startuseMPgraphic, where I need it most.

I skimmed through meta-ini.mkiv, but did not find a solution.
It is however quite possible things cannot be done other than by putting a 
fontchange inside each label.

Hans van der Meer



On 6 May 2013, at 6:04 PM, Marco Patzer 
home...@lavabit.commailto:home...@lavabit.com wrote:

On 2013–05–06 Meer, H. van der wrote:

What is the simplest way to change the size of fonts in labels drawn in 
MetaPost?

Probably a font switch directly in the label:

label(\small foobar, origin);

\switchtobodyfont[size] can be done in \startMPenvironment and inside each 
label.

Better use setupMPinstance:

\setupMPinstance
  [metafun]
  [textstyle=\small]

Marco
_


dimexpr.pdf
Description: dimexpr.pdf
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] MPinclusions, MPextensions, MPinitializations and MPinstances

2013-02-14 Thread Alan BRASLAU
I am glad to see that I am not alone being confused...

We have:

\defineMPinstance
  [name]
  [\s!format=metafun,
   \s!extensions=\v!yes,
   \s!initializations=\v!yes,
   \c!method=\s!default,
   \c!textstyle=,
   \c!textcolor=]

also, \setupMPinstance

So that extensions=yes|no and initializations=yes|no controls the use
of MPextensions and MPinitializations. It seems that extensions is
intended for all instances (when enabled).

From what I can see, extensions are read once, initializations each,
and inclusions are intended for the user. It appears that
initializations is used to pass dynamic things from ConTeXt to MP.

I still have not figured out how to specify MPinclusions for a
particular instance.

It would be nice for someone who understands this all to explain it.

Alan 

 

On Thu, 14 Feb 2013 14:01:44 +0100
Marco Patzer home...@lavabit.com wrote:

 On 2013–02–14 Marco Patzer wrote:
 
  Now I can use “n” in all MP instances (unless switched off for the
  particular instance). I'd like to define some variables only visible
  in instance “foo”. Something like
  
\startMPinitializations [foo]
  numeric n; n=4cm;
\stopMPinitializations
 
 What I was looking for was (it's even mentioned in the manual):
 
   \startMPdefinitions{foo}
 …
   \stopMPdefinitions
 
 That means we have:
 
 - MPdefinitions (for instance-local definitions)
 - MPinclusions  (global definitions)
 - MPinitializations (global definitions, can be disabled for an MP
 instance)
 - MPextensions  (???, seems to be the same as MPinitializations)
 
 And all four include code for use within MP graphics. That really is
 confusing!
 
  Maybe I'm missing the obvious here.
 
 Yes, I did :)

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Change font in \startuseMPgraphic

2012-06-10 Thread Wolfgang Schuster

Am 10.06.2012 um 16:25 schrieb Alfredo Catalina:

 How can I setup a font -name, size, etc- inside a startuseMPgraphic 
 environment?
  
 \startuseMPgraphic{map}
  
 \stopuseMPgraphic

- http://wiki.contextgarden.net/Command/defineMPinstance
- http://wiki.contextgarden.net/Command/setupMPinstance

Wolfgang

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Change font in \startuseMPgraphic

2012-06-10 Thread Meer, H. van der
Being interested I looked up these links in the garden.
The information given there is scarce, however.
The parameters 'extensions' and 'initializations' with values yes/no 
especially. What are they for? What is the effect of yes/no? What exactly are 
these extensions and initializations?
Is there documentation somewhere?

Thanks in advance,
Hans van der Meer



On 10 jun. 2012, at 17:25, Wolfgang Schuster wrote:


Am 10.06.2012 um 16:25 schrieb Alfredo Catalina:

How can I setup a font -name, size, etc- inside a startuseMPgraphic environment?

\startuseMPgraphic{map}

\stopuseMPgraphic

- http://wiki.contextgarden.net/Command/defineMPinstance
- http://wiki.contextgarden.net/Command/setupMPinstance

Wolfgang

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nlmailto:ntg-context@ntg.nl / 
http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Change font in \startuseMPgraphic

2012-06-10 Thread Alfredo Catalina
I'm sorry but I don't know how to use them. I've tried

\setupMPinstance [metafun] [textcolor=red]

and got an undefined control sequence error.

I've also tried

\startMPenvironment [global]
\usetypescript[palatino][ec]
\switchtobodyfont[palatino,7pt]
\stopMPenvironment

and it changed the font size but the font type is not palatino.

thanks
On Sun, Jun 10, 2012 at 5:25 PM, Wolfgang Schuster 
schuster.wolfg...@googlemail.com wrote:


 Am 10.06.2012 um 16:25 schrieb Alfredo Catalina:

  How can I setup a font -name, size, etc- inside a startuseMPgraphic
 environment?
 
  \startuseMPgraphic{map}
 
  \stopuseMPgraphic

 - http://wiki.contextgarden.net/Command/defineMPinstance
 - http://wiki.contextgarden.net/Command/setupMPinstance

 Wolfgang


 ___
 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  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net

 ___

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Change font in \startuseMPgraphic

2012-06-10 Thread Wolfgang Schuster

Am 10.06.2012 um 18:40 schrieb Alfredo Catalina:

 I'm sorry but I don't know how to use them. I've tried
  
 \setupMPinstance [metafun] [textcolor=red]
  
 and got an undefined control sequence error.
  
 I've also tried
  
 \startMPenvironment [global]
 \usetypescript[palatino][ec]
 \switchtobodyfont[palatino,7pt]
 \stopMPenvironment
  
 and it changed the font size but the font type is not palatino.

1. Do you use MkII or MkIV?

2. Do you want Palatino only for the metapost labels or also for the main font 
in the document?

Wolfgang

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Change font in \startuseMPgraphic

2012-06-10 Thread Wolfgang Schuster

Am 10.06.2012 um 18:56 schrieb Alfredo Catalina:

 1. Do you use MkII or MkIV?
 
 2. Do you want Palatino only for the metapost labels or also for the main 
 font in the document? 
 
  I am using MkIV. Whether it is possible I would like to use a different font 
 for the metapost labels.

\setupbodyfont[pagella,11pt]

%\setupMPinstance[metafun][textstyle=sans]
\setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,14pt]}]

\starttext

\input knuth

\startMPcode
draw textext(I’m different!) ;
\stopMPcode

\stoptext

Wolfgang

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Change font in \startuseMPgraphic

2012-06-10 Thread Alfredo Catalina
 \setupbodyfont[pagella,11pt]

 %\setupMPinstance[metafun][textstyle=sans]
 \setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,14pt]}]

 \starttext

 \input knuth

 \startMPcode
 draw textext(I’m different!) ;
 \stopMPcode

 \stoptext




It gives an error:

! Undefined control sequence.
system   tex  error on line 1 in file GeneraMapa.tex: Undefined
control sequence ...
1   \setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,14pt]}]
2
3 \setuppagenumbering[location=]
4 \starttext
5 \input ./mapa.tex
6 \useMPgraphic{mapa}
7 \stoptext
8
l.1 \setupMPinstance
[metafun][textstyle={\switchtobodyfont[termes,14pt]}]
?
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Change font in \startuseMPgraphic

2012-06-10 Thread Aditya Mahajan

On Sun, 10 Jun 2012, Alfredo Catalina wrote:


\setupbodyfont[pagella,11pt]

%\setupMPinstance[metafun][textstyle=sans]
\setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,14pt]}]

\starttext

\input knuth

\startMPcode
draw textext(I’m different!) ;
\stopMPcode

\stoptext





It gives an error:

! Undefined control sequence.
system   tex  error on line 1 in file GeneraMapa.tex: Undefined
control sequence ...
1   \setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,14pt]}]
2
3 \setuppagenumbering[location=]
4 \starttext
5 \input ./mapa.tex
6 \useMPgraphic{mapa}
7 \stoptext
8
l.1 \setupMPinstance
   [metafun][textstyle={\switchtobodyfont[termes,14pt]}]
?


You need to upgrade your ConTeXt installation.

Aditya___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Font for MetaPost graphics

2012-05-10 Thread Procházka Lukáš Ing . - Pontex s . r . o .

Hello,

many thanks Marco for wikifying.

On Tue, 08 May 2012 21:57:04 +0200, Marco net...@lavabit.com wrote:


Thanks a lot Hans for implementing this.

Wikified:

http://wiki.contextgarden.net/Command/defineMPinstance
http://wiki.contextgarden.net/Command/setupMPinstance


Best wishes

Marco



With the permission, I tried to replace the tag texcode with context to get 
source and result.

context mode=mkiv source=yes text=Gives:
...
/context

Unfortunately, the result doesn't appear.

So, what to do to make the example work?

Will it work automatically once the Ctx/MP engine updates on wiki?

Best regards,

Lukas


--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.  [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Font for MetaPost graphics

2012-05-08 Thread Marco
On 2012-05-08 Hans Hagen pra...@wxs.nl wrote:

 ok, can you add this to cont-new.mkiv (after \unprotect):
 
 \def\m_meta_colo_initializations{%
  vardef OverlayLineColor=\MPcolor{\overlaylinecolor} enddef;
  vardef OverlayColor=\MPcolor{\overlaycolor} enddef;
 }

That works.

 As I've used that patch for quite a while now I could probably
 move it to the core.

Since you use it for a while it seems to work ⇒ into the core

Thanks a lot Hans for implementing this.

Wikified:

http://wiki.contextgarden.net/Command/defineMPinstance
http://wiki.contextgarden.net/Command/setupMPinstance


Best wishes

Marco


___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Font for MetaPost graphics

2012-05-05 Thread Hans Hagen

On 4-5-2012 09:13, Aditya Mahajan wrote:

On Fri, 4 May 2012, Mojca Miklavec wrote:


I can think of many workarounds to this, but I agree that there is a
valid reason why
\startMPenvironment
(or some other command) should be able to change the font inside
metapost labels only.


A better alternative would to define

\setupMPtext
[
style=...,
color=...,
setups=...,
]

that can be used to set the style for metapost text.


As we already have instances, I've extended that mechanism, so one can say:

\startsetups mp:instance:one
indeed:\space
\stopsetups

\setupMPinstance
  [metafun]
  [textstyle=bold,
   textcolor=darkgreen,
   setups=mp:instance:one]

\defineMPinstance
  [mympinstance]
  [metafun]
  [textcolor=red]

\starttext

\startMPcode
draw textext(some text) ;
\stopMPcode

\startMPcode{mympinstance}
draw textext(some text) ;
\stopMPcode

\stoptext

 +1

 Marco

So .. we know who is going to wikify this ...

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] Font for MetaPost graphics

2012-05-05 Thread Aditya Mahajan

On Sat, 5 May 2012, Marco wrote:


On 2012-05-05 Hans Hagen pra...@wxs.nl wrote:

That means, MPenvironment will be dropped, right? But what is the
new interface, \setupMPtext or MPinstance?


\setupMPinstance

The advantage is that you can have multiple instances in parallel.

Aditya
___
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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___