Re: [NTG-context] About graphictext macro (Metafun)

2015-08-27 Thread Hans Hagen

On 8/26/2015 7:12 PM, Fabrice Couvreur wrote:

Hi,
I try to understand how this macro by testing a simple example. Why pdf
file is empty?
This question follows my question Cover page (Metafun)
http://www.ntg.nl/pipermail/ntg-context/2015/083078.html
Thank you.

\setuppagenumbering[location=]

\setupcolors
   [state=start]

\setMPtext{text}{MATHEMATIQUES}


\starttext
\startuseMPgraphic{test}
picture pic ;
pic := image(graphictext \MPstring{text}
withdrawcolor red
withpen pencircle scaled 1pt ; ) ;
addto currentpicture also pic ;
\stopuseMPgraphic
\stoptext


Do you have pstoedit installed?

Anyway, there is a new mechanism that doesn't depend on additional 
programs:


% outlinetext   (text) transformations ;
% outlinetext.d (text) (draw options) transformations ;
% outlinetext.f (text) (fill options) transformations ;
% outlinetext.b (text) (draw options) (fill options) transformations ;
% outlinetext.r (text) (fill options) (draw options) transformations ;

\starttext

\startMPdefinitions
let graphictext = new_graphictext ;
\stopMPdefinitions

\startMPpage

draw outlinetext.b
(\framed[align=normal]{\input{tufte}})
(withcolor .5white)
(withcolor red withpen pencircle scaled 1/10)
xsized 10cm ;

\stopMPpage

\startMPpage

draw outlinetext.r
(\framed[align=normal]{\input{tufte}})
(withcolor red withpen pencircle scaled 1/10)
(withcolor .5white)
xsized 10cm ;

\stopMPpage

\startMPpage

draw outlinetext.d
(\framed[align=normal]{\input{tufte}})
(withcolor .5white)
xsized 10cm ;

\stopMPpage

\startMPpage

picture p ; p := outlinetext.p(PX) ;

for i within p :
draw i withcolor red withpen pencircle scaled 1/10 ;
endfor ;

\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] About graphictext macro (Metafun)

2015-08-27 Thread Fabrice Couvreur
Hi Hans,

Do you have pstoedit installed ?


root@debian:/home/fab# apt-cache search pstoedit
libpstoedit0c2a - PostScript to editable vector graphics library (runtime
files)
root@debian:/home/fab#

I compile the file test.tex  with  context test.tex
Fabrice

2015-08-27 9:39 GMT+02:00 Hans Hagen pra...@wxs.nl:

 On 8/26/2015 7:12 PM, Fabrice Couvreur wrote:

 Hi,
 I try to understand how this macro by testing a simple example. Why pdf
 file is empty?
 This question follows my question Cover page (Metafun)
 http://www.ntg.nl/pipermail/ntg-context/2015/083078.html
 Thank you.

 \setuppagenumbering[location=]

 \setupcolors
[state=start]

 \setMPtext{text}{MATHEMATIQUES}


 \starttext
 \startuseMPgraphic{test}
 picture pic ;
 pic := image(graphictext \MPstring{text}
 withdrawcolor red
 withpen pencircle scaled 1pt ; ) ;
 addto currentpicture also pic ;
 \stopuseMPgraphic
 \stoptext


 Do you have pstoedit installed?

 Anyway, there is a new mechanism that doesn't depend on additional
 programs:

 % outlinetext   (text) transformations ;
 % outlinetext.d (text) (draw options) transformations ;
 % outlinetext.f (text) (fill options) transformations ;
 % outlinetext.b (text) (draw options) (fill options) transformations ;
 % outlinetext.r (text) (fill options) (draw options) transformations ;

 \starttext

 \startMPdefinitions
 let graphictext = new_graphictext ;
 \stopMPdefinitions

 \startMPpage

 draw outlinetext.b
 (\framed[align=normal]{\input{tufte}})
 (withcolor .5white)
 (withcolor red withpen pencircle scaled 1/10)
 xsized 10cm ;

 \stopMPpage

 \startMPpage

 draw outlinetext.r
 (\framed[align=normal]{\input{tufte}})
 (withcolor red withpen pencircle scaled 1/10)
 (withcolor .5white)
 xsized 10cm ;

 \stopMPpage

 \startMPpage

 draw outlinetext.d
 (\framed[align=normal]{\input{tufte}})
 (withcolor .5white)
 xsized 10cm ;

 \stopMPpage

 \startMPpage

 picture p ; p := outlinetext.p(PX) ;

 for i within p :
 draw i withcolor red withpen pencircle scaled 1/10 ;
 endfor ;

 \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

 ___
___
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] About graphictext macro (Metafun)

2015-08-26 Thread Fabrice Couvreur
 Hi,
I try to understand how this macro by testing a simple example. Why pdf file
is empty ?
This question follows my question Cover page (Metafun)
http://www.ntg.nl/pipermail/ntg-context/2015/083078.html
Thank you.

\setuppagenumbering[location=]

\setupcolors
  [state=start]

\setMPtext{text}{MATHEMATIQUES}


\starttext
\startuseMPgraphic{test}
picture pic ;
pic := image(graphictext \MPstring{text}
withdrawcolor red
withpen pencircle scaled 1pt ; ) ;
addto currentpicture also pic ;
\stopuseMPgraphic
\stoptext
___
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] Cover page (Metafun)

2015-08-14 Thread Fabrice Couvreur
Hi Hans,
To progress in the use of Metafun, I try to do the same cover page as
your document
'Metafun . Without looking at the code (but using the definitions of your
colors), I managed to get the mosaic.
I would write the word MATHÉMATIQUES as you did with the word CONTEXTEN.
Thank you,
Fabrice


\setuppagenumbering[location=]

\setupcolors
  [state=start]

\definecolor[maincolor][g=.6]
\definecolor[pagecolor][s=.6]
\definecolor[darkcolor][s=.2]
\definecolor[textcolor][r=.6]


\startMPinclusions
  color maincolor ; maincolor := \MPcolor{maincolor} ;
  color pagecolor ; pagecolor := \MPcolor{pagecolor} ;
  color darkcolor ; darkcolor := \MPcolor{darkcolor} ;
  color textcolor ; textcolor := \MPcolor{textcolor} ;
\stopMPinclusions

\startuseMPgraphic{CoverPage}
  path p ; p := OverlayBox xyscaled (1/2,1/7) ;
  fill OverlayBox withcolor pagecolor ;
  path q ; q := p enlarged -12pt randomized 12pt ;
  pair a ;
  for j=0 upto 6 :
 for i=0 upto 1 :
a := (i*xpart urcorner p,j*ypart urcorner p) ;
q := p enlarged -12pt randomized 12pt shifted a ;
circular_shade
  (q, ceiling(uniformdeviate 4), maincolor, .5maincolor) ;
   draw q withpen pencircle scaled 8pt withcolor darkcolor ;
  endfor ;
endfor ;
\stopuseMPgraphic

\defineoverlay[CoverPage][\useMPgraphic{CoverPage}]

\setupbackgrounds
  [rightpage]
  [background=CoverPage]

\starttext

\stoptext
___
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] Command that does not give the expected result (Metafun)

2015-08-11 Thread Fabrice Couvreur
Hi Wolfgang,
I will follow your advice but I will try to understand, when I have the time
, the difference between
\unexpanded\def\ChapterCommand#1#2% et \def\ChapterCommand#1#2%.
Fabrice

