[NTG-context] Metapost/Metafun/Tex/Context question

2006-07-19 Thread WN
Hi all,

I am trying to do the following in Metapost but my new math symbol  is 
not recognized.
Context knows about it but Tex does not.

How can I make this work ?

Kind regards
Wim Neimeijer

% = Test code 
\loadmapfile[original-youngryu-tx.map]
\definebodyfont [28pt,24pt,18pt,
  17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [
  mc=txexa sa 1]

\setupbodyfont [11pt]
\definemathsymbol [varointctrclockwise] [op] [mc] [2B] [mc] [2C]

\starttext
\startformula
\varointctrclockwise_{\gamma} f(z) \: dz = 0
\stopformula
\startMPcode
picture p ;
path q;
numeric u;

u := 1cm;

p := btex $\varointctrclockwise_{\gamma} f(z) \: dz = 0$ etex;
p := p scaled 0.15cm;
draw p;
\stopMPcode
\stoptext

=== Log file ==
 texmfstart texexec --autopdf --pdf testvaroint.tex
TeXExec | processing document 'testvaroint.tex'
TeXExec | no ctx file found
TeXExec | tex processing method: context
TeXExec | TeX run 1
TeXExec | writing option file testvaroint.top
TeXExec | using randomseed 1260
TeXExec | tex engine: pdfetex
TeXExec | tex format: cont-en
TeXExec | progname: context
This is pdfeTeX, Version 3.141592-1.30.3-2.2 (Web2c 7.5.5)
 \write18 enabled.
 (f:\context\usr\local\context\tex\texmf-local/web2c/natural.tcx)
entering extended mode
(./testvaroint.tex

ConTeXt  ver: 2006.07.14 12:08  fmt: 2006.7.14  int: english  mes: english

language: language en is active
protectionstate 0
system  : cont-new loaded
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/cont-new.tex
systems : beware: some patches loaded from cont-new.tex
color   : palette rollover is available
)
system  : cont-old loaded
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/cont-old.tex
loading : Context Old Macros
)
system  : cont-fil loaded
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/cont-fil.tex
loading : Context File Synonyms
)
system  : cont-sys loaded
(f:\context\usr\local\context\tex\texmf-local/tex/context/user/cont-sys.tex)
bodyfont: 12pt rm is loaded
language: patterns nl-texnansi:texnansi-1-2:3 
nl-ec:ec-2-2:3 fr-
texnansi:texnansi-3-2:3 fr-ec:ec-4-2:3 
de-texnansi:texnansi-5-2:3 de-e
c:ec-6-2:3 it-texnansi:texnansi-7-2:3 it-ec:ec-8-2:3 
pt-texnansi:texna
nsi-9-2:3 pt-ec:ec-10-2:3 hr-ec:ec-11-2:3 pl-pl0:pl0-12-2:3 
pl-ec:e
c-13-2:3 pl-qx:qx-14-2:3 cz-il2:il2-15-2:3 cz-ec:ec-16-2:3 
sk-il2:i
l2-17-2:3 sk-ec:ec-18-2:3 sl-ec:ec-19-2:3 en-ec:ec-21-2:3 
uk-ec:ec-
 22-2:3 us-ec:ec-23-2:3 agr-agr:agr-24-2:3 da-ec:ec-25-2:3 
sv-ec:ec-
 26-2:3 af-ec:ec-27-2:3 no-ec:ec-28-2:3 deo-ec:ec-29-2:3 
