ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* metafun "boxes"
@ 2006-03-02 19:41 Renaud AUBIN
  2006-03-02 21:12 ` Aditya Mahajan
  0 siblings, 1 reply; 3+ messages in thread
From: Renaud AUBIN @ 2006-03-02 19:41 UTC (permalink / raw)



Hi all,

Yesterday, I have tried to put "\input boxes" within a MPgraphic. As a
result, I obtain errors at compilation. After discussing this issue with
Taco on #context, it appears that boxes.mp and metafun interaction is
not safe at all.
Ok, but since my needs remain the same, solutions are :
1. just do it, but manually (not smart at all)
2. use metapost then include the result in my document through ps or pdf
files (this solution needs the user takes care of fonts + manually
metaposting -> not "really" smart)
3. use charts (but depends on what you want achieve -> ok, but not for
all purposes)
4. define some metafun macros (time consuming at  the beginning but it's
best to invest for the long term)
X. others solutions I don't know yet... (feel free to add yours !)

My thought is to finally obtain in metafun:
1. Nodes with text (multiline text!) and a collection of "simple" shapes
to use like box, circle, box with rounded corner... 2. Nodes must be
placed freely accroding to the metapost coordinate system
3. Connections between nodes (using boundaries of each nodes +
possibility to give angles from...to for each connections)

PSTricks can do that but it can be nice if metafun can provide this kind
of features.
See http://renolab.lrv.uvsq.fr/perso/ConTeXt/sample.png to have an idea
(nodes are aligned in this figure but it is a particular case)...

Maybe a solution exists, but since I don't know it, I send this post:
1. Are other people interested ?
2. What is the best solution to implement this feature in metafun ?

My idea is to use \framed + shapes + path + ...

Feel free to give your opinion/need/contribution/whateveryouwant.... ;-)

Cheers,

Renaud

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

* Re: metafun "boxes"
  2006-03-02 19:41 metafun "boxes" Renaud AUBIN
@ 2006-03-02 21:12 ` Aditya Mahajan
  2006-03-02 21:55   ` Renaud AUBIN
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2006-03-02 21:12 UTC (permalink / raw)


<--- On Mar 2, Renaud AUBIN wrote --->

>
> Hi all,
>
> Yesterday, I have tried to put "\input boxes" within a MPgraphic. As a
> result, I obtain errors at compilation. After discussing this issue with
> Taco on #context, it appears that boxes.mp and metafun interaction is
> not safe at all.

Shouldn't  that be input boxes; in a MPinclusions?

> X. others solutions I don't know yet... (feel free to add yours !)

Have a look at metaobj.
> My thought is to finally obtain in metafun:
> 1. Nodes with text (multiline text!)

Place inside a framed

> and a collection of "simple" shapes to use like box, circle, box 
> with rounded corner...

Metaobj provides all basic shapes

> 2. Nodes must be placed freely accroding to the metapost coordinate 
> system

Metaobj provides a better interface to placement. You can specify the 
distance and alignment between the nodes.

> 3. Connections between nodes (using boundaries of each nodes +
> possibility to give angles from...to for each connections)

Has all of that

> See http://renolab.lrv.uvsq.fr/perso/ConTeXt/sample.png to have an idea

See the example below. metaobj has some bugs and limitations, but 
works as expected most of the time.

\starttext

\startMPenvironment
   \setupbodyfont[8pt]
   \setupframed[width=3cm, align=center, frame=off]
\stopMPenvironment

\startMPinclusions
   input metaobj;
   setObjectDefaultOption("Ellipse")("fit")(false)
   setCurveDefaultOption("arcangleA",15);
   setCurveDefaultOption("arcangleB",15);
\stopMPinclusions

\startMPpage
   % Metaobj provides a Circle command. But there seems to be
   % a bug in the interaction of Circle and Matix. So using Ellipse with
   % fit=false
   newEllipse.N1(btex \framed{Mise Sous Tension} etex) ;
   newEllipse.N2(btex \framed{Mesure du point zéro méchaique} etex) ;
   newEllipse.N3(btex \framed{Régalage des paramèters de contrôle} etex) ;
   newEllipse.N4(btex \framed{Envoi du contenu de l'\cap{EEPROM}} etex) ;
   newEllipse.N5(btex \framed{{\bf Mode stop|/| réglage}
                 Attente de commande} etex) ;
   newEllipse.N6(btex \framed{\bf Mode freins libres} etex) ;
   newEllipse.N7(btex \framed{Le contenu de l'\cap{EEPROM} a changé} etex) ;
   newEllipse.N8(btex \framed{Ëcriture du contenu de la
                 \cap{RAM} vers l'\cap{EEPROM}} etex);
   newEllipse.N9(btex \framed{{\bf Mode  Contrôle} La valeur
                 de la commande est rafraîchie à chaque cycle} etex) ;

   newMatrix.diagram(3,3)(N1,N2,N3,N4,N5,N6,N7,N8,N9)
                     "hsep(1.5cm)", "vsep(1.5cm)";
   diagram.c = origin ;
   drawObj(diagram) ;
   ncline(N1)(N5) ;
   for i = 2,3,4,6,7,8,9:
     ncarc(N[i])(N[5]) ;
     ncarc(N[5])(N[i]) ;
   endfor
   nccircle(N6) "angleA(-120)" ;
   nccircle(N9) "angleA(-120)" ;

   % Labels can be added. See metaobj manual

\stopMPpage

\stoptext





-- 
Aditya Mahajan, EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam || Ph: 7342624008

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

* Re: metafun "boxes"
  2006-03-02 21:12 ` Aditya Mahajan
@ 2006-03-02 21:55   ` Renaud AUBIN
  0 siblings, 0 replies; 3+ messages in thread
From: Renaud AUBIN @ 2006-03-02 21:55 UTC (permalink / raw)



Hi Adita,

I have already seen metaobj in the past... but I have forgotten it... ;-)

Thank you very much for the example !

Cheers,

Renaud

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

end of thread, other threads:[~2006-03-02 21:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-02 19:41 metafun "boxes" Renaud AUBIN
2006-03-02 21:12 ` Aditya Mahajan
2006-03-02 21:55   ` Renaud AUBIN

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).