2015-08-10 22:38 GMT+02:00 Wolfgang Schuster schuster.wolfg...@gmail.com:

 Fabrice Couvreur fabrice1.couvr...@gmail.com
 10. August 2015 09:13
 Dear Hans,
 I tested without understanding what \unexpanded, and of course it works !

 You can use ConTeXt’s \define command where you don’t have to think about
 \unexpanded etc., e.g.

 \define[2]\ChapterCommand
   {\setbox\scratchbox\hbox to \leftmarginwidth{#1\hss}%
\hskip-\dimexpr\leftmarginwidth+\leftmargindistance\relax
\framed
  [background=titled,frame=off,offset=0pt]
  {\box\scratchbox
   \hskip\leftmargindistance
   #2}}

 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] Command that does not give the expected result (Metafun)

2015-08-10 Thread Wolfgang Schuster

Fabrice Couvreur mailto:fabrice1.couvr...@gmail.com
10. August 2015 09:13
Dear Hans,
I tested without understanding what \unexpanded, and of course it works!

You can use ConTeXt’s \define command where you don’t have to think 
about \unexpanded etc., e.g.


\define[2]\ChapterCommand
  {\setbox\scratchbox\hbox to \leftmarginwidth{#1\hss}%
   \hskip-\dimexpr\leftmarginwidth+\leftmargindistance\relax
   \framed
 [background=titled,frame=off,offset=0pt]
 {\box\scratchbox
  \hskip\leftmargindistance
  #2}}

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] Command that does not give the expected result (Metafun)

2015-08-10 Thread Fabrice Couvreur
Dear Hans,
I tested without understanding what \unexpanded, and of course it works !
Thank you,
Fabrice

2015-08-09 15:40 GMT+02:00 Hans Hagen pra...@wxs.nl:

 On 8/9/2015 1:27 PM, Fabrice Couvreur wrote:

 Hi Hans,
 In the document Metafun, you use commands that I like, and I try to
 understand the definition and operation, which is not always easy with
 TeX commands.
 Also, in the following code, this does not give the expected result.
 Thank you.
 Fabrice

 \showframe

 \setupcolors
[state=start]

 \setuppagenumbering[location=,alternative]

 \startuniqueMPgraphic{titled}
 path p ;
 p := unitsquare xscaled OverlayWidth yscaled OverlayHeight ;
 pickup pencircle scaled 1mm ;
 drawoptions(withcolor .625yellow) ;
 draw llcorner p--lrcorner p ;
 setbounds currentpicture to p ;
 \stopuniqueMPgraphic

 \defineoverlay[titled][\uniqueMPgraphic{titled}]

 \def\ChapterCommand#1#2%
{\setbox0=\hbox to \leftmarginwidth{#1\hss}%
 \hskip-\leftmarginwidth
 \hskip-\leftmargindistance
 \framed
   [background=titled,frame=off,offset=0pt]
   {\box0
\hskip\leftmargindistance
#2}}

 \setuphead
[chapter,section,subsection]
[command=\ChapterCommand,
 color=darkred]

 \starttext
 \chapter{First}
 \section{First}
 \subsection{First}
 \stoptext


 \unexpanded\def\ChapterCommand#1#2%

 -
   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

 ___
___
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] Command that does not give the expected result (Metafun)

2015-08-09 Thread Fabrice Couvreur
Hi Hans,
In the document Metafun, you use commands that I like, and I try to
understand the definition and operation, which is not always easy with TeX
commands.
Also, in the following code, this does not give the expected result.
Thank you.
Fabrice

\showframe

\setupcolors
  [state=start]

\setuppagenumbering[location=,alternative]

\startuniqueMPgraphic{titled}
path p ;
p := unitsquare xscaled OverlayWidth yscaled OverlayHeight ;
pickup pencircle scaled 1mm ;
drawoptions(withcolor .625yellow) ;
draw llcorner p--lrcorner p ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic

\defineoverlay[titled][\uniqueMPgraphic{titled}]

\def\ChapterCommand#1#2%
  {\setbox0=\hbox to \leftmarginwidth{#1\hss}%
   \hskip-\leftmarginwidth
   \hskip-\leftmargindistance
   \framed
 [background=titled,frame=off,offset=0pt]
 {\box0
  \hskip\leftmargindistance
  #2}}

\setuphead
  [chapter,section,subsection]
  [command=\ChapterCommand,
   color=darkred]

\starttext
\chapter{First}
\section{First}
\subsection{First}
\stoptext


ntg29.pdf
Description: Adobe PDF document
___
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] Command that does not give the expected result (Metafun)

2015-08-09 Thread Hans Hagen

On 8/9/2015 1:27 PM, Fabrice Couvreur wrote:

Hi Hans,
In the document Metafun, you use commands that I like, and I try to
understand the definition and operation, which is not always easy with
TeX commands.
Also, in the following code, this does not give the expected result.
Thank you.
Fabrice

\showframe

\setupcolors
   [state=start]

\setuppagenumbering[location=,alternative]

\startuniqueMPgraphic{titled}
path p ;
p := unitsquare xscaled OverlayWidth yscaled OverlayHeight ;
pickup pencircle scaled 1mm ;
drawoptions(withcolor .625yellow) ;
draw llcorner p--lrcorner p ;
setbounds currentpicture to p ;
\stopuniqueMPgraphic

\defineoverlay[titled][\uniqueMPgraphic{titled}]

\def\ChapterCommand#1#2%
   {\setbox0=\hbox to \leftmarginwidth{#1\hss}%
\hskip-\leftmarginwidth
\hskip-\leftmargindistance
\framed
  [background=titled,frame=off,offset=0pt]
  {\box0
   \hskip\leftmargindistance
   #2}}

\setuphead
   [chapter,section,subsection]
   [command=\ChapterCommand,
color=darkred]

\starttext
\chapter{First}
\section{First}
\subsection{First}
\stoptext


\unexpanded\def\ChapterCommand#1#2%

-
  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] Some questions about an environment (Metafun)

2015-08-07 Thread Fabrice Couvreur
Hi Hans,
Thank you for responding to my request, it's really nice. By cons I do not
understand what you mean 
some day textext might handle it okay
Fabrice

2015-08-07 14:26 GMT+02:00 Hans Hagen pra...@wxs.nl:

 On 8/6/2015 11:38 PM, Fabrice Couvreur wrote:

 Hi,
 The following code (Metafun documentation, thanks again Hans !) is fully
 understood and works very well. Sorry if I insist, but can we create a
 counter to avoid writing \FrameTitle{Définition 1},
 \FrameTitle{Définition 2}... ?
 Thus, the only invocation \startMyText ... \stopMyText, \startMyText ...
 \stopMyText... this return Définition 1, Définition 2 ...

 Thank you,
 Fabrice


 \setupbodyfont [palatino,11pt]

 \setupcolors[state=start,cmyk=yes]

 \definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
 \definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]

 \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

 \defineframedtext
 [MyText]
 [frame=off,
  background=MyFrame,
  width=\textwidth,
  location=right]

 \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

 \def\StartFrame{\startMyText}
 \def\StopFrame{\startMyText}

 \def\FrameTitle#1{\setMPtext{MyFrame}{\hbox spread
 1em{\hss\strut{\bf\feature[+][f:smallcaps]}#1\hss}}}

 \setMPtext{MyFrame}{}

 \startuseMPgraphic{MyFrame}
 path a ;
 path b ;
 picture p ;
 o := BodyFontSize ;
 p :=textext.rt(\MPstring{MyFrame}) ;
 p := p shifted (2o,OverlayHeight-ypart center p) ;
 a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
 fill a withcolor \MPcolor{MyColor} ;
 b := boundingbox p ;
 fill b withcolor \MPcolor{myColor} ;
 draw p withcolor white ;
 \stopuseMPgraphic
 \starttext
 \FrameTitle{Définition 1}
 \startMyText
 \input knuth
 \stopMyText
 \FrameTitle{Définition 2}
 \startMyText
 \input knuth
 \stopMyText
 \stoptext


 \setupbodyfont [palatino,11pt]

 \definecolor[MyColorB][c=0.00, m=0.62, y=1.00, k=0.00]
 \definecolor[MyColorA][.75(MyColorB,white)]  %c=0.00, m=0.10, y=0.20,
 k=0.00]

 \defineframedtext
   [MyText]
   [frame=off,
background=MyFrame,
width=\textwidth,
location=right]

 \defineoverlay
   [MyFrame]
   [\useMPgraphic{MyFrame}]

 \definelabel
   [Définition]
   [headstyle=\bf\smallcaps]

 \startuseMPgraphic{MyFrame}
 path b ;
 picture p ;
 p := textext.rt(\white\Définition) ; % some day textext might handle
 it okay
 p := p shifted (2BodyFontSize,OverlayHeight-ypart center
 p+.25ExHeight) ;
 b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth ;
 fill OverlayBox withcolor \MPcolor{MyColorA} ;
 fill b withcolor \MPcolor{MyColorB} ;
 draw p ;
 \stopuseMPgraphic

 \starttext

 \startMyText
 \input knuth
 \stopMyText

 \startMyText
 \input knuth
 \stopMyText

 \stoptext

 2015-08-04 21:30 GMT+02:00 Fabrice Couvreur fabrice1.couvr...@gmail.com
 mailto:fabrice1.couvr...@gmail.com:

 Hi Aditya,
 Thank you, I have already thought of this solution, but I do not
 know to use with the environment that I created.
 Fabrice

 2015-08-04 18:02 GMT+02:00 Aditya Mahajan adit...@umich.edu
 mailto:adit...@umich.edu:

 On Tue, 4 Aug 2015, Fabrice Couvreur wrote:

 How to have Definition 1, Definition 2, Definition 3 ... ?


 \defineenumeration[definition][text=Definition]

 Aditya

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

 maillist : ntg-context@ntg.nl mailto: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

 ___



 --

 -
   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

Re: [NTG-context] Some questions about an environment (Metafun)

2015-08-07 Thread Hans Hagen

On 8/6/2015 11:38 PM, Fabrice Couvreur wrote:

Hi,
The following code (Metafun documentation, thanks again Hans !) is fully
understood and works very well. Sorry if I insist, but can we create a
counter to avoid writing \FrameTitle{Définition 1},
\FrameTitle{Définition 2}... ?
Thus, the only invocation \startMyText ... \stopMyText, \startMyText ...
\stopMyText... this return Définition 1, Définition 2 ...
Thank you,
Fabrice


\setupbodyfont [palatino,11pt]

\setupcolors[state=start,cmyk=yes]

\definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
\definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]

\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\defineframedtext
[MyText]
[frame=off,
 background=MyFrame,
 width=\textwidth,
 location=right]

\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\def\StartFrame{\startMyText}
\def\StopFrame{\startMyText}

\def\FrameTitle#1{\setMPtext{MyFrame}{\hbox spread
1em{\hss\strut{\bf\feature[+][f:smallcaps]}#1\hss}}}

\setMPtext{MyFrame}{}

\startuseMPgraphic{MyFrame}
path a ;
path b ;
picture p ;
o := BodyFontSize ;
p :=textext.rt(\MPstring{MyFrame}) ;
p := p shifted (2o,OverlayHeight-ypart center p) ;
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
fill a withcolor \MPcolor{MyColor} ;
b := boundingbox p ;
fill b withcolor \MPcolor{myColor} ;
draw p withcolor white ;
\stopuseMPgraphic
\starttext
\FrameTitle{Définition 1}
\startMyText
\input knuth
\stopMyText
\FrameTitle{Définition 2}
\startMyText
\input knuth
\stopMyText
\stoptext



\setupbodyfont [palatino,11pt]

\definecolor[MyColorB][c=0.00, m=0.62, y=1.00, k=0.00]
\definecolor[MyColorA][.75(MyColorB,white)]  %c=0.00, m=0.10, y=0.20, 
k=0.00]


\defineframedtext
  [MyText]
  [frame=off,
   background=MyFrame,
   width=\textwidth,
   location=right]

\defineoverlay
  [MyFrame]
  [\useMPgraphic{MyFrame}]

\definelabel
  [Définition]
  [headstyle=\bf\smallcaps]

\startuseMPgraphic{MyFrame}
path b ;
picture p ;
p := textext.rt(\white\Définition) ; % some day textext might 
handle it okay
p := p shifted (2BodyFontSize,OverlayHeight-ypart center 
p+.25ExHeight) ;

b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth ;
fill OverlayBox withcolor \MPcolor{MyColorA} ;
fill b withcolor \MPcolor{MyColorB} ;
draw p ;
\stopuseMPgraphic

\starttext

\startMyText
\input knuth
\stopMyText

\startMyText
\input knuth
\stopMyText

\stoptext


2015-08-04 21:30 GMT+02:00 Fabrice Couvreur fabrice1.couvr...@gmail.com
mailto:fabrice1.couvr...@gmail.com:

Hi Aditya,
Thank you, I have already thought of this solution, but I do not
know to use with the environment that I created.
Fabrice

2015-08-04 18:02 GMT+02:00 Aditya Mahajan adit...@umich.edu
mailto:adit...@umich.edu:

On Tue, 4 Aug 2015, Fabrice Couvreur wrote:

How to have Definition 1, Definition 2, Definition 3 ... ?


\defineenumeration[definition][text=Definition]

Aditya

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

maillist : ntg-context@ntg.nl mailto: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
___




--

-
  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] Some questions about an environment (Metafun)

2015-08-06 Thread Fabrice Couvreur
Hi,
The following code (Metafun documentation, thanks again Hans !) is fully
understood and works very well. Sorry if I insist, but can we create a
counter to avoid writing \FrameTitle{Définition 1},
\FrameTitle{Définition 2}... ?
Thus, the only invocation \startMyText ... \stopMyText,  \startMyText ... \
stopMyText ... this return Définition 1, Définition 2 ...
Thank you,
Fabrice


\setupbodyfont [palatino,11pt]

\setupcolors[state=start,cmyk=yes]

\definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
\definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]

\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\defineframedtext
   [MyText]
   [frame=off,
background=MyFrame,
width=\textwidth,
location=right]

\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\def\StartFrame{\startMyText}
\def\StopFrame{\startMyText}

\def\FrameTitle#1{\setMPtext{MyFrame}{\hbox spread
1em{\hss\strut{\bf\feature[+][f:smallcaps]}#1\hss}}}

\setMPtext{MyFrame}{}

\startuseMPgraphic{MyFrame}
path a ;
path b ;
picture p ;
o := BodyFontSize ;
p :=textext.rt(\MPstring{MyFrame}) ;
p := p shifted (2o,OverlayHeight-ypart center p) ;
a := unitsquare xyscaled (OverlayWidth,OverlayHeight) ;
fill a withcolor \MPcolor{MyColor} ;
b := boundingbox p ;
fill b withcolor \MPcolor{myColor} ;
draw p withcolor white ;
\stopuseMPgraphic
\starttext
\FrameTitle{Définition 1}
\startMyText
\input knuth
\stopMyText
\FrameTitle{Définition 2}
\startMyText
\input knuth
\stopMyText
\stoptext


2015-08-04 21:30 GMT+02:00 Fabrice Couvreur fabrice1.couvr...@gmail.com:

 Hi Aditya,
 Thank you, I have already thought of this solution, but I do not know to
 use with the environment that I created.
 Fabrice

 2015-08-04 18:02 GMT+02:00 Aditya Mahajan adit...@umich.edu:

 On Tue, 4 Aug 2015, Fabrice Couvreur wrote:

 How to have Definition 1, Definition 2, Definition 3 ... ?


 \defineenumeration[definition][text=Definition]

 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

 ___



___
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] Some questions about an environment (Metafun)

2015-08-04 Thread Fabrice Couvreur
 Hi,
How to have Definition 1, Definition 2, Definition 3 ... ?

Is it possible to translate the image p until the left edge of the text area
?

Thank you,
Fabrice

\showframe

\setupcolors[state=start,cmyk=yes]

\definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
\definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]

\setupbodyfont[11pt]
\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\defineframedtext
   [MyText]
   [frame=off,
background=MyFrame,
width=0.9\textwidth,
location=right]

\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\def\StartFrame{\startMyText}
\def\StopFrame{\startMyText}

\setMPtext{MyFrame}{\hbox spread 1em {\hss\strut
{\bf\feature[+][f:smallcaps]  Définition 1 }\hss}}}

\startuseMPgraphic{MyFrame}

path a ;
path b ;
picture p ;
o := BodyFontSize ;
p :=textext.rt(\MPstring{MyFrame}) ;
p := p shifted (0,OverlayHeight-ypart center p) ;
a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ;
fill a withcolor \MPcolor{MyColor} ;
b := boundingbox p ;
fill b withcolor \MPcolor{myColor} ;
draw p withcolor white ;

\stopuseMPgraphic

\starttext
\startlinecorrection[blank]
\startMyText
\input knuth
\stopMyText
\stoplinecorrection

\startlinecorrection[blank]
\startMyText
\input knuth
\stopMyText
\stoplinecorrection

\stoptext
___
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] Some questions about an environment (Metafun)

2015-08-04 Thread Hans Hagen

On 8/4/2015 5:04 PM, Fabrice Couvreur wrote:

Hi,
How to have Definition 1, Definition 2, Definition 3 ...?

Is it possible to translate the image p until the left edge of the text
area ?



\startuseMPgraphic{MyFrame}
picture p ;
p := textext.rt(\MPstring{MyFrame}) ;
p := p shifted (0,OverlayHeight-ypart center p) ;
fill OverlayBox leftenlarged .1TextWidth withcolor \MPcolor{MyColor} ;
fill boundingbox p withcolor \MPcolor{myColor} ;
draw p withcolor white ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic




Thank you,
Fabrice

\showframe

\setupcolors[state=start,cmyk=yes]

\definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
\definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]

\setupbodyfont[11pt]
\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\defineframedtext
[MyText]
[frame=off,
 background=MyFrame,
 width=0.9\textwidth,
 location=right]

\defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

\def\StartFrame{\startMyText}
\def\StopFrame{\startMyText}

\setMPtext{MyFrame}{\hbox spread 1em {\hss\strut
{\bf\feature[+][f:smallcaps]  Définition 1 }\hss}}}

\startuseMPgraphic{MyFrame}

path a ;
path b ;
picture p ;
o := BodyFontSize ;
p :=textext.rt(\MPstring{MyFrame}) ;
p := p shifted (0,OverlayHeight-ypart center p) ;
a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ;
fill a withcolor \MPcolor{MyColor} ;
b := boundingbox p ;
fill b withcolor \MPcolor{myColor} ;
draw p withcolor white ;

\stopuseMPgraphic

\starttext
\startlinecorrection[blank]
\startMyText
\input knuth
\stopMyText
\stoplinecorrection

\startlinecorrection[blank]
\startMyText
\input knuth
\stopMyText
\stoplinecorrection

\stoptext


___
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
___




--

-
  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] Some questions about an environment (Metafun)

2015-08-04 Thread Fabrice Couvreur
Hi Hans,
Thank you for your suggestion, but it's not what I want, but I probably
misstated my request. For me, the image p contains the text Définition 1, and
this is what I want orange rectangle translate to the left edge of the text
area.
Am I more clearly ?
Fabrice

2015-08-04 20:08 GMT+02:00 Hans Hagen pra...@wxs.nl:

 On 8/4/2015 5:04 PM, Fabrice Couvreur wrote:

 Hi,
 How to have Definition 1, Definition 2, Definition 3 ...?

 Is it possible to translate the image p until the left edge of the text
 area ?



 \startuseMPgraphic{MyFrame}
 picture p ;
 p := textext.rt(\MPstring{MyFrame}) ;
 p := p shifted (0,OverlayHeight-ypart center p) ;
 fill OverlayBox leftenlarged .1TextWidth withcolor \MPcolor{MyColor} ;
 fill boundingbox p withcolor \MPcolor{myColor} ;
 draw p withcolor white ;
 setbounds currentpicture to OverlayBox ;
 \stopuseMPgraphic



 Thank you,
 Fabrice

 \showframe

 \setupcolors[state=start,cmyk=yes]

 \definecolor[MyColor][c=0.00, m=0.10, y=0.20, k=0.00]
 \definecolor[myColor][c=0.00, m=0.62, y=1.00, k=0.00]

 \setupbodyfont[11pt]
 \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

 \defineframedtext
 [MyText]
 [frame=off,
  background=MyFrame,
  width=0.9\textwidth,
  location=right]

 \defineoverlay[MyFrame][\useMPgraphic{MyFrame}]

 \def\StartFrame{\startMyText}
 \def\StopFrame{\startMyText}

 \setMPtext{MyFrame}{\hbox spread 1em {\hss\strut
 {\bf\feature[+][f:smallcaps]  Définition 1 }\hss}}}

 \startuseMPgraphic{MyFrame}

 path a ;
 path b ;
 picture p ;
 o := BodyFontSize ;
 p :=textext.rt(\MPstring{MyFrame}) ;
 p := p shifted (0,OverlayHeight-ypart center p) ;
 a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ;
 fill a withcolor \MPcolor{MyColor} ;
 b := boundingbox p ;
 fill b withcolor \MPcolor{myColor} ;
 draw p withcolor white ;

 \stopuseMPgraphic

 \starttext
 \startlinecorrection[blank]
 \startMyText
 \input knuth
 \stopMyText
 \stoplinecorrection

 \startlinecorrection[blank]
 \startMyText
 \input knuth
 \stopMyText
 \stoplinecorrection

 \stoptext



 ___
 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

 ___



 --

 -
   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

 ___

___
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] Some questions about an environment (Metafun)

2015-08-04 Thread Aditya Mahajan

On Tue, 4 Aug 2015, Fabrice Couvreur wrote:


How to have Definition 1, Definition 2, Definition 3 ... ?


\defineenumeration[definition][text=Definition]

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
___

[NTG-context] [MetaFun] Decorating running text

2015-03-18 Thread Norbert Melzer
Hi there!

I have some text (a single word) which I want to decorate using MP.

In this special case, I want to put a little crown above the g in the
word Shogun. Also the crown and text should get scaled accordingly to the
surrounding text.

```tex
\define\Shogun{\startMPcode draw textext(Shogun) \stopMPcode}

\starttext
  The word \Shogun\ shall be decorated with the crown shown in
fig~\in[fig:crown]:

  \placefigure[here][fig:crown]{The crown that shall decorate the \quote{g}
in \quotation{Shogun}}{
  \startMPcode
fill
(-20,-17.5)--(20,-17.5)--(30,12.5)--(10,-2.5)--(0,17.5)--(-10,-2.5)--(-30,12.5)--cycle
  withcolor yellow ;
  \stopMPcode }
\stoptext
```

I wanted to try to draw the text using MPs draw, but then the baselines
doesn't match as you can see in the example. Also I don't know how I could
ensure that the text and the crown would crow accordingly to the
surrounding text.
___
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] Problem in using vlingrid() and hlingrid() macros (Metafun)

2015-03-15 Thread Fabrice

Hi,
To solve my problem, I finally used a loop to draw a grid.
Fabrice

\starttext
\start
\switchtobodyfont[small]
\startMPcode
 path p ;
 u := 2cm ; v:= 1cm ;
 p := (-u,-5v)--(3u,-5v)--(3u,4v)--(-u,4v)--cycle ;
 drawoptions(withpen pencircle scaled 0.5pt withcolor 
\MPcolor{mycolor});

 for i=-u step u until 3u :
 draw (i,-5v)--(i,4v) ;
 endfor ;
 for i=-5v step v until 4v :
 draw (-u,i)--(3u,i) ;
 endfor ;
 drawoptions(withpen pencircle scaled 1pt) ;
 drawarrow (-u,0)--(3u,0) ;
 drawarrow (0,-5v)--(0,4v) ;
 draw (u,-0.05v)--(u,0.05v) ;
 draw (-0.025u,v)--(0.025u,v) ;
 draw curvedfunction (x, 3*x*x-5*x+1, -1, 3, 0.01) xyscaled 
(u,v) withcolor red ;
 draw curvedfunction (x, -5*x+1, -1, 3, 0.01) xyscaled (u,v) 
withcolor blue ;
 draw curvedfunction (x, 7*x-11, -1, 3, 0.01) xyscaled (u,v) 
withcolor green ;

 label.bot(btex $x$ etex,(2.97u,-0.1v)) ;
 label.rt(btex $y$ etex,(0.01u,3.9v)) ;
 label.llft(0,(0,0)) ;
 label.urt(A,(0,v)) ;
 dotlabel(,(u,-4v)) ;
 label.rt(C,(1.02u,-4v)) ;
 dotlabel.lrt(B,(2u,3v)) ;
 label.bot(1,(u,0)) ;
 label.lft(1,(0,v)) ;
 clip currentpicture to p ;
\stopMPcode
\stop
\stoptext
___
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] Problem in using vlingrid() and hlingrid() macros (Metafun)

