summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-12-25 00:31:15 +0000
committerKarl Berry <karl@freefriends.org>2006-12-25 00:31:15 +0000
commit70bdd05d833a7a0fce0b77bc00a3c34b797034f4 (patch)
tree6fafee091dda38cf22a820b5fe8cced16ae02cf3 /Master/texmf-dist/metapost
parent67e67c030aec293b6ac01045a9aabd3184315fbf (diff)
new package cmarrows (with doc source from author)
git-svn-id: svn://tug.org/texlive/trunk@2890 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost')
-rw-r--r--Master/texmf-dist/metapost/cmarrows/cmarrows.mp69
-rw-r--r--Master/texmf-dist/metapost/cmarrows/rgbx0009.mp236
-rw-r--r--Master/texmf-dist/metapost/cmarrows/rgbx0016.mp195
-rw-r--r--Master/texmf-dist/metapost/cmarrows/rgbx0020.mp196
-rw-r--r--Master/texmf-dist/metapost/cmarrows/rgbx0025.mp236
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0008.mp240
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0010.mp240
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0011.mp242
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0012.mp213
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0013.mp213
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0014.mp199
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0015.mp141
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0017.mp196
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0018.mp181
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0019.mp142
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0021.mp174
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0022.mp181
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0023.mp250
-rw-r--r--Master/texmf-dist/metapost/cmarrows/sgbx0024.mp211
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0000.mp100
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0001.mp326
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0002.mp326
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0003.mp325
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0004.mp325
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0005.mp336
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0006.mp179
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0007.mp140
-rw-r--r--Master/texmf-dist/metapost/cmarrows/tgbx0027.mp216
28 files changed, 6028 insertions, 0 deletions
diff --git a/Master/texmf-dist/metapost/cmarrows/cmarrows.mp b/Master/texmf-dist/metapost/cmarrows/cmarrows.mp
new file mode 100644
index 00000000000..fe02d670ddc
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/cmarrows.mp
@@ -0,0 +1,69 @@
+%% cmarrows.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+if known cmarrows_fileversion: endinput fi;
+string cmarrows_fileversion;
+cmarrows_fileversion := "2006/12/18, v0.9";
+message "Loading cmarrows " & cmarrows_fileversion;
+
+vardef setup_cmarrows(text argument_list) =
+
+ save sfile;
+ string sfile;
+
+ save arrow_name, brace_name, parameter_file, macro_name;
+ string arrow_name, brace_name, parameter_file, macro_name;
+
+ argument_list;
+
+ if not known arrow_name:
+ arrow_name := brace_name;
+ fi
+
+ if arrow_name="Bigbrace" : sfile = "tgbx0001.mp";
+ elseif arrow_name="Biggbrace" : sfile = "tgbx0002.mp";
+ elseif arrow_name="bigbrace" : sfile = "tgbx0003.mp";
+ elseif arrow_name="biggbrace" : sfile = "tgbx0004.mp";
+ elseif arrow_name="extensiblebrace" : sfile = "tgbx0005.mp";
+ elseif arrow_name="parallelarrows" : sfile = "tgbx0006.mp";
+ elseif arrow_name="twoheadarrow" : sfile = "tgbx0007.mp";
+ elseif arrow_name="twowayoldarrow" : sfile = "sgbx0008.mp";
+ elseif arrow_name="paralleloppositearrows": sfile = "rgbx0009.mp";
+ elseif arrow_name="twowayarrow" : sfile = "sgbx0010.mp";
+ elseif arrow_name="twowaydoublearrow" : sfile = "sgbx0011.mp";
+ elseif arrow_name="hookleftarrow" : sfile = "sgbx0012.mp";
+ elseif arrow_name="hookrightarrow" : sfile = "sgbx0013.mp";
+ elseif arrow_name="doublearrow" : sfile = "sgbx0014.mp";
+ elseif arrow_name="lefthalfarrow" : sfile = "sgbx0015.mp";
+ elseif arrow_name="paralleloppositerighthalfarrows": sfile = "rgbx0016.mp";
+ elseif arrow_name="mapstoarrow" : sfile = "sgbx0017.mp";
+ elseif arrow_name="oldtexarrow" : sfile = "sgbx0018.mp";
+ elseif arrow_name="righthalfarrow" : sfile = "sgbx0019.mp";
+ elseif arrow_name="paralleloppositelefthalfarrows" : sfile = "rgbx0020.mp";
+ elseif arrow_name="shortaxisarrow" : sfile = "sgbx0021.mp";
+ elseif arrow_name="texarrow" : sfile = "sgbx0022.mp";
+ elseif arrow_name="tailarrow" : sfile = "sgbx0023.mp";
+ elseif arrow_name="tripplearrow" : sfile = "sgbx0024.mp";
+ elseif arrow_name="paralleloppositerightarrows": sfile = "rgbx0025.mp";
+ elseif arrow_name="paren" : sfile = "tgbx0027.mp";
+ else : errmessage "unknown options";
+ fi
+
+ expandafter save scantokens ("setup_" & arrow_name);
+
+ scantokens ("input " & sfile);
+
+ scantokens ("setup_" & arrow_name & "(" &
+ ditto & parameter_file & ditto & "," &
+ ditto & macro_name & ditto & ");" );
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/rgbx0009.mp b/Master/texmf-dist/metapost/cmarrows/rgbx0009.mp
new file mode 100644
index 00000000000..c206b64ed10
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/rgbx0009.mp
@@ -0,0 +1,236 @@
+%% rgbx0009.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_paralleloppositearrows (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__rgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__rgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, fudge, crisp, hair;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.24asc_height#+eps;
+ x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0;
+ penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ % Path macros
+
+ save parallellineright;
+ vardef parallellineright expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp>0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp +
+ (.24asc_height#+eps)*(unitvector direction (arctime s of pppp)
+ of pppp rotated 90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp +
+ (.24asc_height#+eps)*(unitvector direction (length pppp)
+ of pppp rotated 90)
+ fi
+ enddef;
+
+ save parallellineleft;
+ vardef parallellineleft expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp>0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp -
+ (.24asc_height#+eps)*(unitvector direction (arctime s of pppp)
+ of pppp rotated 90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp -
+ (.24asc_height#+eps)*(unitvector direction (length pppp)
+ of pppp rotated 90)
+ fi
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % Macros for drawing the arrow head
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save pq; path pq; pq = z0..{z4-z9}z4r;
+ save right_texarrowhead;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart (pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of pq--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ save qq; path qq; qq = z3l{z9-z3}..z5r;
+ save qp; path qp; qp = z3r{z9-z3}..z0;
+ save left_texarrowhead;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of qq
+ --subpath(xpart ( qp intersectiontimes
+ (point s of qq -- point s of qq + (2rule_thickness#,0)))
+ ,length qp) of qp) transformed T
+ enddef;
+
+ % Draw the arrows. First the left arrow and then the right arrow
+
+ save pa, pb, T, tt, ttt;
+ save f,s;
+
+ save p_left; path p_left; p_left := parallellineleft apth;
+ save p_right; path p_right; p_right := parallellineright apth;
+
+ for ppp = reverse p_left, p_right:
+ transform T;
+ numeric tt; tt := arctime(arclength ppp - (x0-x9)) of ppp;
+ numeric ttt; ttt := arctime(arclength ppp - (x0-x2)) of ppp;
+
+ % Draw the right half of the arrow head
+
+ if arclength ppp = 0:
+ T:=identity shifted (point (length ppp) of ppp - z0);
+ elseif arclength ppp < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length ppp) of ppp))
+ shifted (point (length ppp) of ppp - z0);
+ else:
+ T:=mapto(z0,
+ point (length ppp) of ppp,
+ z2,
+ point ttt of ppp,
+ z9-(0,3rule_thickness#),
+ point tt of ppp - 3rule_thickness#
+ *(unitvector (direction tt of ppp)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of ppp)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength ppp < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ if arclength ppp = 0:
+ T:=identity shifted (point (length ppp) of ppp - z0);
+ elseif arclength ppp < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length ppp) of ppp))
+ shifted (point (length ppp) of ppp - z0);
+ else:
+ T:=mapto(z0,
+ point (length ppp) of ppp,
+ z2,
+ point ttt of ppp,
+ z9+(0,3rule_thickness#),
+ point tt of ppp + 3rule_thickness#
+ *(unitvector (direction tt of ppp)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (qq transformed T) - point tt of ppp)
+ < length(point 0 of qq - z9)
+ enddef;
+
+ if f(0) or (arclength ppp < x0-x3l): s := 0;
+ else: s := solve f(length qq, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle withpen nullpen text_;
+
+ % Draw the path
+
+ if arclength ppp > x0-x2:
+ draw subpath(0,ttt) of ppp withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ endfor
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/rgbx0016.mp b/Master/texmf-dist/metapost/cmarrows/rgbx0016.mp
new file mode 100644
index 00000000000..22186db1b3e
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/rgbx0016.mp
@@ -0,0 +1,195 @@
+%% rgbx0016.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_paralleloppositerighthalfarrows (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__rgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__rgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.36asc_height#+eps;
+ x3=x4=x0-4u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ save t; numeric t;
+ save pq; path pq; pq = z4l..{2(x0-x4),y0-y4}z6r;
+ t=xpart(pq intersectiontimes ((0,y2l)--(w,y2l))); x2=xpart point t of pq;
+ z9=.2[.5[z3,z4],z0];
+
+ save parallellineright;
+ vardef parallellineright expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp > 0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp +
+ spread/2*(unitvector direction (arctime s of pppp)
+ of pppp rotated -90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp +
+ spread/2*(unitvector direction (length pppp)
+ of pppp rotated -90)
+ fi
+ enddef;
+
+ save parallellineleft;
+ vardef parallellineleft expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp>0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp +
+ spread/2*(unitvector direction (arctime s of pppp)
+ of pppp rotated 90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp +
+ spread/2*(unitvector direction (length pppp)
+ of pppp rotated 90)
+ fi
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % Macro for drawing the half arrow head
+
+ save pp; path pp; pp := (z3l..{2(x0-x3),y0-y3}z5r);
+ save pq; path pq; pq := (z3r..{2(x0-x3),y0-y3}z5l);
+
+ save halfarrowhead, pa;
+ vardef halfarrowhead(expr T, s) =
+ (z0--(x0,y2l)--z2l--z2r
+ ..subpath(t,s) of pp
+ --subpath(xpart( pq intersectiontimes
+ (point s of pp -- point s of pp +(2rule_thickness#,0))),
+ length (z3r..{2(x0-x3),y0-y3}z5l)) of pq --cycle)
+ transformed T
+ enddef;
+
+ % Draw the half arrows
+
+ save pa, pb, T, tt, ttt;
+
+ save p_left; path p_left; p_left = parallellineleft apth;
+ save p_right; path p_right; p_right = parallellineright apth;
+
+ for ppp = reverse p_left, p_right:
+
+ transform T;
+ numeric tt; tt = arctime(arclength ppp - (x0-x9)) of ppp;
+ numeric ttt; ttt = arctime(arclength ppp - (x0-x2)) of ppp;
+
+ if arclength ppp = 0:
+ T:=identity reflectedabout(z0+(-1pt,0),z0)
+ shifted (point (length ppp) of ppp - z0);
+ elseif arclength ppp < x0-x3l:
+ T:=identity reflectedabout(z0+(-1pt,0),z0)
+ rotatedaround(z0,angle (direction (length ppp) of ppp))
+ shifted (point (length ppp) of ppp -z0);
+ else:
+ T:=mapto(z0,
+ point (length ppp) of ppp,
+ z2,
+ point ttt of ppp,
+ z9+(0,3rule_thickness#),
+ point tt of ppp - 3rule_thickness#*
+ (unitvector (direction tt of ppp) rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of ppp)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength ppp < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ filldraw halfarrowhead(T,s) text_;
+
+ % Draw the path
+
+ if arclength ppp > x0-x2: draw subpath(0,ttt) of ppp
+ withpen pencircle scaled rule_thickness# text_;
+ fi
+
+ endfor;
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/rgbx0020.mp b/Master/texmf-dist/metapost/cmarrows/rgbx0020.mp
new file mode 100644
index 00000000000..0263156bd93
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/rgbx0020.mp
@@ -0,0 +1,196 @@
+%% rgbx0020.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_paralleloppositelefthalfarrows (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__rgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__rgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.36asc_height#+eps;
+ x3=x4=x0-4u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ save t; numeric t;
+ save pq; path pq; pq = z4l..{2(x0-x4),y0-y4}z6r;
+ t=xpart(pq intersectiontimes ((0,y2l)--(w,y2l))); x2=xpart point t of pq;
+ z9=.2[.5[z3,z4],z0];
+
+ % Path macros
+
+ save parallellineright;
+ vardef parallellineright expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp > 0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp +
+ spread/2*(unitvector direction (arctime s of pppp)
+ of pppp rotated -90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp +
+ spread/2*(unitvector direction (length pppp)
+ of pppp rotated -90)
+ fi
+ enddef;
+
+ save parallellineleft;
+ vardef parallellineleft expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp > 0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp +
+ spread/2*(unitvector direction (arctime s of pppp)
+ of pppp rotated 90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp +
+ spread/2*(unitvector direction (length pppp)
+ of pppp rotated 90)
+ fi
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % Macro for drawing the half arrow head
+
+ save pp; path pp; pp := (z3l..{2(x0-x3),y0-y3}z5r);
+ save pq; path pq; pq := (z3r..{2(x0-x3),y0-y3}z5l);
+
+ save halfarrowhead;
+ vardef halfarrowhead(expr T, s) =
+ (z0--(x0,y2l)--z2l--z2r
+ ..subpath(t,s) of pp
+ --subpath(xpart( pq intersectiontimes
+ (point s of pp -- point s of pp +(2rule_thickness#,0))),
+ length (z3r..{2(x0-x3),y0-y3}z5l)) of pq --cycle)
+ transformed T
+ enddef;
+
+ % Draw the half arrows
+
+ save pa, pb, T, tt, ttt;
+
+ save p_left; path p_left; p_left = parallellineleft apth;
+ save p_right; path p_right; p_right = parallellineright apth;
+
+ for ppp = p_left, reverse p_right:
+
+ transform T;
+ numeric tt; tt = arctime(arclength ppp - (x0-x9)) of ppp;
+ numeric ttt; ttt = arctime(arclength ppp - (x0-x2)) of ppp;
+
+ if arclength ppp = 0:
+ T:=identity shifted (point (length ppp) of ppp - z0);
+ elseif arclength ppp < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length ppp) of ppp))
+ shifted (point (length ppp) of ppp -z0);
+ else:
+ T:=mapto(z0,
+ point (length ppp) of ppp,
+ z2,
+ point ttt of ppp,
+ z9+(0,3rule_thickness#),
+ point tt of ppp + 3rule_thickness#*
+ (unitvector (direction tt of ppp) rotated 90));
+
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of ppp)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength ppp < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ filldraw halfarrowhead(T,s) text_;
+
+ % Draw the path
+
+ if arclength ppp > x0-x2: draw subpath(0,ttt) of ppp
+ withpen pencircle scaled rule_thickness# text_;
+ fi
+
+ endfor;
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/rgbx0025.mp b/Master/texmf-dist/metapost/cmarrows/rgbx0025.mp
new file mode 100644
index 00000000000..1fc45976513
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/rgbx0025.mp
@@ -0,0 +1,236 @@
+%% rgbx0025.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_paralleloppositerightarrows (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__rgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__rgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, fudge, crisp, hair;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.24asc_height#+eps;
+ x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0;
+ penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ % Path macros
+
+ save parallellineright;
+ vardef parallellineright expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp>0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp +
+ (.24asc_height#+eps)*(unitvector direction (arctime s of pppp)
+ of pppp rotated 90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp +
+ (.24asc_height#+eps)*(unitvector direction (length pppp)
+ of pppp rotated 90)
+ fi
+ enddef;
+
+ save parallellineleft;
+ vardef parallellineleft expr pppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength pppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength pppp)/stp;
+
+ if stp>0:
+ for s=0 step stp until arclength pppp - stp:
+ point (arctime s of pppp) of pppp -
+ (.24asc_height#+eps)*(unitvector direction (arctime s of pppp)
+ of pppp rotated 90)
+ {direction (arctime s of pppp) of pppp}..
+ endfor
+ {direction (length pppp) of pppp}
+ point (length pppp) of pppp -
+ (.24asc_height#+eps)*(unitvector direction (length pppp)
+ of pppp rotated 90)
+ fi
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % Macros for drawing the arrow head
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save pq; path pq; pq = z0..{z4-z9}z4r;
+ save right_texarrowhead;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart (pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of pq--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ save qq; path qq; qq = z3l{z9-z3}..z5r;
+ save qp; path qp; qp = z3r{z9-z3}..z0;
+ save left_texarrowhead;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of qq
+ --subpath(xpart ( qp intersectiontimes
+ (point s of qq -- point s of qq + (2rule_thickness#,0)))
+ ,length qp) of qp) transformed T
+ enddef;
+
+ % Draw the arrows. First the left arrow and then the right arrow
+
+ save pa, pb, T, tt, ttt;
+ save f,s;
+
+ save p_left; path p_left; p_left := parallellineleft apth;
+ save p_right; path p_right; p_right := parallellineright apth;
+
+ for ppp = p_left, reverse p_right:
+ transform T;
+ numeric tt; tt := arctime(arclength ppp - (x0-x9)) of ppp;
+ numeric ttt; ttt := arctime(arclength ppp - (x0-x2)) of ppp;
+
+ % Draw the right half of the arrow head
+
+ if arclength ppp = 0:
+ T:=identity shifted (point (length ppp) of ppp - z0);
+ elseif arclength ppp < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length ppp) of ppp))
+ shifted (point (length ppp) of ppp - z0);
+ else:
+ T:=mapto(z0,
+ point (length ppp) of ppp,
+ z2,
+ point ttt of ppp,
+ z9-(0,3rule_thickness#),
+ point tt of ppp - 3rule_thickness#
+ *(unitvector (direction tt of ppp)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of ppp)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength ppp < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ if arclength ppp = 0:
+ T:=identity shifted (point (length ppp) of ppp - z0);
+ elseif arclength ppp < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length ppp) of ppp))
+ shifted (point (length ppp) of ppp - z0);
+ else:
+ T:=mapto(z0,
+ point (length ppp) of ppp,
+ z2,
+ point ttt of ppp,
+ z9+(0,3rule_thickness#),
+ point tt of ppp + 3rule_thickness#
+ *(unitvector (direction tt of ppp)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (qq transformed T) - point tt of ppp)
+ < length(point 0 of qq - z9)
+ enddef;
+
+ if f(0) or (arclength ppp < x0-x3l): s := 0;
+ else: s := solve f(length qq, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the path
+
+ if arclength ppp > x0-x2:
+ draw subpath(0,ttt) of ppp withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ endfor
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0008.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0008.mp
new file mode 100644
index 00000000000..70d308b9877
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0008.mp
@@ -0,0 +1,240 @@
+%% sgbx0008.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_twowayoldarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, fudge, crisp, hair;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.24asc_height#+eps;
+ x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0;
+ penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+ save ss; numeric ss; ss = arctime x0-x9 of apth;
+ save sss; numeric sss; sss = arctime x0-x2 of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9-(0,3rule_thickness#),
+ point tt of apth - 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ if arclength apth = 0:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ shifted (point (length 0) of apth -z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ rotatedaround(z0, angle direction (length 0) of apth)
+ shifted (point (length 0) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point 0 of apth,
+ z2,
+ point sss of apth,
+ z9-(0,3rule_thickness#),
+ point ss of apth - 3rule_thickness#
+ *(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ss of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ save pc; path pc;
+ pc := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ if arclength apth = 0:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ shifted (point (length 0) of apth -z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ rotatedaround(z0, angle direction (length 0) of apth)
+ shifted (point (length 0) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point 0 of apth,
+ z2,
+ point sss of apth,
+ z9+(0,3rule_thickness#),
+ point ss of apth + 3rule_thickness#
+ *(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ss of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ save pd; path pd;
+ pd := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+ filldraw pc--pd--cycle text_;
+
+ if arclength apth > 2(x0-x2):
+ draw subpath(sss,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0010.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0010.mp
new file mode 100644
index 00000000000..e9e3cf9b490
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0010.mp
@@ -0,0 +1,240 @@
+%% sgbx0010.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_twowayarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, fudge, crisp, hair;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.36asc_height#+eps;
+ x3=x4=x0-4u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ z9=.2[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+ save ss; numeric ss; ss = arctime x0-x9 of apth;
+ save sss; numeric sss; sss = arctime x0-x2 of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9-(0,3rule_thickness#),
+ point tt of apth - 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ if arclength apth = 0:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ shifted (point (length 0) of apth -z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ rotatedaround(z0, angle direction (length 0) of apth)
+ shifted (point (length 0) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point 0 of apth,
+ z2,
+ point sss of apth,
+ z9-(0,3rule_thickness#),
+ point ss of apth - 3rule_thickness#
+ *(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ss of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ save pc; path pc;
+ pc := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ if arclength apth = 0:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ shifted (point (length 0) of apth -z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity reflectedabout ((x0,y3),(x0,y4))
+ rotatedaround(z0, angle direction (length 0) of apth)
+ shifted (point (length 0) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point 0 of apth,
+ z2,
+ point sss of apth,
+ z9+(0,3rule_thickness#),
+ point ss of apth + 3rule_thickness#
+ *(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ss of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ save pd; path pd;
+ pd := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+ filldraw pc--pd--cycle text_;
+
+ if arclength apth > 2(x0-x2):
+ draw subpath(sss,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0011.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0011.mp
new file mode 100644
index 00000000000..bd2659ade77
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0011.mp
@@ -0,0 +1,242 @@
+%% sgbx0011.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_twowaydoublearrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, fudge, crisp, hair;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#,.55x_height#];
+ w:=18u#;
+
+ lft x1 = u#-eps; x2=x1; x7=x8=w-x1;
+ y1=y7; y2=y8; y1-y2=spread; .5[y1,y2]=math_axis#;
+
+ rt x0 = w-u#+eps; y0 = math_axis#;
+ penpos3(rule_thickness#,0); penpos4(rule_thickness#,0);
+ y3-y1 = y2-y4 = .24asc_height#+eps; x3=x4=x0-6u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ z9 = .381966[.5[z3,z4],z0];
+
+ save pp;
+ path pp; pp = z4l{z9-z4}..z6r;
+ save t;
+ numeric t; t = xpart(pp intersectiontimes ((0,y0)--(w,y0)));
+ numeric t[]; t1 = xpart(pp intersectiontimes ( (0,y2-rule_thickness#/2)
+ --(w,y2-rule_thickness#/2)));
+ t2 = xpart(pp intersectiontimes ( (0,y2+rule_thickness#/2)
+ --(w,y2+rule_thickness#/2)));
+ save qq;
+ path qq; qq = z3l{z9-z3}..z5r;
+
+ save parallelline;
+ vardef parallelline expr ppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength ppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength ppp)/stp;
+
+ if arclength apth > 0:
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp +
+ spread/2*(unitvector direction (arctime s of ppp)
+ of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp +
+ spread/2*(unitvector direction (length ppp) of ppp rotated 90)
+ withpen pencircle scaled rule_thickness#
+ text_;
+
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp -
+ spread/2*(unitvector direction (arctime s of ppp)
+ of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp -
+ spread/2*(unitvector direction (length ppp) of ppp rotated 90)
+ withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % Draw the front arrow head
+
+ save doublearrowhead;
+ vardef doublearrowhead(expr T, s, ss) =
+ (subpath(0, xpart((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)
+ --subpath(s,t1) of pp
+ --(xpart point t1 of pp, ypart point t2 of pp)
+ --subpath(t2,t) of pp
+ --subpath(t,t2) of qq
+ --(xpart point t1 of qq, ypart point t2 of qq)
+ --subpath(t1,ss) of qq
+ --subpath(xpart ((z3r{z9-z3}..z0) intersectiontimes
+ (point ss of qq -- point ss of qq + (2rule_thickness#,0))),1)
+ of (z3r{z9-z3}..z0)
+ & cycle) transformed T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt;
+ tt = arctime (arclength apth - (x0 - xpart point t1 of pp)) of apth;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-xpart(point t2 of pp):
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T := mapto(
+ z0,
+ point (length apth) of apth,
+ point t1 of pp + (0,rule_thickness#/2),
+ point tt of apth +
+ spread/2*(unitvector direction tt of apth rotated 90),
+ point t1 of qq - (0,rule_thickness#/2),
+ point tt of apth -
+ spread/2*(unitvector direction tt of apth rotated 90));
+ fi
+
+ save f,s,ss,ttt;
+ ttt = arctime(arclength apth - (x0-x9)) of apth;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ttt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ vardef f(expr ss) =
+ length(point ss of (qq transformed T) - point ttt of apth)
+ < length(point 0 of qq - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): ss := 0;
+ else: ss := solve f(length qq, 0);
+ fi
+
+ filldraw doublearrowhead(T,s,ss) text_;
+
+ % Draw the back arrow head
+
+ save ttt; numeric ttt;
+ ttt = arctime (x0 - xpart point t1 of pp) of apth;
+
+ if arclength apth = 0:
+ T:=identity rotatedaround(z0, 180)
+ shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-xpart(point t2 of pp):
+ T:=identity rotatedaround(z0,angle (direction 0 of apth)+180)
+ shifted (point 0 of apth - z0);
+ else:
+ T := mapto(
+ z0,
+ point 0 of apth,
+ point t1 of pp + (0,rule_thickness#/2),
+ point ttt of apth +
+ spread/2*(unitvector direction ttt of apth rotated 90),
+ point t1 of qq - (0,rule_thickness#/2),
+ point ttt of apth -
+ spread/2*(unitvector direction ttt of apth rotated 90));
+ fi
+
+
+ ttt := arctime(x0-x9) of apth;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ttt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ vardef f(expr ss) =
+ length(point ss of (qq transformed T) - point ttt of apth)
+ < length(point 0 of qq - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): ss := 0;
+ else: ss := solve f(length qq, 0);
+ fi
+
+ filldraw doublearrowhead(T,s,ss) text_;
+
+ % Draw the path
+
+ if arclength apth > 2(x0-xpart(point t1 of pp)):
+ parallelline (subpath(ttt,tt) of apth);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0012.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0012.mp
new file mode 100644
index 00000000000..94c225afbc1
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0012.mp
@@ -0,0 +1,213 @@
+%% sgbx0012.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_hookleftarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=if monospace: .24 else: .36 fi asc_height#+eps;
+ x3=x4=x0-if monospace: 3u# else: 4u# fi - eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ z9=.2[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ % the hook
+ x12-rule_thickness#/2=u#-eps; x11=x13=5u#-x12;
+ y11-y13=spread; y12=.5[y11,y13]; y13=0;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+ save ss; numeric ss; ss = arctime x11-x12 of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9-(0,3rule_thickness#),
+ point tt of apth - 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the hook
+
+ save hook;
+ vardef hook(expr T) =
+ (z11{left}...z12{down}...z13{right}) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z13);
+ elseif arclength apth < x11-x12:
+ T:=identity rotatedaround(z13,angle (direction 0 of apth))
+ shifted (point 0 of apth - z13)
+ shifted ((x11-x12)*(unitvector
+ (point (length apth) of apth - point 0 of apth)));
+ else:
+ T:=mapto(z11,
+ point ss of apth,
+ z12,
+ point 0 of apth + (y11-y12)*(unitvector (direction 0 of apth)
+ rotated 90),
+ z13,
+ point ss of apth + (y11-y13)*(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ draw hook(T) withpen pencircle scaled rule_thickness# text_;
+
+ % Draw the path
+
+ if arclength apth > x0-x2 + x11-x12:
+ draw subpath(ss,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0013.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0013.mp
new file mode 100644
index 00000000000..fd5b839225e
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0013.mp
@@ -0,0 +1,213 @@
+%% sgbx0013.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_hookrightarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=if monospace: .24 else: .36 fi asc_height#+eps;
+ x3=x4=x0-if monospace: 3u# else: 4u# fi - eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ z9=.2[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ % the hook
+ x12-rule_thickness#/2=u#-eps; x11=x13=5u#-x12;
+ y11-y13=spread; y12=.5[y11,y13]; y13=0;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+ save ss; numeric ss; ss = arctime x11-x12 of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9-(0,3rule_thickness#),
+ point tt of apth - 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the hook
+
+ save hook;
+ vardef hook(expr T) =
+ (z11{left}...z12{down}...z13{right}) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z11);
+ elseif arclength apth < x11-x12:
+ T:=identity rotatedaround(z11,angle (direction 0 of apth))
+ shifted (point 0 of apth - z11)
+ shifted ((x11-x12)*(unitvector
+ (point (length apth) of apth - point 0 of apth)));
+ else:
+ T:=mapto(z11,
+ point ss of apth,
+ z12,
+ point 0 of apth - (y11-y12)*(unitvector (direction 0 of apth)
+ rotated 90),
+ z13,
+ point ss of apth - (y11-y13)*(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ draw hook(T) withpen pencircle scaled rule_thickness# text_;
+
+ % Draw the path
+
+ if arclength apth > x0-x2 + x11-x12:
+ draw subpath(ss,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0014.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0014.mp
new file mode 100644
index 00000000000..2986a54c8ed
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0014.mp
@@ -0,0 +1,199 @@
+%% sgbx0014.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_doublearrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#,.55x_height#];
+ w:=18u#;
+
+ lft x1 = u#-eps; x2=x1; x7=x8=w-x1;
+ y1=y7; y2=y8; y1-y2=spread; .5[y1,y2]=math_axis#;
+
+ rt x0 = w-u#+eps; y0 = math_axis#;
+ penpos3(rule_thickness#,0); penpos4(rule_thickness#,0);
+ y3-y1 = y2-y4 = .24asc_height#+eps; x3=x4=x0-6u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ z9 = .381966[.5[z3,z4],z0];
+
+ save pp;
+ path pp; pp = z4l{z9-z4}..z6r;
+ save t;
+ numeric t; t = xpart(pp intersectiontimes ((0,y0)--(w,y0)));
+ numeric t[]; t1 = xpart(pp intersectiontimes ( (0,y2-rule_thickness#/2)
+ --(w,y2-rule_thickness#/2)));
+ t2 = xpart(pp intersectiontimes ( (0,y2+rule_thickness#/2)
+ --(w,y2+rule_thickness#/2)));
+ save qq;
+ path qq; qq = z3l{z9-z3}..z5r;
+
+ save parallelline;
+ vardef parallelline expr ppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength ppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength ppp)/stp;
+
+ if stp > 0:
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp +
+ spread/2*
+ (unitvector direction (arctime s of ppp) of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp +
+ spread/2*
+ (unitvector direction (length ppp) of ppp rotated 90)
+ withpen pencircle scaled rule_thickness# text_;
+
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp -
+ spread/2*
+ (unitvector direction (arctime s of ppp) of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp -
+ spread/2*
+ (unitvector direction (length ppp) of ppp rotated 90)
+ withpen pencircle scaled rule_thickness# text_;
+ fi
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % Draw the arrow head
+
+ save doublearrowhead;
+ vardef doublearrowhead(expr T, s, ss) =
+ (subpath(0, xpart((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)
+ --subpath(s,t1) of pp
+ --(xpart point t1 of pp, ypart point t2 of pp)
+ --subpath(t2,t) of pp
+ --subpath(t,t2) of qq
+ --(xpart point t1 of qq, ypart point t2 of qq)
+ --subpath(t1,ss) of qq
+ --subpath(xpart ((z3r{z9-z3}..z0) intersectiontimes
+ (point ss of qq -- point ss of qq + (2rule_thickness#,0))),1)
+ of (z3r{z9-z3}..z0)
+ & cycle) transformed T
+ enddef;
+
+ save T; transform T;
+ save tt;
+ tt = arctime (arclength apth - (x0 - xpart point t1 of pp)) of apth;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-xpart(point t2 of pp):
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T := mapto(
+ z0,
+ point (length apth) of apth,
+ point t1 of pp + (0,rule_thickness#/2),
+ point tt of apth +
+ spread/2*(unitvector direction tt of apth rotated 90),
+ point t1 of qq - (0,rule_thickness#/2),
+ point tt of apth -
+ spread/2*(unitvector direction tt of apth rotated 90));
+ fi
+
+ save f,s,ss,ttt;
+ ttt = arctime(arclength apth - (x0-x9)) of apth;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ttt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ vardef f(expr ss) =
+ length(point ss of (qq transformed T) - point ttt of apth)
+ < length(point 0 of qq - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): ss := 0;
+ else: ss := solve f(length qq, 0);
+ fi
+
+ filldraw doublearrowhead(T,s,ss) text_;
+
+ % Draw the path
+
+ if arclength apth > (x0-xpart(point t1 of pp)):
+ parallelline (subpath(0,tt) of apth);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0015.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0015.mp
new file mode 100644
index 00000000000..838219b64e2
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0015.mp
@@ -0,0 +1,141 @@
+%% sgbx0015.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_lefthalfarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.36asc_height#+eps;
+ x3=x4=x0-4u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ save t; numeric t;
+ save pq; path pq; pq = z4l..{2(x0-x4),y0-y4}z6r;
+ t=xpart(pq intersectiontimes ((0,y2l)--(w,y2l))); x2=xpart point t of pq;
+ z9=.2[.5[z3,z4],z0];
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+
+ % Draw the arrow head
+
+ save pp; path pp; pp := (z3l..{2(x0-x3),y0-y3}z5r);
+ save pq; path pq; pq := (z3r..{2(x0-x3),y0-y3}z5l);
+
+ save halfarrowhead, pa;
+ vardef halfarrowhead(expr T, s) =
+ (z0--(x0,y2l)--z2l--z2r
+ ..subpath(t,s) of pp
+ --subpath(xpart( pq intersectiontimes
+ (point s of pp -- point s of pp +(2rule_thickness#,0))),
+ length (z3r..{2(x0-x3),y0-y3}z5l)) of pq --cycle)
+ transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth -z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#*
+ (unitvector (direction tt of apth) rotated 90));
+
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ filldraw halfarrowhead(T,s) text_;
+
+ % Draw the path
+
+ if arclength apth > x0-x2: draw subpath(0,ttt) of apth
+ withpen pencircle scaled rule_thickness# text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0017.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0017.mp
new file mode 100644
index 00000000000..9a1ac779709
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0017.mp
@@ -0,0 +1,196 @@
+%% sgbx0017.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_mapstoarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.36asc_height#+eps;
+ x3=x4=x0-4u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ z9=.2[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T, s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth -z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the tail
+
+ if arclength apth > x0-x2:
+ draw point 0 of apth + (.24asc_height#+eps)*
+ (unitvector (direction 0 of apth) rotated 90)--
+ point 0 of apth - (.24asc_height#+eps)*
+ (unitvector (direction 0 of apth) rotated 90)
+ withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ % Draw the path
+
+ if arclength apth > x0-x2:
+ draw subpath(0,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
+
+
+
+
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0018.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0018.mp
new file mode 100644
index 00000000000..60f4561d16c
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0018.mp
@@ -0,0 +1,181 @@
+%% sgbx0018.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_oldtexarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.24asc_height#+eps;
+ x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0;
+ penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth +
+ 3rule_thickness#*(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left half of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the path
+
+ if arclength apth > x0-x2:
+ draw subpath(0,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0019.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0019.mp
new file mode 100644
index 00000000000..7cb9b29dbc2
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0019.mp
@@ -0,0 +1,142 @@
+%% sgbx0019.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_righthalfarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.36asc_height#+eps;
+ x3=x4=x0-4u#-eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ save t; numeric t;
+ save pq; path pq; pq = z4l..{2(x0-x4),y0-y4}z6r;
+ t=xpart(pq intersectiontimes ((0,y2l)--(w,y2l))); x2=xpart point t of pq;
+ z9=.2[.5[z3,z4],z0];
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+
+ % Draw the arrow head
+
+ save pp; path pp; pp := (z3l..{2(x0-x3),y0-y3}z5r);
+ save pq; path pq; pq := (z3r..{2(x0-x3),y0-y3}z5l);
+
+ save halfarrowhead, pa;
+ vardef halfarrowhead(expr T, s) =
+ (z0--(x0,y2l)--z2l--z2r
+ ..subpath(t,s) of pp
+ --subpath(xpart( pq intersectiontimes
+ (point s of pp -- point s of pp +(2rule_thickness#,0))),
+ length (z3r..{2(x0-x3),y0-y3}z5l)) of pq --cycle)
+ transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity reflectedabout(z0+(-1pt,0),z0)
+ shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity reflectedabout(z0+(-1pt,0),z0)
+ rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth -z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth - 3rule_thickness#*
+ (unitvector (direction tt of apth) rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ filldraw halfarrowhead(T,s) text_;
+
+ % Draw the path
+
+ if arclength apth > x0-x2: draw subpath(0,ttt) of apth
+ withpen pencircle scaled rule_thickness# text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0021.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0021.mp
new file mode 100644
index 00000000000..8597e69b133
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0021.mp
@@ -0,0 +1,174 @@
+%% sgbx0021.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_shortaxisarrow(expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ pickup pencircle scaled rule_thickness#;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 9u#;
+
+ penpos1(.25rule_thickness#, 90); penpos2(.25rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#;
+ x1=1.5u#-eps;
+ rt x0=w-x1;
+ y3-y0=y0-y4=.24asc_height#+eps; x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0; penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+ save pp; path pp; pp=z4l{z9-z4}..z6r;
+ save t; numeric t;
+ t=xpart(pp intersectiontimes ((0,y2l)--(w,y2l))); x2=xpart point t of pp;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x5l-x2)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x5l-x3)) of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_arrowhead, pa;
+ vardef right_arrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point tt of apth,
+ (x3,y9)-(0,3rule_thickness#),
+ point ttt of apth -
+ 3rule_thickness#*(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z2)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_arrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point tt of apth,
+ (x3,y9)+(0,3rule_thickness#),
+ point ttt of apth +
+ 3rule_thickness#*(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z2)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the path
+
+ if arclength apth > x0-x2:
+ draw subpath(0,tt) of apth withpen pencircle scaled 1.25rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0022.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0022.mp
new file mode 100644
index 00000000000..f5091b73d07
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0022.mp
@@ -0,0 +1,181 @@
+%% sgbx0022.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_texarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, math_axis," &
+ " monospace,asc_height,eps, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "u# := " & decimal u# & ";" &
+ "math_spread := " & decimal math_spread & ";" &
+ "x_height# := " & decimal x_height# & ";" &
+ "rule_thickness# := " & decimal rule_thickness# & ";" &
+ "math_axis# := " & decimal math_axis# & ";" &
+ "monospace := " & if monospace : "true" else: "false" fi & ";" &
+ "asc_height# := " & decimal asc_height# & ";" &
+ "eps := " & decimal eps & ";" &
+ "fudge := " & decimal fudge & ";" &
+ "crisp# := " & decimal crisp# & ";" &
+ "hair# := " & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(rule_thickness#, 0); penpos4(rule_thickness#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=if monospace: .24 else: .36 fi asc_height#+eps;
+ x3=x4=x0-if monospace: 3u# else: 4u# fi - eps;
+ penpos5(rule_thickness#, angle(z4-z0)); z5l=z0;
+ penpos6(rule_thickness#, angle(z3-z0)); z6l=z0;
+ z9=.2[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+
+ % Draw the right half of the arrow head
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9-(0,3rule_thickness#),
+ point tt of apth - 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left part of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the path
+
+ if arclength apth > x0-x2:
+ draw subpath(0,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0023.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0023.mp
new file mode 100644
index 00000000000..89fd897b033
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0023.mp
@@ -0,0 +1,250 @@
+%% sgbx0023.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_tailarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.24asc_height#+eps;
+ x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0;
+ penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+ save ssss; numeric ssss; ssss = arctime(x0-x3l) of apth;
+
+ % Draw the right half of the arrowhead
+
+ save right_texarrowhead, pa;
+ vardef right_texarrowhead(expr T,s) =
+ (subpath(0, xpart ((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)--subpath(s,t) of pp--z2l) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth -z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth +
+ 3rule_thickness#*(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ save f,s;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pa;
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left half of the arrow head
+
+ pp := (z3l{z9-z3}..z5r);
+ save pq; path pq; pq := (z3r{z9-z3}..z0);
+
+ save left_texarrowhead, pb;
+ vardef left_texarrowhead(expr T, s) =
+ (z2r--subpath(t,s) of pp
+ --subpath(xpart ( pq intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0)))
+ ,length pq) of pq) transformed T
+ enddef;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#
+ *(unitvector (direction tt of apth)
+ rotated 90));
+ fi
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point tt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ path pb;
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the right half of the tail
+
+ save ss; ss := arctime(x9-x3l) of apth;
+ save sss; sss := arctime(x2-x3l) of apth;
+
+ if arclength apth = 0:
+ T:=identity shifted (point 0 of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction 0 of apth))
+ shifted (point 0 of apth - z0);
+ else:
+ T:=mapto(z0,
+ point ssss of apth,
+ z2,
+ point sss of apth,
+ z9+(0,3rule_thickness#),
+ point ss of apth +
+ 3rule_thickness#*(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ pp := z4l{z9-z4}..z6r;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ss of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ pa := right_texarrowhead(T,s);
+
+ % Draw the left half of the tail
+
+ if arclength apth = 0:
+ T:=identity shifted (point 0 of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction 0 of apth))
+ shifted (point 0 of apth - z0);
+ else:
+ T:=mapto(z0,
+ point ssss of apth,
+ z2,
+ point sss of apth,
+ z9-(0,3rule_thickness#),
+ point ss of apth -
+ 3rule_thickness#*(unitvector (direction ss of apth)
+ rotated 90));
+ fi
+
+ pp := (z3l{z9-z3}..z5r);
+ pq := (z3r{z9-z3}..z0);
+
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ss of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ pb := left_texarrowhead(T,s);
+
+ filldraw pa--pb--cycle text_;
+
+ % Draw the path
+
+ if arclength apth > 2(x0-x2):
+ save stt; stt := arctime(.5(x0+x2)-x3l) of apth;
+ draw subpath(stt,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/sgbx0024.mp b/Master/texmf-dist/metapost/cmarrows/sgbx0024.mp
new file mode 100644
index 00000000000..72fe6a0adec
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/sgbx0024.mp
@@ -0,0 +1,211 @@
+%% sgbx0024.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_tripplearrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__sgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__sgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, monospace, fudge, crisp, hair;" &
+ "boolean monospace;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "monospace :=" & if monospace: "true" else: "false" fi & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#,.55x_height#];
+ w:=18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(1.5bar#, 0); penpos4(1.5bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0 = w-u#;
+ x0'=x0''=x0; x1'=x1''=x1;
+ y1'=y1+spread; y1''=y1-spread; y0'=y1'; y0''=y1'';
+
+ y3-y0'=y0''-y4=.24asc_height#+eps; x3=x4=x0-6u#-eps;
+ penpos5(bar#,angle(z0-z4)); z5r=z0; penpos6(bar#,angle(z0-z3));
+ z6r=z0; z9=.381966[.5[z3,z4],z0];
+ save pp;
+ path pp; pp = z4l{z9-z4}..z6l;
+ save ss;
+ numeric ss; ss = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2 = xpart point ss of pp;
+ save t;
+ numeric t; t = xpart(pp intersectiontimes ((0,y0'')--(w,y0'')));
+ numeric t[]; t1 = xpart(pp intersectiontimes ((0,y0''-rule_thickness#/2)
+ --(w,y0''-rule_thickness#/2)));
+ t2 = xpart(pp intersectiontimes ((0,y0''+rule_thickness#/2)
+ --(w,y0''+rule_thickness#/2)));
+ t3 = xpart(pp intersectiontimes ((x2,y4)--(x2,y3)));
+ save qq;
+ path qq; qq = z3l{z9-z3}..z5l;
+
+ save parallelline;
+ vardef parallelline expr ppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength ppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength ppp)/stp;
+
+ if stp > 0:
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp +
+ spread*(unitvector direction (arctime s of ppp) of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp +
+ spread*(unitvector direction (length ppp) of ppp rotated 90)
+ withpen pencircle scaled rule_thickness#
+ text_;
+
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp -
+ spread*(unitvector direction (arctime s of ppp) of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp -
+ spread*(unitvector direction (length ppp) of ppp rotated 90)
+ withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % Draw the arrow head
+
+ save tripplearrowhead;
+ vardef tripplearrowhead(expr T,s,ss) =
+ (subpath(0,xpart((z0..{z4-z9}z4r) intersectiontimes
+ (point s of pp -- point s of pp + (2rule_thickness#,0))))
+ of (z0..{z4-z9}z4r)
+ --subpath(s,t1) of pp
+ --(xpart point t1 of pp, ypart point t2 of pp)
+ --subpath(t2,t3) of pp
+ --subpath(t3,t2) of qq
+ --(xpart point t1 of qq, ypart point t2 of qq)
+ --subpath(t1,ss) of qq
+ --subpath(xpart((z3r{z9-z3}..z0) intersectiontimes
+ (point ss of qq -- point ss of qq + (2rule_thickness#,0))),1)
+ of (z3r{z9-z3}..z0)
+ & cycle) transformed T
+ enddef;
+
+ save T; transform T;
+ save tt;
+ tt = arctime (arclength apth - (x0 - xpart point t1 of pp)) of apth;
+ save ttt;
+ ttt = arctime (arclength apth - (x0 - x2)) of apth;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-xpart(point t1 of pp):
+ T:=identity rotatedaround(z0, angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T := mapto(z2,
+ point ttt of apth,
+ point t1 of pp + (0,rule_thickness#/2),
+ point tt of apth +
+ spread*(unitvector direction tt of apth rotated 90),
+ point t1 of qq - (0,rule_thickness#/2),
+ point tt of apth -
+ spread*(unitvector direction tt of apth rotated 90));
+ fi
+
+ save f,s,ss;
+ ttt := arctime(arclength apth - (x0-x9)) of apth;
+ vardef f(expr s) =
+ length(point s of (pp transformed T) - point ttt of apth)
+ < length(point 0 of pp - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): s := 0;
+ else: s := solve f(length pp, 0);
+ fi
+
+ vardef f(expr ss) =
+ length(point ss of (qq transformed T) - point ttt of apth)
+ < length(point 0 of qq - z9)
+ enddef;
+
+ if f(0) or (arclength apth < x0-x3l): ss := 0;
+ else: ss := solve f(length qq, 0);
+ fi
+
+ filldraw tripplearrowhead(T,s,ss) text_;
+
+ % Draw the path
+
+ ttt := arctime (arclength apth - (x0 - x2)) of apth;
+ if arclength apth > x0 - xpart(point t1 of pp):
+ parallelline (subpath(0,tt) of apth);
+ fi
+
+ if arclength apth > x0 - x2:
+ draw subpath(0,ttt) of apth withpen pencircle scaled rule_thickness#
+ text_;
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
+
+
+
+
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0000.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0000.mp
new file mode 100644
index 00000000000..0993553a7d7
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0000.mp
@@ -0,0 +1,100 @@
+%% tgbx0000.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+save
+font_identifier,
+cmbase,
+font_size,
+
+u,
+width_adj,
+serif_fit,
+cap_serif_fit,
+letter_fit,
+
+body_height,
+asc_height,
+cap_height,
+fig_height,
+x_height,
+math_axis,
+bar_height,
+comma_depth,
+desc_depth,
+
+crisp,
+tiny,
+fine,
+thin_join,
+hair,
+stem,
+curve,
+ess,
+flare,
+dot_size,
+cap_hair,
+cap_stem,
+cap_curve,
+cap_ess,
+rule_thickness,
+
+dish,
+bracket,
+jut,
+cap_jut,
+beak_jut,
+beak,
+vair,
+notch_cut,
+bar,
+slab,
+cap_bar,
+cap_band,
+cap_notch_cut,
+serif_drop,
+stem_corr,
+vair_corr,
+apex_corr,
+
+o,
+apex_o,
+
+slant,
+fudge,
+math_spread,
+superness,
+superpull,
+beak_darkness,
+ligs,
+
+square_dots,
+hefty,
+serifs,
+monospace,
+variant_g,
+low_asterisk,
+math_fitting,
+
+designsize,
+
+generate;
+
+vardef generate suffix g = enddef;
+numeric cmbase; cmbase = 0;
+string font_identifier;
+vardef font_size expr g = designsize = g enddef;
+boolean square_dots, hefty, serifs, monospace, variant_g, low_asterisk,
+ math_fitting;
+pt#:=1pt;
+
+
+
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0001.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0001.mp
new file mode 100644
index 00000000000..e8c80c03a74
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0001.mp
@@ -0,0 +1,326 @@
+%% tgbx0001.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_Bigbrace (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save u, designsize, curve, stem, hair, rule_thickness, eps, fine, " &
+ "fudge;" &
+
+ "u# := " & decimal u# & ";" &
+ "designsize := " & decimal designsize & ";" &
+ "curve# := " & decimal curve# & ";" &
+ "stem# := " & decimal stem# & ";" &
+ "hair# := " & decimal hair# & ";" &
+ "rule_thickness# := " & decimal rule_thickness# & ";" &
+ "eps := " & decimal eps & ";" &
+ "fine# := " & decimal fine# & ";" &
+ "fudge := " & decimal fudge & ";" &
+
+ % Time for middle piece
+
+ "save st; numeric st;" &
+ "if unknown " & cmdname & "_middle_time:" &
+ " st := arctime (arclength apth)/2 of apth;" &
+ "else: st:=" & cmdname & "_middle_time; fi")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save w; numeric w; w:=10u#;
+ save h; numeric h; h:=rule_thickness#;
+ save dh; numeric dh; dh:=0.6designsize;
+ save dw; numeric dw; dw:=curve#-stem#;
+ save d; numeric d; d :=3dh-rule_thickness#;
+ save bold; numeric bold; bold:=curve#;
+ save min_breadth; numeric min_breadth;
+ min_breadth:=rule_thickness#;
+ save max_breadth; numeric max_breadth;
+ max_breadth:=.5[stem#,bold];
+
+ save x,y;
+ numeric x[],x[]',x[]l,x[]'l,x[]r,x[]'r,
+ y[],y[]',y[]l,y[]'l,y[]r,y[]'r;
+
+ if fine#>fudge*hair#:
+ fine# := fudge*hair#;
+ fi
+ pickup if fine#=0: nullpen else: pencircle scaled fine# fi;
+
+ forsuffixes $ = 1,1',4,4',7,7': penpos$(min_breadth,0); endfor
+ forsuffixes $ = 2,3,5,6: penpos$(max_breadth,0); endfor
+ x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
+ lft x4l=1.5u#-.5min_breadth; lft x2l=.5w-.5max_breadth;
+ top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
+ y1-y2=y3-y4=(y1-y4)/4;
+ y1-y1'=y4-y4'=y7'-y7=min_breadth-fine#;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % The bottom part of the brace
+
+ save bottom_part;
+ vardef bottom_part(expr T) =
+ filldraw (z6l{down}...{3(x7l-x6l),y7-y6}z7l
+ --z7r--z7'r{3(x6r-x7r),y6-y7'}...{up}z6r--z6l & cycle)
+ transformed T text_;
+ enddef;
+
+ save f;
+ vardef f(expr s) =
+ abs(point 0 of apth - (point s of apth + abs(x7-x6)
+ *(unitvector (direction s of apth) rotated 90)))
+ < abs(z7 - z6)
+ enddef;
+
+ save tolerence; tolerence := epsilon;
+ save s; numeric s;
+
+ save T; transform T; % transform for the bottom part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z7r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(z6l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z6r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ else:
+ s := solve f(0,length apth);
+ T := mapto(z6l,
+ point s of apth
+ +abs(x7r-x6l)
+ *(unitvector (direction s of apth) rotated 90),
+ z6r,
+ point s of apth
+ +abs(x7r-x6r)
+ *(unitvector (direction s of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ fi
+ bottom_part(T);
+
+ % The top part of the brace
+
+ save top_part;
+ vardef top_part(expr T) =
+ filldraw (z1l{3(x2l-x1l),y2-y1}...{down}z2l
+ --z2r{up}...{3(x1r-x2r),y1'-y2}z1'r--z1r--cycle)
+ transformed T text_;
+ enddef;
+
+ save g;
+ vardef g(expr t) =
+ abs(point (length apth) of apth
+ - (point t of apth + abs(x1r-x2)
+ *(unitvector (direction t of apth) rotated 90)))
+ < abs(z1r-z2)
+ enddef;
+
+ save t; numeric t;
+
+ transform T; % transform the top part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z1r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T := mapto(z2l,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z2r,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ else:
+ t := solve g(length apth,0);
+ T := mapto(z2l,
+ point t of apth
+ +abs(x1r-x2l)
+ *(unitvector (direction t of apth) rotated 90),
+ z2r,
+ point t of apth
+ +abs(x1r-x2r)
+ *(unitvector (direction t of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ fi
+ top_part(T);
+
+ % The lower part of the middle piece
+
+ save middle_part_bottom;
+ vardef middle_part_bottom(expr T) =
+ (.5[z4r,z4'r]{3(x5r-x4r),y5-.5[y4,y4']}...{down}z5r
+ --z5l{up}...{3(x4l-x5l),y4'-y5}z4'l) transformed T
+ enddef;
+
+ save ff;
+ vardef ff(expr ss) =
+ abs(point st of apth
+ +abs(x7r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point ss of apth + abs(x7r-x5)
+ *(unitvector (direction ss of apth) rotated 90)))
+ > abs(z4-z5)
+ enddef;
+
+ save ss; numeric ss;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4'l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ ss := solve ff(0,st);
+ T:=mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z5l,
+ point ss of apth
+ +abs(x1r-x5l)
+ *(unitvector (direction ss of apth) rotated 90),
+ z5r,
+ point ss of apth
+ +abs(x1r-x5r)
+ *(unitvector (direction ss of apth) rotated 90));
+ fi
+
+ save pb; path pb;
+ pb:=middle_part_bottom(T);
+
+ % The upper part of the middle piece
+
+ save middle_part_top;
+ vardef middle_part_top(expr T) =
+ (z4l{3(x3l-x4l),y3-y4}...{up}z3l--z3r{down}
+ ...{3(x4r-x3r),.5[y4,y4']-y3}.5[z4r,z4'r]) transformed T
+ enddef;
+
+ save gg;
+ vardef gg(expr tt) =
+ abs(point st of apth
+ +abs(x1r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point tt of apth + abs(x1r-x3)
+ *(unitvector (direction tt of apth) rotated 90)))
+ > abs(z3-z4)
+ enddef;
+
+ save tt; numeric tt;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3l,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3r,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ tt := solve gg(length apth, st);
+ T := mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z3l,
+ point tt of apth
+ +abs(x1r-x3l)
+ *(unitvector (direction tt of apth) rotated 90),
+ z3r,
+ point tt of apth
+ +abs(x1r-x3r)
+ *(unitvector (direction tt of apth) rotated 90));
+ fi
+
+ save ptt; path ptt;
+ ptt:=middle_part_top(T);
+
+ filldraw pb--ptt--cycle text_;
+
+ % The extension parts
+
+ save extension_part, stp;
+ vardef extension_part(expr ss,tt) =
+ numeric stp; stp:=(ss-tt) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(ss-tt)/stp;
+
+ pickup pencircle scaled (x5r-x5l+fine#);
+
+ if stp > 0:
+ draw for uu=ss step stp until tt-stp:
+ point uu of apth + abs(x1r-x6)
+ *(unitvector (direction uu of apth) rotated 90)
+ {direction uu of apth} ..
+ endfor
+ {direction tt of apth}
+ point tt of apth + abs(x1r-x6)
+ *(unitvector (direction tt of apth) rotated 90) text_;
+ fi
+ enddef;
+
+ if arclength apth > y1-y2+y3-y5+y6-y7:
+ extension_part(s,ss); extension_part(tt,t);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
+
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0002.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0002.mp
new file mode 100644
index 00000000000..a554e467478
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0002.mp
@@ -0,0 +1,326 @@
+%% tgbx0000.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_Biggbrace (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save u, designsize, curve, stem, hair, rule_thickness, eps, fine, " &
+ "fudge;" &
+
+ "u# := " & decimal u# & ";" &
+ "designsize := " & decimal designsize & ";" &
+ "curve# := " & decimal curve# & ";" &
+ "stem# := " & decimal stem# & ";" &
+ "hair# := " & decimal hair# & ";" &
+ "rule_thickness# := " & decimal rule_thickness# & ";" &
+ "eps := " & decimal eps & ";" &
+ "fine# := " & decimal fine# & ";" &
+ "fudge := " & decimal fudge & ";" &
+
+ % Time for middle piece
+
+ "save st; numeric st; " &
+ "if unknown " & cmdname & "_middle_time:" &
+ " st := arctime (arclength apth)/2 of apth;" &
+ "else: st:=" & cmdname & "_middle_time; fi")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save w; numeric w; w:=11.5u#;
+ save h; numeric h; h:=rule_thickness#;
+ save dh; numeric dh; dh:=0.6designsize;
+ save dw; numeric dw; dw:=curve#-stem#;
+ save d; numeric d; d :=5dh-rule_thickness#;
+ save bold; numeric bold; bold:=curve#;
+ save min_breadth; numeric min_breadth;
+ min_breadth:=rule_thickness#+.4dw;
+ save max_breadth; numeric max_breadth;
+ max_breadth:=bold+dw;
+
+ save x,y;
+ numeric x[],x[]',x[]l,x[]'l,x[]r,x[]'r,
+ y[],y[]',y[]l,y[]'l,y[]r,y[]'r;
+
+ if fine#>fudge*hair#:
+ fine#:=fudge*hair#;
+ fi
+ pickup if fine#=0: nullpen else: pencircle scaled fine# fi;
+
+ forsuffixes $ = 1,1',4,4',7,7': penpos$(min_breadth,0); endfor
+ forsuffixes $ = 2,3,5,6: penpos$(max_breadth,0); endfor
+ x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
+ lft x4l=1.5u#-.5min_breadth; lft x2l=.5w-.5max_breadth;
+ top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
+ y1-y2=y3-y4=(y1-y4)/4;
+ y1-y1'=y4-y4'=y7'-y7=min_breadth-fine#;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % The bottom part of the brace
+
+ save bottom_part;
+ vardef bottom_part(expr T) =
+ filldraw (z6l{down}...{3(x7l-x6l),y7-y6}z7l
+ --z7r--z7'r{3(x6r-x7r),y6-y7'}...{up}z6r--z6l & cycle)
+ transformed T text_;
+ enddef;
+
+ save f;
+ vardef f(expr s) =
+ abs(point 0 of apth - (point s of apth + abs(x7-x6)
+ *(unitvector (direction s of apth) rotated 90)))
+ < abs(z7 - z6)
+ enddef;
+
+ save tolerence; tolerence := epsilon;
+ save s; numeric s;
+
+ save T; transform T; % transform for the bottom part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z7r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(z6l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z6r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ else:
+ s := solve f(0,length apth);
+ T := mapto(z6l,
+ point s of apth
+ +abs(x7r-x6l)
+ *(unitvector (direction s of apth) rotated 90),
+ z6r,
+ point s of apth
+ +abs(x7r-x6r)
+ *(unitvector (direction s of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ fi
+ bottom_part(T);
+
+ % The top part of the brace
+
+ save top_part;
+ vardef top_part(expr T) =
+ filldraw (z1l{3(x2l-x1l),y2-y1}...{down}z2l
+ --z2r{up}...{3(x1r-x2r),y1'-y2}z1'r--z1r--cycle)
+ transformed T text_;
+ enddef;
+
+ save g;
+ vardef g(expr t) =
+ abs(point (length apth) of apth
+ - (point t of apth + abs(x1r-x2)
+ *(unitvector (direction t of apth) rotated 90)))
+ < abs(z1r-z2)
+ enddef;
+
+ save t; numeric t;
+
+ transform T; % transform the top part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z1r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T := mapto(z2l,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z2r,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ else:
+ t := solve g(length apth,0);
+ T := mapto(z2l,
+ point t of apth
+ +abs(x1r-x2l)
+ *(unitvector (direction t of apth) rotated 90),
+ z2r,
+ point t of apth
+ +abs(x1r-x2r)
+ *(unitvector (direction t of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ fi
+ top_part(T);
+
+ % The lower part of the middle piece
+
+ save middle_part_bottom;
+ vardef middle_part_bottom(expr T) =
+ (.5[z4r,z4'r]{3(x5r-x4r),y5-.5[y4,y4']}...{down}z5r
+ --z5l{up}...{3(x4l-x5l),y4'-y5}z4'l) transformed T
+ enddef;
+
+ save ff;
+ vardef ff(expr ss) =
+ abs(point st of apth
+ +abs(x7r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point ss of apth + abs(x7r-x5)
+ *(unitvector (direction ss of apth) rotated 90)))
+ > abs(z4-z5)
+ enddef;
+
+ save ss; numeric ss;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4'l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ ss := solve ff(0,st);
+ T:=mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z5l,
+ point ss of apth
+ +abs(x1r-x5l)
+ *(unitvector (direction ss of apth) rotated 90),
+ z5r,
+ point ss of apth
+ +abs(x1r-x5r)
+ *(unitvector (direction ss of apth) rotated 90));
+ fi
+
+ save pb; path pb;
+ pb:=middle_part_bottom(T);
+
+ % The upper part of the middle piece
+
+ save middle_part_top;
+ vardef middle_part_top(expr T) =
+ (z4l{3(x3l-x4l),y3-y4}...{up}z3l--z3r{down}
+ ...{3(x4r-x3r),.5[y4,y4']-y3}.5[z4r,z4'r]) transformed T
+ enddef;
+
+ save gg;
+ vardef gg(expr tt) =
+ abs(point st of apth
+ +abs(x1r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point tt of apth + abs(x1r-x3)
+ *(unitvector (direction tt of apth) rotated 90)))
+ > abs(z3-z4)
+ enddef;
+
+ save tt; numeric tt;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3l,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3r,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ tt := solve gg(length apth, st);
+ T := mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z3l,
+ point tt of apth
+ +abs(x1r-x3l)
+ *(unitvector (direction tt of apth) rotated 90),
+ z3r,
+ point tt of apth
+ +abs(x1r-x3r)
+ *(unitvector (direction tt of apth) rotated 90));
+ fi
+
+ save ptt; path ptt;
+ ptt:=middle_part_top(T);
+
+ filldraw pb--ptt--cycle text_;
+
+ % The extension parts
+
+ save extension_part, stp;
+ vardef extension_part(expr ss,tt) =
+ numeric stp; stp:=(ss-tt) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(ss-tt)/stp;
+
+ pickup pencircle scaled (x5r-x5l+fine#);
+
+ if stp>0:
+ draw for uu=ss step stp until tt-stp:
+ point uu of apth + abs(x1r-x6)
+ *(unitvector (direction uu of apth) rotated 90)
+ {direction uu of apth} ..
+ endfor
+ {direction tt of apth}
+ point tt of apth + abs(x1r-x6)
+ *(unitvector (direction tt of apth) rotated 90) text_;
+ fi
+ enddef;
+
+ if arclength apth > y1-y2+y3-y5+y6-y7:
+ extension_part(s,ss); extension_part(tt,t);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
+
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0003.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0003.mp
new file mode 100644
index 00000000000..92ca1954130
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0003.mp
@@ -0,0 +1,325 @@
+%% tgbx0003.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_bigbrace (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save u, designsize, curve, stem, hair, rule_thickness, eps, fine, " &
+ "fudge;" &
+
+ "u# := " & decimal u# & ";" &
+ "designsize := " & decimal designsize & ";" &
+ "curve# := " & decimal curve# & ";" &
+ "stem# := " & decimal stem# & ";" &
+ "hair# := " & decimal hair# & ";" &
+ "rule_thickness# := " & decimal rule_thickness# & ";" &
+ "eps := " & decimal eps & ";" &
+ "fine# := " & decimal fine# & ";" &
+ "fudge := " & decimal fudge & ";" &
+
+ % Time for middle piece
+
+ "save st; numeric st;" &
+ "if unknown " & cmdname & "_middle_time:" &
+ " st := arctime (arclength apth)/2 of apth;" &
+ "else: st:=" & cmdname & "_middle_time; fi")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save w; numeric w; w:=9u#;
+ save h; numeric h; h:=rule_thickness#;
+ save dh; numeric dh; dh:=0.6designsize;
+ save dw; numeric dw; dw:=curve#-stem#;
+ save d; numeric d; d :=2dh-rule_thickness#;
+ save min_breadth; numeric min_breadth;
+ min_breadth:=hair#;
+ save max_breadth; numeric max_breadth;
+ max_breadth:=stem#;
+
+ save x,y;
+ numeric x[],x[]',x[]l,x[]'l,x[]r,x[]'r,
+ y[],y[]',y[]l,y[]'l,y[]r,y[]'r;
+
+ if fine#>fudge*hair#:
+ fine# := fudge*hair#;
+ fi
+ pickup if fine#=0: nullpen else: pencircle scaled fine# fi;
+
+ forsuffixes $ = 1,1',4,4',7,7': penpos$(min_breadth,0); endfor
+ forsuffixes $ = 2,3,5,6: penpos$(max_breadth,0); endfor
+ x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
+ lft x4l=1.5u#-.5min_breadth; lft x2l=.5w-.5max_breadth;
+ top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
+ y1-y2=y3-y4=(y1-y4)/4;
+ y1-y1'=y4-y4'=y7'-y7=min_breadth-fine#;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % The bottom part of the brace
+
+ save bottom_part;
+ vardef bottom_part(expr T) =
+ filldraw (z6l{down}...{3(x7l-x6l),y7-y6}z7l
+ --z7r--z7'r{3(x6r-x7r),y6-y7'}...{up}z6r--z6l & cycle)
+ transformed T text_;
+ enddef;
+
+ save f;
+ vardef f(expr s) =
+ abs(point 0 of apth - (point s of apth + abs(x7-x6)
+ *(unitvector (direction s of apth) rotated 90)))
+ < abs(z7 - z6)
+ enddef;
+
+ save tolerence; tolerence := epsilon;
+ save s; numeric s;
+
+ save T; transform T; % transform for the bottom part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z7r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(z6l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z6r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ else:
+ s := solve f(0,length apth);
+ T := mapto(z6l,
+ point s of apth
+ +abs(x7r-x6l)
+ *(unitvector (direction s of apth) rotated 90),
+ z6r,
+ point s of apth
+ +abs(x7r-x6r)
+ *(unitvector (direction s of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ fi
+ bottom_part(T);
+
+ % The top part of the brace
+
+ save top_part;
+ vardef top_part(expr T) =
+ filldraw (z1l{3(x2l-x1l),y2-y1}...{down}z2l
+ --z2r{up}...{3(x1r-x2r),y1'-y2}z1'r--z1r--cycle)
+ transformed T text_;
+ enddef;
+
+ save g;
+ vardef g(expr t) =
+ abs(point (length apth) of apth
+ - (point t of apth + abs(x1r-x2)
+ *(unitvector (direction t of apth) rotated 90)))
+ < abs(z1r-z2)
+ enddef;
+
+ save t; numeric t;
+
+ transform T; % transform the top part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z1r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T := mapto(z2l,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z2r,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ else:
+ t := solve g(length apth,0);
+ T := mapto(z2l,
+ point t of apth
+ +abs(x1r-x2l)
+ *(unitvector (direction t of apth) rotated 90),
+ z2r,
+ point t of apth
+ +abs(x1r-x2r)
+ *(unitvector (direction t of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ fi
+ top_part(T);
+
+ % The lower part of the middle piece
+
+ save middle_part_bottom;
+ vardef middle_part_bottom(expr T) =
+ (.5[z4r,z4'r]{3(x5r-x4r),y5-.5[y4,y4']}...{down}z5r
+ --z5l{up}...{3(x4l-x5l),y4'-y5}z4'l) transformed T
+ enddef;
+
+ save ff;
+ vardef ff(expr ss) =
+ abs(point st of apth
+ +abs(x7r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point ss of apth + abs(x7r-x5)
+ *(unitvector (direction ss of apth) rotated 90)))
+ > abs(z4-z5)
+ enddef;
+
+ save ss; numeric ss;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4'l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ ss := solve ff(0,st);
+ T:=mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z5l,
+ point ss of apth
+ +abs(x1r-x5l)
+ *(unitvector (direction ss of apth) rotated 90),
+ z5r,
+ point ss of apth
+ +abs(x1r-x5r)
+ *(unitvector (direction ss of apth) rotated 90));
+ fi
+
+ save pb; path pb;
+ pb:=middle_part_bottom(T);
+
+ % The upper part of the middle piece
+
+ save middle_part_top;
+ vardef middle_part_top(expr T) =
+ (z4l{3(x3l-x4l),y3-y4}...{up}z3l--z3r{down}
+ ...{3(x4r-x3r),.5[y4,y4']-y3}.5[z4r,z4'r]) transformed T
+ enddef;
+
+ save gg;
+ vardef gg(expr tt) =
+ abs(point st of apth
+ +abs(x1r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point tt of apth + abs(x1r-x3)
+ *(unitvector (direction tt of apth) rotated 90)))
+ > abs(z3-z4)
+ enddef;
+
+ save tt; numeric tt;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3l,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3r,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ tt := solve gg(length apth, st);
+ T := mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z3l,
+ point tt of apth
+ +abs(x1r-x3l)
+ *(unitvector (direction tt of apth) rotated 90),
+ z3r,
+ point tt of apth
+ +abs(x1r-x3r)
+ *(unitvector (direction tt of apth) rotated 90));
+ fi
+
+ save ptt; path ptt;
+ ptt:=middle_part_top(T);
+
+ filldraw pb--ptt--cycle text_;
+
+ % The extension parts
+
+ save extension_part, stp;
+ vardef extension_part(expr ss,tt) =
+ numeric stp; stp:=(ss-tt) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(ss-tt)/stp;
+
+ pickup pencircle scaled (x5r-x5l+fine#);
+
+ if stp > 0:
+ draw for uu=ss step stp until tt-stp:
+ point uu of apth + abs(x1r-x6)
+ *(unitvector (direction uu of apth) rotated 90)
+ {direction uu of apth} ..
+ endfor
+ {direction tt of apth}
+ point tt of apth + abs(x1r-x6)
+ *(unitvector (direction tt of apth) rotated 90) text_;
+ fi
+ enddef;
+
+ if arclength apth > y1-y2+y3-y5+y6-y7:
+ extension_part(s,ss); extension_part(tt,t);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
+
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0004.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0004.mp
new file mode 100644
index 00000000000..ec0b4d7d700
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0004.mp
@@ -0,0 +1,325 @@
+%% tgbx0004.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_biggbrace (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save u, designsize, curve, stem, hair, rule_thickness, eps, fine, " &
+ "fudge;" &
+
+ "u# := " & decimal u# & ";" &
+ "designsize := " & decimal designsize & ";" &
+ "curve# := " & decimal curve# & ";" &
+ "stem# := " & decimal stem# & ";" &
+ "hair# := " & decimal hair# & ";" &
+ "rule_thickness# := " & decimal rule_thickness# & ";" &
+ "eps := " & decimal eps & ";" &
+ "fine# := " & decimal fine# & ";" &
+ "fudge := " & decimal fudge & ";" &
+
+ % Time for middle piece
+
+ "save st; numeric st;" &
+ "if unknown " & cmdname & "_middle_time:" &
+ " st := arctime (arclength apth)/2 of apth;" &
+ "else: st:=" & cmdname & "_middle_time; fi")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save w; numeric w; w:=11u#;
+ save h; numeric h; h:=rule_thickness#;
+ save dh; numeric dh; dh:=0.6designsize;
+ save dw; numeric dw; dw:=curve#-stem#;
+ save d; numeric d; d :=4dh-rule_thickness#;
+ save bold; numeric bold; bold:=curve#;
+ save min_breadth; numeric min_breadth;
+ min_breadth:=rule_thickness#+.2dw;
+ save max_breadth; numeric max_breadth;
+ max_breadth:=bold;
+
+ save x,y;
+ numeric x[],x[]',x[]l,x[]'l,x[]r,x[]'r,
+ y[],y[]',y[]l,y[]'l,y[]r,y[]'r;
+
+ if fine#>fudge*hair#:
+ fine#:=fudge*hair#;
+ fi
+ pickup if fine#=0: nullpen else: pencircle scaled fine# fi;
+
+ forsuffixes $ = 1,1',4,4',7,7': penpos$(min_breadth,0); endfor
+ forsuffixes $ = 2,3,5,6: penpos$(max_breadth,0); endfor
+ x2=x3=x5=x6; x1=x1'=x7=x7'=w-x4=w-x4';
+ lft x4l=1.5u#-.5min_breadth; lft x2l=.5w-.5max_breadth;
+ top y1=h; bot y7=1-d; .5[y4,y4']=.5[y1,y7]=.5[y2,y6]=.5[y3,y5];
+ y1-y2=y3-y4=(y1-y4)/4;
+ y1-y1'=y4-y4'=y7'-y7=min_breadth-fine#;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % The bottom part of the brace
+
+ save bottom_part;
+ vardef bottom_part(expr T) =
+ filldraw (z6l{down}...{3(x7l-x6l),y7-y6}z7l
+ --z7r--z7'r{3(x6r-x7r),y6-y7'}...{up}z6r--z6l & cycle)
+ transformed T text_;
+ enddef;
+
+ save f;
+ vardef f(expr s) =
+ abs(point 0 of apth - (point s of apth + abs(x7-x6)
+ *(unitvector (direction s of apth) rotated 90)))
+ < abs(z7 - z6)
+ enddef;
+
+ save tolerence; tolerence := epsilon;
+ save s; numeric s;
+
+ save T; transform T; % transform for the bottom part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z7r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(z6l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z6r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ else:
+ s := solve f(0,length apth);
+ T := mapto(z6l,
+ point s of apth
+ +abs(x7r-x6l)
+ *(unitvector (direction s of apth) rotated 90),
+ z6r,
+ point s of apth
+ +abs(x7r-x6r)
+ *(unitvector (direction s of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ fi
+ bottom_part(T);
+
+ % The top part of the brace
+
+ save top_part;
+ vardef top_part(expr T) =
+ filldraw (z1l{3(x2l-x1l),y2-y1}...{down}z2l
+ --z2r{up}...{3(x1r-x2r),y1'-y2}z1'r--z1r--cycle)
+ transformed T text_;
+ enddef;
+
+ save g;
+ vardef g(expr t) =
+ abs(point (length apth) of apth
+ - (point t of apth + abs(x1r-x2)
+ *(unitvector (direction t of apth) rotated 90)))
+ < abs(z1r-z2)
+ enddef;
+
+ save t; numeric t;
+
+ transform T; % transform the top part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z1r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T := mapto(z2l,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z2r,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ else:
+ t := solve g(length apth,0);
+ T := mapto(z2l,
+ point t of apth
+ +abs(x1r-x2l)
+ *(unitvector (direction t of apth) rotated 90),
+ z2r,
+ point t of apth
+ +abs(x1r-x2r)
+ *(unitvector (direction t of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ fi
+ top_part(T);
+
+ % The lower part of the middle piece
+
+ save middle_part_bottom;
+ vardef middle_part_bottom(expr T) =
+ (.5[z4r,z4'r]{3(x5r-x4r),y5-.5[y4,y4']}...{down}z5r
+ --z5l{up}...{3(x4l-x5l),y4'-y5}z4'l) transformed T
+ enddef;
+
+ save ff;
+ vardef ff(expr ss) =
+ abs(point st of apth
+ +abs(x7r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point ss of apth + abs(x7r-x5)
+ *(unitvector (direction ss of apth) rotated 90)))
+ > abs(z4-z5)
+ enddef;
+
+ save ss; numeric ss;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4'l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ ss := solve ff(0,st);
+ T:=mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z5l,
+ point ss of apth
+ +abs(x1r-x5l)
+ *(unitvector (direction ss of apth) rotated 90),
+ z5r,
+ point ss of apth
+ +abs(x1r-x5r)
+ *(unitvector (direction ss of apth) rotated 90));
+ fi
+
+ save pb; path pb;
+ pb:=middle_part_bottom(T);
+
+ % The upper part of the middle piece
+
+ save middle_part_top;
+ vardef middle_part_top(expr T) =
+ (z4l{3(x3l-x4l),y3-y4}...{up}z3l--z3r{down}
+ ...{3(x4r-x3r),.5[y4,y4']-y3}.5[z4r,z4'r]) transformed T
+ enddef;
+
+ save gg;
+ vardef gg(expr tt) =
+ abs(point st of apth
+ +abs(x1r-x4)*(unitvector (direction st of apth) rotated 90)
+ -(point tt of apth + abs(x1r-x3)
+ *(unitvector (direction tt of apth) rotated 90)))
+ > abs(z3-z4)
+ enddef;
+
+ save tt; numeric tt;
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3l,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3r,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ tt := solve gg(length apth, st);
+ T := mapto(.5[z4r,z4'r],
+ point st of apth
+ +abs(x1r-.5[x4r,x4'r])
+ *(unitvector (direction st of apth) rotated 90),
+ z3l,
+ point tt of apth
+ +abs(x1r-x3l)
+ *(unitvector (direction tt of apth) rotated 90),
+ z3r,
+ point tt of apth
+ +abs(x1r-x3r)
+ *(unitvector (direction tt of apth) rotated 90));
+ fi
+
+ save ptt; path ptt;
+ ptt:=middle_part_top(T);
+
+ filldraw pb--ptt--cycle text_;
+
+ % The extension parts
+
+ save extension_part, stp;
+ vardef extension_part(expr ss,tt) =
+ numeric stp; stp:=(ss-tt) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(ss-tt)/stp;
+
+ pickup pencircle scaled (x5r-x5l+fine#);
+
+ if stp > 0:
+ draw for uu=ss step stp until tt-stp:
+ point uu of apth + abs(x1r-x6)
+ *(unitvector (direction uu of apth) rotated 90)
+ {direction uu of apth} ..
+ endfor
+ {direction tt of apth}
+ point tt of apth + abs(x1r-x6)
+ *(unitvector (direction tt of apth) rotated 90) text_;
+ fi
+ enddef;
+
+ if arclength apth > y1-y2+y3-y5+y6-y7:
+ extension_part(s,ss); extension_part(tt,t);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
+
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0005.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0005.mp
new file mode 100644
index 00000000000..6e5c14634c7
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0005.mp
@@ -0,0 +1,336 @@
+%% tgbx0005.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_extensiblebrace (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save u, designsize, curve, stem, hair, rule_thickness, eps, fine, " &
+ "fudge;" &
+
+ "u# := " & decimal u# & ";" &
+ "designsize := " & decimal designsize & ";" &
+ "curve# := " & decimal curve# & ";" &
+ "stem# := " & decimal stem# & ";" &
+ "hair# := " & decimal hair# & ";" &
+ "rule_thickness# := " & decimal rule_thickness# & ";" &
+ "eps := " & decimal eps & ";" &
+ "fine# := " & decimal fine# & ";" &
+ "fudge := " & decimal fudge & ";" &
+
+ % Time for middle piece
+
+ "save st; numeric st;" &
+ "if unknown " & cmdname & "_middle_time:" &
+ " st := arctime (arclength apth)/2 of apth;" &
+ "else: st:=" & cmdname & "_middle_time; fi")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save w; numeric w; w :=12u#;
+ save h; numeric h; h :=0;
+ save dh; numeric dh; dh:=0.6designsize;
+ save dw; numeric dw; dw:=curve#-stem#;
+ save d; numeric d; d :=1.5dh;
+ save min_breadth; numeric min_breadth#;
+ min_breadth#:=rule_thickness#+0.6dw;
+ save heavy_rule_thickness; numeric heavy_rule_thickness#;
+ heavy_rule_thickness#:=3rule_thickness#;
+
+ save x,y;
+ numeric x[],x[]',x[]l,x[]'l,x[]r,x[]'r,
+ y[],y[]',y[]l,y[]'l,y[]r,y[]'r;
+
+ if fine#>fudge*hair#:
+ fine#:=fudge*hair#;
+ fi
+ pickup if fine#=0: nullpen else: pencircle scaled fine# fi;
+
+ penpos7(min_breadth#,0); penpos7'(min_breadth#,0);
+ penpos6(heavy_rule_thickness#,0);
+ rt x7r = rt x7'r = w-1.5u#+.5min_breadth#;
+ lft x6l = .5w-.5heavy_rule_thickness#;
+ bot y7 = -d; y6 = .5[h+eps,y7]; y7'-y7 = min_breadth#-fine#;
+
+ penpos1(min_breadth#,0); penpos1'(min_breadth#,0);
+ penpos2(heavy_rule_thickness#,0);
+ rt x1r = rt x1'r = w-1.5u#+.5min_breadth#;
+ lft x2 = .5w;
+ top y1 = h; y2 = .5[y1,-d-eps]; y1-y1' = min_breadth#-fine#;
+
+ penpos4'(min_breadth#,0); penpos4(min_breadth#,0);
+ penpos5(heavy_rule_thickness#,0);
+ penpos3(heavy_rule_thickness#,0);
+ lft x4l=lft x4'l=1.5u#-.5min_breadth#;
+ lft x5l=.5w-.5heavy_rule_thickness#;
+ y4'-y5=(h+2d+2eps)/4;
+ y4-y4'=min_breadth#-fine#; y4=0;
+ lft x3l = .5w-.5heavy_rule_thickness#;
+ y3-y4 = (h+2d+2eps)/4;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % The bottom part of the brace
+
+ save bottom_part;
+ vardef bottom_part(expr T) =
+ filldraw (z6l{down}...{3(x7l-x6l),y7-y6}z7l
+ --z7r--z7'r{3(x6r-x7r),y6-y7'}...{up}z6r--z6l & cycle)
+ transformed T text_;
+ enddef;
+
+ save f;
+ vardef f(expr s) =
+ abs(point 0 of apth - (point s of apth + (.5w-1.5u#+.5min_breadth#)
+ *(unitvector (direction s of apth) rotated 90)))
+ < ((d/2) ++ (.5w-1.5u#+.5min_breadth#))
+ enddef;
+
+ save tolerence; tolerence := epsilon;
+ save s; numeric s;
+
+ save T; transform T; % transform for the bottom part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z7r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(z6l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z6r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ +abs(x7r-x6r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ else:
+ s := solve f(0,length apth);
+ T := mapto(z6l,
+ point s of apth
+ +(.5w-1.5u#+.5min_breadth#+.5heavy_rule_thickness#)
+ *(unitvector (direction s of apth) rotated 90),
+ z6r,
+ point s of apth
+ +(.5w-1.5u#+.5min_breadth#-.5heavy_rule_thickness#)
+ *(unitvector (direction s of apth) rotated 90),
+ z7r,
+ point 0 of apth);
+ fi
+ bottom_part(T);
+
+ % The top part of the brace
+
+ save top_part;
+ vardef top_part(expr T) =
+ filldraw (z1l{3(x2l-x1l),y2-y1}...{down}z2l
+ --z2r{up}...{3(x1r-x2r),y1'-y2}z1'r--z1r--cycle)
+ transformed T text_;
+ enddef;
+
+ save g;
+ vardef g(expr t) =
+ abs(point (length apth) of apth
+ - (point t of apth + (.5w-1.5u#+.5min_breadth#)
+ *(unitvector (direction t of apth) rotated 90)))
+ < ((d/2) ++ (.5w-1.5u#+.5min_breadth#))
+ enddef;
+
+ save t; numeric t;
+
+ transform T; % transform the top part
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z1r);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T := mapto(z2l,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z2r,
+ .75[point 0 of apth, point (length apth) of apth] +
+ abs(x1r-x2r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ else:
+ t := solve g(length apth,0);
+ T := mapto(z2l,
+ point t of apth
+ +(.5w-1.5u#+.5min_breadth#+.5heavy_rule_thickness#)
+ *(unitvector (direction t of apth) rotated 90),
+ z2r,
+ point t of apth
+ +(.5w-1.5u#+.5min_breadth#-.5heavy_rule_thickness#)
+ *(unitvector (direction t of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ fi
+ top_part(T);
+
+ % The lower part of the middle piece
+
+ save middle_part_bottom;
+ vardef middle_part_bottom(expr T) =
+ (.5[z4r,z4'r]{3(x5r-x4r),y5-.5[y4,y4']}...{down}z5r
+ --z5l{up}...{3(x4l-x5l),y4'-y5}z4'l) transformed T
+ enddef;
+
+ save ff;
+ vardef ff(expr ss) =
+ abs(point st of apth
+ +(w-3u#)*(unitvector (direction st of apth) rotated 90)
+ -(point ss of apth + (.5w-1.5u#+.5min_breadth#)
+ *(unitvector (direction ss of apth) rotated 90)))
+ > ((h+2d+2eps)/4+(min_breadth#-fine#)/2) ++ (.5w-1.5u#-.5min_breadth#)
+ enddef;
+
+ save ss; numeric ss;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4'l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5l,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z5r,
+ .25[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x5r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ ss := solve ff(0,st);
+ T:=mapto(.5[z4r,z4'r],
+ point st of apth
+ +(w-3u#)*(unitvector (direction st of apth) rotated 90),
+ z5l,
+ point ss of apth
+ +(.5w-1.5u#+.5min_breadth#+.5heavy_rule_thickness#)
+ *(unitvector (direction ss of apth) rotated 90),
+ z5r,
+ point ss of apth
+ +(.5w-1.5u#+.5min_breadth#-.5heavy_rule_thickness#)
+ *(unitvector (direction ss of apth) rotated 90));
+ fi
+
+ save pb; path pb;
+ pb:=middle_part_bottom(T);
+
+ % The upper part of the middle piece
+
+ save middle_part_top;
+ vardef middle_part_top(expr T) =
+ (z4l{3(x3l-x4l),y3-y4}...{up}z3l--z3r{down}
+ ...{3(x4r-x3r),.5[y4,y4']-y3}.5[z4r,z4'r]) transformed T
+ enddef;
+
+ save gg;
+ vardef gg(expr tt) =
+ abs(point st of apth
+ +(w-3u#)*(unitvector (direction st of apth) rotated 90)
+ -(point tt of apth + (.5w-1.5u#+.5min_breadth#)
+ *(unitvector (direction tt of apth) rotated 90)))
+ > ((h+2d+2eps)/4+(min_breadth#-fine#)/2) ++ (.5w-1.5u#-.5min_breadth#)
+ enddef;
+
+ save tt; numeric tt;
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z4l);
+ elseif arclength apth < y1-y2+y3-y5+y6-y7:
+ T:=mapto(.5[z4r,z4'r],
+ .5[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-.5[x4r,x4'r])
+ *(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3l,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3r,
+ .75[point 0 of apth, point (length apth) of apth]+
+ abs(x1r-x3r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90));
+ else:
+ tt := solve gg(length apth, st);
+ T := mapto(.5[z4r,z4'r],
+ point st of apth
+ +(w-3u#)*(unitvector (direction st of apth) rotated 90),
+ z3l,
+ point tt of apth
+ +(.5w-1.5u#+.5min_breadth#+.5heavy_rule_thickness#)
+ *(unitvector (direction tt of apth) rotated 90),
+ z3r,
+ point tt of apth
+ +(.5w-1.5u#+.5min_breadth#-.5heavy_rule_thickness#)
+ *(unitvector (direction tt of apth) rotated 90));
+ fi
+
+ save ptt; path ptt;
+ ptt:=middle_part_top(T);
+
+ filldraw pb--ptt--cycle text_;
+
+ % The extension parts
+
+ save extension_part;
+ vardef extension_part(expr ss,tt) =
+ numeric stp; stp:=(ss-tt) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(ss-tt)/stp;
+
+ pickup pencircle scaled (heavy_rule_thickness#+fine#);
+
+ if stp>0:
+ draw for uu=ss step stp until tt-stp:
+ point uu of apth + (.5w-1.5u#+.5min_breadth#)
+ *(unitvector (direction uu of apth) rotated 90)
+ {direction uu of apth} ..
+ endfor
+ {direction tt of apth}
+ point tt of apth + (.5w-1.5u#+.5min_breadth#)
+ *(unitvector (direction tt of apth) rotated 90) text_;
+ fi
+ enddef;
+
+ if arclength apth > y1-y2+y3-y5+y6-y7:
+ extension_part(s,ss); extension_part(tt,t);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0006.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0006.mp
new file mode 100644
index 00000000000..fb135522d85
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0006.mp
@@ -0,0 +1,179 @@
+%% tgbx0006.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_parallelarrows (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, fudge, crisp, hair;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.24asc_height#+eps;
+ x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0;
+ penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save texarrowhead;
+ vardef texarrowhead(expr T) =
+ filldraw (z0..{z4-z9}z4r--subpath(0,t) of pp
+ --z2l--z2r--subpath(t,0) of (z3l{z9-z3}..z5r)
+ --z3r{z9-z3}..z0 & cycle) transformed T text_;
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x3l)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+
+ save parallelline;
+ vardef parallelline expr ppp =
+ save s, stp;
+ numeric s, stp; stp:=(arclength ppp) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(arclength ppp)/stp;
+
+ if stp>0:
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp +
+ (.24asc_height#+eps)*(unitvector direction (arctime s of ppp)
+ of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp +
+ (.24asc_height#+eps)*(unitvector direction (length ppp)
+ of ppp rotated 90)
+ withpen pencircle scaled rule_thickness# text_;
+
+ draw for s=0 step stp until arclength ppp - stp:
+ point (arctime s of ppp) of ppp -
+ (.24asc_height#+eps)*(unitvector direction (arctime s of ppp)
+ of ppp rotated 90)
+ {direction (arctime s of ppp) of ppp}..
+ endfor
+ {direction (length ppp) of ppp}
+ point (length ppp) of ppp -
+ (.24asc_height#+eps)*(unitvector direction (length ppp)
+ of ppp rotated 90)
+ withpen pencircle scaled rule_thickness# text_;
+ fi
+ enddef;
+
+ if arclength apth > x0-x2: parallelline subpath(0,ttt) of apth; fi
+
+ save T; transform T;
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0)
+ shifted (0,.24asc_height#+eps);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0)
+ shifted ((.24asc_height#+eps)*
+ (unitvector (direction (length apth) of apth) rotated 90));
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth +
+ (.24asc_height#+eps)*
+ (unitvector (direction (length apth) of apth) rotated 90),
+ z2,
+ point ttt of apth +
+ (.24asc_height#+eps)*
+ (unitvector (direction (length apth) of apth) rotated 90),
+ z3l,
+ point tt of apth);
+ fi
+ texarrowhead(T);
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0)
+ shifted (0,-.24asc_height#+eps);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0)
+ shifted ((.24asc_height#+eps)*
+ (unitvector (direction (length apth) of apth) rotated -90));
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth -
+ (.24asc_height#+eps)*
+ (unitvector (direction (length apth) of apth) rotated 90),
+ z2,
+ point ttt of apth -
+ (.24asc_height#+eps)*
+ (unitvector (direction (length apth) of apth) rotated 90),
+ z4l,
+ point tt of apth);
+ fi
+ texarrowhead(T);
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0007.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0007.mp
new file mode 100644
index 00000000000..27218cfff5a
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0007.mp
@@ -0,0 +1,140 @@
+%% tgbx0007.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_twoheadarrow (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save math_spread, x_height, u, rule_thickness, bar, math_axis," &
+ " asc_height, eps, fudge, crisp, hair;" &
+
+ "math_spread :=" & decimal math_spread & ";" &
+ "x_height# :=" & decimal x_height# & ";" &
+ "u# :=" & decimal u# & ";" &
+ "rule_thickness# :=" & decimal rule_thickness# & ";" &
+ "bar# :=" & decimal bar# & ";" &
+ "math_axis# :=" & decimal math_axis# & ";" &
+ "asc_height# :=" & decimal asc_height# & ";" &
+ "eps :=" & decimal eps & ";" &
+ "fudge :=" & decimal fudge & ";" &
+ "crisp# :=" & decimal crisp# & ";" &
+ "hair# :=" & decimal hair# & ";")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save x,y;
+ numeric x[], x[]', x[]l, x[]'l, x[]r, x[]'r,
+ y[], y[]', y[]l, y[]'l, y[]r, y[]'r;
+ save spread, w;
+ numeric spread, w;
+
+ if crisp#>fudge*hair#:
+ crisp#:=fudge*hair#;
+ fi
+ pickup if crisp#=0: nullpen else: pencircle scaled crisp# fi;
+
+ spread = math_spread[.45x_height#, .55x_height#];
+ w = 18u#;
+
+ penpos1(rule_thickness#, 90); penpos2(rule_thickness#, 90);
+ penpos3(bar#, 0); penpos4(bar#, 0);
+ y0=y1=y2=math_axis#; x1-.5rule_thickness#=u#; rt x0=w-u#;
+ y3-y0=y0-y4=.24asc_height#+eps;
+ x3=x4=x0-3u#-eps;
+ penpos5(bar#, angle(z4-z0)); z5l=z0;
+ penpos6(bar#, angle(z3-z0)); z6l=z0;
+ z9=.381966[.5[z3,z4],z0];
+
+ save pp; path pp; pp = z4l{z9-z4}..z6r;
+ save t; numeric t; t = xpart(pp intersectiontimes ((0,y2l)--(w,y2l)));
+ x2=xpart point t of pp;
+
+ save texarrowhead;
+ vardef texarrowhead(expr T) =
+ filldraw (z0..{z4-z9}z4r--subpath(0,t) of pp
+ --z2l--z2r--subpath(t,0) of (z3l{z9-z3}..z5r)
+ --z3r{z9-z3}..z0 & cycle) transformed T text_;
+ enddef;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ save T; transform T;
+ save tt; numeric tt; tt = arctime(arclength apth - (x0-x9)) of apth;
+ save ttt; numeric ttt; ttt = arctime(arclength apth - (x0-x2)) of apth;
+
+ if arclength apth > x0-x2:
+ draw subpath(0,ttt) of apth
+ withpen pencircle scaled rule_thickness# text_;
+ fi
+
+ if arclength apth = 0:
+ T:=identity shifted (point (length apth) of apth - z0);
+ elseif arclength apth < x0-x3l:
+ T:=identity rotatedaround(z0,angle (direction (length apth) of apth))
+ shifted (point (length apth) of apth - z0);
+ else:
+ T:=mapto(z0,
+ point (length apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#*
+ (unitvector (direction tt of apth) rotated 90));
+ fi
+ texarrowhead(T);
+
+ tt :=arctime(arclength apth - (x0-x9) + (x3l-x0)) of apth;
+ ttt:=arctime(arclength apth - (x0-x2) + (x3l-x0)) of apth;
+ if arclength apth = 0:
+ T:=identity shifted (point 0 of apth - z0)
+ shifted (x3l-x0,0);
+ elseif arclength apth < x0-x3l+x0-x9:
+ T:=identity rotatedaround(z0,angle direction 0 of apth)
+ shifted ((x0-x3l)*
+ unitvector (point 0 of apth - point (length apth) of apth))
+ shifted ((point (length apth) of apth) - z0);
+ else:
+ T:=mapto(z0,
+ point (arctime((arclength apth)+(x3l-x0)) of apth) of apth,
+ z2,
+ point ttt of apth,
+ z9+(0,3rule_thickness#),
+ point tt of apth + 3rule_thickness#*
+ (unitvector (direction tt of apth) rotated 90));
+ fi
+ texarrowhead(T);
+
+ pickup prevpen;
+
+ enddef;
+
+enddef; \ No newline at end of file
diff --git a/Master/texmf-dist/metapost/cmarrows/tgbx0027.mp b/Master/texmf-dist/metapost/cmarrows/tgbx0027.mp
new file mode 100644
index 00000000000..6e024dc85d5
--- /dev/null
+++ b/Master/texmf-dist/metapost/cmarrows/tgbx0027.mp
@@ -0,0 +1,216 @@
+%% tgbx0027.mp
+%% Copyright 2006 Tommy Ekola <tek@kth.se>
+%
+% This work may be distributed and/or modified under the conditions of
+% the LaTeX Project Public License, either version 1.3 of this license
+% or (at your option) any later version. The latest version of this
+% license is in http://www.latex-project.org/lppl.txt
+%
+% This work has the LPPL maintenance status `maintained'. The Current
+% Maintainer of this work is Tommy Ekola. The Base Interpreter is
+% MetaPost.
+
+vardef setup_paren (expr source_file, cmdname) =
+
+ scantokens ("input tgbx0000");
+
+ scantokens ("input " & source_file);
+
+ expandafter def scantokens cmdname expr p =
+ scantokens (cmdname & "__tgbxww")(p)
+ enddef;
+
+ expandafter vardef scantokens (cmdname & "__tgbxww " & "(expr apth) " &
+ "text text_ = " &
+
+ "save u, designsize, curve, stem, rule_thickness, eps, fine, " &
+ " fudge, hair;" &
+
+ "u# := " & decimal u# & ";" &
+ "designsize := " & decimal designsize & ";" &
+ "curve# := " & decimal curve# & ";" &
+ "stem# := " & decimal stem# & ";" &
+ "rule_thickness# := " & decimal rule_thickness# & ";" &
+ "eps := " & decimal eps & ";" &
+ "fine# := " & decimal fine# & ";" &
+ "fudge := " & decimal fudge & ";" &
+ "hair# := " & decimal hair# & ";" &
+
+ % Time for middle piece
+
+ "save st; numeric st;" &
+ "if unknown " & cmdname & "_middle_time:" &
+ " st := arctime (arclength apth)/2 of apth;" &
+ "else: st:=" & cmdname & "_middle_time; fi")
+
+ save prevpen;
+ prevpen:=savepen;
+
+ save w; numeric w; w :=12u#;
+ save h; numeric h; h :=0;
+ save dh; numeric dh; dh:=0.6designsize;
+ save dw; numeric dw; dw:=curve#-stem#;
+ save d; numeric d; d :=1.5dh;
+ save bold; numeric bold; bold := curve#;
+ save min_breadth; numeric min_breadth;
+ min_breadth:=rule_thickness#+0.6dw;
+ save max_breadth; numeric max_breadth;
+ max_breadth:=bold+2dw;
+ save heavy_rule_thickness; numeric heavy_rule_thickness#;
+ heavy_rule_thickness#:=3rule_thickness#;
+
+ save x,y;
+ numeric x[],x[]',x[]l,x[]'l,x[]r,x[]'r,
+ y[],y[]',y[]l,y[]'l,y[]r,y[]'r;
+
+ if fine#>fudge*hair#:
+ fine# := fudge*hair#;
+ fi
+ pickup if fine#=0: nullpen else: pencircle scaled fine# fi;
+
+ penpos3(min_breadth,0); penpos4(max_breadth,0);
+ rt x3r = w-1.25u#+0.5min_breadth; lft x4l = 1.25u#;
+ bot y3=-d; y4=h;
+
+ penpos1(min_breadth,0); penpos2(max_breadth,0);
+ rt x1r = w-1.25u#+0.5min_breadth; lft x2l = 1.25u#;
+ top y1 = h; y2=-d;
+
+ save mapto, n;
+ vardef mapto(text t) =
+ hide(numeric n; n:=0;
+ numeric x,x_[],y,y_[];
+ for z=t: z_[incr n]:=z; endfor;
+ transform T;
+ z_2 = z_1 transformed T;
+ z_4 = z_3 transformed T;
+ z_6 = z_5 transformed T;)
+ T
+ enddef;
+
+ % The bottom part of the parenthesis
+
+ save bottom_part;
+ vardef bottom_part(expr T) =
+ filldraw (z3l{3(x4l-x3l),y4-y3}..{up}z4l
+ --reverse(z3r{3(x4r-x3r),y4-y3}..{up}z4r)
+ --cycle) transformed T text_;
+ enddef;
+
+ save f;
+ vardef f(expr s) =
+ abs(point 0 of apth - (point s of apth +
+ (w-2.5u#+0.5min_breadth+0.5*max_breadth)
+ *(unitvector (direction s of apth) rotated 90)))
+ < ((h+d) ++ (w-2.5u#+0.5min_breadth+0.5*max_breadth))
+ enddef;
+
+ save tolerence; tolerence:=epsilon;
+ save s; numeric s;
+
+ save T; transform T; % transform the bottom part
+ if arclength apth=0:
+ T := identity shifted (point (length apth) of apth - z3r);
+ elseif arclength apth < y1-y2+y4-y3:
+ T := mapto(z4l,
+ 0.5[point 0 of apth, point (length apth) of apth]
+ + abs(x3r-x4l)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z4r,
+ 0.5[point 0 of apth, point (length apth) of apth]
+ + abs(x3r-x4r)*(unitvector (point (length apth) of apth -
+ point 0 of apth) rotated 90),
+ z3r,
+ point 0 of apth);
+ else:
+ s := solve f(0,length apth);
+ T := mapto(z4l,
+ point s of apth + (w-2.5u#+0.5min_breadth+0.5max_breadth)
+ *(unitvector (direction s of apth) rotated 90),
+ z4r,
+ point s of apth + (w-2.5u#+0.5min_breadth-0.5max_breadth)
+ *(unitvector (direction s of apth) rotated 90),
+ z3r,
+ point 0 of apth);
+ fi;
+
+ bottom_part(T);
+
+ % The top part of the parenthesis
+
+ save top_part;
+ vardef top_part(expr T) =
+ filldraw (z1l{3(x2l-x1l),y2-y1}..{down}z2l
+ --reverse(z1r{3(x2r-x1r),y2-y1}..{down}z2r)
+ --cycle) transformed T text_;
+ enddef;
+
+ save g;
+ vardef g(expr t) =
+ abs(point (length apth) of apth - (point t of apth +
+ (w-2.5u#+0.5min_breadth+0.5max_breadth)
+ *(unitvector (direction s of apth) rotated 90)))
+ < ((h+d) ++ (w-2.5u#+0.5min_breadth+0.5max_breadth))
+ enddef;
+
+ save t; numeric t;
+ transform T; % transform the top part
+ if arclength apth = 0:
+ T := identity shifted (point (length apth) of apth - z1r);
+ elseif arclength apth < y1-y2+y4-y3:
+ T := mapto(z2l,
+ 0.5[point 0 of apth, point (length apth) of apth]
+ +abs(x1r-x2l)*(unitvector (point (length apth) of apth
+ - point 0 of apth) rotated 90),
+ z2r,
+ 0.5[point 0 of apth, point (length apth) of apth]
+ +abs(x1r-x2r)*(unitvector (point (length apth) of apth
+ - point 0 of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ else:
+ t := solve g(length apth, 0);
+ T := mapto(z2l,
+ point t of apth + (w-2.5u#+0.5min_breadth+0.5max_breadth)
+ *(unitvector (direction t of apth) rotated 90),
+ z2r,
+ point t of apth + (w-2.5u#+0.5min_breadth-0.5max_breadth)
+ *(unitvector (direction t of apth) rotated 90),
+ z1r,
+ point (length apth) of apth);
+ fi;
+
+ top_part(T);
+
+ % The extension part
+
+ save extension_part;
+ vardef extension_part(expr ss,tt) =
+ numeric stp; stp:=(ss-tt) div 5pt;
+ if stp=0: stp:=1; fi
+ stp:=(ss-tt)/stp;
+
+ pickup pencircle scaled heavy_rule_thickness#;
+
+ if stp>0:
+ draw for uu=ss step stp until tt-stp:
+ point uu of apth + (w-2.5u#+.5min_breadth)
+ *(unitvector (direction uu of apth) rotated 90)
+ {direction uu of apth} ..
+ endfor
+ {direction tt of apth}
+ point tt of apth + (w-2.5u#+.5min_breadth)
+ *(unitvector (direction tt of apth) rotated 90) text_;
+ fi
+ enddef;
+
+ if arclength apth > y1-y2+y4-y3:
+ extension_part(s,t);
+ fi
+
+ pickup prevpen;
+
+ enddef;
+
+enddef;
+ \ No newline at end of file