ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Metapost label alignment etc.
@ 2006-06-30  3:42 Idris Samawi Hamid
  2006-06-30  5:42 ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Idris Samawi Hamid @ 2006-06-30  3:42 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 4325 bytes --]

Dear knights,

I spent a few hours today with MetaPost and MetaFun, my first serious stab  
at Meta in many years, so I'm a virtual newbie (used PSTricks back in the  
LaTeX days). I am trying to basically duplicate the attached pdf graphic  
and need help with the following:

1. This code is pretty naive; how can I make it more efficient? Eg, can I  
make a global "scaled 1cm" declaration instead of repeating it so many  
times?

2. ConTeXt's alignment mechanism apparently does not work in MetaPost  
(alignment is commented); is there a workaround? ragged left needed for  
some labels.

3. What is the most efficient way to get labels to follow the diagonals as  
in the attached pdf?

Any tips/trick will be appreciated!

Best
Idris
====================================
% output=pdf interface=en

\setupcolors[state=start]

\starttext

\noheaderandfooterlines

\startuseMPgraphic{square}

picture p ; p := dashpattern(on 1mm off 1mm) ;

label bot(btex %\hbox to 1.5cm
                 {%\startalignment[left]
                 \vbox{\hsize=1.2cm
                 \ssxx\setupinterlinespace
                 (0,0,0,0) \crlf
                 Light \crlf
                 Condensed
                 Small \crlf
                 Sans~Serif}
                 %\stopalignment
                 }
                 etex, (-1.2cm,0)) ;

draw (origin -- (0,5) -- (5,5) -- (5,0) -- cycle)
scaled 1cm withcolor .625red ;

%draw ((2,1) -- (2,6) -- (7,6) -- (7,1) -- cycle)
%scaled 1cm withcolor .625red ;

draw ((2,6) -- (7,6))
scaled 1cm withcolor .625red ;

draw ((7,6) -- (7,1))
scaled 1cm withcolor .625red ;

draw ((2,6) -- (2,5))
scaled 1cm withcolor .625red ;

draw ((2,5) -- (2,1))
scaled 1cm withcolor .625red dashed p withpen pencircle scaled 0.4pt;

draw ((2,1) -- (5,1))
scaled 1cm withcolor .625red dashed p withpen pencircle scaled 0.4pt;

draw ((5,1) -- (7,1))
scaled 1cm withcolor .625red ;

draw ((0,5) -- (2,6))
scaled 1cm withcolor .625red ;

draw ((5,5) -- (7,6))
scaled 1cm withcolor .625red ;

draw ((5,0) -- (7,1))
scaled 1cm withcolor .625red ;

draw (origin -- (2,1 ))
scaled 1cm withcolor .625red dashed p withpen pencircle scaled 0.4pt;

\stopuseMPgraphic

\startuseMPgraphic{2squares}

draw (origin -- (0,5) -- (5,5) -- (5,0) -- cycle)
scaled 1cm withcolor .625red ;

draw ((2,1) -- (2,6) -- (7,6) -- (7,1) -- cycle)
scaled 1cm withcolor .625red ;

draw ((0,5) -- (2,6))
scaled 1cm withcolor .625red ;

draw ((5,5) -- (7,6))
scaled 1cm withcolor .625red ;

draw ((5,0) -- (7,1))
scaled 1cm withcolor .625red ;

draw (origin -- (2,1 ))
scaled 1cm withcolor .625red ;

draw ((10,0) -- (10,-5) -- (15,-5) -- (15,0) -- cycle)
scaled 1cm withcolor .625red ;

draw ((12,1) -- (12,-4) -- (17,-4) -- (17,1) -- cycle)
scaled 1cm withcolor .625red ;

draw ((10,0) -- (12,1))
scaled 1cm withcolor .625red ;

draw ((10,-5) -- (12,-4))
scaled 1cm withcolor .625red ;

draw ((15,-5) -- (17,-4))
scaled 1cm withcolor .625red ;

draw ((15,0) -- (17,1 ))
scaled 1cm withcolor .625red ;

% map square to square

picture p ; p := dashpattern(on 1mm off 1mm) ;

draw ((0,5) -- (10,0))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((2,6) -- (12,1))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((0,0) -- (10,-5))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((2,1) -- (12,-4))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((5,5) -- (15,0))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((7,6) -- (17,1))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((5,0) -- (15,-5))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

draw ((7,1) -- (17,-4))
scaled 1cm dashed p withpen pencircle scaled 0.4pt withcolor .625red ;

\stopuseMPgraphic

\midaligned{\useMPgraphic{square}}

\hbox{}\blank[5*big]

\useMPgraphic{2squares}

\stoptext
====================================
-- 
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

[-- Attachment #2: mm_design.pdf --]
[-- Type: application/pdf, Size: 17061 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

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

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

end of thread, other threads:[~2006-07-07  0:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-30  3:42 Metapost label alignment etc Idris Samawi Hamid
2006-06-30  5:42 ` Aditya Mahajan
2006-06-30 20:09   ` Idris Samawi Hamid
2006-06-30 20:54   ` Idris Samawi Hamid
2006-06-30 21:41     ` Hans Hagen
2006-06-30 23:36       ` Idris Samawi Hamid
2006-07-01  0:17         ` Mojca Miklavec
2006-07-01  2:14           ` Idris Samawi Hamid
2006-07-01  4:33             ` Mojca Miklavec
2006-07-01 18:11               ` Idris Samawi Hamid
2006-07-05 22:27             ` Aditya Mahajan
2006-07-06  5:11               ` Idris Samawi Hamid
2006-07-06 14:39                 ` Mojca Miklavec
2006-07-07  0:35                   ` Idris Samawi Hamid
2006-07-06 13:10               ` Aditya Mahajan
2006-06-30 21:42   ` Idris Samawi Hamid
2006-06-30 22:20   ` More Metapost alignment Idris Samawi Hamid

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