2015-03-14 Thread Fabrice Couvreur
Hi,
I encounter some problems in the use of vlingrid() and hlingrid() macros. In
the code below, we see that the grid is not correct.
Does the code can be improved ?
thank you,
Fabrice

\starttext
\startMPcode
 path p ;
 u := 2cm ; v:= 1cm ;
 p := (-u,-5v)--(3u,-5v)--(3u,4v)--(-u,4v)--cycle ;
 drawoptions(withpen pencircle scaled 0.5pt withcolor
\MPcolor{mycolor});
 draw vlingrid(-u,3u,u,4u,9v) shifted (0,-5v) ;
 draw hlingrid(-5v,4v,v,9v,4u)  shifted (-u,0)  ;
 drawoptions(withpen pencircle scaled 1pt) ;
 drawarrow (-u,0)--(3u,0) ;
 drawarrow (0,-5v)--(0,4v) ;
   draw curvedfunction (x, 3*x*x-5*x+1, -1, 3, 0.01) xyscaled (u,v)
withcolor red ;
 draw curvedfunction (x, -5*x+1, -1, 3, 0.01) xyscaled (u,v)
withcolor blue ;
 draw curvedfunction (x, 7*x-11, -1, 3, 0.01) xyscaled (u,v)
withcolor green ;
 label.bot(btex $x$ etex,(2.97u,-0.1v)) ;
 label.rt(btex $y$ etex,(0.01u,3.9v)) ;
 label.llft(0,(0,0)) ;
 dotlabel.urt(A,(0,v)) ;
 dotlabel(,(u,-4v)) ;
 label.rt(C,(1.02u,-4v)) ;
 dotlabel.lrt(B,(2u,3v)) ;
 label.bot(1,(u,0)) ;
 label.lft(1,(0,v)) ;
 clip currentpicture to p ;
\stopMPcode
\stoptext
___
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] Add labels to a grid (Metafun)

2015-03-06 Thread Fabrice Couvreur
To add labels to a grid, Hans wrote a macro hlintext (Min, Max, Step, Lenght
, Format). I do not know what to put in Format.
Best regards,
Fabrice

\definecolor[mycolor][c=.4,m=0,y=0,k=0]
\starttext
\start
\switchtobodyfont[small]
\startMPcode
 input tex;
 numeric xmin, xmax, ymin, ymax;
 xmin := 0; xmax := 22; ymax :=460 ;ymin:=0; u := 0.5cm; v:= 0.025cm;
 drawoptions(withpen pencircle scaled 0.5pt withcolor
\MPcolor{mycolor});
 draw hlingrid(ymin,ymax,20,11.5cm,11cm);
 draw vlingrid(xmin,xmax,2,11cm,11.5cm);
 drawoptions(withpen pencircle scaled 1pt) ;
 drawarrow (0,0)--(22,0) scaled u ;
 drawarrow (0,0)--(0,460) scaled v ;
 for i=0 step 2 until 20 :
label.bot(TEX($decimal(i)$),(i,0)*u);
 endfor;
 for i=0 step 20 until 440:
label.lft(TEX($decimal(i)$),(0,i)*v);
  endfor;
 label.bot( $x$,(10.8cm,-0.1cm)) ;
 label.rt( $y$,(0.1cm,11.3cm)) ;

\stopMPcode
\stop
\stoptext
___
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] Add labels to a grid (Metafun)

2015-03-06 Thread Fabrice
thank you very much Alain, I think I understood for the format @d but 
for other formats, I will need documentation.

Fabrice

\definecolor[mycolor][c=.4,m=0,y=0,k=0]

\starttext
\start
\switchtobodyfont[small]
\startMPcode
 xmin := 0; xmax := 22; ymax :=460 ;ymin:=0; u := 0.5cm; v:= 0.025cm;
 drawoptions(withpen pencircle scaled 0.5pt withcolor 
\MPcolor{mycolor});

 draw hlingrid(ymin,ymax,20,11.5cm,11cm);
 draw vlingrid(xmin,xmax,2,11cm,11.5cm);
 drawoptions(withpen pencircle scaled 1pt) ;
 drawarrow (0,0)--(22,0) scaled u ;
 drawarrow (0,0)--(0,460) scaled v ;
 draw vlintext(0,20,2,10cm,@d) shifted (0,-0.25cm) ;
 draw hlintext(0,420,20,11cm,@d) shifted (-0.35cm,0) ;
 label.bot( $x$,(10.8cm,-0.1cm)) ;
 label.lft( $y$,(-0.1cm,11.4cm)) ;
\stopMPcode
\stop
\stoptext

___
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] Add labels to a grid (Metafun)

2015-03-06 Thread Alan BRASLAU
On Fri, 6 Mar 2015 18:15:09 +0100
Fabrice Couvreur fabrice1.couvr...@gmail.com wrote:

 To add labels to a grid, Hans wrote a macro hlintext (Min, Max, Step,
 Lenght, Format). I do not know what to put in Format.

it is a string format specifier such as %g, %f, %d, ...
Since the % can sometimes cause problems being interpreted as a comment
character, it is usually replaced in Metafun by @, as in @g.

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] Hatch an area with Metapost (Metafun)

2015-02-17 Thread Fabrice

Hi John,
That's what I thought, some macros work indifferently in Metafun or 
Metapost, others not.

Thank you for the interest in my question.
Fabrice
___
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] Hatch an area with Metapost (Metafun)

2015-02-17 Thread John Kitzmiller
On Feb 16, 2015, at 3:21 PM, Fabrice Couvreur wrote:
 
 This does not work with :
 
 labeloffset := 2mm;



On Feb 09, 2015, Hans Hagen wrote:

\startMPpage[offset=2pt]
 path p, q, r ; pair z ;
 p := unitsquare scaled 4cm ;
 z := point 3.6 of p ;
 q := z--urcorner p ;
 r := q -- reverse bottomboundary p -- cycle ;
 draw p ;
 draw q ;
 draw r numberstriped (.25,10,5) withcolor blue ;
 draw thetextext.llft(B, llcorner p) ;
 draw thetextext.lrt (C, lrcorner p) ;
 draw thetextext.ulft(A, ulcorner p) ;
 draw thetextext.urt (D, urcorner p) ;
 draw thetextext.lft (M, z) ;
\stopMPpage
Hello Fabrice,

labeloffset does not work with Hans’ code above using ‘draw thetextext’ for 
labels. It works with the label macro:

\startMPpage[offset=2mm]
 path p, q, r ; pair z ;
 p := unitsquare scaled 4cm ;
 z := point 3.6 of p ;
 q := z--urcorner p ;
 r := q -- reverse bottomboundary p -- cycle ;
 draw p ;
 draw q ;
 draw r numberstriped (.25,10,5) withcolor blue ;
 labeloffset := 2mm ;
 label.llft(B, llcorner p) ;
 label.lrt (C, lrcorner p) ;
 label.ulft(A, ulcorner p) ;
 label.urt (D, urcorner p) ;
 label.lft (M, z) ;
 \stopMPpage

John

___
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] Bug with macro tightfunction (Metafun)

2015-02-16 Thread Fabrice Couvreur
 Hi,
This code generates an error while it was working fine a month ago.
Best regards,
Fabrice

\definecolor[mycolor][c=.4,m=0,y=0,k=0]

\starttext
\start
\switchtobodyfont[small]
\startMPcode
 input hvdm;
 input tex;
 l:=3mm; r:=0.6; alfa:=45; beta:=0; gamma:=0;
 defineDefaultArrow (l, r, alfa, beta, gamma);
 numeric xmin, xmax, ymin, ymax;
 xmin := 0; xmax := 110; ymax :=8000 ;ymin:=0; u := 0.1cm; v:= 0.002cm;
 color mycolor; mycolor:=(0.4,0,0);
 drawoptions(withpen pencircle scaled 0.3pt withcolor
\MPcolor{mycolor});
 draw hlingrid(ymin,ymax,1000,16cm,11cm);
 draw vlingrid(xmin,xmax,10,11cm,16cm);
 pickup pencircle scaled 1pt ;
 arrowline ((xmin,0) -- (xmax,0)) scaled u;
 arrowline ((0,ymin) -- (0,ymax)) scaled v;
 drawoptions(withpen pencircle scaled 1pt);
 draw tightfunction (x, x*x-84*x+5000, 0, 100, 0.01) xyscaled (u,v);
 for i=0 step 10 until 100:
 label.bot(TEX($decimal(i)$),(i*u,0));
 endfor;
 for i=0 step 1000 until 7000:
 label.lft(TEX($decimal(i)$),(0,i*v));
  endfor;
   label.top(Nombre de lots,(90u,50v));
   label.lrt(btex $f(x)$ (en euros) etex,(0,7800v));
\stopMPcode
\stop
\stoptext
___
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] Hatch an area with Metapost (Metafun)

2015-02-16 Thread Fabrice

Hi,
This does not work with :

labeloffset := 2mm;

Fabrice

___
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] Bug with macro tightfunction (Metafun)

2015-02-16 Thread Pablo Rodriguez
On 02/16/2015 06:00 PM, Fabrice Couvreur wrote:
 Hi,
 This code generates an error while it was working fine a month ago.

Hi Fabrice,

MP is too much fun for me ;-)). I mean, this is all Greek to me.

I can only report that I get an empty page with both the latest beta
from 2015.02.03 23:55 and beta from 2014.11.26 21:43.

Just in case it might help,


Pablo


 \definecolor[mycolor][c=.4,m=0,y=0,k=0]
 
 \starttext
 \start
 \switchtobodyfont[small]
 \startMPcode
  input hvdm;
  input tex;
  l:=3mm; r:=0.6; alfa:=45; beta:=0; gamma:=0;
  defineDefaultArrow (l, r, alfa, beta, gamma);
  numeric xmin, xmax, ymin, ymax;
  xmin := 0; xmax := 110; ymax :=8000 ;ymin:=0; u := 0.1cm; v:= 0.002cm;
  color mycolor; mycolor:=(0.4,0,0);
  drawoptions(withpen pencircle scaled 0.3pt withcolor
 \MPcolor{mycolor});
  draw hlingrid(ymin,ymax,1000,16cm,11cm);
  draw vlingrid(xmin,xmax,10,11cm,16cm);
  pickup pencircle scaled 1pt ;
  arrowline ((xmin,0) -- (xmax,0)) scaled u;
  arrowline ((0,ymin) -- (0,ymax)) scaled v;
  drawoptions(withpen pencircle scaled 1pt);
  draw tightfunction (x, x*x-84*x+5000, 0, 100, 0.01) xyscaled (u,v);
  for i=0 step 10 until 100:
  label.bot(TEX($decimal(i)$),(i*u,0));
  endfor;
  for i=0 step 1000 until 7000:
  label.lft(TEX($decimal(i)$),(0,i*v));
   endfor;
label.top(Nombre de lots,(90u,50v));
label.lrt(btex $f(x)$ (en euros) etex,(0,7800v));
 \stopMPcode
 \stop
 \stoptext


-- 
http://www.ousia.tk
___
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] Bug with macro tightfunction (Metafun)

2015-02-16 Thread Hans Hagen

On 2/16/2015 6:00 PM, Fabrice Couvreur wrote:

Hi,
This code generates an error while it was working fine a month ago.


tightfunction was redundant, use curvedfunction instead

(I have been cleaning up all that code as a prelude to an updat efor the 
metafun manual)


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] Bug with macro tightfunction (Metafun)

2015-02-16 Thread Hans Hagen

On 2/16/2015 6:00 PM, Fabrice Couvreur wrote:

Hi,
This code generates an error while it was working fine a month ago.
Best regards,
Fabrice

\definecolor[mycolor][c=.4,m=0,y=0,k=0]

\starttext
\start
\switchtobodyfont[small]
\startMPcode
  input hvdm;
  input tex;
  l:=3mm; r:=0.6; alfa:=45; beta:=0; gamma:=0;
  defineDefaultArrow (l, r, alfa, beta, gamma);
  numeric xmin, xmax, ymin, ymax;
  xmin := 0; xmax := 110; ymax :=8000 ;ymin:=0; u := 0..1cm; v:=
0.002cm;
  color mycolor; mycolor:=(0.4,0,0);
  drawoptions(withpen pencircle scaled 0.3pt withcolor
\MPcolor{mycolor});
  draw hlingrid(ymin,ymax,1000,16cm,11cm);
  draw vlingrid(xmin,xmax,10,11cm,16cm);
  pickup pencircle scaled 1pt ;
  arrowline ((xmin,0) -- (xmax,0)) scaled u;
  arrowline ((0,ymin) -- (0,ymax)) scaled v;
  drawoptions(withpen pencircle scaled 1pt);
  draw tightfunction (x, x*x-84*x+5000, 0, 100, 0.01) xyscaled
(u,v);
  for i=0 step 10 until 100:
  label.bot(TEX($decimal(i)$),(i*u,0));
  endfor;
  for i=0 step 1000 until 7000:
  label.lft(TEX($decimal(i)$),(0,i*v));
   endfor;
label.top(Nombre de lots,(90u,50v));
label.lrt(btex $f(x)$ (en euros) etex,(0,7800v));
\stopMPcode
\stop
\stoptext



what is:

 input hvdm;
 input tex;

both names are also candidates for name clashes

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] Hatch an area with Metapost (Metafun)

2015-02-15 Thread John Kitzmiller
On Feb 15, 2015, at 6:00 AM, Fabrice couvreur.fabr...@wanadoo.fr 
mailto:couvreur.fabr...@wanadoo.fr wrote:
 
 Thank you for this new example.
 Try the mpost variable lableoffset := ? to adjust.
 
 This does not seem to workwith lableoffset := 2mm.
 Fabrice

I spelled it wrong, sorry! It is labeloffset := 2mm;

___
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] Hatch an area with Metapost (Metafun)

2015-02-11 Thread John Kitzmiller
On Feb 10, 2015, at 3:42 PM, couvreur.fabr...@wanadoo.fr 
mailto:couvreur.fabr...@wanadoo.fr wrote:
 Is it  possible to have  some explanation of  the parameters of  the  macro  
 numberstriped(#1,#2,#3)  ?
 How to have  horizontal hatching  ?  (How to  change the slope  hatching  ?)

There is also anglestriped in mp-tool with some examples. The second argument 
changes the angle.

\startMPpage[offset=2mm]
  path p, q ;
  p := unitsquare scaled 4cm ;
  z1 = point 3.6 of p ;
  q := subpath (0,2) of p -- z1 -- cycle;
  q := q shifted(-4cm,-4cm);
  draw q anglestriped(1,180,6) withcolor blue;
  draw p ; 
\stopMPpage

(I have not yet found why the striped path q goes out of position. Looking at 
mp-tool may help.)

 I  just noticed  that the position of  labels  is not  quite the  same  when 
 using  macros  and macro  Metafun Metapost:
 I think the  labels are  too near to the  corners of the square  with the  
 macro  Metafun.

Try the mpost variable lableoffset := ? to adjust.

HTH,
John___
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] Hatch an area with Metapost (Metafun)

2015-02-10 Thread Fabrice

Hi John,
Thank you for that other solution with Metapost. I am in front of 
learning Metapost and Metafun, I'm still far from mastering!

Fabrice
___
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] Hatch an area with Metapost (Metafun)

2015-02-10 Thread Fabrice

Hi Hans,
Is it  possible to have  some explanation of  the parameters of  the  macro  
numberstriped(#1,#2,#3)  ?
How to have  horizontal hatching  ?  (How to  change the slope  hatching  ?)
I  just noticed  that the position of  labels  is not  quite the  same  when 
using  macros  and macro  Metafun  Metapost:
I think the  labels are  too near to the  corners of the square  with the  
macro  Metafun.
thank you,
Fabrice

___
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] Hatch an area with Metapost (Metafun)

2015-02-09 Thread Hans Hagen

On 2/9/2015 7:22 PM, Fabrice wrote:

Hi Hans,
Great, but I did not know the macro numberstriped. Is it a Metapostor
Metafun macro?


yes
-
  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] Hatch an area with Metapost (Metafun)

2015-02-09 Thread Hans Hagen

