On 7/1/06, Idris Samawi Hamid wrote: A question for Hans first: how can something similar be used for \sometxt? \startMPenvironment \ssxx\setupinterlinespace \stopMPenvironment (\setupsometxt[before=,after=] ?)
Wow... Ok, following is my present, still naive code. What I would like to be able to do is
1) In the first figure [square], control the relation of the front and back face of the cube by a single parameter. So if I use z for the front face coordinates, I can use z' for the rear face and define z' as a function of z. Then the angle of the z111--z'111 diagonal wrt the x-axis will change, and the label for that axis will have to change as well. I've been manually calculating inverse tangents to do this but can it be done automatically?
2. In the second figure, to in addition control the distance between the 2 cubes by a single parameter without recalculating the dashed lines mapping the two.
See the example. You only have to change diag1 and diag2.
I only started yesterday but i can see that MetaPost is going to turn me into a junkie if I'm not careful :-)
I can only warn you! Here's the second square as an example without calculating the coordinates. =============meta-test2.tex=========== % output=pdf interface=en \setupcolors[state=start] \setuppagenumbering[state=stop] \def\AXIS#1#2#3{(#1) Axis #2: {\bf #3}} \forceMPTEXcheck{LABELL} \forceMPTEXcheck{LABELR} \forceMPTEXcheck{LABELM} \startMPenvironment \ssxx\setupinterlinespace \stopMPenvironment \startMPinclusions vardef LABELL@\#(expr s, p)= label@\#(textext("% \framed[width=1.5cm,align=left,frame=off,autowidth=force,strut=on]{" & s & "}"),p) enddef ; vardef LABELR@\#(expr s, p)= label@\#(textext("% \framed[width=1.5cm,align=right,frame=off,autowidth=force,strut=on]{" & s & "}"),p) enddef ; vardef LABELM@\#(expr s, p)= label@\#(textext("% \framed[align=middle,frame=off,autowidth=force,strut=on]{" & s & "}"),p) enddef ; picture p ; p := dashpattern(on 1mm off 1mm) ; color mycolor; mycolor = .625red; \stopMPinclusions \startstaticMPfigure{2squares} u := 0.7cm; a := 5; pair diag[]; diag1 = (2,1.25); diag2=(10,-2.5); for i=0 upto 1: for j=0 upto 1: for k=0 upto 1: for l=0 upto 1: z[i+2j+4k+8l] = (((i,j) scaled a) shifted (diag1 scaled k) shifted (diag2 scaled l)) scaled u; endfor; endfor; endfor; endfor; for i=0 upto 3: drawoptions(withcolor mycolor withpen pencircle scaled 0.4pt) ; % four squares draw z[4i]--z[4i+1]--z[4i+3]--z[4i+2]--cycle; % small diagonals draw z[i]--z[i+4]; draw z[i+8]--z[i+12]; drawoptions(withcolor mycolor dashed p withpen pencircle scaled 0.4pt); % dashed lines draw z[i]--z[i+8]; draw z[i+4]--z[i+12]; endfor; drawoptions(withcolor black); label (textext("Sans Serif"),.5[z[3],z[4]]) ; label (textext("Serif"),.5[z[11],z[12]]) ; picture p; p := textext("\AXIS{a}{4}{Serif}") rotated angle(diag2); label.bot(p,.5[z[0],z[8]]); \stopstaticMPfigure \starttext \midaligned{\usestaticMPfigure[2squares]} \stoptext =====================================