es-ec:ec-3
0-2:3 ca-ec:ec-31-2:3 la-ec:ec-32-2:3 ro-ec:ec-33-2:3 
tr-ec:ec-34-
2:3 fi-ec:ec-36-2:3 hu-ec:ec-37-2:3 loaded
specials: tex,postscript,rokicki loaded
system  : testvaroint.top loaded
(./testvaroint.top
specials: loading definition file tpd
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/spec-tpd.tex
specials: loading definition file fdf
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/spec-fdf.tex)
specials: fdf loaded
)
specials: fdf,tpd loaded
)
systems : system commands are enabled
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/pdfr-ec.tex)
(./testvaroint.tuo) (./testvaroint.tuo) (./testvaroint.tuo) 
(./testvaroint.tuo)
(./testvaroint.tuo) (./testvaroint.tuo) (./testvaroint.tuo) 
(./testvaroint.tuo)
(./testvaroint.tuo) (./testvaroint.tuo)
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/sort-def.tex)
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/sort-lan.tex)
(./testvaroint.tuo) (./testvaroint.tuo)TeXExec | processing graphic 
'testvaroint-mpgraph'
TeXExec | using internal mptotex converter
TeXExec | processing document 'testvaroint-mpgraph-temp.tex'
TeXExec | no ctx file found
TeXExec | tex processing method: context
TeXExec | writing option file testvaroint-mpgraph-temp.top
TeXExec | using randomseed 447
TeXExec | tex engine: pdfetex
TeXExec | tex format: cont-en
TeXExec | progname: context
This is pdfeTeX, Version 3.141592-1.30.3-2.2 (Web2c 7.5.5)
 \write18 enabled.
 (f:\context\usr\local\context\tex\texmf-local/web2c/natural.tcx)
entering extended mode
(./testvaroint-mpgraph-temp.tex

ConTeXt  ver: 2006.07.14 12:08  fmt: 2006.7.14  int: english  mes: english

language: language en is active
protectionstate 0
system  : cont-new loaded
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/cont-new.tex
systems : beware: some patches loaded from cont-new.tex
color   : palette rollover is available
)
system  : cont-old loaded
(f:\context\usr\local\context\tex\texmf-local/tex/context/base/cont-old.tex
loading : Context Old Macros
)
system  : cont-fil loaded

Re: [NTG-context] Metapost/Metafun/Tex/Context question