On 2/9/2015 3:30 PM, Fabrice Couvreur wrote:

Hi,
How hatched trapezoid MBCD?
Best regards,
Fabrice

\starttext
\startMPcode
path p ;
p=unitsquare scaled 4cm ;
draw p ;
pair z ;
z=point 3.6 of p ;
draw z--urcorner p ;
label.llft(btex B etex,llcorner p) ;
label.lrt(btex C etex,lrcorner p) ;
label.ulft(btex A etex,ulcorner p) ;
label.urt(btex  D etex, urcorner p) ;
label.lft(btex M etex, z) ;
\stopMPcode
\stoptext



\startMPpage[offset=2pt]
path p, q, r ; pair z ;
p := unitsquare scaled 4cm ;
z := point 3.6 of p ;
q := z--urcorner p ;
r := q -- reverse bottomboundary p -- cycle ;
draw p ;
draw q ;
draw r numberstriped (.25,10,5) withcolor blue ;
draw thetextext.llft(B, llcorner p) ;
draw thetextext.lrt (C, lrcorner p) ;
draw thetextext.ulft(A, ulcorner p) ;
draw thetextext.urt (D, urcorner p) ;
draw thetextext.lft (M, z) ;
\stopMPpage


-
  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] Hatch an area with Metapost (Metafun)

2015-02-09 Thread Fabrice

Hi Hans,
Great, but I did not know the macro numberstriped. Is it a Metapostor 
Metafun macro?

Fabrice
___
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] Hatch an area with Metapost (Metafun)

2015-02-09 Thread Fabrice Couvreur
Hi,
How hatched trapezoid MBCD ?
Best regards,
Fabrice

\starttext
\startMPcode
path p ;
p=unitsquare scaled 4cm ;
draw p ;
pair z ;
z=point 3.6 of p ;
draw z--urcorner p ;
label.llft(btex B etex,llcorner p) ;
label.lrt(btex C etex,lrcorner p) ;
label.ulft(btex A etex,ulcorner p) ;
label.urt(btex  D etex, urcorner p) ;
label.lft(btex M etex, z) ;
\stopMPcode
\stoptext
___
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] Hatch an area with Metapost (Metafun)

2015-02-09 Thread John Kitzmiller
On Feb 9, 2015, at 1:46 PM, Fabrice couvreur.fabr...@wanadoo.fr 
mailto:couvreur.fabr...@wanadoo.fr wrote:
 
 Great, but I did not know the macro numberstriped. Is it a Metapost or 
 Metafun macro?



It is a MetaFun macro in mp-tool, afaik.

The idea of filling a path is sometimes clipping to a path. Here is a way to do 
your task with (almost) only MetaPost:

\startMPpage[offset=2mm]
 path p, q ;
 p := unitsquare scaled 4cm ;
 z1 = point 3.6 of p ;
 q := z1 -- urcorner p -- lrcorner p -- llcorner p -- cycle;
 for i = 8 step -.5 until 0:
   draw (i,0)*cm -- (i-4,4)*cm withpen pencircle scaled 2pt withcolor blue;
 endfor;
 clip currentpicture to q;
 draw p ; draw q ;
 label.llft(B, llcorner p) ;
 label.lrt (C, lrcorner p) ;
 label.ulft(A, ulcorner p) ;
 label.urt (D, urcorner p) ;
 label.lft (M, z1) ;
\stopMPpage

…just in case it helps to clarify.

John___
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] Define a new type section with metafun

2014-12-29 Thread Fabrice

Hi Hans,
Thank you for your answer, text placement is correct as long as the 
policy is not too great.
For cons, I'll remove the red line separation because its placement is 
random.

Best regards,
Fabrice
___
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] Define a new type section with metafun

2014-12-28 Thread Fabrice

Thank you to Akira and Hans for these solutions.
How do now to the numbering and the title text are equidistant from the 
red line separation ?

Fabrice
___
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] Define a new type section with metafun

2014-12-28 Thread Fabrice
Another worry: when the title is too long, there is a line break, which 
is normal, but what follows is under the dial.

Thanks,
Fabrice

% macros=mkvi
\setuppapersize[A4][A4]

\setuphead
[section]
[sectionstopper={},
conversion=Characters,
sectionsegments=section:section]

\setuphead
[subsection]
[sectionstopper={},
sectionsegments=subsection:subsection,
conversion=number,]

\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]

\starttext

\startuniqueMPgraphic{funny}
 numeric h ; h := OverlayHeight ;
 pathp ; p := unitsquare xscaled \overlaywidth yscaled
\overlayheight superellipsed 0.9 ;
 pickup pencircle scaled \overlaylinewidth ;
 fill p withcolor \MPcolor{\overlaycolor} ;
 draw (20,-1)--(20,h+1) withcolor red ;
 clip currentpicture to p ;
 draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic

\defineoverlay[funny][\uniqueMPgraphic{funny}]

\define[2]\MySectionCommand
   {\framed
  [background=funny,
   frame=off,
   width=fit,
   align={right},
   framecolor=mycolor,
   rulethickness=1.5pt,
   backgroundcolor=white,
   offset=6pt]
  {#1\space\colortext#2}}

\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]

\section{A}{REPRÉSENTATION EN PERSPECTIVE CAVALIÈRE ET RÈGLES DE BASE}
\subsection{Représentation en perspective cavalière de solides}
___
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] Define a new type section with metafun

2014-12-28 Thread Hans Hagen

On 12/28/2014 1:00 PM, Fabrice wrote:


align={right},


align={flushright,lohi}

-
  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
___

[NTG-context] Define a new type section with metafun

2014-12-27 Thread Akira Kakuto

Dear Fabrice,

A try and error method which you may not want:

% macros=mkvi
\setuppapersize[A4][A4]

\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]

\starttext

\startuniqueMPgraphic{funny}
path p ;
numeric h ;
h := OverlayHeight ;
p:=unitsquare xscaled \overlaywidth yscaled \overlayheight superellipsed
0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw (20,1)--(20,h-1) withcolor red ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
\stopuniqueMPgraphic

\defineoverlay[funny][\uniqueMPgraphic{funny}]

\define[2]\MySectionCommand
  {\framed
 [background=funny,
  frame=off,
  width=0.5\textwidth,
  align={right},
  framecolor=mycolor,
  rulethickness=1.5pt,
  backgroundcolor=white,
  offset=4pt]
 {\tfb #1\space\colortext#2}}

\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]

\section{A}{PLAN DE L'ESPACE}
\stoptext

Best,
Akira

___
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] Define a new type section with metafun

2014-12-26 Thread Fabrice Couvreur
Hi,
I wish red separation is exactly in the middle of the dial and the title of the
section. Then, the line is too long, it should not exceed the boundary of
the ellipse.
Best regards,
Fabrice

% macros=mkvi
\setuppapersize[A4][A4]

\setupcolors[state=start,cmyk=yes,mpcmyk=yes]
\definecolor[mycolor][c=0.45,m=0.00,y=0.1,k=0.00]
\definecolor[colortext][c=1,m=0.00,y=0.3,k=0.3]

\starttext

\startuniqueMPgraphic{funny}
path p ;
numeric h ;
h := OverlayHeight ;
p:=unitsquare xscaled \overlaywidth yscaled \overlayheight superellipsed
0.9 ;
pickup pencircle scaled \overlaylinewidth ;
fill p withcolor \MPcolor{\overlaycolor} ;
draw p withcolor \MPcolor{\overlaylinecolor} ;
draw (20,0)--(20,h) withcolor red ;
\stopuniqueMPgraphic

\defineoverlay[funny][\uniqueMPgraphic{funny}]

\define[2]\MySectionCommand
   {\framed
  [background=funny,
   frame=off,
   width=0.5\textwidth,
   align={right},
   framecolor=mycolor,
   rulethickness=1.5pt,
   backgroundcolor=white,
   offset=4pt]
  {\tfb #1\space\colortext#2}}

\setuphead[section][command=\MySectionCommand,ownnumber=yes,numbercolor=colortext]

\section{A}{PLAN DE L'ESPACE}
\stoptext
___
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] clipping in metafun has weird side effects

2014-11-02 Thread Hans Hagen

On 10/31/2014 1:33 PM, Tobias Columbus wrote:

On Fri, Oct 31, 2014 at 12:22:37PM +0100, Hans Hagen wrote:

On 10/31/2014 10:15 AM, Tobias Columbus wrote:


def a_impl text t =
   begingroup
 save c ; picture c ; c := mycircle ;
 clip c to bbox c scaled 0.5 ;


try this to see what happens:

% clip c to bbox c scaled 0.5 ;
draw bbox c scaled 0.5 ;

and then this to solve it:

clip c to bbox (c scaled 0.5) ;


I tried your suggestions and attached both the example and output. Drawing and
clipping solves the problem indeed. But using only the modified clip either does
not solve the problem, or I am just too stupid to implement your solution.

Note also that in the modified example the context output coincides with the
mptopdf output if one draws the label before calling test the second time. (I
marked the position in the metapost file.)

Sorry for probably getting on your nerves ...


hopefully ok in next beta

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] clipping in metafun has weird side effects

2014-11-02 Thread Tobias Columbus
On Sun, Nov 02, 2014 at 11:29:24AM +0100, Hans Hagen wrote:
 On 10/31/2014 1:33 PM, Tobias Columbus wrote:
 On Fri, Oct 31, 2014 at 12:22:37PM +0100, Hans Hagen wrote:
 On 10/31/2014 10:15 AM, Tobias Columbus wrote:
 
 def a_impl text t =
begingroup
  save c ; picture c ; c := mycircle ;
  clip c to bbox c scaled 0.5 ;
 
 try this to see what happens:
 
 % clip c to bbox c scaled 0.5 ;
 draw bbox c scaled 0.5 ;
 
 and then this to solve it:
 
 clip c to bbox (c scaled 0.5) ;
 
 I tried your suggestions and attached both the example and output. Drawing 
 and
 clipping solves the problem indeed. But using only the modified clip either 
 does
 not solve the problem, or I am just too stupid to implement your solution.
 
 Note also that in the modified example the context output coincides with the
 mptopdf output if one draws the label before calling test the second time. 
 (I
 marked the position in the metapost file.)
 
 Sorry for probably getting on your nerves ...
 
 hopefully ok in next beta
 
 Hans

Seems to be fixed in 2014.11.02 12:23.

Thank you very much!
Tobias

 
 
 
 -
   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
 ___

-- 
___
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] clipping in metafun has weird side effects

2014-10-31 Thread Tobias Columbus
Hi again,

I tried my example from yesterday in context with metapost format, but
the output still differs from what mptopdf produces.

While doing that, I noticed that the mpost format is currently not usable out of
the box: 

\startMPcode{metapost}
  draw (0,0) -- (1cm,0) ;
\stopMPcode

produces the error message

 mfun_first_run
 true
! Equation cannot be performed (numeric=boolean).

and the same for 'mfun_trial_run'. Simply adding 

boolean mfun_trial_run, mfun_first_run ;

to texmf/metapost/base/mpost.mp resolved the issue for me. However, that may
introduce other complications that I have no idea of.

Tobias



On Thu, Oct 30, 2014 at 08:56:34PM +0100, Tobias Columbus wrote:
 Dear all,
 
 I stumbled upon some very weird behaviour of clipping in metafun/context. 
 When I
 add some clipped pictures to currentpicture and draw something dashed, some
 subsequent lines will also be drawn dashed.
 
 This behaviour only shows up with context but not with mptopdf or mpost. I
 attached a minimal example and the corresponding output of context and 
 mptopdf.
 
 I tried context versions 2014.05.21 22:04 and 2014.10.29 17:47, but the result
 is the same in both.
 
 Tobias
 
 
 
 
 -- 

 
 vardef mycircle =
   save c ; picture c ; c := nullpicture ;
   addto c contour fullcircle scaled 2mm ;
   c
 enddef ;
 
 def a expr p =
   path _p_ ; _p_ := p ;
   a_impl
 enddef ;
 
 def a_impl text t =
   begingroup
 save c ; picture c ; c := mycircle ;
 clip c to bbox c scaled 0.5 ;
 addto currentpicture also c t ;
 addto currentpicture doublepath _p_ t ;
   endgroup
 enddef ;
 
 def b expr p =
   path _p_ ; _p_ := p ;
   b_impl
 enddef ;
 
 def b_impl text t =
   begingroup
 save c; picture c ; c := mycircle ;
 addto currentpicture also c t ;
 addto currentpicture doublepath _p_ t ;
   endgroup
 enddef ;
 beginfig(1)
 
   a (0,0) -- (1cm,0) dashed evenly ;
   currentpicture := currentpicture shifted (2cm,0) ;
   a (0,0) -- (1cm,0) ;
 
   currentpicture := currentpicture shifted (-2cm, 0.5cm );
 
   b (0,0) -- (1cm,0) dashed evenly ;
   currentpicture := currentpicture shifted (2cm,0) ;
   b (0,0) -- (1cm,0) ;
 
 endfig ;
 end




-- 
___
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] clipping in metafun has weird side effects

2014-10-31 Thread Hans Hagen

On 10/31/2014 9:58 AM, Tobias Columbus wrote:

Hi again,

I tried my example from yesterday in context with metapost format, but
the output still differs from what mptopdf produces.

While doing that, I noticed that the mpost format is currently not usable out of
the box:

\startMPcode{metapost}
   draw (0,0) -- (1cm,0) ;
\stopMPcode

produces the error message



\startMPcode
  draw (0,0) -- (1cm,0) ;
\stopMPcode

why the {metapost}


mfun_first_run
true

! Equation cannot be performed (numeric=boolean).

and the same for 'mfun_trial_run'. Simply adding

boolean mfun_trial_run, mfun_first_run ;

to texmf/metapost/base/mpost.mp resolved the issue for me. However, that may
introduce other complications that I have no idea of.

Tobias



On Thu, Oct 30, 2014 at 08:56:34PM +0100, Tobias Columbus wrote:

Dear all,

I stumbled upon some very weird behaviour of clipping in metafun/context. When I
add some clipped pictures to currentpicture and draw something dashed, some
subsequent lines will also be drawn dashed.

This behaviour only shows up with context but not with mptopdf or mpost. I
attached a minimal example and the corresponding output of context and mptopdf.

I tried context versions 2014.05.21 22:04 and 2014.10.29 17:47, but the result
is the same in both.

Tobias




--




vardef mycircle =
   save c ; picture c ; c := nullpicture ;
   addto c contour fullcircle scaled 2mm ;
   c
enddef ;

def a expr p =
   path _p_ ; _p_ := p ;
   a_impl
enddef ;

def a_impl text t =
   begingroup
 save c ; picture c ; c := mycircle ;
 clip c to bbox c scaled 0.5 ;
 addto currentpicture also c t ;
 addto currentpicture doublepath _p_ t ;
   endgroup
enddef ;

def b expr p =
   path _p_ ; _p_ := p ;
   b_impl
enddef ;

def b_impl text t =
   begingroup
 save c; picture c ; c := mycircle ;
 addto currentpicture also c t ;
 addto currentpicture doublepath _p_ t ;
   endgroup
enddef ;
beginfig(1)

   a (0,0) -- (1cm,0) dashed evenly ;
   currentpicture := currentpicture shifted (2cm,0) ;
   a (0,0) -- (1cm,0) ;

   currentpicture := currentpicture shifted (-2cm, 0.5cm );

   b (0,0) -- (1cm,0) dashed evenly ;
   currentpicture := currentpicture shifted (2cm,0) ;
   b (0,0) -- (1cm,0) ;

endfig ;
end








--

-
  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] clipping in metafun has weird side effects

2014-10-31 Thread Tobias Columbus
On Fri, Oct 31, 2014 at 10:05:35AM +0100, Hans Hagen wrote:
 On 10/31/2014 9:58 AM, Tobias Columbus wrote:
 Hi again,
 
 I tried my example from yesterday in context with metapost format, but
 the output still differs from what mptopdf produces.
 
 While doing that, I noticed that the mpost format is currently not usable 
 out of
 the box:
 
 \startMPcode{metapost}
