Hi All!

I'm in beginning to write a thesis in physics(undergraduate level) and
one of many things I wanna do is, cause I create much illustrations in
DIA http://www.gnome.org/projects/dia/   
and the program can export to figure.mp, to include these in my
document.

I've read the instructions on http://wiki.contextgarden.net/Mpgraphic

I do not get this working. How is the best way to accomplish this?

The reason is why I want to do in this way is to input tex code in the
figure (especially math and symbol definitions) and optionally place
them in specific places inside the figure. By this method I can even do
better illustrations, hopefully.

My workflow has been like this:

1. Create the desired figure in DIA and choose the export option. TeX
metapost *.mp(see attached file ).

2. Tryed to do inclusion in a TeX-document like this

\startstaticMPfigure{magflux}
  the code in the attached file
\stopstaticMPfigure

\starttext

Here is my figure \usestaticMPfigure[magflux][width=0.8\textwidth]

\stoptext

But it fails with errormessage:

!Paragraph ended before \startstaticMPfigure was complete .....

Should I place part of the code in some definitions?

3. To input textlabels in mathnotation optionally anywhere I want inside
the figure. 

And also do something like

\placefigure[][fig:metapostfigure]{Here is the figure I made in DIA
converted to metapost}{\usestaticMPfigure[magflux][width=0.8\textwidth]}

so it also can be referred to in the text.

All best and thanks in advance!

Janneman



-- 
TeX Engine : LuaTeX

current version: 2008.10.23 17:32

OS : Ubuntu 8.10 Intrepid Ibex
% Metapost TeX macro
% Title: /home/djsameman/Dokument/fysikC/uppsats/FysikC15HP/bilder/magfluxdensity.dia
% Creator: Dia v0.96.1
% CreationDate: Mon Nov 24 13:07:01 2008
% For: djsameman


beginfig(1);
verbatimtex
%&latex
\documentclass{minimal}
\begin{document}
etex
% Define macro for horizontal centering.
vardef hcentered primary P =
  P shifted -(xpart center P, 0)
enddef;
% Define macro for right justification.
vardef rjust primary P =
  P shifted -(xpart (lrcorner P - llcorner P), 0)
enddef;
  % picture(3.815239,-25.950081)(46.421315,6.984149)
  x = 1.000000cm; y = -1.000000cm;

  t = 1.000000;

% set_line_color 0.000000, 0.000000, 0.000000
% set_line_color 1.000000, 1.000000, 1.000000
% set_linewidth 0.100000
  path p;
  p = (15.400000x,5.150000y)--(15.400000x,22.900000y)--(46.100000x,22.900000y)--(46.100000x,5.150000y)--cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
%metapost_arc
% center->x = 15.400000% center->y = 5.150000% width = 0.000000% height = 0.000000% angle1 = 90.000000% angle2 = 180.000000% set_line_color 1.000000, 1.000000, 1.000000
  draw (15.400000x,5.150000y)..(15.400000x,5.150000y)..(15.400000x,5.150000y)
    withpen pencircle scaled 0.1000x
    withcolor (1.0000, 1.0000, 1.0000);
%metapost_arc
% center->x = 46.100000% center->y = 5.150000% width = 0.000000% height = 0.000000% angle1 = 0.000000% angle2 = 90.000000% set_line_color 1.000000, 1.000000, 1.000000
  draw (46.100000x,5.150000y)..(46.100000x,5.150000y)..(46.100000x,5.150000y)
    withpen pencircle scaled 0.1000x
    withcolor (1.0000, 1.0000, 1.0000);
  path p;
  p = (15.400000x,5.150000y)--(15.400000x,22.900000y)--(46.100000x,22.900000y)--(46.100000x,5.150000y)--cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
%metapost_arc
% center->x = 15.400000% center->y = 22.900000% width = 0.000000% height = 0.000000% angle1 = 180.000000% angle2 = 270.000000% set_line_color 1.000000, 1.000000, 1.000000
  draw (15.400000x,22.900000y)..(15.400000x,22.900000y)..(15.400000x,22.900000y)
    withpen pencircle scaled 0.1000x
    withcolor (1.0000, 1.0000, 1.0000);
%metapost_arc
% center->x = 46.100000% center->y = 22.900000% width = 0.000000% height = 0.000000% angle1 = 270.000000% angle2 = 360.000000% set_line_color 1.000000, 1.000000, 1.000000
  draw (46.100000x,22.900000y)..(46.100000x,22.900000y)..(46.100000x,22.900000y)
    withpen pencircle scaled 0.1000x
    withcolor (1.0000, 1.0000, 1.0000);
% set_line_color 0.000000, 0.000000, 0.000000
  draw (15.400000x,5.150000y)--(46.100000x,5.150000y)
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
  draw (15.400000x,22.900000y)--(46.100000x,22.900000y)
    withpen pencircle scaled 0.1000x;