2006-07-19 Thread Hans Hagen
WN wrote:
 Hi all,

 I am trying to do the following in Metapost but my new math symbol  is 
 not recognized.
 Context knows about it but Tex does not.

 How can I make this work ?

 Kind regards
 Wim Neimeijer

 % = Test code 
 \loadmapfile[original-youngryu-tx.map]
 \definebodyfont [28pt,24pt,18pt,
   17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [
   mc=txexa sa 1]

 \setupbodyfont [11pt]
 \definemathsymbol [varointctrclockwise] [op] [mc] [2B] [mc] [2C]

 \starttext
 \startformula
 \varointctrclockwise_{\gamma} f(z) \: dz = 0
 \stopformula
 \startMPcode
 picture p ;
 path q;
 numeric u;

 u := 1cm;

 p := btex $\varointctrclockwise_{\gamma} f(z) \: dz = 0$ etex;
 p := p scaled 0.15cm;
 draw p;
 \stopMPcode
 \stoptext
   
make sure that mp knows about the definitions: 

- first extend the math collection (use decimen, since there is a linesplit bug 
with  here) 
- then load the times font 
- somehow display and inline math render differently; something for taco 

\startMPenvironment[global]

\startmathcollection [default]
\definemathsymbol [varointctrclockwise] [op] [mc] [43] [mc] [44]
\stopmathcollection
\usetypescript[times][ec]
\setupbodyfont[times,11pt]

\stopMPenvironment

\starttext

why the funny .15cm scale ... 

\startformula
\varointctrclockwise_{\gamma} f(z) \: dz = 0
\stopformula

$\varointctrclockwise_{\gamma} f(z) \: dz = 0$

\startMPcode
draw btex $\varointctrclockwise_{\gamma} f(z) \: dz = 0$ etex scaled 0.15cm 
;
\stopMPcode

\startMPcode
draw btex $\displaystyle \varointctrclockwise_{\gamma} f(z) \: dz = 0$ etex 
scaled 0.15cm ;
\stopMPcode

\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost/Metafun/Tex/Context question

2006-07-19 Thread Aditya Mahajan
On Wed, 19 Jul 2006, WN wrote:

 Hi all,

 I am trying to do the following in Metapost but my new math symbol  is
 not recognized.
 Context knows about it but Tex does not.

 How can I make this work ?

Hans and Taco have already explained the correct way to do this, so I 
will not go into that. This is one place where you can use the new 
sometxt feature.

 % = Test code 
 \loadmapfile[original-youngryu-tx.map]
 \definebodyfont [28pt,24pt,18pt,
  17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [
  mc=txexa sa 1]

 \setupbodyfont [11pt]
 \definemathsymbol [varointctrclockwise] [op] [mc] [2B] [mc] [2C]

 \starttext
 \startformula
 \varointctrclockwise_{\gamma} f(z) \: dz = 0
 \stopformula
 \startMPcode
picture p ;
path q;
numeric u;

u := 1cm;

p := btex $\varointctrclockwise_{\gamma} f(z) \: dz = 0$ etex;

Replace this by

  p := \sometxt{$\varointctrclockwise_{\gamma} f(z) \: dz = 0$} ;

and everything works!



p := p scaled 0.15cm;
draw p;
 \stopMPcode
 \stoptext

Aditya
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost/Metafun/Tex/Context question

2006-07-19 Thread WN




[EMAIL PROTECTED] wrote:

  
Hans Hagen wrote:
  
  
make sure that mp knows about the definitions: 

- first extend the math collection (use decimen, since there is a linesplit bug with " here) 
- then load the times font 

  
  
Math family mc has to be txexa or something similar before the code
actually shows the integral instead  of a plus sign, but Wim can
figure that out himself, no doubt  :-)

  
  
- somehow display and inline math render differently; something for taco 

  
  
That is normal. One is with an operator with \limits, one without.

Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
  

For those interested, this is what I did. Taco is right in saying you
have to load the txexa font first. 
The code works for me, but I am not sure it is the proper Context way
of doing things. 

Kind regards
Wim Neimeijer

% === some extra math symbols I need
=
\startenvironment layout04

\unprotect
%
% extra math symbols
%
\usetypescript[modern]
\usetypescript[times]

\definetypeface[MyFace][rm][serif][times][default][encoding=ec]
\definetypeface[MyFace][mm][math][modern][default][encoding=ec]
\setupbodyfont[MyFace,10pt]

\loadmapfile[original-youngryu-tx.map]
\definebodyfont [28pt,24pt,18pt,
 17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [
 mc=txexa sa 1]

\setupbodyfont [11pt]

%%%
% txfonts
%%%

\definemathsymbol [oiint] [op] [mc] ["08] [mc] ["09]
\definemathsymbol [oiiint] [op] [mc] ["29] [mc] ["2a]
\definemathsymbol [ointctrclockwise] [op] [mc] ["0A] [mc] ["0B]
\definemathsymbol [ointclockwise] [op] [mc] ["0C] [mc] ["0D]
\definemathsymbol [varointctrclockwise] [op] [mc] ["2B] [mc] ["2C]
\definemathsymbol [varointclockwise] [op] [mc] ["2D] [mc] ["2E]

\definemathsymbol [iint] [op] [mc] ["21] [mc] ["22]
\definemathsymbol [iiint] [op] [mc] ["23] [mc] ["24]
\definemathsymbol [nt] [op] [mc] ["25] [mc] ["26]
\definemathsymbol [idotsint] [op] [mc] ["27] [mc] ["28]

\definemathsymbol [oiintctrclockwise] [op] [mc] ["40] [mc] ["41]
\definemathsymbol [oiintclockwise] [op] [mc] ["48] [mc] ["49]
\definemathsymbol [varoiintctrclockwise][op] [mc] ["4A] [mc] ["4B]
\definemathsymbol [varoiintclockwise] [op] [mc] ["42] [mc] ["43]

\definemathsymbol [oiiintctrclockwise] [op] [mc] ["44] [mc] ["45]
\definemathsymbol [oiiintclockwise] [op] [mc] ["4C] [mc] ["4D]
\definemathsymbol [varoiiintctrclockwise][op] [mc] ["4E] [mc] ["4F]
\definemathsymbol [varoiiintclockwise] [op] [mc] ["46] [mc] ["47]

\protect

\stopenvironment



___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost/Metafun/Tex/Context question

2006-07-19 Thread WN
[EMAIL PROTECTED] wrote:
 On Wed, 19 Jul 2006, WN wrote:

   
 Hi all,

 I am trying to do the following in Metapost but my new math symbol  is
 not recognized.
 Context knows about it but Tex does not.

 How can I make this work ?
 

 Hans and Taco have already explained the correct way to do this, so I 
 will not go into that. This is one place where you can use the new 
 sometxt feature.

   
 % = Test code 
 \loadmapfile[original-youngryu-tx.map]
 \definebodyfont [28pt,24pt,18pt,
  17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt] [mm] [
  mc=txexa sa 1]

 \setupbodyfont [11pt]
 \definemathsymbol [varointctrclockwise] [op] [mc] [2B] [mc] [2C]

 \starttext
 \startformula
 \varointctrclockwise_{\gamma} f(z) \: dz = 0
 \stopformula
 \startMPcode
picture p ;
path q;
numeric u;

u := 1cm;

p := btex $\varointctrclockwise_{\gamma} f(z) \: dz = 0$ etex;
 

 Replace this by

   p := \sometxt{$\varointctrclockwise_{\gamma} f(z) \: dz = 0$} ;

 and everything works!

   
I was wondering about the \sometxt feature, I did not know exactly how 
to use it, but will certainly do
some experiments. Thanks Wim.



   
p := p scaled 0.15cm;
draw p;
 \stopMPcode
 \stoptext

 
 Aditya
 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context
   

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost and TeX [OT]

2004-08-24 Thread Brooks Moses
On Mon, Aug 23, 2004 at 10:48:42PM -0400, [EMAIL PROTECTED] wrote:
 I don't have any experience in metapost.  I would appreciate if someone would
 please answer this question without me having to do thru tutorials and
 metapost source code.
 
 I was wondering how does metapost talk to TeX?  Quicky glancing through the
 metafun book, I found out that you can super-impose text typeset by
 TeX on top of a diagram.  I imagine you could do the same with
 mathematical equations too.

The following is as I understand it; others can I'm sure correct any
misunderstandings:

Metapost dumps out a TeX file, consisting of any header commands
specified in the Metapost file, and whatever is between btex and etex
tags.  It also puts in stuff so that what's between each pair of tags
gets put on its own page.  (This is actually done with the mpto command,
rather than in Metapost itself; if you just run that, you can examine
the output to see what TeX commands it uses.)

TeX is then run on this file, creating a .dvi file.

Metapost then reads in the .dvi file, using that to create the typeset
text that appears in the output Postscript file.

- Brooks

___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost and TeX [OT]

2004-08-24 Thread Taco Hoekwater


[EMAIL PROTECTED] wrote:

 So how does it happen in reality?

Matthias' reply is better for your situation, but for curiosity's
sake, here is what actually happens:

- MetaPost is happily reading MetaPost commands when suddenly it sees
  a btex command.

- Now it will throw away everything upto the next etex, and it will
  run the external command makempx with the current filename as argument.
  
* makempx's goal is to create a file with the same name as it's argument, but
  with the extension replaced with .mpx. That file will contain a series of
  low-level MetaPost commands for each label in the source file, and 
  those lists of commands are separated by the MetaPost command mpxbreak.

* nothing is done by makempx if the mpx file exists and is newer than the  
  source file.

** otherwise, the source file is scanned for verbatimtex ... etex and btex ... etex
   blocks. These are wrapped in very simple TeX macros and written to a TeX input
   file.

** TeX is run, to produce a DVI file from these commands (each dvi page representing 
   a label)

** The entire DVI file is then converted into the .mpx file in a single action.

- MetaPost will now open the .mpx file as a concurrent source of commands
  linked to the current source file, and read commands from it up to the
  first mpxbreak.

- The location pointer in the .mpx file is saved for subsequent labels.

Greetings, Taco

___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost and TeX [OT]

2004-08-24 Thread Hans Hagen
Brooks Moses wrote:
On Mon, Aug 23, 2004 at 10:48:42PM -0400, [EMAIL PROTECTED] wrote:
 

I don't have any experience in metapost.  I would appreciate if someone would
please answer this question without me having to do thru tutorials and
metapost source code.
I was wondering how does metapost talk to TeX?  Quicky glancing through the
metafun book, I found out that you can super-impose text typeset by
TeX on top of a diagram.  I imagine you could do the same with
mathematical equations too.
   

The following is as I understand it; others can I'm sure correct any
misunderstandings:
Metapost dumps out a TeX file, consisting of any header commands
specified in the Metapost file, and whatever is between btex and etex
tags.  It also puts in stuff so that what's between each pair of tags
gets put on its own page.  (This is actually done with the mpto command,
rather than in Metapost itself; if you just run that, you can examine
the output to see what TeX commands it uses.)
TeX is then run on this file, creating a .dvi file.
Metapost then reads in the .dvi file, using that to create the typeset
text that appears in the output Postscript file.
 

you miss a step: a mpx file is created from the dvi file; an mpx file is a bunch of metapost pictures that will replace the btex..etex's in the mp file 

Hans 

-
 Hans Hagen | PRAGMA ADE
 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-
___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost and TeX [OT]

2004-08-24 Thread Hans Hagen
Taco Hoekwater wrote:
- The location pointer in the .mpx file is saved for subsequent labels.
 

a small addition: 

- since we are dealing with parsing, btex .. etex cannot be changed dynamically, which is one of the reasons why metafun has the textext macro which provides an alternative for btex .. etex 

Hans 

-
 Hans Hagen | PRAGMA ADE
 Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-
___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] Metapost and TeX [OT]

2004-08-23 Thread skhilji
I don't have any experience in metapost.  I would appreciate if someone would please 
answer this question without me having to do thru tutorials and metapost source code.

I was wondering how does metapost talk to TeX?  Quicky glancing through the metafun 
book, I found out that you can super-impose text typeset by TeX on top of a diagram.  
I imagine you could do the same with mathematical equations too.

So how does metapost interact with TeX?  Let me guess:

1)  Metapost could first write down to a file the text that it wan't TeX to typeset.  
It could then run TeX on the file.  TeX produces a DVI file and metapost reads it 
back.  It can then superimpose it on top of a picture.

2)  Metapost could also be including within itself a simplified version of TeX.  But 
that would be reinventing the wheel.