draw (0,0) -- (1cm,0) ;
 \stopMPcode
 
 produces the error message
 
 
 \startMPcode
   draw (0,0) -- (1cm,0) ;
 \stopMPcode
 
 why the {metapost}

I wanted to know if the impact of clipping is caused by the metafun format.
According to the wiki page
http://wiki.contextgarden.net/Command/defineMPinstance the instances metapost
and metafun are predefined and can be used by

\startMPcode{instance}
  ...
\stopMPcode

where metafun is the default instance, i.e. used when there is no instance
given.

 
 mfun_first_run
 true
 ! Equation cannot be performed (numeric=boolean).
 
 and the same for 'mfun_trial_run'. Simply adding
 
 boolean mfun_trial_run, mfun_first_run ;
 
 to texmf/metapost/base/mpost.mp resolved the issue for me. However, that may
 introduce other complications that I have no idea of.
 
 Tobias
 
 
 
 On Thu, Oct 30, 2014 at 08:56:34PM +0100, Tobias Columbus wrote:
 Dear all,
 
 I stumbled upon some very weird behaviour of clipping in metafun/context. 
 When I
 add some clipped pictures to currentpicture and draw something dashed, some
 subsequent lines will also be drawn dashed.
 
 This behaviour only shows up with context but not with mptopdf or mpost. I
 attached a minimal example and the corresponding output of context and 
 mptopdf.
 
 I tried context versions 2014.05.21 22:04 and 2014.10.29 17:47, but the 
 result
 is the same in both.
 
 Tobias
 
 
 
 
 --
 
 
 vardef mycircle =
save c ; picture c ; c := nullpicture ;
addto c contour fullcircle scaled 2mm ;
c
 enddef ;
 
 def a expr p =
path _p_ ; _p_ := p ;
a_impl
 enddef ;
 
 def a_impl text t =
begingroup
  save c ; picture c ; c := mycircle ;
  clip c to bbox c scaled 0.5 ;
  addto currentpicture also c t ;
  addto currentpicture doublepath _p_ t ;
endgroup
 enddef ;
 
 def b expr p =
path _p_ ; _p_ := p ;
b_impl
 enddef ;
 
 def b_impl text t =
begingroup
  save c; picture c ; c := mycircle ;
  addto currentpicture also c t ;
  addto currentpicture doublepath _p_ t ;
endgroup
 enddef ;
 beginfig(1)
 
a (0,0) -- (1cm,0) dashed evenly ;
currentpicture := currentpicture shifted (2cm,0) ;
a (0,0) -- (1cm,0) ;
 
currentpicture := currentpicture shifted (-2cm, 0.5cm );
 
b (0,0) -- (1cm,0) dashed evenly ;
currentpicture := currentpicture shifted (2cm,0) ;
b (0,0) -- (1cm,0) ;
 
 endfig ;
 end
 
 
 
 
 
 
 -- 
 
 -
   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
 ___

-- 
___
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] clipping in metafun has weird side effects

2014-10-31 Thread Hans Hagen

On 10/31/2014 10:15 AM, Tobias Columbus wrote:

On Fri, Oct 31, 2014 at 10:05:35AM +0100, Hans Hagen wrote:

On 10/31/2014 9:58 AM, Tobias Columbus wrote:

Hi again,

I tried my example from yesterday in context with metapost format, but
the output still differs from what mptopdf produces.

While doing that, I noticed that the mpost format is currently not usable out of
the box:

\startMPcode{metapost}
   draw (0,0) -- (1cm,0) ;
\stopMPcode

produces the error message



\startMPcode
   draw (0,0) -- (1cm,0) ;
\stopMPcode

why the {metapost}


I wanted to know if the impact of clipping is caused by the metafun format.
According to the wiki page
http://wiki.contextgarden.net/Command/defineMPinstance the instances metapost
and metafun are predefined and can be used by

\startMPcode{instance}
   ...
\stopMPcode

where metafun is the default instance, i.e. used when there is no instance
given.


i fixed the metapost run and also added basic text support in it (next 
beta)






mfun_first_run
true

! Equation cannot be performed (numeric=boolean).

and the same for 'mfun_trial_run'. Simply adding

boolean mfun_trial_run, mfun_first_run ;

to texmf/metapost/base/mpost.mp resolved the issue for me. However, that may
introduce other complications that I have no idea of.

Tobias



On Thu, Oct 30, 2014 at 08:56:34PM +0100, Tobias Columbus wrote:

Dear all,

I stumbled upon some very weird behaviour of clipping in metafun/context. When I
add some clipped pictures to currentpicture and draw something dashed, some
subsequent lines will also be drawn dashed.

This behaviour only shows up with context but not with mptopdf or mpost. I
attached a minimal example and the corresponding output of context and mptopdf.

I tried context versions 2014.05.21 22:04 and 2014.10.29 17:47, but the result
is the same in both.

Tobias




--




vardef mycircle =
   save c ; picture c ; c := nullpicture ;
   addto c contour fullcircle scaled 2mm ;
   c
enddef ;

def a expr p =
   path _p_ ; _p_ := p ;
   a_impl
enddef ;

def a_impl text t =
   begingroup
 save c ; picture c ; c := mycircle ;
 clip c to bbox c scaled 0.5 ;
 addto currentpicture also c t ;
 addto currentpicture doublepath _p_ t ;
   endgroup
enddef ;

def b expr p =
   path _p_ ; _p_ := p ;
   b_impl
enddef ;

def b_impl text t =
   begingroup
 save c; picture c ; c := mycircle ;
 addto currentpicture also c t ;
 addto currentpicture doublepath _p_ t ;
   endgroup
enddef ;
beginfig(1)

   a (0,0) -- (1cm,0) dashed evenly ;
   currentpicture := currentpicture shifted (2cm,0) ;
   a (0,0) -- (1cm,0) ;

   currentpicture := currentpicture shifted (-2cm, 0.5cm );

   b (0,0) -- (1cm,0) dashed evenly ;
   currentpicture := currentpicture shifted (2cm,0) ;
   b (0,0) -- (1cm,0) ;

endfig ;
end








--

-
   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
___





--

-
  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] clipping in metafun has weird side effects

2014-10-31 Thread Hans Hagen

On 10/31/2014 10:15 AM, Tobias Columbus wrote:


def a_impl text t =
   begingroup
 save c ; picture c ; c := mycircle ;
 clip c to bbox c scaled 0.5 ;


try this to see what happens:

% clip c to bbox c scaled 0.5 ;
draw bbox c scaled 0.5 ;

and then this to solve it:

clip c to bbox (c scaled 0.5) ;

-
  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] clipping in metafun has weird side effects

2014-10-31 Thread Tobias Columbus
On Fri, Oct 31, 2014 at 12:22:37PM +0100, Hans Hagen wrote:
 On 10/31/2014 10:15 AM, Tobias Columbus wrote:
 
 def a_impl text t =
begingroup
  save c ; picture c ; c := mycircle ;
  clip c to bbox c scaled 0.5 ;
 
 try this to see what happens:
 
 % clip c to bbox c scaled 0.5 ;
 draw bbox c scaled 0.5 ;
 
 and then this to solve it:
 
 clip c to bbox (c scaled 0.5) ;

I tried your suggestions and attached both the example and output. Drawing and
clipping solves the problem indeed. But using only the modified clip either does
not solve the problem, or I am just too stupid to implement your solution.

Note also that in the modified example the context output coincides with the
mptopdf output if one draws the label before calling test the second time. (I
marked the position in the metapost file.)

Sorry for probably getting on your nerves ... 

 
 -
   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
 ___

-- 


mwe-context.pdf
Description: Adobe PDF document


mwe-mptopdf.pdf
Description: Adobe PDF document

vardef mycircle =
  save c ; picture c ; c := nullpicture ;
  addto c contour fullcircle scaled 2mm ;
  c
enddef ;

def test (expr m) expr p =
  path _p_ ; _p_ := p ;
  scantokens m
enddef ;

def only_clip text t =
  begingroup
save c ; picture c ; c := mycircle ;
clip c to bbox (c scaled 0.5) ;
addto currentpicture also c t ;
addto currentpicture doublepath _p_ t ;
  endgroup
enddef ;


def no_clip text t =
  begingroup
save c; picture c ; c := mycircle ;
addto currentpicture also c t ;
addto currentpicture doublepath _p_ t ;
  endgroup
enddef ;


def draw_clip text t =
  begingroup
save c ; picture c ; c := mycircle ;
draw bbox (c scaled 0.5) ;
clip c to bbox (c scaled 0.5) ;
addto currentpicture also c t ;
addto currentpicture doublepath _p_ t ;
  endgroup
enddef ;

beginfig(1)
  
  for macro = only_clip, no_clip, draw_clip:
test( macro ) (0,0) -- (1cm,0) dashed evenly ;
% NOTE:
% Drawing the label here makes the weird second dashed line go away.
% label.rt(macro, (-5cm,0) );
currentpicture := currentpicture shifted (-2cm,0) ;
test( macro ) (0,0) -- (1cm,0) ;
label.rt(macro, (-5cm,0) );
currentpicture := currentpicture shifted(2cm,0.5cm );
  endfor

endfig ;
end
___
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] Metapost/Metafun: textext

2014-10-15 Thread Willi Egger
Hi all,

In the course of a project I wanted to create a decorative border around a 
framed text. The border should be built from chosen glyphs which are placed 
along the border as pictures. For this purpose the textext macro is a good 
candidate. However I run into troubles. With help from Hans, a solution could 
be found. Hans, thank you so much! 

I have created a section on the wiki, where the problem is shown and the 
solution is given. In order to illustrate the whole thing I placed also a full 
example.

http://wiki.contextgarden.net/MetaPost#Repetition_of_a_Text_Element_to_Fill_a_Bar_Using_textext

Kind regards 

Willi___
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] Metafun standalone and fonts

2014-09-27 Thread Pol Stra
Hello!

I have an mp file that I use with success in my document with mprun.

But if I try to generate the figure alone with this command:

mpost --mem=metafun myfigure.mp

I obtain this error:

 ! Font cmr10 not usable: TFM file not found.
 thelabel-...ture(EXPR3):infont.defaultfont.scaled
 
   .defaultscale.fi;(p.shifte
   ...
 
 l.22 label.ulft($\vec{k}$, point infinity of p4)
  ;

This is with my ConTeXt installation with only mkiv.
The ConTeXt installation with both mkiv and mkii, the error is:


 Warning: cannot open font map file psfonts.map
 ]
 Missing character: There is no 226 in font cmr10!

I tried to set:
defaultfont:=latinmodernmath;

Which is in the list of:
mtxrun --script fonts --list --all --pattern=

but it doesn't found the TFM file either.

I know I can use the:

\startMPpage
\input myfigure.mp
\stopMPpage

But the point is I want to generate an svg file, not a pdf.

(mpost -s 'outputformat=svg;prologues:=3' --mem=metafun myfigure.mp)


Note that with mpost command, it use metafun.mpii, while with mprun, it use 
metafun.mpiv.

Thanks
___
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] Metafun standalone and fonts

2014-09-27 Thread Hans Hagen

On 9/27/2014 10:21 AM, Pol Stra wrote:

Hello!

I have an mp file that I use with success in my document with mprun.

But if I try to generate the figure alone with this command:

mpost --mem=metafun myfigure.mp


that will never work with metafun in mkiv as we have extensions

just run

context myfigure.mp

or do:

\starttext

\startMPpage
   mp code
\stopMPpage

\stoptext

and run that.

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] Metafun standalone and fonts

2014-09-27 Thread Pol Stra
Le samedi 27 septembre 2014, 12:23:47 Hans Hagen a écrit :
 On 9/27/2014 10:21 AM, Pol Stra wrote:
  Hello!
  
  I have an mp file that I use with success in my document with mprun.
  
  But if I try to generate the figure alone with this command:
  
  mpost --mem=metafun myfigure.mp
 
 that will never work with metafun in mkiv as we have extensions
 
 just run
 
 context myfigure.mp
 
 or do:
 
 \starttext
 
 \startMPpage
 mp code
 \stopMPpage
 
 \stoptext
 
 and run that.
 
 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
 
 -

Ah, nice about directly use the context command!

Unfortunately, this only solve half of my problem: this outputs one pdf with 
all figures, while I try to output all figures in separated svg files.

My workaround is to put only one figure per file and convert the pdf with 
pdf2svg. I hoped there where a more direct way to do it.

Regards
___
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] Metafun standalone and fonts

2014-09-27 Thread Hans Hagen

On 9/27/2014 2:28 PM, Pol Stra wrote:


Unfortunately, this only solve half of my problem: this outputs one pdf with
all figures, while I try to output all figures in separated svg files.


that would not give you the benefits of the context run (fonts and so) ...

just use mudraw to convert the bunch to individual svg images


My workaround is to put only one figure per file and convert the pdf with
pdf2svg. I hoped there where a more direct way to do it.

Regards
___
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
___




--

-
  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] Metafun error

2014-09-27 Thread Willi Egger
Hi Otared, 
thank you for this! - I do not understand correctly what has happened here. Now 
after rebooting it works again….. ;-(

Thanks!

Willi
On 26 sep. 2014, at 23:09, Otared Kavian ota...@gmail.com wrote:

 Hi Willi,
 
 I just updated to
   ConTeXt  ver: 2014.09.26 11:42 MKIV beta  fmt: 2014.9.26  int: 
 english/english
 and tested again your example: everything works as expected here…
 
 So probably there is something strange happening on your side.
 
 Best regards: OK
 
 On 26 Sep 2014, at 16:22, Willi Egger cont...@boede.nl wrote:
 
 Hi Otared,
 
 As mentioned in my first post I tested on  
  ConTeXt  ver: 2014.08.29 20:57
   ConTeXt  ver: 2014.09.26 11:42.
 
 strange!
 
 Willi
 On 26 sep. 2014, at 15:23, Otared Kavian ota...@gmail.com wrote:
 
 Hi Willi,
 
 I tested your example file: it works fine here with
 ConTeXt  ver: 2014.09.25 18:58 MKIV beta  fmt: 2014.9.25  int: 
 english/english
 Which version are using?
 
 Best regards: OK
 
 On 26 Sep 2014, at 15:17, Willi Egger cont...@boede.nl wrote:
 
 Hello!
 
 Today I wanted to use an older tex file…. I get the same error as in the 
 following test.
 
 \startuniqueMPgraphic{test}
 
path p;
p := fullcircle scaled 5cm;
draw p;
label.bot(textext(Centre), center p);

 \stopuniqueMPgraphic
 
 \starttext
 \startTEXpage
 \useMPgraphic{test} 
 \stopTEXpage
 \stoptext
 
 ___
 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
 ___
 
 ___
 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
___


[NTG-context] Metafun error

2014-09-26 Thread Willi Egger
Hello!

Today I wanted to use an older tex file…. I get the same error as in the 
following test.

\startuniqueMPgraphic{test}

path p;
p := fullcircle scaled 5cm;
draw p;
label.bot(textext(Centre), center p);

\stopuniqueMPgraphic

\starttext
\startTEXpage
\useMPgraphic{test} 
\stopTEXpage
\stoptext


The error message is:

Argument of \meta_start_environment has an extra }

inserted text 
\par 
to be read again 
}
\meta_handle_unique_graphic ...ocess_graphic {#3}}
  \setxvalue {\??mpgraphic \...
\meta_use_graphic ...]}\getvalue {\??mpgraphic #1}
  \empty \meta_end_graphic_g...
to be read again 
 
l.288 \useMPgraphic{test}

This error occurs as well with version ConTeXt  ver: 2014.08.29 20:57 as with 
the latest beta ConTeXt  ver: 2014.09.26 11:42.


Am I missing something?

Kind regards

Willi
___
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] Metafun error

2014-09-26 Thread Otared Kavian
Hi Willi,

I tested your example file: it works fine here with
ConTeXt  ver: 2014.09.25 18:58 MKIV beta  fmt: 2014.9.25  int: 
english/english
Which version are using?

Best regards: OK

