Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/Crow.m4

raw
1 .PS
2 # Crow.m4
3 #`Illustrates shadebox and custom crowfoot line termination; uses s_box'
4 gen_init
5 s_init(Crow)
6 sinclude(tst.dim)
7
8 # Custom macros --------------------------
9
10 # `crowline(linespec,wid,ht)'
11 # `Single-segment line with crowfoot end'
12 define(`crowline',
13 `line `$1'
14 M4_E: last line.end
15 crow_wd = ifelse(`$2',,`(arrowwid*8/5)',`$2')
16 crow_ht = ifelse(`$3',,`(1.5*crow_wd)',`$3')
17 M4_P: vperp(last line,crow_wd)
18 M4_X: Along_(last line,crow_ht,R)
19 ifdpic(
20 `spline 0.4 from M4_E+M4_P to M4_X+M4_P then to M4_X-M4_P then to M4_E-M4_P',
21 `spline from M4_E+(M4_P.x,M4_P.y) to M4_X+(M4_P.x,M4_P.y) \
22 then to M4_X-(M4_P.x,M4_P.y) then to M4_E-(M4_P.x,M4_P.y)') ')
23
24 define(`custombox',
25 ``$1': shadebox(box `$2',3)
26 s_box({\sf `$1'}) at last box.n above
27 boxtext(`$3')')
28
29 define(`boxtext',`s_box(\parbox{%gpt}{\sf `$1'},int(last box.wid/(1pt__))) \
30 with .nw at last box.nw +(5pt__,-5pt__) ')
31
32 # ----------------------------
33
34 boxwid = boxwid*1.15
35 boxsep = boxwid/2
36
37 custombox(Class,ht boxht*1.7,
38 `classkey\\ class\_type\\ class\_desc')
39
40 custombox(Product,ht Class.ht with .nw at Class.ne+(boxsep,0),
41 `classkey\\ prodkey\\ prod\_name\\ pkg\_type')
42
43 custombox(Sales,ht boxht*2.75 with .nw at Product.ne+(boxsep*2,13pt__),
44 `perkey\\ classkey\\ prodkey\\ storekey\\ promokey\\ quantity\\ dollars')
45
46 custombox(Period,ht Sales.ht with .nw at Sales.ne+(boxsep*2,0),
47 `perkey\\ date\\ day\\ week\\ month\\ qtr\\ year')
48
49 custombox(Market,ht Sales.ht with .nw at Class.sw+(0,-boxsep*3/2),
50 `perkey\\ date\\ day\\ week\\ month\\ qtr\\ year')
51
52 custombox(Store,ht boxht*3.2 with .sw at (Product.w,Market.s),
53 `storekey\\ mktkey\\ store\_type\\ store\_name\\ street\\ city\\ state\\ zip')
54
55 custombox(Promotion,ht Market.ht with .sw at (Period.w,Market.s),
56 `promokey\\ promo\_type\\ promo\_desc\\ value\\ start\_date\ end\_date')
57
58 move to Class.ne+(0,-10pt__); crowline(to (Product.w,Here))
59
60 move to Product.ne+(0,-10pt__); crowline(to (Sales.w,Here))
61 move to last line.start+(0,-crow_wd*2.5); crowline(to (Sales.w,Here))
62 T: last line.c+(0,-crow_wd*2.5)
63
64 move to Period.nw+(0,-10pt__); crowline(to (Sales.e,Here),,1.75*crow_wd)
65 Q: (last line.c,0.35 between Sales.se and Sales.ne)
66
67 move to Market.ne+(0,-10pt__); crowline(to (Store.w,Here))
68 move to Store.ne+(0,-10pt__); line to (T,Here) then to T
69 crowline(to (Sales.w,Here))
70
71 move to Promotion.nw+(0,-10pt__); line to (Q,Here) then to Q
72 crowline(to (Sales.e,Here),,1.75*crow_wd)
73
74 .PE