ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Nice move in MP
@ 2000-11-02 17:51 David Arnold
  2000-11-03  9:03 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: David Arnold @ 2000-11-02 17:51 UTC (permalink / raw)
  Cc: pragma

Hans, All,

I took a swipe with your advice and got very lucky! I am using Miktex 1.20. 
Using plain Metapost and the command

mp --tex=latex p193n3

the attached file gives me the \mathcal and \mathbb fonts that I want. This 
is pretty neat and I post it here because this is the first time I've been 
able to do this, and I've read some users' posts to this list asking 
questions similar to this. So, enjoy.

By the way, Hans, your top top hint in the Metafun manual came in handy for 
my arrows. Very nice indeed.

Meanwhile, I am trying to do the same thing in Context, but I am really not 
sure how to start. Here's the file p193n3.mp.

verbatimtex
  \documentclass{article}
  \usepackage{amsmath}
  \usepackage{amsfonts}
  \begin{document}
  \def\E{\mathcal{E}}
  \def\L{\mathcal{L}}
  \def\U{\mathcal{U}}
  \def\R{\mathbb{R}}
etex

input mp-tool;

%prologues:=0;

beginfig(1);

%initialize picture array
picture pic[];

%initialize scale
numeric u; 1u=1cm;

%draw and label the space
path p; p:=fullcircle xscaled 2.5u yscaled 3u;
filldraw p withcolor 0.85white;
label(btex $\R^3$ etex, (0,1.25u));

%center the vector element
dotlabel.lft(btex $[{\bf v}]_\E$ etex, origin);

%typeset basis
label.top(btex $\E=\{{\bf e}_1,{\bf e}_2,{\bf e}_3\}$ etex, (0,1.5u));

%get current picture and save it in array
pic1:=currentpicture;
currentpicture:=nullpicture;

%draw and label the space
path p; p:=fullcircle xscaled 2.5u yscaled 3u;
filldraw p withcolor 0.85white;
label(btex $\R^3$ etex, (0,1.25u));

%center the vector element
dotlabel.rt(btex $[\L({\bf v})]_\E$ etex, origin);

%typeset basis
label.top(btex $\E=\{{\bf e}_1,{\bf e}_2,{\bf e}_3\}$ etex, (0,1.5u));

%get current picture and save it in array
pic2:=currentpicture;
currentpicture:=nullpicture;

%draw and label the space
path p; p:=fullcircle xscaled 2.5u yscaled 3u;
filldraw p withcolor 0.85white;
label(btex $\R^3$ etex, (0,-1.25u));

%center the vector element
dotlabel.lft(btex $[{\bf v}]_\U$ etex, origin);

%typeset basis
label.bot(btex $\U=\{{\bf u}_1,{\bf u}_2,{\bf u}_3\}$ etex, (0,-1.5u));

%get current picture and save it in array
pic3:=currentpicture;
currentpicture:=nullpicture;

%draw and label the space
path p; p:=fullcircle xscaled 2.5u yscaled 3u;
filldraw p withcolor 0.85white;
label(btex $\R^3$ etex, (0,-1.25u));

%center the vector element
dotlabel.rt(btex $[\L({\bf v})]_\U$ etex, origin);

%typeset basis
label.bot(btex $\U=\{{\bf u}_1,{\bf u}_2,{\bf u}_3\}$ etex, (0,-1.5u));

%get current picture and save it in array
pic4:=currentpicture;
currentpicture:=nullpicture;

%set centers of spaces
z1=origin shifted (0,6u);
z2=origin shifted (4u,6u);
z3=origin;
z4=origin shifted (4u,0);

%set the spaces
draw pic1 shifted z1;
draw pic2 shifted z2;
draw pic3 shifted z3;
draw pic4 shifted z4;

%draw arrows from space to space
pickup pencircle scaled 2pt;
drawarrow rt rt z1-- lft lft z2 withcolor blue;
drawarrow top top z3--bot bot z1 withcolor blue;
drawarrow bot bot z2-- top top z4 withcolor blue;
drawarrow rt rt z3-- lft lft z4 withcolor red;

%label arrows
label.top(btex $\L$ etex, 0.5[z1,z2]);
label.bot(btex $A$ etex, 0.5[z1,z2]);
label.top(btex $\L$ etex, 0.5[z3,z4]);
label.bot(btex $C$ etex, 0.5[z3,z4]);
label.lft(btex $U$ etex, 0.5[z3,z1]);
label.rt(btex $U^{-1}$ etex, 0.5[z4,z2]);
endfig;

end.

verbatimtex
  \end{document}
etex
-
David Arnold
College of the Redwoods
Mathematics Department
7351 Tompkins Hill Rd
Eureka, CA 95501
(707) 476-4222 Office
(707) 476-4424 Fax

http://online.redwoods.cc.ca.us/instruct/darnold/

Ordinary Differential Equations Using MATLAB, 2/e
http://www.prenhall.com/books/esm_0130113816.html


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Nice move in MP
  2000-11-02 17:51 Nice move in MP David Arnold
@ 2000-11-03  9:03 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2000-11-03  9:03 UTC (permalink / raw)
  Cc: ntg-context

At 09:51 AM 11/2/00 -0800, David Arnold wrote:

>verbatimtex
>  \documentclass{article}
>  \usepackage{amsmath}
>  \usepackage{amsfonts}
>  \begin{document}
>  \def\E{\mathcal{E}}
>  \def\L{\mathcal{L}}
>  \def\U{\mathcal{U}}
>  \def\R{\mathbb{R}}
>etex

For context it depends on what you want. I think that for this math
specific things you can stick to  

  verbatimtex 
    \usemodule[math]
  etex 

and 

  mp --tex=cont-en filename

although 

  texexec --mptex filename 

is the best way. 

>verbatimtex
>  \end{document}
>etex

This is not needed, since mp's extraction tools already put an enddocument
there. Actually, the tex file is rather simple: 
everything etex ends up in a shipout with some nexted boxes

in context things like 

  btex \framed{hi david} etex 

work well and you will notice that rules also show up. Of course the best
way is then 

 picture p ; p := btex \strut hi david etex ; draw p ; draw boundingbox p
enlarged 3pt ; 

Context supports veratimtex, although mp environments are a cleaner way to go

Hans

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-11-03  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-02 17:51 Nice move in MP David Arnold
2000-11-03  9:03 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).