On 26 Sep 2014, at 15:17, Willi Egger cont...@boede.nl wrote:

 Hello!
 
 Today I wanted to use an older tex file…. I get the same error as in the 
 following test.
 
 \startuniqueMPgraphic{test}
 
   path p;
   p := fullcircle scaled 5cm;
   draw p;
   label.bot(textext(Centre), center p);
   
 \stopuniqueMPgraphic
 
 \starttext
 \startTEXpage
\useMPgraphic{test} 
 \stopTEXpage
 \stoptext

___
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] Metafun error

2014-09-26 Thread Willi Egger
Hi Otared,

As mentioned in my first post I tested on  
ConTeXt  ver: 2014.08.29 20:57
ConTeXt  ver: 2014.09.26 11:42.

strange!

Willi
On 26 sep. 2014, at 15:23, Otared Kavian ota...@gmail.com wrote:

 Hi Willi,
 
 I tested your example file: it works fine here with
   ConTeXt  ver: 2014.09.25 18:58 MKIV beta  fmt: 2014.9.25  int: 
 english/english
 Which version are using?
 
 Best regards: OK
 
 On 26 Sep 2014, at 15:17, Willi Egger cont...@boede.nl wrote:
 
 Hello!
 
 Today I wanted to use an older tex file…. I get the same error as in the 
 following test.
 
 \startuniqueMPgraphic{test}
 
  path p;
  p := fullcircle scaled 5cm;
  draw p;
  label.bot(textext(Centre), center p);
  
 \stopuniqueMPgraphic
 
 \starttext
 \startTEXpage
   \useMPgraphic{test} 
 \stopTEXpage
 \stoptext
 
 ___
 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] Metafun error

2014-09-26 Thread Otared Kavian
Hi Willi,

I just updated to
ConTeXt  ver: 2014.09.26 11:42 MKIV beta  fmt: 2014.9.26  int: 
english/english
and tested again your example: everything works as expected here…

So probably there is something strange happening on your side.

Best regards: OK

On 26 Sep 2014, at 16:22, Willi Egger cont...@boede.nl wrote:

 Hi Otared,
 
 As mentioned in my first post I tested on  
   ConTeXt  ver: 2014.08.29 20:57
ConTeXt  ver: 2014.09.26 11:42.
 
 strange!
 
 Willi
 On 26 sep. 2014, at 15:23, Otared Kavian ota...@gmail.com wrote:
 
 Hi Willi,
 
 I tested your example file: it works fine here with
  ConTeXt  ver: 2014.09.25 18:58 MKIV beta  fmt: 2014.9.25  int: 
 english/english
 Which version are using?
 
 Best regards: OK
 
 On 26 Sep 2014, at 15:17, Willi Egger cont...@boede.nl wrote:
 
 Hello!
 
 Today I wanted to use an older tex file…. I get the same error as in the 
 following test.
 
 \startuniqueMPgraphic{test}
 
 path p;
 p := fullcircle scaled 5cm;
 draw p;
 label.bot(textext(Centre), center p);
 
 \stopuniqueMPgraphic
 
 \starttext
 \startTEXpage
  \useMPgraphic{test} 
 \stopTEXpage
 \stoptext
 
 ___
 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
 ___

___
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] Metapost and Metafun

2014-05-21 Thread Fabrice Couvreur
Hi,
As PSTricks (which I prefer) is not yet well integrated, I decided to learn
Metapost starting with a simple code.

\starttext
\startMPcode
numeric xmin, xmax, ymin, ymax;
xmin := -2.5; xmax := 2.5; ymax :=2.5 ;ymin:=-2.5; u := 2cm;
vardef f(expr x) = -x*x+1 enddef;
xinc := 0.001;
path pts_f;
pts_f := (xmin,f(xmin))*u
for x=xmin+xinc step xinc until xmax+xinc:
.. (x,f(x))*u
endfor;
path axe_x,axe_y;
path screen;
screen=(xmin,ymin)*u--(xmax,ymin)*u--(xmax,ymax)*u--(xmin,ymax)*u--cycle;
axe_x = (xmin,0)*u -- (xmax,0)*u;
axe_y = (0,ymin)*u -- (0,ymax)*u;
drawarrow axe_x;
drawarrow axe_y;
draw pts_f withpen pencircle scaled 1;
clip currentpicture to screen;
\stopMPcode
\stoptext

Are there any routines with Metafun to improve this code?
thank you,
Fabrice
___
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] Metapost and Metafun

2014-05-21 Thread Hans Hagen

On 5/21/2014 7:55 PM, Fabrice Couvreur wrote:

Hi,
As PSTricks (which I prefer) is not yet well integrated, I decided to
learn Metapost starting with a simple code.

\starttext
\startMPcode
numeric xmin, xmax, ymin, ymax;
xmin := -2.5; xmax := 2.5; ymax :=2.5 ;ymin:=-2.5; u := 2cm;
vardef f(expr x) = -x*x+1 enddef;
xinc := 0.001;
path pts_f;
pts_f := (xmin,f(xmin))*u
for x=xmin+xinc step xinc until xmax+xinc:
.. (x,f(x))*u
endfor;
path axe_x,axe_y;
path screen;
screen=(xmin,ymin)*u--(xmax,ymin)*u--(xmax,ymax)*u--(xmin,ymax)*u--cycle;
axe_x = (xmin,0)*u -- (xmax,0)*u;
axe_y = (0,ymin)*u -- (0,ymax)*u;
drawarrow axe_x;
drawarrow axe_y;
draw pts_f withpen pencircle scaled 1;
clip currentpicture to screen;
\stopMPcode
\stoptext

Are there any routines with Metafun to improve this code?


define 'improve' .. anyway:

\starttext
\startMPpage
numeric xmin, xmax, ymin, ymax;
xmin := -2.5; xmax := 2.5; ymax :=2.5 ;ymin:=-2.5; u := 2cm;
pickup pencircle scaled 1pt ;
drawarrow ((xmin,0) -- (xmax,0)) scaled u;
drawarrow ((0,ymin) -- (0,ymax)) scaled u;
draw tightfunction (x, -x*x+1, xmin, xmax, (xmax-xmin)/10) 
scaled u;
setbounds currentpicture to boundingbox (((xmin,ymin) -- 
(xmax,ymax)) scaled u);

\stopMPpage
\stoptext

I'm sure that Alan can tell you how to use the new built-in 
interpolators,  their pros and cons in this case.


Hans

ps. A step of 0.001 is not needed here and gives a pretty large path.

-
  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] Metapost and Metafun

2014-05-21 Thread Fabrice

Hi Hans,
Thank you for the code that is cleaner and certainly less long!
Fabrice

PS : What do you mean by:

define 'improve' .. anyway:



A step of 0.001 is not needed here and gives a*pretty large path*.


___
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] Metafun: numeric=color

2014-01-30 Thread Hans Hagen

On 1/29/2014 9:41 PM, Otared Kavian wrote:

Hi,

With the latest beta,

ConTeXt  ver: 2013.06.07 17:34 MKII  fmt: 2014.1.29

in a file typeset with mkii I have a bunch of metapost macros (drawing a logo…) 
which used to typeset correctly until last week, I get an error message saying:

Preloading the plain mem file, version 1.004 for metafun ii  cyan  
(0,1,1) ! Equation cannot be performed (numeric=color).

Unfortunately I cannot reproduce this error message in a minimal example, but 
can anyone tell me whether something has changed in MetaPost?


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
___


[NTG-context] Metafun: numeric=color

2014-01-29 Thread Otared Kavian
Hi,

With the latest beta,

ConTeXt  ver: 2013.06.07 17:34 MKII  fmt: 2014.1.29

in a file typeset with mkii I have a bunch of metapost macros (drawing a logo…) 
which used to typeset correctly until last week, I get an error message saying:

Preloading the plain mem file, version 1.004 for metafun ii  cyan  
(0,1,1) ! Equation cannot be performed (numeric=color). 

Unfortunately I cannot reproduce this error message in a minimal example, but 
can anyone tell me whether something has changed in MetaPost?

Best regards: OK
___
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] runtime problem with metafun() code

2014-01-27 Thread Hans Hagen

On 1/25/2014 1:58 PM, Peter Rolf wrote:

Am 25.01.2014 01:07, schrieb Hans Hagen:

On 1/24/2014 7:41 PM, Peter Rolf wrote:

Am 24.01.2014 14:45, schrieb Hans Hagen:

On 1/24/2014 1:35 PM, Peter Rolf wrote:

Hi,

I try to create a Metapost path in lua and it works so far for the
attached example. But a call of that function from another lua function
sadly fails (no path visible after call). The code seems to be executed
later (the output from 'show pid;' appears somewhere later in the log).

How can I ensure that the code is executed at runtime?


I don't understand the issue but isn't there a

  metafun(draw p;)

missing then?


Setting the bounding box has the same effect, as drawing something.
Both methods avoid that the emtpy graphic is ignored by ConTeXt.

Anyhow, the MP path is not available in metapost.variables after the
function call. If there is no other way I have to call the function from
the TeX side (like in the attached example). Will look into that
tomorrow.


%D We also provide an outputless run:

\unexpanded\def\startMPcalculation


I tried that command, but couldn't get it to work on the lua side.

The first pure MP line after context.startMPcalculation() raises a lua
error and a combination with metafun() is also not working. So how to
use this in lua?


Anyhow, the problem is the execution time of the MP graphic. I changed
the attached example a bit, so that you can see it.
The inspect() in drops.foo() gives an empty table, while the second
inspect on the TeX side shows the path drops:foo.

I need the path right after the call (it needs to be adapted to IM
afterwards; mainly scaling and shifting). Is there a way to force the
execution of the graphic without switching back to the TeX side?



function drops.foo(id,width,height,radius)
drops.generate_default_path(id,width,height,radius)
context(function() inspect(metapost.variables) end) -- empty here
end

or

function drops.bar()
inspect(metapost.variables)
end

function drops.foo(id,width,height,radius)
drops.generate_default_path(id,width,height,radius)
context(drops.bar) -- empty here
end


-
  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] runtime problem with metafun() code

2014-01-27 Thread Peter Rolf
Am 27.01.2014 13:12, schrieb Hans Hagen:
 On 1/25/2014 1:58 PM, Peter Rolf wrote:
 Am 25.01.2014 01:07, schrieb Hans Hagen:
 On 1/24/2014 7:41 PM, Peter Rolf wrote:
 Am 24.01.2014 14:45, schrieb Hans Hagen:
 On 1/24/2014 1:35 PM, Peter Rolf wrote:
 Hi,

 I try to create a Metapost path in lua and it works so far for the
 attached example. But a call of that function from another lua
 function
 sadly fails (no path visible after call). The code seems to be
 executed
 later (the output from 'show pid;' appears somewhere later in the
 log).

 How can I ensure that the code is executed at runtime?

 I don't understand the issue but isn't there a

   metafun(draw p;)

 missing then?

 Setting the bounding box has the same effect, as drawing something.
 Both methods avoid that the emtpy graphic is ignored by ConTeXt.

 Anyhow, the MP path is not available in metapost.variables after the
 function call. If there is no other way I have to call the function
 from
 the TeX side (like in the attached example). Will look into that
 tomorrow.

 %D We also provide an outputless run:

 \unexpanded\def\startMPcalculation

 I tried that command, but couldn't get it to work on the lua side.

 The first pure MP line after context.startMPcalculation() raises a lua
 error and a combination with metafun() is also not working. So how to
 use this in lua?


 Anyhow, the problem is the execution time of the MP graphic. I changed
 the attached example a bit, so that you can see it.
 The inspect() in drops.foo() gives an empty table, while the second
 inspect on the TeX side shows the path drops:foo.

 I need the path right after the call (it needs to be adapted to IM
 afterwards; mainly scaling and shifting). Is there a way to force the
 execution of the graphic without switching back to the TeX side?
 
 
 function drops.foo(id,width,height,radius)
 drops.generate_default_path(id,width,height,radius)
 context(function() inspect(metapost.variables) end) -- empty here
 end
 
 or
 
 function drops.bar()
 inspect(metapost.variables)
 end
 
 function drops.foo(id,width,height,radius)
 drops.generate_default_path(id,width,height,radius)
 context(drops.bar) -- empty here
 end
 
 
Ah, that's how it works. I'm still a luatex noob...
Many thanks, Hans!!


Peter


___
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] runtime problem with metafun() code

2014-01-25 Thread Peter Rolf
Am 25.01.2014 01:07, schrieb Hans Hagen:
 On 1/24/2014 7:41 PM, Peter Rolf wrote:
 Am 24.01.2014 14:45, schrieb Hans Hagen:
 On 1/24/2014 1:35 PM, Peter Rolf wrote:
 Hi,

 I try to create a Metapost path in lua and it works so far for the
 attached example. But a call of that function from another lua function
 sadly fails (no path visible after call). The code seems to be executed
 later (the output from 'show pid;' appears somewhere later in the log).

 How can I ensure that the code is executed at runtime?

 I don't understand the issue but isn't there a

  metafun(draw p;)

 missing then?

 Setting the bounding box has the same effect, as drawing something.
 Both methods avoid that the emtpy graphic is ignored by ConTeXt.

 Anyhow, the MP path is not available in metapost.variables after the
 function call. If there is no other way I have to call the function from
 the TeX side (like in the attached example). Will look into that
 tomorrow.
 
 %D We also provide an outputless run:
 
 \unexpanded\def\startMPcalculation

I tried that command, but couldn't get it to work on the lua side.

The first pure MP line after context.startMPcalculation() raises a lua
error and a combination with metafun() is also not working. So how to
use this in lua?


Anyhow, the problem is the execution time of the MP graphic. I changed
the attached example a bit, so that you can see it.
The inspect() in drops.foo() gives an empty table, while the second
inspect on the TeX side shows the path drops:foo.

I need the path right after the call (it needs to be adapted to IM
afterwards; mainly scaling and shifting). Is there a way to force the
execution of the graphic without switching back to the TeX side?


Peter


thirddata= thirddataor { }
thirddata.drops  = thirddata.drops  or { }

local drops = thirddata.drops

local metafun = context.metafun

local format,todimen = string.format, string.todimen
local floor = math.floor

-- http://lua-users.org/wiki/SimpleRound
local function round(num, idp)
local mult = 10^(idp or 0)
return floor(num * mult + 0.5) / mult
end

function drops.numberofpixels(n,idp)
local dimenfactor = 1/tex.pdfpxdimen
return round(todimen(n)*dimenfactor,idp)
end

local numberofpixels = drops.numberofpixels


function drops.generate_default_path(id,width,height,radius)

local w,h,r
w = numberofpixels(width); h = numberofpixels(height); r = numberofpixels(radius)

metafun.start()

metafun(save p,pid; path p; string pid;)

-- metafun(id := \drops:boxshadow_w%sh%sr%s\;,w,h,r)
metafun(pid := \%s\;,id)
--metafun(show pid;) -- ok
metafun(p:= unitsquare xyscaled(%s,%s) smoothed %s;,w,h,r)

metafun(passvariable(pid,p);)
metafun(setbounds currentpicture to boundingbox(p);) -- 'activator'; void graphics are ignored

metafun.stop()

end


function drops.foo(id,width,height,radius)
drops.generate_default_path(id,width,height,radius)
inspect(metapost.variables) -- empty here
end
\ctxloadluafile{mplua}{}


\starttext
\ctxlua{metapost.showlog = true}

%\ctxlua{thirddata.drops.generate_default_path(drops:boxshadow-w199h100r10,200pt,100pt,10pt)}
%\ctxlua{inspect(metapost.variables)}

\ctxlua{thirddata.drops.foo(drops:foo,200pt,100pt,10pt)}
\ctxlua{inspect(metapost.variables)} % ok here


\stoptext
___
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] runtime problem with metafun() code

2014-01-24 Thread Peter Rolf
Hi,

I try to create a Metapost path in lua and it works so far for the
attached example. But a call of that function from another lua function
sadly fails (no path visible after call). The code seems to be executed
later (the output from 'show pid;' appears somewhere later in the log).

How can I ensure that the code is executed at runtime?


Peter
thirddata= thirddataor { }
thirddata.drops  = thirddata.drops  or { }

local drops = thirddata.drops

local metafun = context.metafun

local format,todimen = string.format, string.todimen
local floor = math.floor

