| 1 |
.PS |
| 2 |
# ArrowFn.m4 |
| 3 |
# https://tex.stackexchange.com/questions/581089/arrow-function-diagrams |
| 4 |
gen_init |
| 5 |
textoffset = 3bp__ |
| 6 |
brad = 0.04 |
| 7 |
bht = 0.4 |
| 8 |
bwid = 0.25 |
| 9 |
define(`rbox',`box rad brad outlined "orange"') |
| 10 |
|
| 11 |
B1: [ |
| 12 |
linethick = 1.2 |
| 13 |
arrowwid = 0.08 |
| 14 |
rbox wid 5*boxwid ht 3/2*boxwid |
| 15 |
line from last box.w-(bht/4,0) "\Large $X$" above ljust |
| 16 |
T: Here |
| 17 |
arrow up bwid right bwid then right bwid |
| 18 |
F: rbox ht bht "\Large $f$" |
| 19 |
{"\Large $Y$" above ljust } |
| 20 |
arrow down bwid right bwid from T then right boxwid + bwid*3/2 |
| 21 |
G: rbox ht bht "\Large $g$" |
| 22 |
{"\Large $Z$" above ljust } |
| 23 |
S: circle diam bht "\Large $+$" at (G.e.x+boxwid,(F.y+G.y)/2) |
| 24 |
d = F.y-S.nw.y |
| 25 |
arrow from F.e to S.nw+(-d,d) then to S.nw |
| 26 |
arrow from G.e to S.sw+(-d,-d) then to S.sw |
| 27 |
arrow right from S.e |
| 28 |
] |
| 29 |
[ |
| 30 |
bht = bht/2 |
| 31 |
sbwid = boxwid*3/4 |
| 32 |
bbwid = sbwid*5/4 |
| 33 |
dh = bht/2 |
| 34 |
B1: rbox wid bbwid ht bbwid |
| 35 |
B2: rbox wid sbwid*3/2 ht bbwid at B1+(3/2*bbwid,0) |
| 36 |
B3: rbox wid bbwid ht bbwid at B2+(3/2*bbwid,0) |
| 37 |
B4: rbox wid sbwid*3/2 ht bbwid at B3+(3/2*bbwid,0) |
| 38 |
B5: rbox wid bbwid ht bbwid at B4+(3/2*bbwid,0) |
| 39 |
F: rbox ht bht wid sbwid at B2.n-(0,bht*3/4) "$f$" |
| 40 |
BR: B2.s+(0,B2.n.y-F.y) |
| 41 |
G: rbox ht bht wid sbwid at (B4,F) "$g$" |
| 42 |
S: circle diam bht*3/2 at B5+(bht/2,0) "$+$" |
| 43 |
arrow right from S.e |
| 44 |
T: B1.w+(dh,0) |
| 45 |
B: rbox ht bbwid*5/4 wid boxwid*7.25 with .w at T-(sbwid*3/4,0) |
| 46 |
{ line from T left sbwid "$x$" above ljust } |
| 47 |
arrow from T to (B1.e-(dh,0),F) then to F.w |
| 48 |
arrow from F.e to (B3.w+(dh,0),F) then to (B3.e-(dh,0),BR) |
| 49 |
continue to (B5.w+(dh,0),Here) then to S.sw |
| 50 |
line thick 5 outlined "white" from B3.sw to B3.ne chop brad |
| 51 |
arrow from T to (B1.e-(dh,0),BR) then to (B3.w+(dh,0),BR) \ |
| 52 |
then to (B3.e-(dh,0),G) then to G.w |
| 53 |
arrow from G.e to (B5.w+(dh,0),G) then to S.nw |
| 54 |
] with .nw at B1.sw+(0,-0.2) |
| 55 |
|
| 56 |
.PE |