So how does it happen in reality?

The reason that I am asking is that I am interested in producing some diagrams using 
the libHARU PDF library (a C++ library to produce PDF files).  Beautiful Text support, 
however, is missing from the library.  I was wondering if I could hack it up so that I 
could somehow use TeX for the text part and C++ calls for the graphics part.


___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Metapost and TeX

2004-08-23 Thread Matthias Weber
This is not exactly an answer to your question, but it might
solve your problem.
You can use overlays with any figure, see cont-eni.pdf page 150ff.
The mechanism is not so much the tex-engine TeX but one of the many 
little
add-ons that come with ConText and exploit features of PDF.

In particular, you can use your PDFs directly in ConText.
I found this easier than to teach my picture producing applications to 
use the
right fonts in the right way at the right place.

Matthias
On Aug 23, 2004, at 9:48 PM, [EMAIL PROTECTED] wrote:
I don't have any experience in metapost.  I would appreciate if 
someone would please answer this question without me having to do thru 
tutorials and metapost source code.

I was wondering how does metapost talk to TeX?  Quicky glancing 
through the metafun book, I found out that you can super-impose text 
typeset by TeX on top of a diagram.  I imagine you could do the same 
with mathematical equations too.

So how does metapost interact with TeX?  Let me guess:
1)  Metapost could first write down to a file the text that it wan't 
TeX to typeset.  It could then run TeX on the file.  TeX produces a 
DVI file and metapost reads it back.  It can then superimpose it on 
top of a picture.

2)  Metapost could also be including within itself a simplified 
version of TeX.  But that would be reinventing the wheel.

So how does it happen in reality?
The reason that I am asking is that I am interested in producing some 
diagrams using the libHARU PDF library (a C++ library to produce PDF 
files).  Beautiful Text support, however, is missing from the library. 
 I was wondering if I could hack it up so that I could somehow use TeX 
for the text part and C++ calls for the graphics part.

___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context

___
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context