-- http://lua-users.org/wiki/SimpleRound
local function round(num, idp)
local mult = 10^(idp or 0)
return floor(num * mult + 0.5) / mult
end

function drops.numberofpixels(n,idp)
local dimenfactor = 1/tex.pdfpxdimen
return round(todimen(n)*dimenfactor,idp)
end

local numberofpixels = drops.numberofpixels


function drops.generate_default_path(id,width,height,radius)
local w,h,r
w = numberofpixels(width); h = numberofpixels(height); r = numberofpixels(radius)

metafun.start()

metafun(save p,pid; path p; string pid;)

-- metafun(id := \drops:boxshadow_w%sh%sr%s\;,w,h,r)
metafun(pid := \%s\;,id)
--metafun(show pid;) -- ok
metafun(p:= unitsquare xyscaled(%s,%s) smoothed %s;,w,h,r)

metafun(passvariable(pid,p);)
metafun(setbounds currentpicture to boundingbox(p);) -- 'activator'; void graphics are ignored

metafun.stop()
end
\ctxloadluafile{mplua}{}


\starttext
\ctxlua{metapost.showlog = true}

\ctxlua{thirddata.drops.generate_default_path(drops:boxshadow-w199h100r10,200pt,100pt,10pt)}
\ctxlua{inspect(metapost.variables)}



\stoptext
___
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] runtime problem with metafun() code

2014-01-24 Thread Hans Hagen

On 1/24/2014 1:35 PM, Peter Rolf wrote:

Hi,

I try to create a Metapost path in lua and it works so far for the
attached example. But a call of that function from another lua function
sadly fails (no path visible after call). The code seems to be executed
later (the output from 'show pid;' appears somewhere later in the log).

How can I ensure that the code is executed at runtime?


I don't understand the issue but isn't there a

metafun(draw p;)

missing then?

-
  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] runtime problem with metafun() code

2014-01-24 Thread Peter Rolf
Am 24.01.2014 14:45, schrieb Hans Hagen:
 On 1/24/2014 1:35 PM, Peter Rolf wrote:
 Hi,

 I try to create a Metapost path in lua and it works so far for the
 attached example. But a call of that function from another lua function
 sadly fails (no path visible after call). The code seems to be executed
 later (the output from 'show pid;' appears somewhere later in the log).

 How can I ensure that the code is executed at runtime?
 
 I don't understand the issue but isn't there a
 
 metafun(draw p;)
 
 missing then?

Setting the bounding box has the same effect, as drawing something.
Both methods avoid that the emtpy graphic is ignored by ConTeXt.

Anyhow, the MP path is not available in metapost.variables after the
function call. If there is no other way I have to call the function from
the TeX side (like in the attached example). Will look into that tomorrow.


Peter


 -
   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
 ___
 
 

___
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] runtime problem with metafun() code

2014-01-24 Thread Hans Hagen

On 1/24/2014 7:41 PM, Peter Rolf wrote:

Am 24.01.2014 14:45, schrieb Hans Hagen:

On 1/24/2014 1:35 PM, Peter Rolf wrote:

Hi,

I try to create a Metapost path in lua and it works so far for the
attached example. But a call of that function from another lua function
sadly fails (no path visible after call). The code seems to be executed
later (the output from 'show pid;' appears somewhere later in the log).

How can I ensure that the code is executed at runtime?


I don't understand the issue but isn't there a

 metafun(draw p;)

missing then?


Setting the bounding box has the same effect, as drawing something.
Both methods avoid that the emtpy graphic is ignored by ConTeXt.

Anyhow, the MP path is not available in metapost.variables after the
function call. If there is no other way I have to call the function from
the TeX side (like in the attached example). Will look into that tomorrow.


%D We also provide an outputless run:

\unexpanded\def\startMPcalculation

-
  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
___


[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
___


[NTG-context] METAFUN+CONTEXT+CUSTOMIZE

2013-05-02 Thread MANUEL GONZALEZ SUAREZ
Hi
everyone.

I would
like to pose the following question: I would like to know how I can customize
the page number using an embedded graphic made ​​with METAFUN. I mean, I
wish someone would send me a simple example to do that, for example, a page
number or headers (chapter,
section, etc..)  may appear with a color background
or something else. The METAFUN manual provides, for example, the page number
within an ellipse, and the sections are underlined in orange.

Thank you
all for your patience and sorry for my poor English and my poor knowledge of
ConTeXt, but I'm studying hard reference manuals ConTeXt and hope to go slowly
improving, although I am not expert in computer programming languages ​​or even less in
mathematics.

Thanks very much.-- Manuel González Suárez
___
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] METAFUN+CONTEXT+CUSTOMIZE

2013-05-02 Thread Wolfgang Schuster

Am 02.05.2013 um 23:31 schrieb MANUEL GONZALEZ SUAREZ 
gonzalezsman...@uniovi.es:

 
 Hi everyone.
 
 I would like to pose the following question: I would like to know how I can 
 customize the page number using an embedded graphic made ​​with METAFUN. I 
 mean, I wish someone would send me a simple example to do that, for example, 
 a page number or headers (chapter, section, etc..)  may appear with a color 
 background or something else. The METAFUN manual provides, for example, the 
 page number within an ellipse, and the sections are underlined in orange.
 
 Thank you all for your patience and sorry for my poor English and my poor 
 knowledge of ConTeXt, but I'm studying hard reference manuals ConTeXt and 
 hope to go slowly improving, although I am not expert in computer programming 
 languages ​​or even less in mathematics.
 
 Thanks very much.
 
These are only simple styles but the show how you can customize the heading and 
pagenumber.

\define[2]\ChapterCommand
  {\startframed[frame=off,bottomframe=on,framecolor=orange,width=fit]
#1\hspace[medium]#2
\stopframed}

\setuphead[chapter][command=\ChapterCommand]

\startuseMPgraphic{pagenumber}
  draw fullcircle xyscaled(OverlayWidth,OverlayHeight) withcolor \MPcolor{blue} 
;
\stopuseMPgraphic

\defineoverlay[pagenumber][\useMPgraphic{pagenumber}]

\define[1]\PagenumberCommand
  {\framed[frame=off,background=pagenumber]{#1}}

\setuppagenumbering[command=\PagenumberCommand]

\starttext
\chapter{This is a chapter}
\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] METAFUN+CONTEXT+CUSTOMIZE

2013-05-02 Thread MANUEL GONZALEZ SUAREZ
Wolfgang Thanks for your help.Your definition to customize the number of page works, but the command definition \ ChapterCommand gives me a compilation error. (with LuaTeX and MKIV).Thank you again. Now I see that is a bit more complicated than I imagined.Greetings.-- Manuel González Suárez
___
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] METAFUN+CONTEXT+CUSTOMIZE

2013-05-02 Thread Wolfgang Schuster

Am 03.05.2013 um 00:27 schrieb MANUEL GONZALEZ SUAREZ 
gonzalezsman...@uniovi.es:

 Wolfgang Thanks for your help.
 Your definition to customize the number of page works, but the command 
 definition \ ChapterCommand gives me a compilation error. (with LuaTeX and 
 MKIV).

I guess you’re using a older context version (TeXLive 2012?) where you have to 
use

  \unexpanded\def\ChapterCommand#1#2{…}

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] METAFUN+CONTEXT+CUSTOMIZE

2013-05-02 Thread MANUEL GONZALEZ SUAREZ
I use TeXLive 2011 and I get the following error (the file name is custo.tex):mtx-context | warning: synctex is enabled
mtx-context | run 1: luatex --synctex=1 --fmt=C:/texlive/2011/texmf-var/luatex-cache/context/210a96fef5fbab446fd11afa77acb026/formats/cont-en --lua=C:/texlive/2011/texmf-var/luatex-cache/context/210a96fef5fbab446fd11afa77acb026/formats/cont-en.lui --backend=pdf ./custo.tex
This is LuaTeX, Version beta-0.70.1-2011061421 (rev 4277) 
 \write18 enabled.
