/usr/share/texmf-texlive/metapost/metaobj/pstricksex1.mp is in texlive-metapost 2009-15.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | % This file contains metaobj code for several figures of the pstricks manual,
% regarding connections, matrices and trees.
% D. Roegel, May 6-9, 2001
verbatimtex
%&latex
\documentclass{article}
\begin{document}
etex
def TCs=
new_Circle_("")("filled(true)")
enddef;
def Tdot(expr p)=
new_Circle_(p)("circmargin(-.2mm)")
enddef;
def Toplus=
Tdot(btex $+$ etex)
enddef;
input metaobj
% page 26 of beta manual
beginfig(1);
setObjectDefaultOption("Matrix")("hsep")(1cm);
setObjectDefaultOption("Matrix")("vsep")(1cm);
newBox.a(btex $U$ etex) "framed(false)";
newBox.b(btex $X\times_Z Y$ etex) "framed(false)";
newBox.c(btex $X$ etex) "framed(false)";
newBox.d(btex $Y$ etex) "framed(false)";
newBox.e(btex $Z$ etex) "framed(false)";
newMatrix.mat(3,3)(a,nb,nb,nb,b,c,nb,d,e);
mat.c=origin;
mcline.mat(1,1,2,2) "name(a)";
ObjLabel.mat(btex $y$ etex) "labpathname(a)","labdir(llft)";
mcline.mat(1,1,2,3) "doubleline(true)",
"arrows(draw)","linestyle(dashed evenly)", "name(b)";
ObjLabel.mat(btex $x$ etex) "labpathname(b)","labdir(urt)";
mcline.mat(2,2,2,3), "name(c)";
ObjLabel.mat(btex $p$ etex) "labpathname(c)","labdir(bot)";
mcline.mat(2,2,3,2), "name(d)";
ObjLabel.mat(btex $q$ etex) "labpathname(d)","labdir(lft)";
mcline.mat(3,2,3,3), "name(e)";
ObjLabel.mat(btex $g$ etex) "labpathname(e)","labdir(bot)";
mcline.mat(2,3,3,3), "name(f)";
ObjLabel.mat(btex $f$ etex) "labpathname(f)","labdir(rt)";
drawObj(mat);
endfig;
clearObj a,b,c,d,e,mat;
% page 27 of beta manual
beginfig(3);
newCircle.a(btex A etex);
newCircle.b(btex B etex);
newCircle.c(btex C etex);
newCircle.d(btex D etex);
newCircle.e(btex E etex);
verbatimtex \small etex;
newMatrix.mat(3,3)(nb,a,nb,b,e,c,nb,d,nb) "hsep(2cm)", "vsep(2cm)";
mcline.mat(2,2,2,3) "name(a)";
ObjLabel.mat(btex a etex) "labpathname(a)","labpos(0.75)", "labdir(top)";
mcline.mat(2,2,2,1) "name(b)";
ObjLabel.mat(btex b etex) "labpathname(b)","labdir(bot)";
mcline.mat(3,2,2,1) "name(c)";
ObjLabel.mat(btex c etex) "labpathname(c)","labdir(llft)";
mcarc.mat(3,2,1,2)
"arcangleA(-40)","arcangleB(-40)", "border(3pt)", "name(d)";%,
%"laberase(true)";
ObjLabel.mat(btex d etex) "labpathname(d)","labdir(lrt)", "labpos(0.3)";
ObjLabel.mat(btex e etex) "labpathname(d)","labdir(llft)", "labpos(0.7)";
mcarc.mat(1,2,2,1) "arcangleA(12)","arcangleB(12)", "name(f)";
ObjLabel.mat(btex f etex) "labpathname(f)","labdir(lrt)";
mcarc.mat(2,1,1,2) "arcangleA(12)","arcangleB(12)", "name(g)";
ObjLabel.mat(btex g etex) "labpathname(g)","labdir(ulft)";
mat.c=origin;
drawObj(mat);
endfig;
% page 28 of beta manual
clearObj a,b,c,d,e,mat;
beginfig(4);
newCircle.x(btex X etex);
newCircle.y(btex Y etex) "framed(false)";
newCircle.Z(btex Z etex) "framed(false)"; % |z| is reserved
newMatrix.mat(2,2)(nb,x,y,Z) "hsep(1cm)", "vsep(2cm)";
mcline.mat(1,2,2,1) "nodesepA(3pt)";
mcline.mat(1,2,2,2) "nodesepA(3pt)";
mcline.mat(2,1,2,2) "linestyle(dashed withdots)";
mat.c=origin;
drawObj(mat);
endfig;
clearObj x,y,Z,mat;
% page 33 of beta manual
beginfig(5);
setCurveDefaultOption("arrows")("draw"); % works
t=_T(new_Ellipse(btex root etex))(TCs,TCs,TCs,TCs);
Obj(t).c=origin;
draw_Obj(t);
endfig;
beginfig(55);
setCurveDefaultOption("arrows")("draw");
u=T_(Tn)(TCs,
T_(Tc)(TCs,TCs)("hbsep(5mm)","hideleaves(true)"),
TCs)("hbsep(5mm)");
Obj(u).c=origin;
draw_Obj(u);
endfig;
% page 34 of beta manual
beginfig(6);
setCurveDefaultOption("arrows")("draw");
t:=_T(new_Circle(btex $X$ etex))
(new_Box_(btex $\tilde{\tilde{X}}$ etex)("framed(false)"),
new_Box_(btex $x$ etex)("framed(false)"),
new_Box_(btex $y$ etex)("framed(false)"));
Obj(t).c=origin;
draw_Obj(t);
endfig;
beginfig(66);
setCurveDefaultOption("arrows")("draw");
% in the next example, we align the baselines, by adding \strut s:
t:=_T(new_Circle(btex $X$ etex))
(new_Box_(btex \strut $\smash{\tilde{\tilde{X}}}$ etex)("framed(false)"),
new_Box_(btex \strut $x$ etex)("framed(false)"),
new_Box_(btex \strut $y$ etex)("framed(false)"));
Obj(t).c=origin;
draw_Obj(t);
endfig;
% page 35 of beta manual
beginfig(7);
setCurveDefaultOption("arrows")("draw");
setCurveDefaultOption("nodesepA")(3pt); % works
setCurveDefaultOption("nodesepB")(3pt); % works
setObjectDefaultOption("Tree")("hideleaves")(true); % works
t:=_T(TCs)
(_T(TCs)(TCs,Tn),
_T(TCs)(TCs,_T(TCs)(Tn,TCs))
);
Obj(t).c=origin;
draw_Obj(t);
setCurveDefaultOption("nodesepA")(0); % works
setCurveDefaultOption("nodesepB")(0); % works
endfig;
% page 36 of beta manual
beginfig(8);
setObjectDefaultOption("Tree")("hideleaves")(true);
t:=T_(new_Circle(btex foo etex))
(new_HFan_(1cm,0)("filled(true)"),
Tf,
_T(new_RBox(btex bar etex))(new_HFan(1cm,0))
)
("Dalign(center)");
Obj(t).c=origin;
draw_Obj(t);
setObjectDefaultOption("Tree")("hideleaves")(false);
endfig;
beginfig(88);
setObjectDefaultOption("Tree")("hideleaves")(true);
t:=_T(new_Circle(btex foo etex))
(_T(new_HFan_(1cm,0)("filled(true)","fillcolor(red)","fanlinearc(1mm)"
%,"pointedfan(false)"
))
(TCs,new_HFan_(1cm,0)("fanlinestyle(dashed evenly)")));
Obj(t).c=origin;
draw_Obj(t);
setObjectDefaultOption("Tree")("hideleaves")(false);
endfig;
% page 37 of beta manual
beginfig(9);
setCurveDefaultOption("arrows")("draw");
setObjectDefaultOption("Tree")("hideleaves")(true); % works
setCurveDefaultOption("nodesepA")(3pt); % works
setCurveDefaultOption("nodesepB")(3pt); % works
setObjectDefaultOption("Tree")("Ualign")("center");
setObjectDefaultOption("Tree")("Lalign")("center");
setObjectDefaultOption("Tree")("hbsep")(5mm);
setObjectDefaultOption("Tree")("vbsep")(5mm);
setObjectDefaultOption("Tree")("hsep")(2cm);
setObjectDefaultOption("Tree")("vsep")(2cm);
t:=T_(Tc_(1.5mm))(T_(Tc_(1.5mm))(Toplus,Toplus)("treemode(L)"),Toplus,Toplus)("treemode(U)");
Obj(t).c=origin;
draw_Obj(t);
setCurveDefaultOption("nodesepA")(0pt); % works
setCurveDefaultOption("nodesepB")(0pt); % works
endfig;
beginfig(10);
setCurveDefaultOption("arrows")("draw");
setObjectDefaultOption("Tree")("hsep")(1cm);
setObjectDefaultOption("Tree")("vsep")(1cm);
% we draw two trees which share a root node:
t:=T_(new_Circle(btex root etex))(Tr_(btex B etex))("treemode(L)");
Obj(t).c=origin;
u:=_T(obj(Obj(t).root))(Tr_(btex A1 etex),Tr_(btex A2 etex));
draw_Obj(t);
draw_Obj(u);
endfig;
% page 38 of beta manual
beginfig(11);
setCurveDefaultOption("arrows")("draw");
setObjectDefaultOption("Tree")("Dalign")("center");
setObjectDefaultOption("Tree")("hbsep")(5mm);
t:=_T(Tc)(TCs,
T_(Tc)(new_Circle_("")("filled(true)","circmargin(15pt)"),TCs)
("treenodehsize(1cm)"),
TCs);
Obj(t).c=origin;
draw_Obj(t);
endfig;
beginfig(110);
setCurveDefaultOption("arrows")("draw");
t:=_T(Tc)(Tr_(btex $j$ etex),Tr_(btex $K_4$ etex),Tr_(btex $x>y$ etex));
Obj(t).c=origin;
draw_Obj(t);
endfig;
beginfig(111);
setCurveDefaultOption("arrows")("draw");
t:=T_(Tc)(Tr_(btex $j$ etex),Tr_(btex $K_4$ etex),Tr_(btex $x>y$ etex))
("treenodehsize(5mm)");
Obj(t).c=origin;
draw_Obj(t);
endfig;
setObjectDefaultOption("Tree")("Dalign")("top");
setObjectDefaultOption("Tree")("hideleaves")(false); % works
% page 39 of beta manual
beginfig(12);
setCurveDefaultOption("arrows")("draw");
t:=_T(TCs)(Tc,_T(TCs)(_T(Tc)(Tc,Tc,Tc),TCs,TCs,TCs));
Obj(t).c=origin;
draw_Obj(t);
endfig;
beginfig(120);
setCurveDefaultOption("arrows")("draw");
setObjectDefaultOption("Tree")("hideleaves")(true);
t:=_T(TCs)(Tc,_T(TCs)(_T(Tc)(Tc,Tc,Tc),TCs,TCs,TCs));
Obj(t).c=origin;
draw_Obj(t);
setObjectDefaultOption("Tree")("hideleaves")(false);
endfig;
beginfig(121);
setCurveDefaultOption("arrows")("draw");
t:=T_(TCs)(_T(TCs)(TCs,TCs),_T(TCs)(TCs,TCs))("vsep(.5cm)","hbsep(2cm)");
Obj(t).c=origin;
draw_Obj(t);
endfig;
% page 40 of beta manual
beginfig(13);
% We don't have a hook for a given level as PSTricks does,
% so we have to give the hsep option several times;
% however, we could avoid it by building the tree in a non-streamlined way.
% Also, the labels must be given in the opposite order.
setCurveDefaultOption("arrows")("draw");
setObjectDefaultOption("Tree")("treemode")("R");
%setObjectDefaultOption("Tree")("treeflip")(true);
t:=_T(Tc)(
_T(TCs)(T_(TCs)(Tr_(btex $J_1$ etex),Tr_(btex $J_2$ etex))("hsep(3cm)"),
T_(TCs)(Tr_(btex $K_1$ etex),Tr_(btex $K_2$ etex))("hsep(3cm)")
),
_T(TCs)(T_(TCs)(Tr_(btex $Y_1$ etex),Tr_(btex $Y_2$ etex))("hsep(3cm)"),
T_(TCs)(Tr_(btex $X_1$ etex),Tr_(btex $X_2$ etex))("hsep(3cm)")
)
);
Obj(t).c=origin;
draw_Obj(t);
endfig;
end
|