%metapost_arc
% center->x = 15.400000% center->y = 5.150000% width = 0.000000% height = 0.000000% angle1 = 90.000000% angle2 = 180.000000% set_line_color 0.000000, 0.000000, 0.000000
  draw (15.400000x,5.150000y)..(15.400000x,5.150000y)..(15.400000x,5.150000y)
    withpen pencircle scaled 0.1000x;
%metapost_arc
% center->x = 46.100000% center->y = 5.150000% width = 0.000000% height = 0.000000% angle1 = 0.000000% angle2 = 90.000000% set_line_color 0.000000, 0.000000, 0.000000
  draw (46.100000x,5.150000y)..(46.100000x,5.150000y)..(46.100000x,5.150000y)
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
  draw (15.400000x,5.150000y)--(15.400000x,22.900000y)
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
  draw (46.100000x,5.150000y)--(46.100000x,22.900000y)
    withpen pencircle scaled 0.1000x;
%metapost_arc
% center->x = 15.400000% center->y = 22.900000% width = 0.000000% height = 0.000000% angle1 = 180.000000% angle2 = 270.000000% set_line_color 0.000000, 0.000000, 0.000000
  draw (15.400000x,22.900000y)..(15.400000x,22.900000y)..(15.400000x,22.900000y)
    withpen pencircle scaled 0.1000x;
%metapost_arc
% center->x = 46.100000% center->y = 22.900000% width = 0.000000% height = 0.000000% angle1 = 270.000000% angle2 = 360.000000% set_line_color 0.000000, 0.000000, 0.000000
  draw (46.100000x,22.900000y)..(46.100000x,22.900000y)..(46.100000x,22.900000y)
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 1.000000, 1.000000, 1.000000
% fill_polygon
  path p;
  p = (9.950000x,1.150000y)--(40.000000x,1.050000y)--(46.250000x,5.050000y)--(15.450000x,5.000000y)--cycle;
  fill p 
    withpen pencircle scaled 0.1000x
    withcolor (1.0000, 1.0000, 1.0000);
% set_line_color 0.000000, 0.000000, 0.000000
  draw (9.950000x,1.150000y)--(40.000000x,1.050000y)--(46.250000x,5.050000y)--(15.450000x,5.000000y)--cycle
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 0.749020, 0.749020, 0.749020
% fill_polygon
  path p;
  p = (10.000000x,1.100000y)--(15.350000x,4.950000y)--(15.450000x,22.850000y)--(10.050000x,18.800000y)--cycle;
  fill p 
    withpen pencircle scaled 0.1000x
    withcolor (0.7490, 0.7490, 0.7490);