(custo.tex

ConTeXt  ver: 2011.05.18 18:04 MKIV  fmt: 2013.4.23  int: english/english

system   cont-new.mkiv loaded
(C:/texlive/2011/texmf-dist/tex/context/base/cont-new.mkiv
system   beware: some patches loaded from cont-new.mkiv
)
system   custo.top loaded
(custo.top)
fontslatin modern fonts are not preloaded
languageslanguage en is active
{C:/texlive/2011/texmf-dist/fonts/map/pdftex/context/mkiv-base.map}
fontspreloading latin modern fonts (second stage)
(C:/texlive/2011/texmf-dist/tex/context/base/type-siz.mkiv) (C:/texlive/2011/texmf-dist/tex/context/base/type-otf.mkiv){C:/texlive/2011/texmf-dist/fonts/map/dvips/lm/lm-math.map}{C:/texlive/2011/texmf-dist/fonts/map/dvips/lm/lm-rm.map}
fontsvirtual math  unable to resolve name mapsfromchar
fontsfallback modern rm 12pt is loaded
system   begin file custo.tex at line 18
structuresectioning  chapter @ level 2 : 0.1 - This is a chapter
! Undefined control sequence.

system   tex  error on line 19 in file custo.tex: Undefined control sequence ...

 9 \stopuseMPgraphic
10 
11 \defineoverlay[pagenumber][\useMPgraphic{pagenumber}]
12 
13 \define[1]\PagenumberCommand
14   {\framed[frame=off,background="">
15 
16 \setuppagenumbering[command=\PagenumberCommand]
17 
18 \starttext
19   \chapter{This is a chapter}
20 \stoptext


\ChapterCommand #1#2-\startframed 
   [frame=off,bottomframe=on,framecolor=oran...
\placestructureheadnumbertext ...uctureheadtitle }
  }\fi \endheadplacement {\g...
\dohandlestructurehead ...structureheadnumbertext 
  \else \placestructureheadt...
l.19 \chapter{This is a chapter}

? 
! Undefined control sequence.

system   tex  error on line 19 in file custo.tex: Undefined control sequence ...

 9 \stopuseMPgraphic
10 
11 \defineoverlay[pagenumber][\useMPgraphic{pagenumber}]
12 
13 \define[1]\PagenumberCommand
14   {\framed[frame=off,background="">
15 
16 \setuppagenumbering[command=\PagenumberCommand]
17 
18 \starttext
19   \chapter{This is a chapter}
20 \stoptext


\ChapterCommand ...\hspace [medium]#2 \stopframed 
  
\placestructureheadnumbertext ...uctureheadtitle }
  }\fi \endheadplacement {\g...
\dohandlestructurehead ...structureheadnumbertext 
  \else \placestructureheadt...
l.19 \chapter{This is a chapter}

? 
metapost     initializing instance 'metafun' using format 'metafun'
metapost loading 'metafun.mp' (experimental metapost version two)
backend  xmp  using file 'C:/texlive/2011/texmf-dist/tex/context/base/lpdf-pdx.xml'
pagesflushing realpage 1, userpage 1, subpage 1
system   end file custo.tex at line 20
 )C:/texlive/2011/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.otf
mkiv lua stats   used config file  - selfautoparent:/texmfcnf.lua;selfautoparent:/texmf/web2c/texmfcnf.lua
mkiv lua stats   used cache path   - readable: 'C:/texlive/2011/texmf-var/luatex-cache/context/210a96fef5fbab446fd11afa77acb026' (order 1)
mkiv lua stats   used cache path   - writable: 'C:/texlive/2011/texmf-var/luatex-cache/context/210a96fef5fbab446fd11afa77acb026'
mkiv lua stats   synctex tracing   - synctex has been enabled (extra log file generated)
mkiv lua stats   input load time   - 0.314 seconds
mkiv lua stats   stored bytecode data  - 285 modules, 60 tables, 345 chunks
mkiv lua stats   cleaned up reserved nodes - 33 nodes, 9 lists of 423
mkiv lua stats   node memory usage - 27 glue_spec
mkiv lua stats   node list callback tasks  - 6 unique task lists, 5 instances (re)created, 2385 calls
mkiv lua stats   used backend  - pdf (backend for directly generating pdf output)
mkiv lua stats   loaded patterns   - en::2
mkiv lua stats   callbacks - 2542 direct, 2985 indirect, 5527 total
mkiv lua stats   randomizer- resumed with value 0.59913937803278
mkiv lua stats   lxml preparation time - 0.000 seconds, 0 nodes, 15 lpath calls, 0 cached calls
mkiv lua stats   result saved in 

Re: [NTG-context] METAFUN+CONTEXT+CUSTOMIZE

2013-05-02 Thread Wolfgang Schuster

Am 03.05.2013 um 00:45 schrieb MANUEL GONZALEZ SUAREZ 
gonzalezsman...@uniovi.es:

 I use TeXLive 2011 and I get the following error (the file name is custo.tex):

Use this definition

\define[2]\ChapterCommand
  {\framed
 [frame=off,bottomframe=on,framecolor=orange,width=fit]
 {#1\hspace[medium]#2}}


In newer versions (the environment form was added a few months ago) you can use

  \startframed … \stopframed

instead of

  \framed{…}

which makes it easier to format code when \framed has more content.

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] Metafun textext()

2013-01-10 Thread Alan BRASLAU
Metafun textext() has been changed in an attempt to be more efficient. However, 
this has a side effet that it now handles colors differently, among other 
things. The following example, intended to cause difficulties for the color 
blind, no longer works. Is this a bug or a feature?

\starttext
\startMPcode
picture T ;
T := thelabel(textext(I'm seeing double),origin) ;

draw T withcolor green ;
draw T shifted (-1mm,1mm) withcolor blue ;
\stopMPcode
\stoptext

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] Metafun textext()

2013-01-10 Thread Aditya Mahajan

On Thu, 10 Jan 2013, Alan BRASLAU wrote:

Metafun textext() has been changed in an attempt to be more efficient. 
However, this has a side effet that it now handles colors differently, 
among other things. The following example, intended to cause 
difficulties for the color blind, no longer works. Is this a bug or a 
feature?


\starttext
\startMPcode
picture T ;
T := thelabel(textext(I'm seeing double),origin) ;

draw T withcolor green ;
draw T shifted (-1mm,1mm) withcolor blue ;
\stopMPcode
\stoptext


Since the beginning of MkIV, colors in metapost labels need to be set at 
the ConTeXt end (Untested):


T := thelabel(textext(\color[blue]{I'm seeing double}), origin);

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] Metafun textext()

2013-01-10 Thread Alan BRASLAU
On Thu, 10 Jan 2013 06:51:50 -0500
Aditya Mahajan adit...@umich.edu wrote:

 Since the beginning of MkIV, colors in metapost labels need to be set at 
 the ConTeXt end (Untested):
 
 T := thelabel(textext(\color[blue]{I'm seeing double}), origin);
 
 Aditya

I don't believe that this is true, but I am most likely wrong.
Indeed \blue text has worked, but 'draw T withcolor blue;' *should* work as 
well.
The processing of textext() has changed recently, it seems.

\startMPcode
label(textext(I'm seeing double),origin) withcolor green ;
label(textext(I'm seeing double),(-1mm,1mm)) withcolor blue ;
\stopMPcode

DOES work.

Of course, these are much simplified minimal examples of what I would like to 
do.

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] Metafun textext()

2013-01-10 Thread Mojca Miklavec
On Thu, Jan 10, 2013 at 2:01 PM, Alan BRASLAU wrote:
 On Thu, 10 Jan 2013 06:51:50 -0500
 Aditya Mahajan wrote:

 Since the beginning of MkIV, colors in metapost labels need to be set at
 the ConTeXt end (Untested):

 T := thelabel(textext(\color[blue]{I'm seeing double}), origin);

 Aditya

 I don't believe that this is true, but I am most likely wrong.

Based on a snippet from mp-gnuplot (and agreeing with your point of
view that it would be nice if it worked without the extra hassle) I
tend to agree with Aditya (and I seem to remember that Hans
implemented \colored[r=...,g=...,b=...] command exactly when this
became a problem):

  % Returns an image with colored text according to current color
  % This only makes sense for mkiv text. Mkii is handled with \sometxt
  % and colors are working properly there. /.../
  vardef gp_colored_mkiv_text(expr str) =

% since withcolor doesn't work any more, we need to provide a workaround.
save r, g, b;
r = redpart   gp_color_current;
g = greenpart gp_color_current;
b = bluepart  gp_color_current;

rawtextext(\colored[r=  decimal(r)  ,g=  decimal(g)  ,b=
 decimal(b)  ]{  str  })
  enddef;

Mojca
___
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] Metafun textext()

2013-01-10 Thread Aditya Mahajan

On Thu, 10 Jan 2013, Alan BRASLAU wrote:


On Thu, 10 Jan 2013 06:51:50 -0500
Aditya Mahajan adit...@umich.edu wrote:


Since the beginning of MkIV, colors in metapost labels need to be set at
the ConTeXt end (Untested):

T := thelabel(textext(\color[blue]{I'm seeing double}), origin);

Aditya


I don't believe that this is true, but I am most likely wrong.


Well, I think it was true in the beginning (as I remember a discussion 
from Mojca on how to handle labels differently in the gnuplot module), 
but clearly that is not the case now.



Indeed \blue text has worked, but 'draw T withcolor blue;' *should* work as 
well.
The processing of textext() has changed recently, it seems.

\startMPcode
label(textext(I'm seeing double),origin) withcolor green ;
label(textext(I'm seeing double),(-1mm,1mm)) withcolor blue ;
\stopMPcode

DOES work.

Of course, these are much simplified minimal examples of what I would like to 
do.


Minimal example to show what is happening:

\startbuffer[initialize]
  picture T;
  T := textext(Hello);

  picture Q;
  Q := T;
\stopbuffer

\startbuffer[T]
  draw T withcolor blue;
\stopbuffer

\startbuffer[Q]
  draw Q shifted (-1mm, 1mm) withcolor red;
\stopbuffer

\startlines
Only draw T: \processMPbuffer[initialize,T]
Only draw Q: \processMPbuffer[initialize,Q]
Draw T  Q : \processMPbuffer[initialize,T,Q]
Draw Q  T : \processMPbuffer[initialize,Q,T]
\stoplines

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] Metafun textext()

2013-01-10 Thread Hans Hagen

On 1/10/2013 2:18 PM, Aditya Mahajan wrote:

On Thu, 10 Jan 2013, Alan BRASLAU wrote:


On Thu, 10 Jan 2013 06:51:50 -0500
Aditya Mahajan adit...@umich.edu wrote:


Since the beginning of MkIV, colors in metapost labels need to be set at
the ConTeXt end (Untested):

T := thelabel(textext(\color[blue]{I'm seeing double}), origin);

Aditya


I don't believe that this is true, but I am most likely wrong.


Well, I think it was true in the beginning (as I remember a discussion
from Mojca on how to handle labels differently in the gnuplot module),
but clearly that is not the case now.


Indeed \blue text has worked, but 'draw T withcolor blue;' *should*
work as well.
The processing of textext() has changed recently, it seems.


The mkiv implementation has always been rather different from the mkii 
one: text handling as well as dealing with colors.



\startMPcode
label(textext(I'm seeing double),origin) withcolor green ;
label(textext(I'm seeing double),(-1mm,1mm)) withcolor blue ;
\stopMPcode

DOES work.

Of course, these are much simplified minimal examples of what I would
like to do.


Minimal example to show what is happening:

\startbuffer[initialize]
   picture T;
   T := textext(Hello);

   picture Q;
   Q := T;
\stopbuffer

\startbuffer[T]
   draw T withcolor blue;
\stopbuffer

\startbuffer[Q]
   draw Q shifted (-1mm, 1mm) withcolor red;
\stopbuffer

\startlines
Only draw T: \processMPbuffer[initialize,T]
Only draw Q: \processMPbuffer[initialize,Q]
Draw T  Q : \processMPbuffer[initialize,T,Q]
Draw Q  T : \processMPbuffer[initialize,Q,T]
\stoplines


You and Alan can pick up the beta from the ftp server and play with this:

\setupbodyfont[dejavu]

\starttext

\startMPpage[offset=10pt]

picture MyText ; MyText := textext(Dummy) ; % not used later on

picture MyText ; MyText := textext(\red Red) ;

draw MyText ;

draw MyText scaled 2 shifted (0,-1cm) ;

draw MyText scaled 3 shifted (0,-2cm) ;

picture MyText ; MyText := textext(Blue Green Red) ;

draw MyText rotatedaround(center MyText,10) shifted (0,-3cm) 
withcolor blue ;


draw MyText shifted (0,-4cm) withcolor green ;

draw MyText rotatedaround(center MyText,-10) shifted (0,-5cm) 
withcolor red ;


picture MyText ; MyText := image (
draw textext(Green Red Blue {\yellow YELLOW} Whatever 1) ;
draw textext(Green Red Blue {\yellow YELLOW} Whatever 2) 
shifted (10cm,0) ;

) ;

draw MyText shifted (0,-6cm) withcolor green ;

draw MyText shifted (0,-7cm) withcolor red ;

draw MyText shifted (0,-8cm) withcolor blue ;

\stopMPpage

\stoptext

The complication is that we reuse a picture which once defined has 
frozen properties. However, after hours of lua/tex juggling I managed to 
made a variant that better keeps track of applied colors. I'm not sure 
if this is foolproof but it's probably quite ok for what Alan wants to 
do. Although ... being a scientist he will look for the next frontier 
... (or even more scientific: try to prove me wrong).


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
-


textext-002.pdf
Description: Adobe PDF document
___
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] OOP in Metafun.

2012-12-11 Thread Nicola
In article 
CADVh14XYT3Mi6aPUOv4Py==_gjy=MAFEH-hQbmRVE=r_d-t...@mail.gmail.com,
 Andre Caldas andre.em.cal...@gmail.com wrote:

  But I would like to use some object oriented like approach.
  [...]
  How do I do that in METAFUN/METAPOST?
 
  You may want to take a look at my attempt:
 
  http://users.dimi.uniud.it/~nicola.vitacolonna/home/content/metappeal
 
 Looks nice! I didn't find any license explaining the licensing terms.

In the documentation there is a Disclaimer. In short, do what you want with the 
code, but do not blame me ;)

Nicola

___
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] OOP in Metafun.

2012-12-10 Thread Nicola
In article 
cadvh14ul9igw6wyvymg80hymiaxxhzfoc0no_4+dr70knok...@mail.gmail.com,
 Andre Caldas andre.em.cal...@gmail.com wrote:

 Hello, list!
 
 I am writing down a macro package for commutative diagrams using metafun.
 This is my first try:
 https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab20348c9a9c9e5
 0740618173648979f45/src/environments/diagrams.tex?at=default
 
 Used here:
 https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab2034/src/prod
 ucts/assorted/open_mapping_theorem/notes/introduction.tex?at=default#cl-106
 
 But I would like to use some object oriented like approach. That is,
 I'd like the diagram data structure to be set up like this:
 
 d = CD.new;
 d.vertex($X$); d.arrow($f$); d.vertex($Y$);
 d.newline;
 d.arrow($\pi$); d.arrow($\pi$);
 d.vertex($A$); d.arrow($g$); d.vertex($B$);
 
 or even in some thelabel similar fashion,
 
 d = CD.new;
 CD.vertex(d, $X$); CD.arrow(d, $f$); CD.vertex(d, $Y$);
 CD.newline(d);
 CD.arrow(d, $\pi$); CD.arrow(d, $\pi$);
 CD.vertex(d, $A$); CD.arrow(d, $g$); CD.vertex(d, $B$);
 
 
 How do I do that in METAFUN/METAPOST?

You may want to take a look at my attempt:

http://users.dimi.uniud.it/~nicola.vitacolonna/home/content/metappeal

It is a library intended to provide a minimal framework for “oo-like” 
constructs.
It is a work in progress (actually, I have not worked on it for a while since I 
didn't receive any feedback) and the documentation is a bit messy, but the core 
is stable and well tested and should be compatible with MetaFun.

It is all based on a pair of macros that generalize MetaPost declarations, a 
first draft of which is shortly described here:

http://oldwww.gust.org.pl/projects/pearls/2011p/index_html

For the functionality you are describing, you may just need to grab the file 
metappeal.mp (and the files that it includes) and include it in your source.

Nicola

___
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] OOP in Metafun.

2012-12-10 Thread Andre Caldas
 But I would like to use some object oriented like approach.
 [...]
 How do I do that in METAFUN/METAPOST?

 You may want to take a look at my attempt:

 http://users.dimi.uniud.it/~nicola.vitacolonna/home/content/metappeal

Looks nice! I didn't find any license explaining the licensing terms.


André Caldas.
___
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] OOP in Metafun.

2012-12-09 Thread Andre Caldas
Hello, list!

I am writing down a macro package for commutative diagrams using metafun.
This is my first try:
https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab20348c9a9c9e50740618173648979f45/src/environments/diagrams.tex?at=default

Used here:
https://bitbucket.org/andrecaldas/math-video-classes/src/9a050eab2034/src/products/assorted/open_mapping_theorem/notes/introduction.tex?at=default#cl-106

But I would like to use some object oriented like approach. That is,
I'd like the diagram data structure to be set up like this:

d = CD.new;
d.vertex($X$); d.arrow($f$); d.vertex($Y$);
d.newline;
d.arrow($\pi$); d.arrow($\pi$);
d.vertex($A$); d.arrow($g$); d.vertex($B$);

or even in some thelabel similar fashion,

d = CD.new;
CD.vertex(d, $X$); CD.arrow(d, $f$); CD.vertex(d, $Y$);
CD.newline(d);
CD.arrow(d, $\pi$); CD.arrow(d, $\pi$);
CD.vertex(d, $A$); CD.arrow(d, $g$); CD.vertex(d, $B$);


How do I do that in METAFUN/METAPOST?


Cheers,
André Caldas.
___
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] OOP in Metafun.

2012-12-09 Thread Andre Caldas
 But I would like to use some object oriented like approach.

I have done some OOP like coding...
https://bitbucket.org/andrecaldas/math-video-classes/src/77036fe1001ede35e301305700943ac952089d32/src/environments/diagrams.tex?at=default

This is my first METAFUN experience. Comments are very welcome!


André Caldas.
___
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] using variable for subscript in math+lua (and math+MetaFun)

2012-10-25 Thread Jeong Dal
Dear Gesang and Hans,

Your solution is working nicely. 
I may use lua to simplify my other work.

I'd like to ask you one more thing.

I tried to write a matrix using MetaFun to add some graphics as following:

label(btex $a_{11}$ etex, ( , )); 
label(btex $a_{12}$ etex, ( , ));
label(btex $a_{13}$ etex, ( , ));
…
label(btex $a_{3,3}$ etex, ( , ));

Since the same command is repeated, I tested to use for iteration.
But I couldn't succeed. It is OK to use the variable as a text but I couldn't 
find a way to use a variable as a subscript.

For example, 

for i=1 unto 3: label(btex decimal(i) etex, (x,y)); endfor;  

is OK. But,
 
for i=1 upto 3: label(btex $a_{i}$ etex, (x,y)); endfor; 
or
for i=1 upto 3: label(btex $a_{deciaml(i)}$ etex, (x,y)); endfor; 

are not working as I wanted. 

Is there a way to use variable as a subscript in label?

Thank you again.

Best regards,

Dalyoung

___
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] using variable for subscript in math+lua (and math+MetaFun)

2012-10-25 Thread Hans Hagen
On 25-10-2012 13:59, Jeong Dal wrote:
 Dear Gesang and Hans,
 
 Your solution is working nicely.
 I may use lua to simplify my other work.
 
 I'd like to ask you one more thing.
 
 I tried to write a matrix using MetaFun to add some graphics as following:
 
 label(btex $a_{11}$ etex, ( , ));
 label(btex $a_{12}$ etex, ( , ));
 label(btex $a_{13}$ etex, ( , ));
 …
 label(btex $a_{3,3}$ etex, ( , ));
 
 Since the same command is repeated, I tested to use for iteration.
 But I couldn't succeed. It is OK to use the variable as a text but I couldn't 
 find a way to use a variable as a subscript.
 
 For example,
 
 for i=1 unto 3: label(btex decimal(i) etex, (x,y)); endfor;
 
 is OK. But,
   
 for i=1 upto 3: label(btex $a_{i}$ etex, (x,y)); endfor;
 or
 for i=1 upto 3: label(btex $a_{deciaml(i)}$ etex, (x,y)); endfor;
 
 are not working as I wanted.
 
 Is there a way to use variable as a subscript in label?

play with code like this

\starttext

\startluacode
context.startMPcode()
for i=1,10 do
for j=1,10 do
context('draw (%scm,%scm) withpen pencircle scaled 2mm
;',i,j)
context('draw
thetextext.top(\\tt%s,%s,(%scm,%scm+2mm)) ;',i,j,i,j)
end
end
context.stopMPcode()
\stopluacode

\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] using variable for subscript in math+lua (and math+MetaFun)

2012-10-25 Thread Jeong Dal
Dear Hans,

The structure of your code  is very interesting.

MP code) inside ConTeXt) inside Lua) inside ConTeXt) again!

It is really useful.

Thank you.

Best regards,

Dalyoung

 
 play with code like this
 
 \starttext
 
 \startluacode
context.startMPcode()
for i=1,10 do
for j=1,10 do
context('draw (%scm,%scm) withpen pencircle scaled 2mm
 ;',i,j)
context('draw
 thetextext.top(\\tt%s,%s,(%scm,%scm+2mm)) ;',i,j,i,j)
end
end
context.stopMPcode()
 \stopluacode
 
 \stoptext
 

___
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] Is it possible to generate eps files using metafun and context?

2012-06-18 Thread Hans Hagen

On 14-6-2012 19:07, Hongwen Qiu wrote:

Hi,

Is it possible to typeset the label with context and generate eps output
files using the metafun format? If yes, then how?



\startMPpage
...
\stopMPpage

or

\startTEXpage
...
\stopTEXpage

and then use pstopdf to turn the pdf into an eps

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] Is it possible to generate eps files using metafun and context?

2012-06-18 Thread Hongwen Qiu

On 06/18/2012 04:19 PM, Hans Hagen wrote:
and then use pstopdf to turn the pdf into an eps 
You must mean pdftops, since pstopdf cannot convert pdf files into eps 
but pdftops can.


I tried pdftops, the result quality is high, but since my desire is to 
provide eps figures to others that have to insert high quality figures 
into Microsoft Word, the pdftops converted eps files cannot insert into 
Microsoft Word. Fortunately, I have found out that pstopdf uses 
ghostscript/Inkscape to do the real job, and I use ghostscript directly 
to convert pdf into eps, the quality is high enough with the -dNOCACHE 
option (I had tried inkscape before my last posting a few weeks ago, and 
the resulting quality is not high enough when I'm using Fedora 16. But 
it seems that inkscape in Fedora 17 produces better quality now, though 
ghostscript is better), and it can be recognized by Microsoft Word.


Thanks for the information.
___
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] Is it possible to generate eps files using metafun and context?

2012-06-14 Thread Hongwen Qiu

Hi,

Is it possible to typeset the label with context and generate eps output 
files using the metafun format? If yes, then how?


TIA.
___
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] Metapost/Metafun Q: using variables and building blocks?

2012-05-07 Thread Mari Voipio
On Sun, May 6, 2012 at 4:52 PM, Hans Hagen pra...@wxs.nl wrote:
 You have seen this one, haven't you? Posted by Don Knuth:

 http://www.youtube.com/watch?v=YVuggGxeBVk

 So that's your next challenge.

Yes, I've seen it, had to watch the whole thing, it is so fascinating.

If I ever decide to invest in such a machine, it'll be an expensive
one that allows me to digitize my own graphics (not just ready-made
sets), preferably as vectors. In which case doing *that* isn't so much
of a challenge any more.

I've coveted one of those for a while, but currently cannot justifty
getting one, neither for fun nor for my tiny craft business as that
one is concentrated on the pre-steam era. However, I'm planning to use
MetaPost to create blackwork charts, I've got the feeling that it'll
give me neater results than any existing software. And I won't be
stuck with one OS, either. :-)


Mari
___
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
___


<    1   2   3   4   5   6   7   8   9   10   >