% set_line_color 0.000000, 0.000000, 0.000000
  draw (10.000000x,1.100000y)--(15.350000x,4.950000y)--(15.450000x,22.850000y)--(10.050000x,18.800000y)--cycle
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (10.000000x,18.800000y)--(40.000000x,18.850000y)
    withpen pencircle scaled 0.1000x
    dashed dashpattern (on 0.050000x off 0.050000x);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (40.000000x,1.200000y)--(39.950000x,18.700000y)
    withpen pencircle scaled 0.1000x
    dashed dashpattern (on 0.050000x off 0.050000x);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (39.950000x,18.800000y)--(46.100000x,22.800000y)
    withpen pencircle scaled 0.1000x
    dashed dashpattern (on 0.050000x off 0.050000x);
  path p;
  p = (19.100000x,20.000000y)..(18.600000x,20.500000y)..(18.100000x,20.000000y)..(18.600000x,19.500000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (19.100000x,20.000000y)..(18.600000x,20.500000y)..(18.100000x,20.000000y)..(18.600000x,19.500000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (17.000000x,3.150000y)..(16.500000x,3.650000y)..(16.000000x,3.150000y)..(16.500000x,2.650000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (17.000000x,3.150000y)..(16.500000x,3.650000y)..(16.000000x,3.150000y)..(16.500000x,2.650000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (34.500000x,4.100000y)..(34.000000x,4.600000y)..(33.500000x,4.100000y)..(34.000000x,3.600000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (34.500000x,4.100000y)..(34.000000x,4.600000y)..(33.500000x,4.100000y)..(34.000000x,3.600000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (23.600100x,6.975000y)..(23.100100x,7.475000y)..(22.600100x,6.975000y)..(23.100100x,6.475000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (23.600100x,6.975000y)..(23.100100x,7.475000y)..(22.600100x,6.975000y)..(23.100100x,6.475000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (20.590000x,12.350000y)..(20.090000x,12.850000y)..(19.590000x,12.350000y)..(20.090000x,11.850000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (20.590000x,12.350000y)..(20.090000x,12.850000y)..(19.590000x,12.350000y)..(20.090000x,11.850000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (28.225000x,12.000000y)..(27.725000x,12.500000y)..(27.225000x,12.000000y)..(27.725000x,11.500000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (28.225000x,12.000000y)..(27.725000x,12.500000y)..(27.225000x,12.000000y)..(27.725000x,11.500000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (27.850000x,16.250000y)..(27.350000x,16.750000y)..(26.850000x,16.250000y)..(27.350000x,15.750000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (27.850000x,16.250000y)..(27.350000x,16.750000y)..(26.850000x,16.250000y)..(27.350000x,15.750000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (35.245000x,21.200000y)..(34.745000x,21.700000y)..(34.245000x,21.200000y)..(34.745000x,20.700000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (35.245000x,21.200000y)..(34.745000x,21.700000y)..(34.245000x,21.200000y)..(34.745000x,20.700000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (39.300000x,16.050000y)..(38.800000x,16.550000y)..(38.300000x,16.050000y)..(38.800000x,15.550000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (39.300000x,16.050000y)..(38.800000x,16.550000y)..(38.300000x,16.050000y)..(38.800000x,15.550000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (44.550000x,16.500000y)..(44.050000x,17.000000y)..(43.550000x,16.500000y)..(44.050000x,16.000000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (44.550000x,16.500000y)..(44.050000x,17.000000y)..(43.550000x,16.500000y)..(44.050000x,16.000000y)..cycle
    withpen pencircle scaled 0.1000x;
  path p;
  p = (35.250100x,9.625000y)..(34.750100x,10.125000y)..(34.250100x,9.625000y)..(34.750100x,9.125000y)..cycle;
  fill p withcolor (1.000000,1.000000,1.000000);
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (35.250100x,9.625000y)..(34.750100x,10.125000y)..(34.250100x,9.625000y)..(34.750100x,9.125000y)..cycle
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (33.600100x,22.850000y)--(21.805237x,-2.533529y)
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
% fill_polygon
  path p;
  p = (21.647213x,-2.873608y)--(22.084630x,-2.525518y)--(21.805237x,-2.533529y)--(21.631192x,-2.314821y)--cycle;
  fill p 
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
  draw (21.647213x,-2.873608y)--(22.084630x,-2.525518y)--(21.805237x,-2.533529y)--(21.631192x,-2.314821y)--cycle
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (45.900100x,25.500000y)--(15.936903x,25.450799y)
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
% fill_polygon
  path p;
  p = (15.561903x,25.450184y)--(16.062313x,25.201005y)--(15.936903x,25.450799y)--(16.061492x,25.701004y)--cycle;
  fill p 
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
  draw (15.561903x,25.450184y)--(16.062313x,25.201005y)--(15.936903x,25.450799y)--(16.061492x,25.701004y)--cycle
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (15.350100x,23.300000y)--(15.350100x,25.550000y)
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (46.035100x,23.150000y)--(46.035100x,25.400000y)
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (12.700100x,12.175000y)--(5.036903x,12.175000y)
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
% fill_polygon
  path p;
  p = (4.661903x,12.175000y)--(5.161903x,11.925000y)--(5.036903x,12.175000y)--(5.161903x,12.425000y)--cycle;
  fill p 
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
  draw (4.661903x,12.175000y)--(5.161903x,11.925000y)--(5.036903x,12.175000y)--(5.161903x,12.425000y)--cycle
    withpen pencircle scaled 0.1000x;
% set_linewidth 0.050000
%metapost_arc
% center->x = 16.044451% center->y = 29.643274% width = 29.161250% height = 29.161250% angle1 = 104.068771% angle2 = 146.755563% set_line_color 0.000000, 0.000000, 0.000000
  draw (12.500100x,15.500000y)..(7.595646x,17.759995y)..(3.850100x,21.650000y)
    withpen pencircle scaled 0.0500x;
% set_linewidth 0.050000
%metapost_arc
% center->x = 46.858720% center->y = 3.886073% width = 25.384589% height = 25.384589% angle1 = 121.377854% angle2 = 178.640130% set_line_color 0.000000, 0.000000, 0.000000
  draw (40.250100x,-6.950000y)..(35.865875x,-2.458349y)..(34.170000x,3.584860y)
    withpen pencircle scaled 0.0500x;
% set_linewidth 0.100000
% set_line_color 0.000000, 0.000000, 0.000000
  draw (14.350100x,24.250000y)--(7.786891x,24.203452y)
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
% fill_polygon
  path p;
  p = (7.411901x,24.200793y)--(7.913661x,23.954345y)--(7.786891x,24.203452y)--(7.910115x,24.454333y)--cycle;
  fill p 
    withpen pencircle scaled 0.1000x;
% set_line_color 0.000000, 0.000000, 0.000000
  draw (7.411901x,24.200793y)--(7.913661x,23.954345y)--(7.786891x,24.203452y)--(7.910115x,24.454333y)--cycle
    withpen pencircle scaled 0.1000x;
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to